如何使用R和摘要输出中的估算来模拟相同大小的以下数据集的100倍???
rating officer
1 76 1
2 65 1
3 85 1
4 74 1
5 59 2
6 75 2
7 81 2
8 67 2
> > fit5=lmer(rating~(1|officer),data=rat, REML=FALSE)
> summary(fit5)
Linear mixed model fit by maximum likelihood
Formula: rating ~ (1 | officer)
Data: rat
AIC BIC logLik deviance REMLdev
62.06 62.3 -28.03 56.06 52.07
Random effects:
Groups Name Variance Std.Dev.
officer (Intercept) 0.000 0.0000
Residual 64.688 8.0429
Number of obs: 8, groups: officer, 2
Fixed effects:
Estimate Std. Error t value
(Intercept) 72.750 2.844 25.58
答案 0 :(得分:2)
如果通过模拟,你的意思是重新采样,这样的事情应该这样做:
replicate(100,
summary(lmer(rating~(1|officer),
data=rat[sample(1:nrow(rat),nrow(rat),TRUE)),],
REML=FALSE)))