[R] What is se.fit in a glm predict list?

peter dalgaard pdalgd at gmail.com
Thu Mar 2 09:50:52 CET 2017


It comes from linearizing log(x) around the fitted value, derivative of log is 1/x, so
aa$se.fit/aa$fit == bb$se.fit

For diverged estimates, this gets dubious as the linearization only works in a neighborhood and for x not too close to the singularity of log() at zero.

-pd

> On 02 Mar 2017, at 09:22 , Patrick Connolly <p_connolly at slingshot.co.nz> wrote:
> 
> 
> I'm trying  to calculate a CI for predictions from a Poisson GLM object egg.glm.
> 
> Browse[2]> aa <- as.data.frame(predict(egg.glm, newdat, type = "response", se.fit = TRUE)[-3])
> Browse[2]> bb <- as.data.frame(predict(egg.glm, newdat, se.fit = TRUE)[-3])
> Browse[2]> aa
>           fit       se.fit
> 1 6.144212e-07 0.0005114257
> 2 2.452632e+01 5.4657657443
> 3 1.440000e+01 2.5817126393
> 4 4.389796e+01 4.5533997800
> 5 3.820455e+01 4.4827326393
> 6 6.226667e+01 5.6589154967
> Browse[2]> bb
>         fit       se.fit
> 1 -14.302585 832.36979026
> 2   3.199747   0.22285311
> 3   2.667228   0.17928560
> 4   3.781868   0.10372691
> 5   3.642954   0.11733506
> 6   4.131426   0.09088194
> Browse[2]> 
> 
> bb$fit is clearly log of aa$fit but just what is se.fit?  How do I use
> it to get a CI which is calculated on the log scale?  The first one is
> a bit messy since it is entirely from zeros.  Should I remove those or
> would that be unnecessary?
> 
> TIA
> 
> -- 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>   ___    Patrick Connolly   
> {~._.~}                   Great minds discuss ideas    
> _( Y )_  	         Average minds discuss events 
> (:_~*~_:)                  Small minds discuss people  
> (_)-(_)  	                      ..... Eleanor Roosevelt
> 	  
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list