I am not sure whether it is a design decision or just an oversight. When I ask for the standard errors of the predictions with predict(budwm.lgt,se=TRUE) where budwm.lgt is a logistic fit of the budworm data in MASS, I got Error in match.arg(type) : ARG should be one of response, terms If one is to construct a CI for the fitted binomial probability, wouldn't it be more natural to do it on the link scale before transforming to the probability scale? Of course, knowing a bit about what's going on inside glm, I could use predict.lm to get what I want, but I am curious why se is not made available for the link prediction in predict.glm. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 17 Feb 2000, Chong Gu wrote:> > I am not sure whether it is a design decision or just an oversight. > > When I ask for the standard errors of the predictions with > > predict(budwm.lgt,se=TRUE) > > where budwm.lgt is a logistic fit of the budworm data in MASS, I got > > Error in match.arg(type) : ARG should be one of response, terms > > If one is to construct a CI for the fitted binomial probability, > wouldn't it be more natural to do it on the link scale before > transforming to the probability scale?Yes, that's what we (V&R) do normally.> Of course, knowing a bit about what's going on inside glm, I could use > predict.lm to get what I want, but I am curious why se is not made > available for the link prediction in predict.glm.It is, and this works in 0.99.0. You are hitting a bug in an earlier version of R. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Chong Gu <chong at stat.purdue.edu> writes:> Of course, knowing a bit about what's going on inside glm, I could use > predict.lm to get what I want, but I am curious why se is not made > available for the link prediction in predict.glm.This was fixed recently (in 0.99.0). It happened because the typeargument got passed on to predict.lm which doesn't know about type=link. Newer versions of predict.glm has this kind of stuff internally: pred <- predict.lm(object, newdata, se.fit, scale = residual.scale, type=ifelse(type=="link", "response", type), terms=terms) fit <- pred$fit se.fit <- pred$se.fit switch(type, response = { fit <- family(object)$linkinv(fit) se.fit <- se.fit * abs(family(object)$mu.eta(fit)) }, link =, terms=) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 17 Feb 2000, Chong Gu wrote:> > I am not sure whether it is a design decision or just an oversight. > > When I ask for the standard errors of the predictions with > > predict(budwm.lgt,se=TRUE) > > where budwm.lgt is a logistic fit of the budworm data in MASS, I got > > Error in match.arg(type) : ARG should be one of response, terms > > If one is to construct a CI for the fitted binomial probability, > wouldn't it be more natural to do it on the link scale before > transforming to the probability scale? > > Of course, knowing a bit about what's going on inside glm, I could use > predict.lm to get what I want, but I am curious why se is not made > available for the link prediction in predict.glm.It's a bug. It's been fixed. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._