[R-sig-ME] nlme4 vs. nlme question

Chaudhari, Monica mchaudhari at deltadentalwa.com
Thu Jun 21 00:26:59 CEST 2007


I think, the problem is that the variable 'subcorp' is not defined as a
factor variable. You could check it using is.factor(set_dimb$subcorp).
If it returns False, then you could make it a factor variable by using
set_dimb$subcorp<-as.factor(set_dimb$subcorp)
Now try using lmer. It should work.

Thanks,
Monica

-----Original Message-----
From: r-sig-mixed-models-bounces at r-project.org
[mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Sofie Van
Gijsel
Sent: Tuesday, June 19, 2007 6:00 AM
To: R-SIG-Mixed-Models at r-project.org
Subject: [R-sig-ME] nlme4 vs. nlme question


>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 
>interpretable results.
>
>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 :-)),
>Many thanks,
>
>Kind regards,
>Sofie VG


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


#########################################################
The information contained in this e-mail and subsequent attachments may be privileged, 
confidential and protected from disclosure.  This transmission is intended for the sole 
use of the individual and entity to whom it is addressed.  If you are not the intended 
recipient, any dissemination, distribution or copying is strictly prohibited.  If you 
think that you have received this message in error, please e-mail the sender at the above 
e-mail address.
#########################################################




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