Tanja Srebotnjak
2009-Feb-26 16:58 UTC
[R] error message and convergence issues in fitting glmer in package lme4
I'm resending this message because I did not include a subject line in my first posting. Apologies for the inconvenience! Tanja> Hello,>> I'm trying to fit a generalized linear mixed model to estimate diabetes prevalence at US county level. To do this I'm using the glmer() function in package lme4. I can fit relatively simple models (i.e. few covariates) but when expanding the number of covariates I usually encounter the following error message.>> gm8 <-> glmer(DIAB05F~AGE+as.factor(SEX)+poolt+poolx+poverty+fastfood+(1|as.factor(diab$fips)), family = binomial(link="logit"), data = diab, doFit=TRUE) Error in validObject(.Object) :> invalid class "mer" object: Slot Zt must by dims['q'] by> dims['n']*dims['s']>> In the above, the response is person-level diabetes status as a function of AGE=age, SEX=sex, poolt=average county diabetes prevalence for previous years, poolx=pooled county diabetes prevalence for counties with similar age, sex, race, and income structure, poverty=county poverty rate, fastfood=number of fastfood places per 100,000 people in the county, and a county random effect.>> If I leave out fastfood, the model gets at least fitted - although it doesn't converge (yet):>> Warning message:> In mer_finalize(ans) : false convergence (8)>> I would be grateful for any advice on what the problem could be and how to resolve it.>> Thanks,> TanjaTanja Srebotnjak, PhD, MSc, Dipl. Stat. Postgraduate Fellow Institute for Health Metrics and Evaluation University of Washington 2301 5th Ave, Suite 600 Seattle, WA 98121 Email: tanjas@u.washington.edu<mailto:tanjas@u.washington.edu> Tel: +1-206-897-2866 www.healthmetricsandevaluation.org<http://www.healthmetricsandevaluation.org> From: Tanja Srebotnjak Sent: Thursday, February 26, 2009 12:17 AM To: 'r-help@r-project.org' Subject: Hello, I'm trying to fit a generalized linear mixed model to estimate diabetes prevalence at US county level. To do this I'm using the glmer() function in package lme4. I can fit relatively simple models (i.e. few covariates) but when expanding the number of covariates I usually encounter the following error message. gm8 <- glmer(DIAB05F~AGE+as.factor(SEX)+poolt+poolx+poverty+fastfood+(1|as.factor(diab$fips)), family = binomial(link="logit"), data = diab, doFit=TRUE) Error in validObject(.Object) : invalid class "mer" object: Slot Zt must by dims['q'] by dims['n']*dims['s'] In the above, the response is person-level diabetes status as a function of AGE=age, SEX=sex, poolt=average county diabetes prevalence for previous years, poolx=pooled county diabetes prevalence for counties with similar age, sex, race, and income structure, poverty=county poverty rate, fastfood=number of fastfood places per 100,000 people in the county, and a county random effect. If I leave out fastfood, the model gets at least fitted - although it doesn't converge (yet): Warning message: In mer_finalize(ans) : false convergence (8) I would be grateful for any advice on what the problem could be and how to resolve it. Thanks, Tanja [[alternative HTML version deleted]]
Douglas Bates
2009-Feb-26 20:43 UTC
[R] error message and convergence issues in fitting glmer in package lme4
On Thu, Feb 26, 2009 at 10:58 AM, Tanja Srebotnjak <tanjas at u.washington.edu> wrote:> I'm resending this message because I did not include a subject line in my first posting.Also, it is generally more effective to send questions about lmer/glmer to the R-SIG-Mixed-Models list, which I am cc:ing on this reply.>> Hello,>> I'm trying to fit a generalized linear mixed model to estimate diabetes prevalence at US county level. To do this I'm using the glmer() function in package lme4. I can fit relatively simple models (i.e. few covariates) but when expanding the number of covariates I usually encounter the following error message.>> gm8 <- >> glmer(DIAB05F~AGE+as.factor(SEX)+poolt+poolx+poverty+fastfood+(1|as.factor(diab$fips)), family = binomial(link="logit"), data = diab, doFit=TRUE)Error in validObject(.Object) : ? invalid class "mer" object: Slot Zt must by dims['q'] ?by dims['n']*dims['s'] Getting that error message from this model is peculiar. I couldn't actually say what might be happening without trying the fit myself. I would suggest setting doFit = FALSE but I think that this error would be encountered even with doFit = FALSE. Again, it would be hard to say exactly what is happening here.>> In the above, the response is person-level diabetes status as a function of AGE=age, SEX=sex, poolt=average county diabetes prevalence for previous years, poolx=pooled county diabetes prevalence for counties with similar age, sex, race, and income structure, poverty=county poverty rate, fastfood=number of fastfood places per 100,000 people in the county, and a county random effect.>> If I leave out fastfood, the model gets at least fitted - although it doesn't converge (yet):The version of lmer currently under development tries to address that problem. The optimization of the parameter estimates is performed in a slightly different way that will, I hope, provide smoother convergence. If your data are not restricted and you would be willing to send me a copy of the diab data frame I could check what happens on that version (or you could install the development version yourself but that is a non-trivial undertaking). If you can send the data the best way to send it is to create an R data file as save(diab, file = "diab.rda") and send the file diab.rda>> Warning message: >> In mer_finalize(ans) : false convergence (8)Frequently that is a sign of an overspecified model.>> > >> I would be grateful for any advice on what the problem could be and how to resolve it. > >> > >> Thanks, > >> Tanja > > > Tanja Srebotnjak, PhD, MSc, Dipl. Stat. > Postgraduate Fellow > Institute for Health Metrics and Evaluation > University of Washington > 2301 5th Ave, Suite 600 > Seattle, WA 98121 > Email: tanjas at u.washington.edu<mailto:tanjas at u.washington.edu> > Tel: +1-206-897-2866 > www.healthmetricsandevaluation.org<http://www.healthmetricsandevaluation.org> > > From: Tanja Srebotnjak > Sent: Thursday, February 26, 2009 12:17 AM > To: 'r-help at r-project.org' > Subject: > > Hello, > > I'm trying to fit a generalized linear mixed model to estimate diabetes prevalence at US county level. To do this I'm using the glmer() function in package lme4. I can fit relatively simple models (i.e. few covariates) but when expanding the number of covariates I usually encounter the following error message. > > gm8 <- glmer(DIAB05F~AGE+as.factor(SEX)+poolt+poolx+poverty+fastfood+(1|as.factor(diab$fips)), family = binomial(link="logit"), data = diab, doFit=TRUE) > Error in validObject(.Object) : > ?invalid class "mer" object: Slot Zt must by dims['q'] ?by dims['n']*dims['s'] > > In the above, the response is person-level diabetes status as a function of AGE=age, SEX=sex, poolt=average county diabetes prevalence for previous years, poolx=pooled county diabetes prevalence for counties with similar age, sex, race, and income structure, poverty=county poverty rate, fastfood=number of fastfood places per 100,000 people in the county, and a county random effect. > > If I leave out fastfood, the model gets at least fitted - although it doesn't converge (yet): > > Warning message: > In mer_finalize(ans) : false convergence (8) > > I would be grateful for any advice on what the problem could be and how to resolve it. > > Thanks, > Tanja > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >