R version 2.7.0 Under development (unstable) (2008-01-17 r44028) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(lme4) Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs > > srrs2 <- + read.table("http://www.stat.columbia.edu/~gelman/arm/examples/radon/srrs2.dat", + header = TRUE, sep=",") > # Strip trailing blanks and capitalize county names. > levels(srrs2$county) <- gsub("(\\w)(\\w*)", "\\U\\1\\L\\2", + sub('[[:space:]]+$', '', levels(srrs2$county)), + perl=TRUE) > # Use pmax to define the log radon > srrs2$log.radon <- log(pmax(srrs2$activity, 0.1)) > # Define floor as a factor with meaningful labels > srrs2$floor[srrs2$floor == 9] <- NA > srrs2$floor <- factor(srrs2$floor, labels = c("bsmnt", "1st", "2nd", "3rd")) > > (M1<-lmer(log.radon ~ 1 + floor + (1|county), srrs2, subset = state == "MN")) Linear mixed model fit by REML Formula: log.radon ~ 1 + floor + (1 | county) Data: srrs2 Subset: state == "MN" AIC BIC logLik deviance REMLdev 2177 2192 -1086 2164 2171 Random effects: Groups Name Variance Std.Dev. county (Intercept) 0.10771 0.32819 Residual 0.57092 0.75559 Number of obs: 919, groups: county, 85 Fixed effects: Estimate Std. Error t value (Intercept) 1.46159 0.05157 28.340 floor1st -0.69299 0.07043 -9.839 Correlation of Fixed Effects: (Intr) floor1st -0.288 > ranef(M1) An object of class “ranef.mer” [[1]] (Intercept) Aitkin -0.27006599 Anoka -0.53393800 Becker 0.01761490 Beltrami 0.04290088 Benton -0.01544452 Big Stone 0.01858295 Blue Earth 0.39650878 Brown 0.22115201 Carlton -0.30150038 Carver 0.04700898 Cass -0.02934816 Chippewa 0.11554290 Chisago -0.22452334 Clay 0.37640720 Clearwater -0.05909210 Cook -0.21826655 Cottonwood -0.08922393 Crow Wing -0.24063972 Dakota -0.11533157 Dodge 0.12242145 Douglas 0.16950564 Faribault -0.44036531 Fillmore -0.02064995 Freeborn 0.39894723 Goodhue 0.35194416 Hennepin -0.09890608 Houston 0.16065520 Hubbard -0.11481611 Isanti -0.14659025 Itasca -0.36159468 Jackson 0.27133290 Kanabec -0.09689908 Kandiyohi 0.25817000 Kittson 0.03992963 Koochiching -0.37453345 Lac Qui Parle 0.40643482 Lake -0.66872284 Lake Of The Woods 0.16874168 Le Sueur 0.13638219 Lincoln 0.36441916 Lyon 0.30201145 Mahnomen -0.01596964 Marshall 0.07888185 Martin -0.24159875 Mcleod -0.12406905 Meeker -0.11988835 Mille Lacs -0.16202612 Morrison -0.19921040 Mower 0.16784183 Murray 0.16373379 Nicollet 0.30253935 Nobles 0.16845797 Norman -0.07950325 Olmsted -0.12875864 Otter Tail 0.08785802 Pennington -0.13692876 Pine -0.37378783 Pipestone 0.16878299 Polk 0.10597800 Pope -0.04991567 Ramsey -0.26204439 Redwood 0.25042769 Renville 0.07225594 Rice 0.25895528 Rock -0.04451075 Roseau 0.13666335 Scott 0.23658540 Sherburne -0.22349262 Sibley -0.09424855 Stearns 0.02132103 Steele 0.07732212 Stevens 0.09044960 St Louis -0.57164093 Swift -0.20409713 Todd 0.09141911 Traverse 0.23222654 Wabasha 0.20267921 Wadena -0.09073539 Waseca -0.36711777 Washington -0.12111301 Watonwan 0.44439533 Wilkin 0.12196102 Winona 0.11008563 Wright 0.12903053 Yellow Medicine -0.07535666 > sqrt(as.vector(attr(ranef(M1, postVar = TRUE)[[1]], "postVar"))) [1] 0.24776139 0.09981789 0.26226150 0.21543965 0.24776139 0.26226150 [7] 0.17198992 0.24776139 0.19316763 0.22476988 0.23542779 0.24776139 [13] 0.22476988 0.17198992 0.24776139 0.27964703 0.24776139 0.18165941 [19] 0.09142725 0.26226150 0.19980737 0.22476988 0.27964703 0.19980737 [25] 0.17198992 0.07194472 0.22476988 0.23542779 0.26226150 0.18714866 [31] 0.23542779 0.24776139 0.24776139 0.26226150 0.21543965 0.27964703 [37] 0.19980737 0.24776139 0.23542779 0.24776139 0.20718251 0.30102240 [43] 0.19980737 0.21543965 0.17662646 0.23542779 0.27964703 0.19980737 [49] 0.17662646 0.30102240 0.24776139 0.26226150 0.26226150 0.14203336 [55] 0.20718251 0.26226150 0.22476988 0.24776139 0.24776139 0.27964703 [61] 0.12371723 0.23542779 0.26226150 0.18714866 0.27964703 0.17198992 [67] 0.17662646 0.20718251 0.24776139 0.13726586 0.19316763 0.27964703 [73] 0.06860509 0.24776139 0.26226150 0.24776139 0.21543965 0.23542779 [79] 0.24776139 0.10549376 0.26226150 0.30102240 0.17662646 0.17662646 [85] 0.27964703 > > proc.time() user system elapsed 11.300 0.232 12.537