Martin Turcotte
2013-Nov-07 16:55 UTC
[R] Error running MuMIn dredge function using glmer models
Dear list, I am trying to use MuMIn to compare all possible mixed models using the dredge function on binomial data but I am getting an error message that I cannot decode. This error only occurs when I use glmer. When I use an lmer analysis on a different response variable every works great. Example using a simplified glmer model global model: mod<- glmer(cbind(st$X2.REP.LIVE, st$X2.REP.DEAD) ~ DOMESTICATION*GLUC + (1|PAIR), data=st, na.action=na.omit , family=binomial) The response variables are the number of survival and dead insects (successes and failures) DOMESTICATION is a 2 level factor. GLUC is a continuous variable. PAIR is coded as a factor or character (both ways fail). This model functions correctly but when I try it with dredge() I get an error. g<- dredge(mod, beta=F, evaluate=F, rank='AIC') Error in sprintf(gettext(fmt, domain = domain), ...) : invalid type of argument[1]: 'symbol' When I try with another rank the same thing happens: chat<- deviance(mod)/58 g<- dredge(mod, beta=F, evaluate=F, rank='QAIC', chat=chat) Error in sprintf(gettext(fmt, domain = domain), ...) : invalid type of argument[1]: 'symbol' Any suggestions would be greatly appreciated thanks Martin Turcotte, Ph. D. mart.turcotte@gmail.com [[alternative HTML version deleted]]
Ben Bolker
2013-Nov-07 23:10 UTC
[R] Error running MuMIn dredge function using glmer models
Martin Turcotte <mart.turcotte <at> gmail.com> writes:> Dear list, > I am trying to use MuMIn to compare all possible mixed models > using the dredge function on binomial data but I > am getting an error message that I cannot decode. This error > only occurs when I use glmer. When I use an lmer > analysis on a different response variable every works great. > > Example using a simplified glmer model > global model: > mod<- glmer(cbind(st$X2.REP.LIVE, st$X2.REP.DEAD) ~ > DOMESTICATION*GLUC + (1|PAIR), data=st, > na.action=na.omit , family=binomial) > > The response variables are the number of survival and dead insects > (successes and failures) > DOMESTICATION is a 2 level factor. > GLUC is a continuous variable. > PAIR is coded as a factor or character (both ways fail). > > This model functions correctly but when I try it with dredge() > I get an error. > > g<- dredge(mod, beta=F, evaluate=F, rank='AIC') > Error in sprintf(gettext(fmt, domain = domain), ...) : > invalid type of argument[1]: 'symbol' > > When I try with another rank the same thing happens: > chat<- deviance(mod)/58 > g<- dredge(mod, beta=F, evaluate=F, rank='QAIC', chat=chat) > Error in sprintf(gettext(fmt, domain = domain), ...) : > invalid type of argument[1]: 'symbol' > > Any suggestions would be greatly appreciated > > thanks > > Martin Turcotte, Ph. D. > mart.turcotte <at> gmail.com* Please send follow-ups to r-sig-mixed-models at r-project.org * I think we need a reproducible example: it works OK for the first two binomial GLMMs I tried: library(lme4) library(MuMIn) gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial) dredge(gm1) dredge(gm1,beta=FALSE,evaluate=FALSE) library(mlmRev) gm2 <- glmer(use ~ urban+age+livch+(1|district), Contraception, binomial) dredge(gm2) dredge(gm2,beta=FALSE,evaluate=FALSE) * It might be worth removing the 'st$' from your response variable, e.g. mod<- glmer(cbind(X2.REP.LIVE, X2.REP.DEAD) ~ DOMESTICATION*GLUC + (1|PAIR), data=st,family=binomial) * What are the results of traceback()? sessionInfo() ?
Kamil BartoĊ
2013-Nov-08 11:35 UTC
[R] Error running MuMIn dredge function using glmer models
There is indeed a glitch in 'dredge' that prevents you from seeing the actual error message. It is explained in "?dredge", in section "Missing values". (it's been corrected now in 1.9.14, on R-forge) kamil On 2013-11-08 11:00, r-help-request at r-project.org wrote:> ------------------------------ > > Message: 26 > Date: Thu, 7 Nov 2013 11:55:50 -0500 > From: Martin Turcotte<mart.turcotte at gmail.com> > To:r-help at r-project.org > Subject: [R] Error running MuMIn dredge function using glmer models > Message-ID:<1E4F5497-CCB4-4E8B-A23A-8AA5E1136DAE at gmail.com> > Content-Type: text/plain > > Dear list, > I am trying to use MuMIn to compare all possible mixed models using the dredge function on binomial data but I am getting an error message that I cannot decode. This error only occurs when I use glmer. When I use an lmer analysis on a different response variable every works great. > > Example using a simplified glmer model > global model: > mod<- glmer(cbind(st$X2.REP.LIVE, st$X2.REP.DEAD) ~ DOMESTICATION*GLUC + (1|PAIR), data=st, na.action=na.omit , family=binomial) > > The response variables are the number of survival and dead insects (successes and failures) > DOMESTICATION is a 2 level factor. > GLUC is a continuous variable. > PAIR is coded as a factor or character (both ways fail). > > This model functions correctly but when I try it with dredge() I get an error. > > g<- dredge(mod, beta=F, evaluate=F, rank='AIC') > Error in sprintf(gettext(fmt, domain = domain), ...) : > invalid type of argument[1]: 'symbol' > > When I try with another rank the same thing happens: > chat<- deviance(mod)/58 > g<- dredge(mod, beta=F, evaluate=F, rank='QAIC', chat=chat) > Error in sprintf(gettext(fmt, domain = domain), ...) : > invalid type of argument[1]: 'symbol' > > Any suggestions would be greatly appreciated > > thanks > > Martin Turcotte, Ph. D. > mart.turcotte at gmail.comThe University of Aberdeen is a charity registered in Scotland, No SC013683.
Maybe Matching Threads
- Error message in dredge function (MuMIn package) used with binary GLM
- Package MuMIn (dredge): Error in ret[, ] <- cbind(x, se, rep(if (is.null(df)) NA_real_ else df, : number of items to replace is not a multiple of replacement length.
- Difference between stats.steps() and MuMIn.dredge() to select best fit model
- difficulties with MuMIn model generation with coxph
- MuMIn Problem getting adjusted Confidence intervals