I am using the R package nlme to perform a repeated measure analysis. The model call is mymodel<-lme(measure~time, data=mydata[is.finite(mydata$measure),], random= ~ 1 | subjectId/time)
. I would like to provide an estimate of the standard error of residual, by means the residual after the time effect (the pure random residual). When observing the model call I get:
Linear mixed-effects model fit by REML
Data: mydata[is.finite(mydata$measure), ]
AIC BIC logLik
182 190 -83.9
Random effects:
Formula: ~1 | subjectId
(Intercept)
StdDev: 4.42
Formula: ~1 | time %in% subjectId
(Intercept) Residual
StdDev: 4.43 1.89
Fixed effects: measure ~ time
Value Std.Error DF t-value p-value
(Intercept) 13.80 2.07 16 6.68 0.000
timePost -1.44 2.34 16 -0.61 0.548
timePost 2 mesi -2.21 2.59 16 -0.85 0.406
timePost 4 mesi -2.31 2.77 16 -0.84 0.416
Correlation:
(Intr) timPst tmPs2m
timePost -0.479
timePost 2 mesi -0.433 0.426
timePost 4 mesi -0.405 0.398 0.369
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-0.5487 -0.1739 -0.0217 0.2025 0.6455
Number of Observations: 29
Number of Groups:
subjectId time %in% subjectId
10 29
So i find two measures of residuals: 4.42, 4.43/1.89, that appears different from the one I get calling sd(residuals(mymodel))
that In my basing intuition is the traditional meausre of residual. So my question is twofolds:
- What are the different type of residuals in nlme/lme4 or in mixed effects modeling in general?
- How can I get the various ones?
- How can I get the residuals after any modelable effects (fixed or random)? I would use
sd(residuals(mymodel))
but I am not sure.