Skip to content
Prev 11399 / 20628 Next

bug/problem with update for merMod

Alexandra Kuznetsova <alku at ...> writes:
This works (for me) if I copy the new arguments into the environment
of the formula:

updateModel <- function(model, reml, l)
{

  nfit <- update(object=model, formula.=as.formula(paste(".~."))
                 , REML=reml ,contrasts=l, evaluate=FALSE)
  env <- environment(formula(model))
  assign("l",l,envir=env)
  assign("reml",reml,envir=env)
  eval(nfit, envir = env)
}

library(lme4)
m <- lmer(Reaction ~ Days +(1|Subject), data=sleepstudy)
updateModel(m, FALSE, "contr.SAS")