The second edition of the textbook, Multilevel Analysis: An introduction to basic and advanced multilevel modeling, written by Tom A.B. Snijders and Roel J. Bosker, appeared November 2011 at Sage Publishers. The official publication year, however, is 2012. The Sage announcement of this book is here, and here is the table of contents.The book was totally updated, with new chapters on missing data, multilevel analysis and survey weights, and miscellaneous methods (Bayesian estimation, sandwich standard errors, latent class models). Each chapter (from 2 to 17) ends with a glommary, which is a combination of a glossary and a summary, giving the main terms and an overview of the chapter. This webpage contains:
|
- The main data set, used in Chapters 4-10 (where missings are excluded):
- mlbook2_r_dat.zip, zipped file containing the file named mlbook2_r.dat, an ascii file with 11 variables, top line gives the variable names, may be read into R by a command such as > mlbook_red <- read.table("mlbook2_r.dat", header=TRUE)For reading this file into other software, delete the top line but note that it contains the variable names.
- mlbook2_r_obe.zip, zipped file containing the file named mlbook2_r.obe, the same, but formatted as a macro file to be read directly by MLwiN: obey mlbook2_r.obe
- mlbook2_mm.zip, zipped file containing the file named mlbook2_mm.dat, an ascii file with 23 variables, top line gives the variable names. This is the data file used in Example 9.3, containing some more cases that have missing values on the dependent variable langPOST. For the construction of this file and meaning of the variable names, consult script mlbook2_prepare_data.r contained in the zipped file mlbook2_data_preparations.zip which is also mentioned below.
After unzipping, this file may be read into R by a command such as > mlbook_mm <- read.table("mlbook2_mm.dat", header=TRUE)For reading this file into other software, delete the top line but note that it contains the variable names. - The original data set and an r script transforming it to the derived data sets used here, is in the zipped file mlbook2_data_preparations.zip.
This is not directly needed, but is included just to show the data transformations that were carried out.
- Data set used in example 3.7 in Chapter 3:
- mlbook2_bb_obe.zip, zipped file containing the file named mlbook2_bb.obe; a data set with a few more cases than mlbook2_r (obtained by also including those that had a missing value on aritPOST but not on any other variables) formatted as a macro file to be read directly by MLwiN: obey mlbook2_bb.obeIf you wish to use this data file in other software, just delete the top and bottom text lines that contain the information for MLwiN.
- mlbook2_bb_obe.zip, zipped file containing the file named mlbook2_bb.obe; a data set with a few more cases than mlbook2_r (obtained by also including those that had a missing value on aritPOST but not on any other variables) formatted as a macro file to be read directly by MLwiN: obey mlbook2_bb.obeIf you wish to use this data file in other software, just delete the top and bottom text lines that contain the information for MLwiN.
- Data set used in Chapter 14:
- DataPISA.zip, zipped file containing the file combineusa-999_c.sav.
- pisacc.zip, an excerpt from this file in ascii format, as written in script pisa_b.r below.
- For how to use this: see the MLwiN and r scripts below.
- Data set used in Section 15.1.
- soep_5560_21.zip, zipped file containing the file soep_5560_21.dat, to be read in when using R.
- soep5560_21.zip, zipped file containing the file soep5560_21.dat, to be read in when using MLwiN.
- For how to use this: see the MLwiN and R scripts below.
- Data set used in the examples in Chapter 16:
- mlbook2_b_obe.zip, zipped file containing the file named mlbook2_b.obe; a data set with a few more cases than mlbook2_r (obtained by also including those that had a missing value on aritPOST or langPOST but not on any other variables) formatted as a macro file to be read directly by MLwiN: obey mlbook2_b.obeIf you wish to use this data file in other software, just delete the top and bottom text lines that contain the information for MLwiN.
- mlbook2_b_dat.zip, zipped file containing the file named mlbook2_b.dat, which basically is the same data file, but now for use by R: > mlbook_b <- read.table("mlbook2_b.dat", header=TRUE)
- Data set used in Sections 17.2-3:
- rel_level12.zip, zipped file containing the files named rel_level1.txt and rel_level2.txt, two ascii files for both of which the top line gives the variable names. These files may be read into R by a command such as > level2 <- read.table("rel_level2.txt", header=TRUE)For reading this file into other software, delete the top line but note that it contains the variable names.
- rel_level12.zip, zipped file containing the files named rel_level1.txt and rel_level2.txt, two ascii files for both of which the top line gives the variable names. These files may be read into R by a command such as > level2 <- read.table("rel_level2.txt", header=TRUE)For reading this file into other software, delete the top line but note that it contains the variable names.
- Data set used in Sections 17.3.4-5:
- LOOPDIC.zip, zipped file containing the file named LOOPDIC.DAT, an ascii file with 10 variables.
- LOOPDIC.zip, zipped file containing the file named LOOPDIC.DAT, an ascii file with 10 variables.
Macros / scripts The following macros/scripts are used in the software setups below, and can be helpful for data analysis in general. MlwiN
- hetsced1.obe, a MLwiN macro for testing level-one heteroscedasticity using test (10.5) of Snijders and Bosker (2012), which is the same as test (9.6) in Bryk and Raudenbush (2002). Used in Chapter 10.
- smooth_2.obe, a MLwiN macro for smoothing Y as a function of X, using moving averages. Used in Chapter 10.
- table_2.obe, a MLwiN macro for averaging Y as a function of variable X that should have a limited number of discrete values. Used in Chapter 10.
- dinfl_2.obe, a MLwiN macro for calculating deletion influence statistics for level-two units. It is based on Snijders and Berkhof (2008, Section 3), and implements the methods also explained in Section 10.7 of Snijders and Bosker (2012). Used in Chapter 10.
- explvar.mac, a MLwiN macro for computing the explained variance in a two-level random intercept logistic regression model, according to formula (17.22).
- ml2_impute_b.R, a collection of R functions for multiple imputation by two-level random intercept models for continuous and binary variables.
- nlme_utils.R, a couple of nlme utilities used in the R script for Chapter 9.
- Not a macro used in an example, but useful packages:
The packages reshape and reshape2 can apply various transformations to data that are very useful for multilevel modeling. For data sets of repeated measures (level 1) within individuals (level 2), they can easily transform between multivariate (one line per individual) and disaggregated (one line per measurement) formats. See the cookbook for R for a brief explanation of reshape2. If you wish more information, note that the author Hadley Wickham has explained the transition from reshape to reshape2; and there are an introduction to reshape and a publication. - Not a macro used in an example, but a useful package:
The package influence.ME for detecting influential data in mixed effects models ; also see the publication about this package in the R journal.
- Not used in an example in the book, but useful nevertheless for Section 9.4.2:
A SAS Macro for Computing Pooled Likelihood Ratio Tests with Multiply Imputed Data by Stephen A. Mistler.
- predict_margins.do, a do file to plot marginal effects and predicted probabilities from multilevel logistic regression models, contributed by Tim Mueller.