Solved – Fitted values of ‘lme’ function result

mixed modelr

I fitted a linear mixed model with R as follows.

lmme3cs = lme(LAZ ~ group_k + x1 + x2 + x4 + x6 + x1_k + x2_k + x4_k + x6_k,
              random = ~1|SECTORID/CHILDUID,
              correlation = corCompSymm(form = ~1|SECTORID/CHILDUID), data=dat2c)

It has 50043 observations, but the object 'lmme3cs$fitted' is a 50043 by 3 matrix which has three columns fixed, SECTORID, and CHILDUID.
What are these three columns?

Best Answer

They are the fitted values at different levels of grouping. For example, if you fit

> library(nlme)
> fmOxide <- lme(Thickness ~ 1, Oxide, ~1|Lot/Wafer)

you can get the predicted overall outcome by

> fitted(fmOxide, level = 0)

and it is 2000.153. The predicted outcomes for each Lot are:

> fitted(fmOxide, level = 1)

and there are eight outocomes as there are eight Lots. The predicted outcomes for each Wafer, which are nested within Lots, are:

> fitted(fmOxide, level = 2)

If you run

> fitted(fmOxide, level = 0:2)

you get the predicted outcomes for each level of grouping, i.e. fmOxide$fixed.

Related Question