[R] lme cant get parameter estimated correctly

toby909 toby909 at gmail.com
Sun Apr 6 07:26:33 CEST 2008


I am caught in a mental trap. Why isn't the between groups variance estimated
(0.0038) to be around the value with which I generated the data (0.0002)?

Thanks Toby






set.seed(76589437887)

fph = 0.4

Sigh = sqrt(0.0002)
Sigi = sqrt(0.04)

ci = 1
fpi = matrix(,7200,3)
for (i in 1:90) {
 fph = rnorm(1, fph, Sigh)
 for (k in 1:80) {
  fpi[ci,1:3] = matrix(c(i, k, rnorm(1, fph, Sigi)),1)
  ci = ci+1
 }
}

colnames(fpi) = c("hospid", "empid", "fpi1")
dta = as.data.frame(fpi)



lme = lme(fpi1 ~ 1, dta, ~1|hospid)
summary(lme)






lme = lme(fpi1 ~ 1, dta, ~1|hospid)
summary(lme)
Linear mixed-effects model fit by REML
 Data: dta 
        AIC       BIC   logLik
  -2555.416 -2534.771 1280.708

Random effects:
 Formula: ~1 | hospid
        (Intercept)  Residual
StdDev:  0.06173257 0.1997302

Fixed effects: fpi1 ~ 1 
               Value   Std.Error   DF  t-value p-value
(Intercept) 0.368082 0.006919828 7110 53.19236       0

Standardized Within-Group Residuals:
       Min         Q1        Med         Q3        Max 
-3.4870696 -0.6747173 -0.0048658  0.6838012  4.2633384 

Number of Observations: 7200
Number of Groups: 90 

0.0617^2
[1] 0.00380689



More information about the R-help mailing list