2011/2/5 Sebastián Daza <sebastian.d...@gmail.com>: > Hi everyone, > > I need to get a between-component variance (e.g. random effects Anova), but > using lmer I don't get the same results (variance component) than using > random effects Anova. I am using a database of students, clustered on > schools (there is not the same number of students by school). > > According to the ICC1 command, the interclass correlation is .44 > >> ICC1(anova1) > [1] 0.4414491
If you don't tell us exactly what model you are calculating in "anova1", how would we guess if there is something wrong? Similarly, I get this > ICC1 Error: object 'ICC1' not found so it must mean you've loaded a package or written a function, which you've not shown us. I googled my way to a package called "multilevel" that has ICC1, and its code for ICC1 shows a formula that does not match the one you used to calculate ICC from lmer. function (object) { MOD <- summary(object) MSB <- MOD[[1]][1, 3] MSW <- MOD[[1]][2, 3] GSIZE <- (MOD[[1]][2, 1] + (MOD[[1]][1, 1] + 1))/(MOD[[1]][1, 1] + 1) OUT <- (MSB - MSW)/(MSB + ((GSIZE - 1) * MSW)) return(OUT) } I'm not saying that's right or wrong, just not obviously identical to the formula you proposed. > > However, I cannot get the same ICC from the lmer output: > >> anova2 <- lmer(math ~ 1 + (1|schoolid), data=nels88) >> summary(anova2 <- lmer(math ~ 1 + (1|schoolid), data=nels88)) > Instead, do this (same thing, fits model only once): > anova2 <- lmer(math ~ 1 + (1|schoolid), data=nels88) > summary(anova2) Note that lmer is going to estimate a normally distributed random effect for each school, as well as an individual observation random effect (usual error term) that is assumed independent of the school-level effect. What is "anova1" estimating? -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.