Gert
2011-Jun-04 20:24 UTC
[R] Predicted values based on fixed effects do not correspond with actual data in cross-classified generalized linear mixed model (lmer)
Dear R-Users, I have fitted a cross-classified generalized linear mixed model using the lmer package with the following code. Mod<-lmer(y~x+(1|a)+(1|b)+ (1|c), family=binomial) In this case, only including a covariate (x) as a fixed effect. The fitted values, using fitted(mod), correspond to the raw data nicely, and the mean of the fitted values is equal to the mean of the raw data. In addition, the parameter estimate for the fixed effect (x) corresponds to the data as well (the slope ?seems? right). So far so good. The problem arises when I calculate the predicted values based on the intercept and the parameter estimate of the fixed effect, using the formula exp(X)/(1+EXP(X)), where X=intercept + par. Est. * x. When I use calculate the mean of these predicted values, this mean is much lower than the mean of the actual data. The shape of the predicted curve fits nicely to the data, but the predicted lines is always ?below? the actual data. Apparently, the intercept of the curve is not predicted correctly. Does anyone know why this is? I guess it has something to do with the fact that the intercept for the fixed effects is estimated for a certain value of the random effects? According to the R documentation on fitted values; ?the fitted values at level i are obtained by adding together the contributions from the estimated fixed effects and the estimated random effects??. But is there an 'average contribution' of the random effects? Is there a way to evaluate the fixed effects at the ?average level? of the random effects? Do I need to adjust the formula for the predictions to take into account the random effects? Many thanks, Gert Stulp -- View this message in context: http://r.789695.n4.nabble.com/Predicted-values-based-on-fixed-effects-do-not-correspond-with-actual-data-in-cross-classified-gener-tp3574116p3574116.html Sent from the R help mailing list archive at Nabble.com.
Seemingly Similar Threads
- p-value for fixed effect in generalized linear mixed model
- lmer: mixed effects models: predictors as random slopes but not found in the fixed effects?
- generalized linear mixed models with a beta distribution
- generalized linear mixed model by ML
- generalized linear mixed models with a beta distribution