R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), 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. 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("mlmRev-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('mlmRev') Loading required package: lme4 Loading required package: Matrix Loading required package: lattice > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "Chem97" > > ### * Chem97 > > flush(stderr()); flush(stdout()) > > ### Name: Chem97 > ### Title: Scores on A-level Chemistry in 1997 > ### Aliases: Chem97 > ### Keywords: datasets > > ### ** Examples > > str(Chem97) `data.frame': 31022 obs. of 8 variables: $ lea : Factor w/ 131 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ... $ school : Factor w/ 2410 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ... $ student : Factor w/ 31022 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... $ score : num 4 10 10 10 8 10 6 8 4 10 ... $ gender : Factor w/ 2 levels "M","F": 2 2 2 2 2 2 2 2 2 2 ... $ age : num 3 -3 -4 -2 -1 4 1 4 3 0 ... $ gcsescore: num 6.62 7.62 7.25 7.50 6.44 ... $ gcsecnt : num 0.339 1.339 0.964 1.214 0.158 ... > summary(Chem97) lea school student score gender 118 : 969 698 : 188 1 : 1 Min. : 0.000 M:17262 116 : 931 1408 : 126 2 : 1 1st Qu.: 4.000 F:13760 119 : 916 431 : 118 3 : 1 Median : 6.000 109 : 802 416 : 111 4 : 1 Mean : 5.813 113 : 791 1215 : 99 5 : 1 3rd Qu.: 8.000 129 : 762 908 : 94 6 : 1 Max. :10.000 (Other):25851 (Other):30286 (Other):31016 age gcsescore gcsecnt Min. :-6.0000 Min. :0.000 Min. :-6.286e+00 1st Qu.:-3.0000 1st Qu.:5.750 1st Qu.:-5.357e-01 Median :-1.0000 Median :6.375 Median : 8.932e-02 Mean :-0.4678 Mean :6.286 Mean :-2.667e-13 3rd Qu.: 3.0000 3rd Qu.:6.900 3rd Qu.: 6.143e-01 Max. : 5.0000 Max. :8.000 Max. : 1.714e+00 > (fm1 <- lmer(score ~ (1|school) + (1|lea), Chem97)) Linear mixed-effects model fit by REML Formula: score ~ (1 | school) + (1 | lea) Data: Chem97 AIC BIC logLik MLdeviance REMLdeviance 157881.8 157915.2 -78936.9 157869.9 157873.8 Random effects: Groups Name Variance Std.Dev. school (Intercept) 2.75017 1.65836 lea (Intercept) 0.15334 0.39158 Residual 8.51585 2.91819 # of obs: 31022, groups: school, 2410; lea, 131 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) 5.3189e+00 5.8101e-02 31021 91.546 < 2.2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > (fm2 <- lmer(score ~ gcsecnt + (1|school) + (1|lea), Chem97)) Linear mixed-effects model fit by REML Formula: score ~ gcsecnt + (1 | school) + (1 | lea) Data: Chem97 AIC BIC logLik MLdeviance REMLdeviance 141707 141748.7 -70848.5 141685.6 141697 Random effects: Groups Name Variance Std.Dev. school (Intercept) 1.166197 1.07991 lea (Intercept) 0.014767 0.12152 Residual 5.154202 2.27029 # of obs: 31022, groups: school, 2410; lea, 131 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) 5.6355e+00 3.1235e-02 31020 180.42 < 2.2e-16 *** gcsecnt 2.4726e+00 1.6904e-02 31020 146.27 < 2.2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > cleanEx(); ..nameEx <- "Contraception" > > ### * Contraception > > flush(stderr()); flush(stdout()) > > ### Name: Contraception > ### Title: Contraceptive use in Bangladesh > ### Aliases: Contraception > ### Keywords: datasets > > ### ** Examples > > data(Contraception) > str(Contraception) `data.frame': 1934 obs. of 6 variables: $ woman : Factor w/ 1934 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... $ district: Factor w/ 60 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ... $ use : Factor w/ 2 levels "N","Y": 1 1 1 1 1 1 1 1 1 1 ... $ livch : Factor w/ 4 levels "0","1","2","3+": 4 1 3 4 1 1 4 4 2 4 ... $ age : num 18.44 -5.56 1.44 8.44 -13.56 ... $ urban : Factor w/ 2 levels "N","Y": 2 2 2 2 2 2 2 2 2 2 ... > summary(Contraception) woman district use livch age urban 1 : 1 14 : 118 N:1175 0 :530 Min. :-13.560000 N:1372 2 : 1 1 : 117 Y: 759 1 :356 1st Qu.: -7.559900 Y: 562 3 : 1 46 : 86 2 :305 Median : -1.559900 4 : 1 25 : 67 3+:743 Mean : 0.002198 5 : 1 6 : 65 3rd Qu.: 6.440000 6 : 1 30 : 61 Max. : 19.440000 (Other):1928 (Other):1420 > (fm1 <- lmer(use ~ urban+age+livch+(1|district), Contraception, binomial)) Generalized linear mixed model fit using PQL Formula: use ~ urban + age + livch + (1 | district) Data: Contraception Family: binomial(logit link) AIC BIC logLik deviance 2429.664 2474.203 -1206.832 2413.664 Random effects: Groups Name Variance Std.Dev. district (Intercept) 0.21518 0.46387 # of obs: 1934, groups: district, 60 Estimated scale (compare to 1) 0.9844111 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.6606460 0.1452147 -11.4358 < 2.2e-16 *** urbanY 0.7193097 0.1183317 6.0788 1.211e-09 *** age -0.0261558 0.0078152 -3.3468 0.0008176 *** livch1 1.0921026 0.1565011 6.9782 2.989e-12 *** livch2 1.3545533 0.1729641 7.8314 4.824e-15 *** livch3+ 1.3241531 0.1773558 7.4661 8.262e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > ##(fm2 <- lmer(use ~ urban+age+livch+(1|district), Contraception, family = binomial, > ## method = "Laplace")) > (fm3 <- lmer(use ~ urban+age+livch+(urban|district), Contraception, binomial)) Generalized linear mixed model fit using PQL Formula: use ~ urban + age + livch + (urban | district) Data: Contraception Family: binomial(logit link) AIC BIC logLik deviance 2419.121 2474.795 -1199.561 2399.121 Random effects: Groups Name Variance Std.Dev. Corr district (Intercept) 0.38774 0.62269 urbanY 0.66745 0.81698 -0.793 # of obs: 1934, groups: district, 60 Estimated scale (compare to 1) 0.9759564 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.6665200 0.1572532 -10.5977 < 2.2e-16 *** urbanY 0.7914232 0.1681257 4.7073 2.510e-06 *** age -0.0258502 0.0079082 -3.2688 0.00108 ** livch1 1.0987723 0.1580051 6.9540 3.550e-12 *** livch2 1.3342511 0.1745854 7.6424 2.132e-14 *** livch3+ 1.3227367 0.1795440 7.3672 1.743e-13 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > cleanEx(); ..nameEx <- "Early" > > ### * Early > > flush(stderr()); flush(stdout()) > > ### Name: Early > ### Title: Early childhood intervention study > ### Aliases: Early > ### Keywords: datasets > > ### ** Examples > > data(Early) > str(Early) `data.frame': 309 obs. of 4 variables: $ id : Factor w/ 103 levels "86","87","77",..: 12 12 12 17 17 17 22 22 22 8 ... $ cog: int 103 119 96 106 107 96 112 86 73 100 ... $ age: num 1 1.5 2 1 1.5 2 1 1.5 2 1 ... $ trt: Factor w/ 2 levels "N","Y": 2 2 2 2 2 2 2 2 2 2 ... > > > > cleanEx(); ..nameEx <- "Exam" > > ### * Exam > > flush(stderr()); flush(stdout()) > > ### Name: Exam > ### Title: Exam scores from inner London > ### Aliases: Exam > ### Keywords: datasets > > ### ** Examples > > str(Exam) `data.frame': 4059 obs. of 10 variables: $ school : Factor w/ 65 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ... $ normexam: num 0.261 0.134 -1.724 0.968 0.544 ... $ schgend : Factor w/ 3 levels "mixed","boys",..: 1 1 1 1 1 1 1 1 1 1 ... $ schavg : num 0.166 0.166 0.166 0.166 0.166 ... $ vr : Factor w/ 3 levels "bottom 25%","mid 50%",..: 2 2 2 2 2 2 2 2 2 2 ... $ intake : Factor w/ 3 levels "bottom 25%","mid 50%",..: 1 2 3 2 2 1 3 2 2 3 ... $ standLRT: num 0.619 0.206 -1.365 0.206 0.371 ... $ sex : Factor w/ 2 levels "F","M": 1 1 2 1 1 2 2 2 1 2 ... $ type : Factor w/ 2 levels "Mxd","Sngl": 1 1 1 1 1 1 1 1 1 1 ... $ student : Factor w/ 650 levels "1","2","3","4",..: 143 145 142 141 138 155 158 115 117 113 ... > summary(Exam) school normexam schgend schavg 14 : 198 Min. :-3.6660720 mixed:2169 Min. :-0.755961 17 : 126 1st Qu.:-0.6995050 boys : 513 1st Qu.:-0.149341 18 : 120 Median : 0.0043222 girls:1377 Median :-0.020198 49 : 113 Mean :-0.0001138 Mean : 0.001810 8 : 102 3rd Qu.: 0.6787592 3rd Qu.: 0.210525 15 : 91 Max. : 3.6660912 Max. : 0.637656 (Other):3309 vr intake standLRT sex type bottom 25%: 640 bottom 25%:1176 Min. :-2.934953 F:2436 Mxd :2169 mid 50% :2263 mid 50% :2344 1st Qu.:-0.620713 M:1623 Sngl:1890 top 25% :1156 top 25% : 539 Median : 0.040499 Mean : 0.001810 3rd Qu.: 0.619059 Max. : 3.015952 student 20 : 34 54 : 34 15 : 33 22 : 33 31 : 33 59 : 33 (Other):3859 > (fm1 <- lmer(normexam ~ standLRT + sex + schgend + (1|school), Exam)) Linear mixed-effects model fit by REML Formula: normexam ~ standLRT + sex + schgend + (1 | school) Data: Exam AIC BIC logLik MLdeviance REMLdeviance 9361.673 9405.834 -4673.837 9325.501 9347.673 Random effects: Groups Name Variance Std.Dev. school (Intercept) 0.085829 0.29297 Residual 0.562534 0.75002 # of obs: 4059, groups: school, 65 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) -1.0493e-03 5.5569e-02 4054 -0.0189 0.98494 standLRT 5.5975e-01 1.2450e-02 4054 44.9601 < 2.2e-16 *** sexM -1.6739e-01 3.4100e-02 4054 -4.9089 9.519e-07 *** schgendboys 1.7769e-01 1.1347e-01 4054 1.5659 0.11745 schgendgirls 1.5900e-01 8.9403e-02 4054 1.7784 0.07541 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > (fm2 <- lmer(normexam ~ standLRT*sex + schgend + (1|school), Exam)) Linear mixed-effects model fit by REML Formula: normexam ~ standLRT * sex + schgend + (1 | school) Data: Exam AIC BIC logLik MLdeviance REMLdeviance 9369.204 9419.673 -4676.602 9325.458 9353.204 Random effects: Groups Name Variance Std.Dev. school (Intercept) 0.085856 0.29301 Residual 0.562666 0.75011 # of obs: 4059, groups: school, 65 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) -8.4349e-04 5.5586e-02 4053 -0.0152 0.98789 standLRT 5.5745e-01 1.6662e-02 4053 33.4572 < 2.2e-16 *** sexM -1.6733e-01 3.4105e-02 4053 -4.9064 9.638e-07 *** schgendboys 1.7765e-01 1.1349e-01 4053 1.5653 0.11759 schgendgirls 1.5879e-01 8.9422e-02 4053 1.7757 0.07586 . standLRT:sexM 5.1121e-03 2.4584e-02 4053 0.2079 0.83528 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > (fm3 <- lmer(normexam ~ standLRT*sex + schgend + (1|school), Exam)) Linear mixed-effects model fit by REML Formula: normexam ~ standLRT * sex + schgend + (1 | school) Data: Exam AIC BIC logLik MLdeviance REMLdeviance 9369.204 9419.673 -4676.602 9325.458 9353.204 Random effects: Groups Name Variance Std.Dev. school (Intercept) 0.085856 0.29301 Residual 0.562666 0.75011 # of obs: 4059, groups: school, 65 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) -8.4349e-04 5.5586e-02 4053 -0.0152 0.98789 standLRT 5.5745e-01 1.6662e-02 4053 33.4572 < 2.2e-16 *** sexM -1.6733e-01 3.4105e-02 4053 -4.9064 9.638e-07 *** schgendboys 1.7765e-01 1.1349e-01 4053 1.5653 0.11759 schgendgirls 1.5879e-01 8.9422e-02 4053 1.7757 0.07586 . standLRT:sexM 5.1121e-03 2.4584e-02 4053 0.2079 0.83528 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > cleanEx(); ..nameEx <- "Gcsemv" > > ### * Gcsemv > > flush(stderr()); flush(stdout()) > > ### Name: Gcsemv > ### Title: GCSE exam score > ### Aliases: Gcsemv > ### Keywords: datasets > > ### ** Examples > > data(Gcsemv) > str(Gcsemv) `data.frame': 1905 obs. of 5 variables: $ school : Factor w/ 73 levels "20920","22520",..: 1 1 1 1 1 1 1 1 1 2 ... $ student: Factor w/ 649 levels "1","2","3","4",..: 16 25 27 31 42 62 101 113 146 1 ... $ gender : Factor w/ 2 levels "F","M": 2 1 1 1 2 1 1 2 2 1 ... $ written: num 23 NA 39 36 16 36 49 25 NA 48 ... $ course : num NA 71.2 76.8 87.9 44.4 NA 89.8 17.5 32.4 84.2 ... > > > > cleanEx(); ..nameEx <- "Hsb82" > > ### * Hsb82 > > flush(stderr()); flush(stdout()) > > ### Name: Hsb82 > ### Title: High School and Beyond - 1982 > ### Aliases: Hsb82 > ### Keywords: datasets > > ### ** Examples > > data(Hsb82) > summary(Hsb82) school minrty sx ses mAch 2305 : 67 No :5211 Male :3390 Min. :-3.7580000 Min. :-2.832 5619 : 66 Yes:1974 Female:3795 1st Qu.:-0.5380000 1st Qu.: 7.275 4292 : 65 Median : 0.0020000 Median :13.131 8857 : 64 Mean : 0.0001434 Mean :12.748 4042 : 64 3rd Qu.: 0.6020000 3rd Qu.:18.317 3610 : 64 Max. : 2.6920000 Max. :24.993 (Other):6795 meanses sector cses Min. :-1.1939459 Public :3642 Min. :-3.651e+00 1st Qu.:-0.3230000 Catholic:3543 1st Qu.:-4.479e-01 Median : 0.0320000 Median : 1.600e-02 Mean : 0.0001434 Mean :-6.490e-19 3rd Qu.: 0.3269123 3rd Qu.: 4.694e-01 Max. : 0.8249825 Max. : 2.856e+00 > > > > cleanEx(); ..nameEx <- "Mmmec" > > ### * Mmmec > > flush(stderr()); flush(stdout()) > > ### Name: Mmmec > ### Title: Malignant melanoma deaths in Europe > ### Aliases: Mmmec > ### Keywords: datasets > > ### ** Examples > > str(Mmmec) `data.frame': 354 obs. of 6 variables: $ nation : Factor w/ 9 levels "Belgium","W.Germany",..: 1 1 1 1 1 1 1 1 1 1 ... $ region : Factor w/ 78 levels "1","2","3","4",..: 1 2 2 2 2 2 3 3 3 3 ... $ county : Factor w/ 354 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... $ deaths : int 79 80 51 43 89 19 19 15 33 9 ... $ expected: num 51.2 80.0 46.5 55.1 67.8 ... $ uvb : num -2.91 -3.21 -2.80 -3.01 -3.01 ... > summary(Mmmec) nation region county deaths expected Italy :95 44 : 13 1 : 1 Min. : 0.00 Min. : 0.69 France :94 49 : 12 2 : 1 1st Qu.: 8.00 1st Qu.: 11.02 UK :70 72 : 12 3 : 1 Median : 14.50 Median : 18.76 W.Germany:30 59 : 9 4 : 1 Mean : 27.83 Mean : 27.80 Ireland :26 65 : 9 5 : 1 3rd Qu.: 31.00 3rd Qu.: 34.39 Denmark :14 66 : 9 6 : 1 Max. :313.00 Max. :258.86 (Other) :25 (Other):290 (Other):348 uvb Min. :-8.9002000 1st Qu.:-4.1584000 Median :-0.8864000 Mean : 0.0002040 3rd Qu.: 3.2755250 Max. :13.3590000 > (fm1 <- lmer(deaths ~ offset(log(expected)) + uvb + (1|region), Mmmec, poisson)) Generalized linear mixed model fit using PQL Formula: deaths ~ offset(log(expected)) + uvb + (1 | region) Data: Mmmec Family: poisson(log link) AIC BIC logLik deviance 666.3289 681.806 -329.1644 658.3289 Random effects: Groups Name Variance Std.Dev. region (Intercept) 0.12539 0.3541 # of obs: 354, groups: region, 78 Estimated scale (compare to 1) 1.134873 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -0.1287457 0.0430654 -2.9895 0.002794 ** uvb -0.0378191 0.0086734 -4.3603 1.299e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > cleanEx(); ..nameEx <- "Oxboys" > > ### * Oxboys > > flush(stderr()); flush(stdout()) > > ### Name: Oxboys > ### Title: Heights of Boys in Oxford > ### Aliases: Oxboys > ### Keywords: datasets > > ### ** Examples > > data(Oxboys) > > > > cleanEx(); ..nameEx <- "ScotsSec" > > ### * ScotsSec > > flush(stderr()); flush(stdout()) > > ### Name: ScotsSec > ### Title: Scottish secondary school scores > ### Aliases: ScotsSec > ### Keywords: datasets > > ### ** Examples > > data(ScotsSec) > str(ScotsSec) `data.frame': 3435 obs. of 6 variables: $ verbal : num 11 0 -14 -6 -30 -17 -17 -11 -9 -19 ... $ attain : num 10 3 2 3 2 2 4 6 4 2 ... $ primary: Factor w/ 148 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ... $ sex : Factor w/ 2 levels "M","F": 1 2 1 1 2 2 2 1 1 1 ... $ social : num 0 0 0 20 0 0 0 0 0 0 ... $ second : Factor w/ 19 levels "1","2","3","4",..: 9 9 9 9 9 9 1 1 9 9 ... > > > > cleanEx(); ..nameEx <- "Socatt" > > ### * Socatt > > flush(stderr()); flush(stdout()) > > ### Name: Socatt > ### Title: Social Attitudes Survey > ### Aliases: Socatt > ### Keywords: datasets > > ### ** Examples > > data(Socatt) > str(Socatt) `data.frame': 1056 obs. of 9 variables: $ district: Factor w/ 54 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 2 2 ... $ respond : Factor w/ 264 levels "39","46","48",..: 258 258 258 258 259 259 259 259 260 260 ... $ year : Factor w/ 4 levels "1983","1984",..: 1 2 3 4 1 2 3 4 1 2 ... $ numpos : Ord.factor w/ 8 levels "0"<"1"<"2"<"3"<..: 8 4 5 8 4 5 7 4 8 8 ... $ party : Factor w/ 5 levels "conservative",..: 2 2 2 2 5 1 2 4 5 4 ... $ class : Factor w/ 3 levels "middle","upper working",..: 3 3 3 3 3 1 3 1 1 2 ... $ gender : Factor w/ 2 levels "male","female": 1 1 1 1 2 2 2 2 1 1 ... $ age : int 65 65 65 65 31 31 31 31 33 33 ... $ religion: Factor w/ 4 levels "Roman Catholic",..: 2 2 2 2 2 2 2 2 4 4 ... > summary(Socatt) district respond year numpos party 44 : 40 39 : 4 1983:264 7 :338 conservative :400 8 : 36 46 : 4 1984:264 3 :248 labour :371 14 : 36 48 : 4 1985:264 6 :140 Lib/SDP/Alliance:223 20 : 36 55 : 4 1986:264 4 :127 others : 39 32 : 36 56 : 4 5 :124 none : 23 19 : 32 60 : 4 2 : 52 (Other):840 (Other):1032 (Other): 27 class gender age religion middle :264 male :468 Min. :18.00 Roman Catholic: 72 upper working:268 female:588 1st Qu.:31.00 Protestant :448 lower working:524 Median :40.50 others :180 Mean :43.52 none :356 3rd Qu.:55.00 Max. :80.00 > > > > cleanEx(); ..nameEx <- "bdf" > > ### * bdf > > flush(stderr()); flush(stdout()) > > ### Name: bdf > ### Title: Language scores > ### Aliases: bdf > ### Keywords: datasets > > ### ** Examples > > data(bdf) > summary(bdf) schoolNR pupilNR IQ.verb IQ.perf sex 40 : 35 1017001: 1 Min. : 4.00 Min. : 5.000 0:1194 155 : 33 1017002: 1 1st Qu.:10.50 1st Qu.: 9.333 1:1093 54 : 31 1017003: 1 Median :12.00 Median :11.000 159 : 31 1017004: 1 Mean :11.83 Mean :11.047 161 : 31 1017005: 1 3rd Qu.:13.00 3rd Qu.:12.667 183 : 31 1017006: 1 Max. :18.00 Max. :17.667 (Other):2095 (Other):2281 Minority repeatgr aritPRET classNR aritPOST N:2155 0:1988 Min. : 1.00 Min. : 180 Min. : 2.00 Y: 132 1: 295 1st Qu.: 9.00 1st Qu.: 6780 1st Qu.:14.00 2: 4 Median :12.00 Median :14180 Median :20.00 Mean :11.94 Mean :13382 Mean :19.44 3rd Qu.:14.00 3rd Qu.:19580 3rd Qu.:25.00 Max. :20.00 Max. :25880 Max. :30.00 langPRET langPOST ses denomina schoolSES Min. :11.00 Min. : 9.00 Min. :10.00 1:775 Min. :10.00 1st Qu.:30.00 1st Qu.:35.00 1st Qu.:20.00 2:803 1st Qu.:16.00 Median :35.00 Median :42.00 Median :27.00 3:617 Median :18.00 Mean :34.19 Mean :40.93 Mean :27.81 4: 92 Mean :19.00 3rd Qu.:39.00 3rd Qu.:48.00 3rd Qu.:35.00 3rd Qu.:22.00 Max. :49.00 Max. :58.00 Max. :50.00 Max. :29.00 satiprin natitest meetings currmeet mixedgra Min. :2.143 0:1056 Min. :1.100 Min. :1.000 0:1658 1st Qu.:3.143 1:1231 1st Qu.:1.800 1st Qu.:1.667 1: 629 Median :3.286 Median :2.000 Median :1.833 Mean :3.325 Mean :2.055 Mean :1.973 3rd Qu.:3.571 3rd Qu.:2.300 3rd Qu.:2.167 Max. :4.000 Max. :3.600 Max. :3.333 percmino aritdiff homework classsiz Min. : 0.000 Min. : 8.00 Min. :1.333 Min. :10.00 1st Qu.: 0.000 1st Qu.:13.00 1st Qu.:2.000 1st Qu.:23.00 Median : 0.000 Median :15.00 Median :2.667 Median :27.00 Mean : 6.579 Mean :16.15 Mean :2.462 Mean :26.51 3rd Qu.: 6.000 3rd Qu.:19.00 3rd Qu.:2.667 3rd Qu.:31.00 Max. :90.000 Max. :27.00 Max. :3.667 Max. :39.00 groupsiz IQ.ver.cen avg.IQ.ver.cen grpSiz.cen Min. : 5.0 Min. :-7.834e+00 Min. :-5.084e+00 Min. :-1.810e+01 1st Qu.:17.0 1st Qu.:-1.334e+00 1st Qu.:-4.174e-01 1st Qu.:-6.101e+00 Median :24.0 Median : 1.659e-01 Median : 1.059e-01 Median : 8.994e-01 Mean :23.1 Mean : 2.259e-15 Mean : 4.466e-16 Mean : 1.741e-14 3rd Qu.:28.0 3rd Qu.: 1.166e+00 3rd Qu.: 5.231e-01 3rd Qu.: 4.899e+00 Max. :37.0 Max. : 6.166e+00 Max. : 1.899e+00 Max. : 1.390e+01 > > > > cleanEx(); ..nameEx <- "egsingle" > > ### * egsingle > > flush(stderr()); flush(stdout()) > > ### Name: egsingle > ### Title: US Sustaining Effects study > ### Aliases: egsingle > ### Keywords: datasets > > ### ** Examples > > str(egsingle) `data.frame': 7230 obs. of 12 variables: $ schoolid: Factor w/ 60 levels "2020","2040",..: 1 1 1 1 1 1 1 1 1 1 ... $ childid : Factor w/ 1721 levels "101480302","173559292",..: 244 244 244 248 248 248 248 248 253 253 ... $ year : num 0.5 1.5 2.5 -1.5 -0.5 0.5 1.5 2.5 -1.5 -0.5 ... $ grade : num 2 3 4 0 1 2 3 4 0 1 ... $ math : num 1.146 1.134 2.300 -1.303 0.439 ... $ retained: Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... $ female : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ... $ black : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... $ hispanic: Factor w/ 2 levels "0","1": 2 2 2 1 1 1 1 1 2 2 ... $ size : num 380 380 380 380 380 380 380 380 380 380 ... $ lowinc : num 40.3 40.3 40.3 40.3 40.3 40.3 40.3 40.3 40.3 40.3 ... $ mobility: num 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 ... > (fm1 <- lmer(math~year*size+female+(1|childid)+(1|schoolid), egsingle, + control = list(EMv = 1, msV = 1))) EM iterations 0 17660.029 ( 1.57539: 662.) ( 45.1875: 3.76) 1 17071.948 (0.980742: 647.) ( 11.7923: 8.48) 2 16853.085 (0.716564: 455.) ( 4.42107: 8.94) 3 16798.417 (0.602474: 252.) ( 2.66558: 5.11) 4 16787.302 (0.553611: 121.) ( 2.17244: 2.15) 5 16785.232 (0.532838: 54.2) ( 2.01547: 0.814) 6 16784.860 (0.524052: 23.4) ( 1.96182: 0.301) 7 16784.795 (0.520346: 9.95) ( 1.94273: 0.111) 8 16784.783 (0.518786: 4.20) ( 1.93575: 0.0417) 9 16784.781 (0.518130: 1.77) ( 1.93315: 0.0159) 10 16784.781 (0.517854: 0.743) ( 1.93216: 0.00613) 11 16784.781 (0.517738: 0.312) ( 1.93178: 0.00240) 12 16784.781 (0.517690: 0.131) ( 1.93163:0.000950) 13 16784.780 (0.517669: 0.0550) ( 1.93157:0.000381) 14 16784.780 (0.517661: 0.0231) ( 1.93155:0.000154) 15 16784.780 (0.517657: 0.00967) ( 1.93154:6.26e-05) iter 0 value 16784.780500 final value 16784.780500 converged Linear mixed-effects model fit by REML Formula: math ~ year * size + female + (1 | childid) + (1 | schoolid) Data: egsingle AIC BIC logLik MLdeviance REMLdeviance 16800.78 16855.87 -8392.39 16732.53 16784.78 Random effects: Groups Name Variance Std.Dev. childid (Intercept) 0.66937 0.81815 schoolid (Intercept) 0.17939 0.42355 Residual 0.34650 0.58864 # of obs: 7230, groups: childid, 1721; schoolid, 60 Fixed effects: Estimate Std. Error DF t value Pr(>|t|) (Intercept) -5.9801e-01 1.4094e-01 7225 -4.2429 2.234e-05 *** year 7.9167e-01 1.4101e-02 7225 56.1418 < 2.2e-16 *** size -2.7381e-04 1.9098e-04 7225 -1.4337 0.151700 femaleMale -4.6525e-03 4.2448e-02 7225 -0.1096 0.912726 year:size -6.0669e-05 1.7387e-05 7225 -3.4894 0.000487 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > > cleanEx(); ..nameEx <- "guImmun" > > ### * guImmun > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: guImmun > ### Title: Immunization in Guatemala > ### Aliases: guImmun > ### Keywords: datasets > > ### ** Examples > > data(guImmun) > summary(guImmun) kid mom comm immun kid2p mom25p 2 : 1 310 : 3 185 : 55 N:1195 N: 493 N:1038 269 : 1 384 : 3 210 : 50 Y: 964 Y:1666 Y:1121 272 : 1 456 : 3 226 : 34 273 : 1 464 : 3 227 : 32 274 : 1 498 : 3 174 : 30 275 : 1 514 : 3 188 : 30 (Other):2153 (Other):2141 (Other):1928 ord ethn momEd husEd momWork rural pcInd81 01:380 L:1283 N:1050 N: 676 N:1187 N: 519 Min. :0.006683 23:740 N: 374 P: 963 P:1056 Y: 972 Y:1640 1st Qu.:0.080635 46:721 S: 502 S: 146 S: 245 Median :0.506864 7p:318 U: 182 Mean :0.466552 3rd Qu.:0.834860 Max. :0.995884 > > > > cleanEx(); ..nameEx <- "guPrenat" > > ### * guPrenat > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: guPrenat > ### Title: Prenatal care in Guatemala > ### Aliases: guPrenat > ### Keywords: datasets > > ### ** Examples > > data(guPrenat) > summary(guPrenat) kid mom cluster prenat childAge 2 : 1 665 : 4 185 : 50 Traditional:1347 0-2:1492 269 : 1 879 : 4 143 : 36 Modern :1102 3+ : 957 270 : 1 1485 : 4 218 : 35 271 : 1 2163 : 4 161 : 33 273 : 1 246 : 3 188 : 33 275 : 1 259 : 3 65 : 31 (Other):2443 (Other):2427 (Other):2231 motherAge birthOrd indig momEd husEd 24-:1158 1 :461 Ladino :1411 None :1137 None : 723 25+:1291 2-3:830 NoSpa : 417 Primary :1132 Primary :1208 4-6:798 Spanish: 621 Secondary+: 180 Secondary+: 292 7+ :360 Unknown : 226 husEmpl toilet TV pcInd81 Unskilled :107 None : 470 None :1887 Min. :0.006683 Professional:323 Modern:1979 not daily: 120 1st Qu.:0.080635 Agri (self) :829 daily : 442 Median :0.506864 Agri (empl) :630 Mean :0.481012 Skilled :560 3rd Qu.:0.895539 Max. :0.995884 ssDist Min. : 0.00 1st Qu.: 4.00 Median :14.00 Mean :22.29 3rd Qu.:36.00 Max. :97.00 > > > > cleanEx(); ..nameEx <- "s3bbx" > > ### * s3bbx > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: s3bbx > ### Title: Covariates in the Rodriguez and Goldman simulation > ### Aliases: s3bbx > ### Keywords: datasets > > ### ** Examples > > data(s3bbx) > str(s3bbx) `data.frame': 2449 obs. of 6 variables: $ child : int 1213 898 901 902 904 907 910 912 913 919 ... $ family : Factor w/ 1558 levels "3","4","6","7",..: 135 1080 1081 1081 1082 1083 1084 1085 1085 1086 ... $ community: Factor w/ 161 levels "1","38","40",..: 1 2 2 2 2 2 2 2 2 2 ... $ chldcov : num -0.173 -0.102 -0.102 -0.102 -0.275 ... $ famcov : num 2.134 1.011 1.146 1.146 0.955 ... $ commcov : num -0.1048 -0.0718 -0.0718 -0.0718 -0.0718 ... > > > > cleanEx(); ..nameEx <- "s3bby" > > ### * s3bby > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: s3bby > ### Title: Responses simulated by Rodriguez and Goldman > ### Aliases: s3bby > ### Keywords: datasets > > ### ** Examples > > data(s3bby) > str(s3bby) num [1:2449, 1:100] 1 1 0 0 1 1 1 1 1 1 ... > > > > cleanEx(); ..nameEx <- "star" > > ### * star > > flush(stderr()); flush(stdout()) > > ### Name: star > ### Title: Student Teacher Achievment Ratio (STAR) project data > ### Aliases: star > ### Keywords: datasets > > ### ** Examples > > str(star) `data.frame': 26796 obs. of 18 variables: $ id : Factor w/ 11598 levels "100017","100028",..: 1 2 3 3 3 4 5 5 6 6 ... $ sch : Factor w/ 80 levels "1","2","3","4",..: 28 52 41 41 41 64 40 40 22 22 ... $ gr : Ord.factor w/ 4 levels "K"<"1"<"2"<"3": 1 1 2 3 4 1 1 2 1 2 ... $ cltype : Factor w/ 3 levels "small","reg",..: 1 2 1 1 1 1 2 3 1 1 ... $ hdeg : Ord.factor w/ 6 levels "ASSOC"<"BS/BA"<..: 2 3 2 3 2 2 2 2 2 3 ... $ clad : Factor w/ 7 levels "NOT","APPR","PROB",..: 5 5 5 2 5 5 2 5 3 5 ... $ exp : int 3 12 20 15 5 19 2 5 9 9 ... $ trace : Factor w/ 6 levels "W","B","A","H",..: 2 1 1 2 1 1 1 1 2 2 ... $ read : int 476 410 507 575 610 430 495 629 418 524 ... $ math : int 602 444 572 620 655 484 576 592 489 567 ... $ ses : Factor w/ 2 levels "F","N": 1 2 2 2 2 2 1 1 1 1 ... $ schtype: Factor w/ 4 levels "inner","suburb",..: 1 2 2 2 2 3 3 3 1 1 ... $ sx : Factor w/ 2 levels "M","F": 2 2 1 1 1 2 2 2 2 2 ... $ eth : Factor w/ 6 levels "W","B","A","H",..: 2 1 1 1 1 1 1 1 2 2 ... $ birthq : Ord.factor w/ 25 levels "1977:1"<"1977:2"<..: 14 15 15 15 15 14 12 12 14 14 ... $ birthy : Ord.factor w/ 6 levels "1977"<"1978"<..: 4 4 4 4 4 4 3 3 4 4 ... $ yrs : num 0 0 1 2 3 0 0 1 0 1 ... $ tch : Factor w/ 1387 levels "1","2","3","4",..: 478 893 698 701 706 1102 679 684 351 359 ... > > > > ### *