I have a problem with the glmulti package and linear mixed models. When I try to estimate the model-averaged coefficients with the coff.glmulti function I get this error:
After changing the token name from vy2 to vy1 the first call to glmulti no longer throws an error but this one does:
coef.glmulti(glmulti_lmm,select="all",varweighting="Johnson",icmethod="Burnham")
I do not think that your highlighted line is the source of the error since if it were the warning would have been issued and furthermore the object has 8 models. I think it is just below that point where this line appears:
coke = lapply(coffee, getfit) # since that is step three in the traceback()
Looking at the content of glmulti_lmm
we see that the objects slot has 8 models:
> summary(glmulti_lmm)$bestmodel
[1] "vy1 ~ 1"
> glmulti_lmm@objects[[1]]
Linear mixed model fit by maximum likelihood ['lmerMod']
Formula: vy1 ~ 1 + (1 | random_effect)
Data: data
AIC BIC logLik deviance
1183.9965 1191.8120 -588.9983 1177.9965
Random effects:
Groups Name Std.Dev.
random_effect (Intercept) 0.00
Residual 87.45
Number of obs: 100, groups: random_effect, 4
Fixed Effects:
(Intercept)
105.5
> coef( glmulti_lmm@objects[[1]])
$random_effect
(Intercept)
1 105.48
2 105.48
3 105.48
4 105.48
attr(,"class")
[1] "coef.mer"
You didn't say what your goal was but perhaps this shows how to inspect such objects. To me this is suspicious for a bug and you may want to send a memo to the package maintainer.
If you are using one of the latest versions of lme4, the getfit() function I recommended is no longer adapted. Indeed, the lme4 package maintainers have made quite a lot of changes in their package: the class of objects is now "merMod", where it was "mer", and a few other things.
Then the getfit function must be slightly adjusted in order to interface glmulti with the new lme4 structure. Here a a getfit definition that works with the latest builds of lme4 for Ubuntu 12.04, as of yesterday:
setMethod('getfit', 'merMod', function(object, ...) {
summ=summary(object)$coef
summ1=summ[,1:2]
if (length(dimnames(summ)[[1]])==1) {
summ1=matrix(summ1, nr=1, dimnames=list(c((Intercept)"),c("Estimate","Std. Error")))
}
cbind(summ1, df=rep(10000,length(fixef(object))))
})
This should fix the issue. [see also my website http://vcalcagnoresearch.wordpress.com/package-glmulti/] Regards