Hello,

 

I am trying to predict response values for a model with new, unmeasured
parameter values. It is an lmer model constructed using the lme4 package. I
realise there is not a 'predict.lmer()' function or similar for lmer models.
Having searched on the internet I found 3 possible methods for calculating
predicted values given unmeasured values for a given parameter in the model.


 

This is my model:

data.m2<-data.frame(pods.bind,FUNGICIDE,N.TENTS,Day,HUMIDITY,PLOT,TREE)
#where 'pods.bind' is cbind(Black.pods,healthy.pods)

m2<-lmer(pods.bind~FUNGICIDE+N.TENTS*Day+HUMIDITY*Day+(1|PLOT/TREE),family="
quasibinomial")

 

 

Here are the possible methods:

#1

mm = model.matrix(terms(m2),data.m2)

data.m2$pods.bind = mm %*% fixef(m2)

predicted.1<-exp(data.m2$pods.bind)/(1+exp(data.m2$pods.bind))

 

#2

predict.lmerBin <- function(object, X){

if(missing(X))

X <- object@X

b <- fixef(object)

plogis(X %*% b)

}

predicted.2<-predict.lmerBin(m2)

 

#3

predicted.3<-exp(model.matrix(terms(m2),data.m2)%*%fixef(m2))

 

 

All three methods result in exactly the same predicted values. However, when
I plug in the real data I get different values than I do for fitted(). This
makes me doubt the validity of my predicted values. Could anybody explain
why the predicted values, using these methods, differ from the fitted
values? 

 

Thanks for your help.

 

Amy

 

............................................................................
...............

Amy S. I. Wade

Centre for Agri-Environmental Research

University of Reading

 


	[[alternative HTML version deleted]]


