Skip to content

Problem with fitted function

2 messages · Ira Sharenow, Doran, Harold

1 day later
#
You're email is a bit confusing. Let's keep this simple and draw with a distinction between lm and lmer in terms of what is a fitted value.

In least squares regression, your model is

Y = XB + e

Where Y is your outcome, X is the model matrix for the fixed effects, B is the vector of coefficients, and e is the error term. 

And the fitted values are then

\hat{Y} = X\hat{B}

Where \hat{B} is the vector of estimated fixed effects.

In mixed models, your model is

Y = XB + Zu + e

Where Y is your outcome, X is the model matrix for the fixed effects, B is the vector of coefficients, Z is the model matrix for the random effects, u are the BLUP, and e is the error term.

Now, the fitted function in lmer yields

\hat{Y} = X\hat{B} + Z\hat{u}

Where \hat{B} is the vector of estimated fixed effects and now \hat{u} are the predictions of the random effects.