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
extracting residuals in lmer glmm
3 messages · Martin Henry H. Stevens, Douglas Bates
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)
1 day later
On Thu, Aug 14, 2008 at 9:47 AM, Hank Stevens <HStevens at muohio.edu> wrote:
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.
I was just going to write that you must be using a very old version of the lme4 package. The wrkres slot was removed in the transition from the 0.99875 to 0.999375 series. What is returned by the resid generic applied to a generalized linear mixed model is (m1 at y - m1 at mu)/sqrt(m1 at var) That is one of the many possible definitions of "residuals" for a generalized linear model. There is a name for those residuals but I can't remember right now what they are callled - perhaps after I have recovered from the trans-Atlantic flight returning from the useR!2008 conference, which was wonderful. Thanks again to the organizers and to the more than 400 attendees who made it such a success. We hope to see many of you again in Rennes, France for useR!2009 next July.
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)
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models