[R-sig-ME] nlme4 vs. nlme question
Sofie Van Gijsel
Sofie.VanGijsel at arts.kuleuven.ac.be
Tue Jun 19 14:59:36 CEST 2007
>Dear List members,
>I have a question regarding the difference between nlme & lme4 to
>which I don't seem to find an answer in the previous posts about this topic.
>I fitted a mixed-effects model with the different observations in my
>dataset as random effect, in a by-subject analysis. Basically, I have
>the following model:
>set_dimb.lmer_pois <- lmer(type_wf ~dim + region + edu + sex +
>(1|subcorp), family = "poisson", data = set_dimb)
>In this model, dim, region, edu & sex are all categorical variables.
>subcorp = the subcorpora or observations in the dataset. Type_wf is
>the "number of types per subcorpus".
>With nlme, this worked fine, and plotting the ranefs gives insight in
>which subcorpora behave in an anomolous way.
>However, if I attempt to do the same with lme4, the error message
>tells me that the model cannot fit:
>Error in lmerFactorList(formula, mf, fltype) :
> number of levels in grouping factor(s) 'subcorp' is too large
>I think the problem might be that for different combinations of the
>factor levels, I have more than one sample, so for example for one
>level of dim, region, education & sex, the dataset contains several
>subcorpora. In fact, if I include the subcorpus types as random
>effect (so not on the individual level of the subcorpora but on the
>'higher' level of the different types of combinations of the
>independent variables), the analysis does work and gives
>So my question is: why does nlme allow this, but lme4 not? And if
>lme4 does not allow this analysis, is there a theoretical reason,
>viz. is it "wrong" to fit this type of by-subject analysis? Could this
>indicate a problem with the sampling method (viz. with the dataset)?
>I hope this is clear (I am not exactly a statistician :-)),
More information about the R-sig-mixed-models