[R-sig-ME] simulate() fails for poisson lmer fits

William Valdar valdar at well.ox.ac.uk
Thu Aug 2 01:23:07 CEST 2007


I missed out a line in the code below. The line that throws the error is 
not the fitting but the subsequent simulation, ie:

fit <- lmer(count ~ weight + (1|batch),  family=poisson, data=counts)
simulate(fit)
# Error: inherits(object, "lmer") is not TRUE


On Wed, 1 Aug 2007, William Valdar wrote:
> Hello,
>
> I wish to simulate() from a fitted Poisson GLMM. Both lmer() and lmer2() from 
> lme4 (version info at the bottom) fail, apparently due to bugs. Here's a test 
> case:
>
> counts <- data.frame(
>        count  = c(8, 3, 0, 3, 0, 9, 0, 11, 4, 7, 0, 0, 0, 4, 3, 6, 3,
>                15, 11, 9),
>        batch = c(3.1, 3.1, 3.1, 3.3, 3.3, 3.3, 3.2, 3.12, 3.8, 3.11,
>                3.4, 3.4, 3.4, 3.4, 3.5, 3.5, 3.5, 3.5, 3.6, 3.6),
>        weight = c(324.4, 372.5, 352.7, 379.6, 388.1, 431, 448.4, 377.3,
>                376.5, 358.4, 356, 351.4, 350.8, 332.1, 334.5, 392, 370.5,
>                409.7, 375, 318.5))
>
> fit <- lmer(count ~ weight + (1|batch),  family=poisson, data=counts)
> # Error: inherits(object, "lmer") is not TRUE
>
> fit <- lmer2(count ~ weight + (1|batch),  family=poisson, data=counts)
> simulate(fit)
> # CHOLMOD error: X and/or Y have wrong dimensions
> # Error in crossprod(object at ZXyt, c(unlist(lapply(seq_along(re), # 
> function(k) (t(cholL[[k]]) %*%  :
> #        Cholmod error 'X and/or Y have wrong dimensions' at # 
> file:../MatrixOps/cholmod_sdmult.c, line 90
>
> Is there a quick fix for either of these two? Otherwise, is there an 
> alternative (I've checked objects produced by nlme, glmmPQL, GLMMGibbs with 
> no luck)? I am using lme4 0.99875-6 version R 2.5.1 on Windows XP.
>
> Many thanks,
>
> Will
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Dr William Valdar               ++44 (0)1865 287 589
> Wellcome Trust Centre           valdar at well.ox.ac.uk
> for Human Genetics, Oxford      www.well.ox.ac.uk/~valdar
>
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dr William Valdar               ++44 (0)1865 287 589
Wellcome Trust Centre           valdar at well.ox.ac.uk
for Human Genetics, Oxford      www.well.ox.ac.uk/~valdar




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