studynum <-c(1, 2, 3, 4, 5)
y <-c(0.284, 0.224, 0.360, 0.785, 0.492)
w <-c(14.63, 17.02, 9.08, 33.03, 5.63)
genData2 <-data.frame(cbind(studynum, y, w))
library(nlme)
re.teo<-lme(y~1,data=genData2,random=~1|studynum, method="REML", weights=varFixed(~w))
summary(re.teo)
运行结果如下:
Linear mixed-effects model fit by REML
Data: genData2
AIC BIC logLik
5.033622 3.192505 0.483189
Random effects:
Formula: ~1 | studynum
(Intercept) Residual
StdDev: 4.205259e-06 0.04701933
Variance function:
Structure: fixed weights
Formula: ~w
Fixed effects: y ~ 1
Value Std.Error DF t-value p-value
(Intercept) 0.4119562 0.0704743 5 5.845481 0.0021
此处的自由度为什么是5?
Standardized Within-Group Residuals:
1 2 3 4 5
-0.7114801 -0.9689479 -0.3667061 1.3804766 0.7174588
attr(,"label")
[1] "Standardized residuals"
Number of Observations: 5
Number of Groups: 5