Hi all,

I am struggling to use predict.merMod to generate predictions from a 
relatively simple mixed model. I have no trouble generating predictions 
when the random effects structure is straightforward (e.g. single random 
intercept factor), but get difficulties when I add interaction terms 
either in the random effects structure (e.g. random slope) or in the 
fixed effects. I know I can pull out parameter estimates and generate 
predictions 'by hand', but am wondering if there is a straightforward 
way to make use of the predict() function here. Data object is a 
dataframe of tree information, including stand level predictors. I am 
attempting to predict height to certain crown characteristics (variable 
'top'), with a number of tree and stand-level predictors. There are 480 
stands and 11 species. Variable 'ht' is the measured total height of the 
tree, 'DBH' is diameter.

Example code follows:

mer0 <- lmer ( top ~ 1 + (1|stand), data=data)
mer0.1 <- update( mer0, .~. + (1|species))
pred0.1 <- predict (mer0.1, newdata=data, allow.new.levels=T) # no 
problem here

mer1 < - update(mer0.1, .~. + DBH)
predict(mer1, newdata=data, allow.new.levels=T) # no problem here

mer2 <- update(mer1, .~. + (DBH|Species)
predict(mer2, newdata=data, allow.new.levels=T) # This fails with the 
following error:

Error in t(.Call(Csparse_dense_crossprod, y, t(x))) :
   error in evaluating the argument 'x' in selecting a method for function 't': Error: Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90


It seems that I am failing to provide the proper matrix format for the 
newdata argument, but I don't necessarily see how to fix it.

Thanks in advance,

-Nathan Rutenbeck

---------------------------
PhD Student, Silviculture
University of Maine School of Forest Resources

	[[alternative HTML version deleted]]

