I have the following mixed effects model with two crossed random effects which I am using to model tree growth:
Model <- lmer (log(Growth) ~ log(Size) + log(Competition) + (1 + log(Size) | Treatment) + (1 | Plot))
I am using this model to predict new data, and was glad to see that the development version of lme4 now comes with a predict
function that allows both fixed and random effects to be used to generate predictions. However I also need to be able to estimate the uncertainty in the predictions I am making, which is a problem since predict
in lme4 doesn't generate SE for predictions.
I have tried to alternative approached. The first was to use simulate
to generate a distribution of predicted values which I could then summarize into uncertainty estimates. However, I found that the output of simulate
is clearly different from that of predict
, regardless of how I treated the use.u argument relating to random effects. When I take the mean predicted value across 1000 or more simulations and compare it to the output of predict
, it is clear that the two methods are producing different results.
The second approach was to use the bootMer function as recommended in the help file for predict
. From this I was able to obtain SE for the parameter estimates. However, I'm not quite sure how to then translate these into uncertainty in the predictions (i.e., how do I obtain SEs for the predicted values?). Am I missing something obvious?
Any help/advice on the two approaches I have used would be much appreciated, as would any suggestions on alternatives I have not considered!