[R-sig-ME] extracting residuals in lmer glmm

Hank Stevens HStevens at MUOhio.edu
Thu Aug 14 16:47:48 CEST 2008


In answer (sort of) to my own question, resid() now works on both mer  
and summary.mer objects.
All of these results (resid() working and not working) have occurred  
while using yesterday's CRAN version of lme4 {R package version  
0.999375-24}.

I have no idea what would have caused the problem yesterday and this  
morning, but not now. Oh well.

Hank


y <- rpois(100, lambda=10)
xz <- expand.grid(x=gl(2,5), z=gl(10,1))
m1 <- lmer(y ~ x + (1|z), xz, family="poisson")
m1s <- summary(m1)
resid(m1)
   [1] -0.04336 -0.98556  0.89885  0.27071 -0.67149 -0.14260
...
resid(m1s)
   [1] -0.04336 -0.98556  0.89885  0.27071 -0.67149 -0.14260
...

On Aug 14, 2008, at 9:32 AM, Martin Henry H. Stevens wrote:

> Hi folks,
> I seem unable to figure out how to extract residuals from a Poisson
> lmer model.
>
> And, I am not sure what to do with the working residuals.
>
> Any references or ideas would be appreciated.
>
> # Example:
> y <- rpois(100, lambda=10)
> xz <- expand.grid(x=gl(2,5), z=gl(10,1))
> m1 <- lmer(y ~ x + (1|z), xz, family="poisson")
>
> resid(m1)
> Error: 'resid' is not implemented yet
>
>  residuals(m1)
> Error: 'residuals' is not implemented yet
>
>  summary(m1 @ wrkres)
> Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 1.38    1.98    2.20    2.22    2.50    3.13
>
>
> Hank Stevens
>
>
>
>



Dr. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.cas.muohio.edu/ecology
http://www.muohio.edu/botany/

"If the stars should appear one night in a thousand years, how would men
believe and adore." -Ralph Waldo Emerson, writer and philosopher  
(1803-1882)




More information about the R-sig-mixed-models mailing list