这是nlme
library(nlme)
fit1 <- lme(score ~ - 1 + Machine, random=~1|Worker, data=Machines)
MCMCglmm
中相应的模型公式是什么?
是吗:
library(MCMCglmm)
fit2 <- MCMCglmm(score ~ - 1 + Machine,
random= ~us(1):Worker, data=Machines)
fit1输出:
> summary(fit1)
Linear mixed-effects model fit by REML
Data: Machines
AIC BIC logLik
296.8782 306.5373 -143.4391
Random effects:
Formula: ~1 | Worker
(Intercept) Residual
StdDev: 5.146552 3.161647
Fixed effects: score ~ -1 + Machine
Value Std.Error DF t-value p-value
MachineA 52.35556 2.229312 46 23.48507 0
MachineB 60.32222 2.229312 46 27.05867 0
MachineC 66.27222 2.229312 46 29.72765 0
Correlation:
MachnA MachnB
MachineB 0.888
MachineC 0.888 0.888
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.7248806 -0.5232891 0.1327564 0.6513056 1.7559058
Number of Observations: 54
Number of Groups: 6
fit2的输出
> summary(fit2)
Iterations = 3001:12991
Thinning interval = 10
Sample size = 1000
DIC: 287.5152
G-structure: ~us(1):Worker
post.mean l-95% CI u-95% CI eff.samp
(Intercept):(Intercept).Worker 42.29 4.97 120.4 1000
R-structure: ~units
post.mean l-95% CI u-95% CI eff.samp
units 10.51 6.398 15.21 1000
Location effects: score ~ -1 + Machine
post.mean l-95% CI u-95% CI eff.samp pMCMC
MachineA 52.36 46.77 57.66 1000 <0.001 ***
MachineB 60.32 55.04 66.34 1000 <0.001 ***
MachineC 66.38 60.61 71.85 1000 <0.001 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1