I would try adding to your calls to glm the arguments maxit =25 and epsilon = 1E-5; e.g.:
sp1.glm <- glm(y~log(x)+factor(dose.val), family=Gamma(link=log),data=sp.dat, maxit = 25, epsilon = 1E-5)
and
sp2.glm <- glm(y~log(x)+dose.val, family=Gamma(link=log),data=sp.dat, maxit = 25, epsilon = 1E-5).
I add these arguments to all my glm calls.
Your sensible query indicates why I consider Venables and Ripley's Modern Applied Statistics with S-Plus, 2d ed, to be essential. Be sure to also download from the Web their "Complements" to the monograph. Further information is available at: http://www.stats.ox.ac.uk/pub/MASS2/.
Terry Elrod
--------
Prof. Terry Elrod; 3-23 Fac. of Business; U. of Alberta; Edmonton AB; Canada T6G 2R6
email: Terry.Elrod@Ualberta.ca; tel: (403) 492-5884; fax: (403) 492-3325
Web page: http://www.ualberta.ca/~telrod/
--------
-----Original Message-----
From: David Maxwell SS CEFAS [SMTP:D.L.MAXWELL@cefas.co.uk]
Sent: Wednesday, March 18, 1998 4:47 AM
To: s-news
Subject: [S] glm: why aren't these nested?
I have a numeric variable, dose.val, with 4 different values. I fitted two models using glm:
1.
sp1.glm <- glm(y~log(x)+factor(dose.val), family=Gamma(link=log),data=sp.dat)
2.
sp2.glm <- glm(y~log(x)+dose.val, family=Gamma(link=log),data=sp.dat)
I intuitively expected model 2 to be nested in model 1, i.e. that the deviance due to factor(dose.val) could be split into the deviance due to linear dose.val and the remaining deviance.
But fitting dose.val as a number gives a slightly lower residual deviance than when it is fitted as a factor, see the anovas below.
Please can someone explain this to me or provide a suitable reference.
Other info:
10 of the 73 values for y are zero
SPlus v3.3 windows 3.11
Thanks for your time,
David
d.l.maxwell@cefas.co.uk
> anova(sp1.glm)
Analysis of Deviance Table
Gamma model
Response: y
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 72 137.4406
log(x) 1 8.2889 71 129.1517
factor(dose.val) 3 54.9171 68 74.2346
>
>
> anova(sp2.glm)
Analysis of Deviance Table
Gamma model
Response: y
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 72 137.4406
log(x) 1 8.28890 71 129.1517
dose.val 1 55.10674 70 74.0449
> summary(factor(sp.dat$dose.val))
0.0002 0.2402 0.5102 1.0202
18 19 22 14
>
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news