Reputation: 139
How can I simulate 100 times the following dataset of equal size using R and the estimates from the summary output???
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
Upvotes: 0
Views: 342
Reputation: 44527
If by simulate, you mean resample, something like this should do it:
replicate(100,
summary(lmer(rating~(1|officer),
data=rat[sample(1:nrow(rat),nrow(rat),TRUE)),],
REML=FALSE)))
Upvotes: 2