[R-sig-ME] random effects specified in re.form that were not present in original model
John Poulsen, Ph.D.
john@poul@en @ending from duke@edu
Fri Jul 27 20:57:51 CEST 2018
Hello --
I am trying to predict from a non-linear mixed model over just part of the range of one of the variables - 'depth', but am having problems with the specification of the random effect term using simulate(). Here is a reproducible dataset, the model, and my attempts at simulating responses.
soildata = data.frame(plot2b = rep(1:10, each=10), depth = rep(seq(1,2,length=10), 10), resp = rnorm(n = 100, 0.86, 0.76))
invpoly.f <- deriv(~depth/(a+b*depth), namevec=c('a', 'b'), function.arg=c('depth', 'a', 'b'))
fit.invpoly <- nlmer(resp ~ invpoly.f(depth, a, b) ~ depth|plot2b, start=list(nlpars=c(a=1, b=0.5)), data=soildata)
newdat <- data.frame(plot2b = soildata$plot2b, depth = rep(seq(1.5, 2,length=10), 10))
simulate(fit.invpoly, newdata = newdat, re.form=NULL, seed = 1, nsim = 1)
simulate(fit.invpoly, newdata = newdat, re.form=(depth|plot2b), seed = 1, nsim = 1)
simulate(fit.invpoly, newdata = newdat, re.form=(1|plot2b), seed = 1, nsim = 1)
The first attempt at simulating, produces: Error in FUN(X[[i]], ...) : random effects specified in re.form that were not present in original model
The second two attempts produce: Error in mkNewReTrms(object, rfd, re.form, na.action = na.action, allow.new.levels = allow.new.levels) : object 'ReTrms' not found
Any guidance for what I am doing wrong would be appreciated.
Thanks,
John
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list