Pierre Morel <pier.morel at ...> writes:
This is my first message to the list, I hope I won't start on the wrong foot !
Welcome.
I installed the last version of lme4 (0.999902345-0) and I think there is a problem in simulate() when trying to simulate a GLMM in which a link function was specified. For example, this works (directly from the manual): gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial) gg <- simulate(gm1,10) However, when you specify the link function for the binomial family (even if
you keep the default one,
logit), there is an error: gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial(link="logit")) gg <- simulate(gm1,10) Error in simulate.merMod(gm1, 10) : 'family' not recognized Not a problem if you want to use the default link, but I have psychophysics data for which I would like to use the mafc.logit(2) from the psyphy library.
When I look at the source code, even if I am not good enough in R programming to fix it, it seems that it should work with any link function, since the end result seems only used to get the inverse link function:
etasim <- etasim.fix+etasim.reff
family <- object <at> call$family
if(is.symbol(family)) family <- as.character(family)
if(is.character(family))
family <- get(family, mode = "function",
envir = parent.frame(2))
if(is.function(family)) family <- family()
if(is.null(family$family)) stop("'family' not recognized")
musim <- family$linkinv(etasim)
Any idea for a quick fix ?
Thank you for the report.
This is now fixed on the SVN -- should be rebuilt/installable
on Linux or Windows in 24 hours or less. If you want to fix it
yourself, I added the line
if(is.language(family)) family <- eval(family)
right before the is.null() check.
If you're in a hurry you could (1) download the SVN code
and build it yourself; (2) copy lme4:::simulate.merMod and
make your own fixed version (I don't know offhand if simulate.merMod
makes use of other internal lme4::: functions)
I may not get around to updating the built MacOS binary at
lme4.r-forge.r-project.org/repos for a while -- if someone desperately
needs this for the Mac and can't build their own binary they
can let me know.
Ben Bolker