Multilevel and Longitudinal Modeling Using Stata, Third Edition
Volume I: Continuous Responses
Volume II: Categorical Responses, Counts, and Survival
Authors: 
Sophia RabeHesketh and Anders Skrondal 
Publisher: 
Stata Press 
Copyright: 
2012 
ISBN13: 
9781597181082 
Pages: 
974; paperback 
Price: 
$109.00 



Comment from the Stata technical group
Multilevel and Longitudinal Modeling Using Stata, Third Edition, by
Sophia RabeHesketh and Anders Skrondal, looks specifically at Stata’s
treatment of generalized linear mixed models, also known as multilevel or
hierarchical models. These models are “mixed” because they
allow fixed and random effects, and they are “generalized”
because they are appropriate for continuous Gaussian responses as well as
binary, count, and other types of limited dependent variables.
The material in the third edition consists of two volumes, a result
of the substantial expansion of material from the second edition,
and has much to offer readers of the earlier editions. The text has almost
doubled in length from the second edition and almost quadrupled in length
from the original version to almost 1,000 pages across the two volumes.
Fully updated
for Stata 12, the book has 5 new chapters and many new exercises
and datasets.
The two volumes comprise 16 chapters organized into eight parts.
Volume I is devoted to continuous Gaussian linear mixed models and has nine
chapters organized into four parts. The first part reviews the methods of
linear regression. The second part provides indepth coverage of
twolevel models, the simplest extensions of a linear regression model.
RabeHesketh and Skrondal begin with the comparatively simple
randomintercept linear model without covariates, developing the mixed model
from principles and thereby familiarizing the reader with terminology,
summarizing and relating the widely used estimating strategies, and
providing historical perspective. Once the authors have established the
mixedmodel foundation, they smoothly generalize to randomintercept models
with covariates and then to a discussion of the various estimators (between,
within, and randomeffects). The authors then discuss models with random
coefficients.
The third part of volume I describes models for longitudinal and panel data,
including dynamic models, marginal models (a new chapter), and growthcurve
models (a new chapter). The fourth and final part covers models with
nested and crossed random effects, including a new chapter describing
in more detail higherlevel nested models for continuous outcomes.
The mixedmodel foundation and the indepth coverage of the mixedmodel
principles provided in volume I for continuous outcomes make it
straightforward to transition to generalized linear mixed models for
noncontinuous outcomes, which are described in volume II.
Volume II is devoted to generalized linear mixed models for binary,
categorical, count, and survival outcomes. The second volume has seven
chapters also organized into four parts. The first three parts in volume II
cover models for categorical responses, including binary, ordinal, and
nominal (a new chapter); models for count data; and models for survival
data, including discretetime and continuoustime (a new chapter) survival
responses. The fourth and final part in volume II describes models with
nested and crossedrandom effects with an emphasis on binary outcomes.
The book has extensive applications of generalized mixed models performed in
Stata. RabeHesketh and Skrondal developed gllamm, a Stata
program that can fit many latentvariable models, of which the generalized
linear mixed model is a special case. As of version 10, Stata contains the
xtmixed, xtmelogit, and
xtmepoisson commands for fitting multilevel models, in
addition to other xt commands for fitting standard
randomintercept models. The types of models fit by these commands
sometimes overlap; when this happens, the authors highlight the differences
in syntax, data organization, and output for the two (or more) commands that
can be used to fit the same model. The authors also point out the relative
strengths and weaknesses of each command when used to fit the same model,
based on considerations such as computational speed, accuracy, available
predictions, and available postestimation statistics.
In summary, this book is the most complete, uptodate depiction of
Stata’s capacity for fitting generalized linear mixed models. The
authors provide an ideal introduction for Stata users wishing to learn about
this powerful data analysis tool.
Table of contents
List of Tables
List of Figures
Preface
Multilevel and longitudinal models: When and why?
I Preliminaries
1 Review of linear regression
1.1 Introduction
1.2 Is there gender discrimination in faculty salaries?
1.3 Independentsamples t test
1.4 Oneway analysis of variance
1.5 Simple linear regression
1.6 Dummy variables
1.7 Multiple linear regression
1.8 Interactions
1.9 Dummy variables for more than two groups
1.10 Other types of interactions
1.10.1 Interaction between dummy variables
1.10.2 Interaction between continuous covariates
1.11 Nonlinear effects
1.12 Residual diagnostics
1.13 Causal and noncausal interpretations of regression coefficients
1.13.1 Regression as conditional expectation
1.13.2 Regression as structural model
1.14 Summary and further reading
1.15 Exercises
II Twolevel models
2 Variancecomponents models
2.1 Introduction
2.2 How reliable are peakexpiratoryflow measurements?
2.3 Inspecting withinsubject dependence
2.4 The variancecomponents model
2.4.1 Model specification
2.4.2 Path diagram
2.4.3 Betweensubject heterogeneity
2.4.4 Withinsubject dependence
Intraclass correlation
Intraclass correlation versus Pearson correlation
2.5 Estimation using Stata
2.5.1 Data preparation: Reshaping to long form
2.5.2 Using xtreg
2.5.3 Using xtmixed
2.6 Hypothesis tests and confidence intervals
2.6.1 Hypothesis test and confidence interval for the population mean
2.6.2 Hypothesis test and confidence interval for the betweencluster variance
Likelihoodratio test
F test
Confidence intervals
2.7 Model as datagenerating mechanism
2.8 Fixed versus random effects
2.9 Crossed versus nested effects
2.10 Parameter estimation
2.10.1 Model assumptions
Mean structure and covariance structure
Distributional assumptions
2.10.2 Different estimation methods
2.10.3 Inference for β
Estimate and standard error: Balanced case
Estimate: Unbalanced case
2.11 Assigning values to the random intercepts
2.11.1 Maximum “likelihood” estimation
Implementation via OLS regression
Implementation via the mean total residual
2.11.2 Empirical Bayes prediction
2.11.3 Empirical Bayes standard errors
Comparative standard errors
Diagnostic standard errors
2.12 Summary and further reading
2.13 Exercises
3 Randomintercept models with covariates
3.1 Introduction
3.2 Does smoking during pregnancy affect birthweight?
3.2.1 Data structure and descriptive statistics
3.3 The linear randomintercept model with covariates
3.3.1 Model specification
3.3.2 Model assumptions
3.3.3 Mean structure
3.3.4 Residual variance and intraclass correlation
3.3.5 Graphical illustration of randomintercept model
3.4 Estimation using Stata
3.4.1 Using xtreg
3.4.2 Using xtmixed
3.5 Coefficients of determination or variance explained
3.6 Hypothesis tests and confidence intervals
3.6.1 Hypothesis tests for regression coefficients
Hypothesis tests for individual regression coefficients
Joint hypothesis tests for several regression coefficients
3.6.2 Predicted means and confidence intervals
3.6.3 Hypothesis test for randomintercept variance
3.7 Between and within effects of level1 covariates
3.7.1 Betweenmother effects
3.7.2 Withinmother effects
3.7.3 Relations among estimators
3.7.4 Level2 endogeneity and clusterlevel confounding
3.7.5 Allowing for different within and between effects
3.7.6 Hausman endogeneity test
3.8 Fixed versus random effects revisited
3.9 Assigning values to random effects: Residual diagnostics
3.10 More on statistical inference
3.10.1 Overview of estimation methods
3.10.2 Consequences of using standard regression modeling for clustered data
3.10.3 Power and samplesize determination
3.11 Summary and further reading
3.12 Exercises
4 Randomcoefficient models
4.1 Introduction
4.2 How effective are different schools?
4.3 Separate linear regressions for each school
4.4 Specification and interpretation of a randomcoefficient model
4.4.1 Specification of a randomcoefficient model
4.4.2 Interpretation of the randomeffects variances and covariances
4.5 Estimation using xtmixed
4.5.1 Randomintercept model
4.5.2 Randomcoefficient model
4.6 Testing the slope variance
4.7 Interpretation of estimates
4.8 Assigning values to the random intercepts and slopes
4.8.1 Maximum “likelihood” estimation
4.8.2 Empirical Bayes prediction
4.8.3 Model visualization
4.8.4 Residual diagnostics
4.8.5 Inferences for individual schools
4.9 Twostage model formulation
4.10 Some warnings about randomcoefficient models
4.10.1 Meaningful specification
4.10.2 Many random coefficients
4.10.3 Convergence problems
4.10.4 Lack of identification
4.11 Summary and further reading
4.12 Exercises
III Models for longitudinal and panel data
Introduction to models for longitudinal and panel data (part III)
5 Subjectspecific effects and dynamic models
5.1 Introduction
5.2 Conventional randomintercept model
5.3 Randomintercept models accommodating endogenous covariates
5.3.1 Consistent estimation of effects of endogenous timevarying covariates
5.3.2 Consistent estimation of effects of endogenous timevarying and
endogenous timeconstant covariates
5.4 Fixedintercept model
5.4.1 Using xtreg or regress with a differencing operator
5.4.2 Using anova
5.5 Randomcoefficient model
5.6 Fixedcoefficient model
5.7 Laggedresponse or dynamic models
5.7.1 Conventional laggedresponse model
5.7.2 Laggedresponse model with subjectspecific intercepts
5.8 Missing data and dropout
5.8.1 Maximum likelihood estimation under MAR: A simulation
5.9 Summary and further reading
5.10 Exercises
6 Marginal models
6.1 Introduction
6.2 Mean structure
6.3 Covariance structures
6.3.1 Unstructured covariance matrix
6.3.2 Randomintercept or compound symmetric/exchangeable structure
6.3.3 Randomcoefficient structure
6.3.4 Autoregressive and exponential structures
6.3.5 Movingaverage residual structure
6.3.6 Banded and Toeplitz structures
6.4 Hybrid and complex marginal models
6.4.1 Random effects and correlated level1 residuals
6.4.2 Heteroskedastic level1 residuals over occasions
6.4.3 Heteroskedastic level1 residuals over groups
6.4.4 Different covariance matrices over groups
6.5 Comparing the fit of marginal models
6.6 Generalized estimating equations (GEE)
6.7 Marginal modeling with few units and many occasions
6.7.1 Is a highly organized labor market beneficial for economic growth?
6.7.2 Marginal modeling for long panels
6.7.3 Fitting marginal models for long panels in Stata
6.8 Summary and further reading
6.9 Exercises
7 Growthcurve models
7.1 Introduction
7.2 How do children grow?
7.2.1 Observed growth trajectories
7.3 Models for nonlinear growth
7.3.1 Polynomial models
Fitting the models
Predicting the mean trajectory
Predicting trajectories for individual children
7.3.2 Piecewise linear models
Fitting the models
Predicting the mean trajectory
7.4 Twostage model formulation
7.5 Heteroskedasticity
7.5.1 Heteroskedasticity at level 1
7.5.2 Heteroskedasticity at level 2
7.6 How does reading improve from kindergarten through third grade?
7.7 Growthcurve model as a structural equation model
7.7.1 Estimation using sem
7.7.2 Estimation using xtmixed
7.8 Summary and further reading
7.9 Exercises
IV Models with nested and crossed random effects
8 Higherlevel models with nested random effects
8.1 Introduction
8.2 Do peakexpiratoryflow measurements vary between methods within subjects?
8.3 Inspecting sources of variability
8.4 Threelevel variancecomponents models
8.5 Different types of intraclass correlation
8.6 Estimation using xtmixed
8.7 Empirical Bayes prediction
8.8 Testing variance components
8.9 Crossed versus nested random effects revisited
8.10 Does nutrition affect cognitive development of Kenyan children?
8.11 Describing and plotting threelevel data
8.11.1 Data structure and missing data
8.11.2 Level1 variables
8.11.3 Level2 variables
8.11.4 Level3 variables
8.11.5 Plotting growth trajectories
8.12 Threelevel randomintercept model
8.12.1 Model specification: Reduced form
8.12.2 Model specification: Threestage formulation
8.12.3 Estimation using xtmixed
8.13 Threelevel randomcoefficient models
8.13.1 Random coefficient at the child level
8.13.2 Random coefficient at the child and school levels
8.14 Residual diagnostics and predictions
8.15 Summary and further reading
8.16 Exercises
9 Crossed random effects
9.1 Introduction
9.2 How does investment depend on expected profit and capital stock?
9.3 A twoway errorcomponents model
9.3.1 Model specification
9.3.2 Residual variances, covariances, and intraclass correlations
Longitudinal correlations
Crosssectional correlations
9.3.3 Estimation using xtmixed
9.3.4 Prediction
9.4 How much do primary and secondary schools affect attainment at age 16?
9.5 Data structure
9.6 Additive crossed randomeffects model
9.6.1 Specification
9.6.2 Estimation using xtmixed
9.7 Crossed randomeffects model with random interaction
9.7.1 Model specification
9.7.2 Intraclass correlations
9.7.3 Estimation using xtmixed
9.7.4 Testing variance components
9.7.5 Some diagnostics
9.8 A trick requiring fewer random effects
9.9 Summary and further reading
9.10 Exercises
A Useful Stata commands
References
List of Tables
List of Figures
V Models for categorical responses
10.1 Introduction
10.2 Singlelevel logit and probit regression models for dichotomous responses
10.2.1 Generalized linear model formulation
10.2.2 Latentresponse formulation
Logistic regression
Probit regression
10.3 Which treatment is best for toenail infection?
10.4 Longitudinal data structure
10.5 Proportions and fitted populationaveraged or marginal probabilities
10.6 Randomintercept logistic regression
10.6.1 Model specification
Reducedform specification
Twostage formulation
10.7 Estimation of randomintercept logistic models
10.7.1 Using xtlogit
10.7.2 Using xtmelogit
10.7.3 Using gllamm
10.8 Subjectspecific or conditional vs. populationaveraged or marginal
relationships
10.9 Measures of dependence and heterogeneity
10.9.1 Conditional or residual intraclass correlation of the latent
responses
10.9.2 Median odds ratio
10.9.3 Measures of association for observed responses at median fixed part
of the model
10.10 Inference for randomintercept logistic models
10.10.1 Tests and confidence intervals for odds ratios
10.10.2 Tests of variance components
10.11 Maximum likelihood estimation
10.11.1 Adaptive quadrature
10.11.2 Some speed and accuracy considerations
Advice for speeding up estimation in gllamm
10.12 Assigning values to random effects
10.12.1 Maximum “likelihood” estimation
10.12.2 Empirical Bayes prediction
10.12.3 Empirical Bayes modal prediction
10.13 Different kinds of predicted probabilities
10.13.1 Predicted populationaveraged or marginal probabilities
10.13.2 Predicted subjectspecific probabilities
Predictions for hypothetical subjects: Conditional probabilities
Predictions for the subjects in the sample: Posterior mean probabilities
10.14 Other approaches to clustered dichotomous data
10.14.1 Conditional logistic regression
10.14.2 Generalized estimating equations (GEE)
10.15 Summary and further reading
10.16 Exercises
11 Ordinal responses
11.1 Introduction
11.2 Singlelevel cumulative models for ordinal responses
11.2.1 Generalized linear model formulation
11.2.2 Latentresponse formulation
11.2.3 Proportional odds
11.2.4 Identification
11.3 Are antipsychotic drugs effective for patients with schizophrenia?
11.4 Longitudinal data structure and graphs
11.4.1 Longitudinal data structure
11.4.2 Plotting cumulative proportions
11.4.3 Plotting cumulative sample logits and transforming the time scale
11.5 A singlelevel proportional odds model
11.5.1 Model specification
11.5.2 Estimation using Stata
11.6 A randomintercept proportional odds model
11.6.1 Model specification
11.6.2 Estimation using Stata
11.6.3 Measures of dependence and heterogeneity
Residual intraclass correlation of latent responses
Median odds ratio
11.7 A randomcoefficient proportional odds model
11.7.1 Model specification
11.7.2 Estimation using gllamm
11.8 Different kinds of predicted probabilities
11.8.1 Predicted populationaveraged or marginal probabilities
11.8.2 Predicted subjectspecific probabilities: Posterior mean
11.9 Do experts differ in their grading of student essays?
11.10 A randomintercept probit model with grader bias
11.10.1 Model specification
11.10.2 Estimation using gllamm
11.11 Including graderspecific measurement error variances
11.11.1 Model specification
11.11.2 Estimation using gllamm
11.12 Including graderspecific thresholds
11.12.1 Model specification
11.12.2 Estimation using gllamm
11.13 Other link functions
Cumulative complementary loglog model
Continuationratio logit model
Adjacentcategory logit model
Baselinecategory logit and stereotype models
11.14 Summary and further reading
11.15 Exercises
12 Nominal responses and discrete choice
12.1 Introduction
12.2 Singlelevel models for nominal responses
12.2.1 Multinomial logit models
12.2.2 Conditional logit models
Classical conditional logit models
Conditional logit models also including covariates that vary only over
units
12.3 Independence from irrelevant alternatives
12.4 Utilitymaximization formulation
12.5 Does marketing affect choice of yogurt?
12.6 Singlelevel conditional logit models
12.6.1 Conditional logit models with alternativespecific intercepts
12.7 Multilevel conditional logit models
12.7.1 Preference heterogeneity: Brandspecific random intercepts
12.7.2 Response heterogeneity: Marketing variables with random coefficients
12.7.3 Preference and response heterogeneity
Estimation using gllamm
Estimation using mixlogit
12.8 Prediction of random effects and response probabilities
12.9 Summary and further reading
12.10 Exercises
VI Models for counts
13 Counts
13.1 Introduction
13.2 What are counts?
13.2.1 Counts versus proportions
13.2.2 Counts as aggregated eventhistory data
13.3 Singlelevel Poisson models for counts
13.4 Did the German healthcare reform reduce the number of doctor visits?
13.5 Longitudinal data structure
13.6 Singlelevel Poisson regression
13.6.1 Model specification
13.6.2 Estimation using Stata
13.7 Randomintercept Poisson regression
13.7.1 Model specification
13.7.2 Measures of dependence and heterogeneity
13.7.3 Estimation using Stata
Using xtpoisson
Using xtmepoisson
Using gllamm
13.8 Randomcoefficient Poisson regression
13.8.1 Model specification
13.8.2 Estimation using Stata
Using xtmepoisson
Using gllamm
13.8.3 Interpretation of estimates
13.9 Overdispersion in singlelevel models
13.9.1 Normally distributed random intercept
13.9.2 Negative binomial models
Mean dispersion or NB2
Constant dispersion or NB1
13.9.3 Quasilikelihood
13.10 Level1 overdispersion in twolevel models
13.11 Other approaches to twolevel count data
13.11.1 Conditional Poisson regression
13.11.2 Conditional negative binomial regression
13.11.3 Generalized estimating equations
13.12 Marginal and conditional effects when responses are MAR
13.13 Which Scottish counties have a high risk of lip cancer?
13.14 Standardized mortality ratios
13.15 Randomintercept Poisson regression
13.15.1 Model specification
13.15.2 Estimation using gllamm
13.15.3 Prediction of standardized mortality ratios
13.16 Nonparametric maximum likelihood estimation
13.16.1 Specification
13.16.2 Estimation using gllamm
13.16.3 Prediction
13.17 Summary and further reading
13.18 Exercises
VII Models for survival or duration data
Introduction to models for survival or duration data (part VII)
14 Discretetime survival
14.1 Introduction
14.2 Singlelevel models for discretetime survival data
14.2.1 Discretetime hazard and discretetime survival
14.2.2 Data expansion for discretetime survival analysis
14.2.3 Estimation via regression models for dichotomous responses
14.2.4 Including covariates
Timeconstant covariates
Timevarying covariates
14.2.5 Multiple absorbing events and competing risks
14.2.6 Handling lefttruncated data
14.3 How does birth history affect child mortality?
14.4 Data expansion
14.5 Proportional hazards and intervalcensoring
14.6 Complementary loglog models
14.7 A randomintercept complementary loglog model
14.7.1 Model specification
14.7.2 Estimation using Stata
14.8 Populationaveraged or marginal vs. subjectspecific or conditional
survival probabilities
14.9 Summary and further reading
14.10 Exercises
15 Continuoustime survival
15.1 Introduction
15.2 What makes marriages fail?
15.3 Hazards and survival
15.4 Proportional hazards models
15.4.1 Piecewise exponential model
15.4.2 Cox regression model
15.4.3 Poisson regression with smooth baseline hazard
15.5 Accelerated failuretime models
15.5.1 Lognormal model
15.6 Timevarying covariates
15.7 Does nitrate reduce the risk of angina pectoris?
15.8 Marginal modeling
15.8.1 Cox regression
15.8.2 Poisson regression with smooth baseline hazard
15.9 Multilevel proportional hazards models
15.9.1 Cox regression with gamma shared frailty
15.9.2 Poisson regression with normal random intercepts
15.9.3 Poisson regression with normal random intercept and random coefficient
15.10 Multilevel accelerated failuretime models
15.10.1 Lognormal model with gamma shared frailty
15.10.2 Lognormal model with lognormal shared frailty
15.11 A fixedeffects approach
15.11.1 Cox regression with subjectspecific baseline hazards
15.12 Different approaches to recurrentevent data
15.12.1 Total time
15.12.2 Counting process
15.12.3 Gap time
15.13 Summary and further reading
15.14 Exercises
VIII Models with nested and crossed random effects
16 Models with nested and crossed random effects
16.1 Introduction
16.2 Did the Guatemalan immunization campaign work?
16.3 A threelevel randomintercept logistic regression model
16.3.1 Model specification
16.3.2 Measures of dependence and heterogeneity
Types of residual intraclass correlations of the latent responses
Types of median odds ratios
16.3.3 Threestage formulation
16.4 Estimation of threelevel randomintercept logistic regression models
16.4.1 Using gllamm
16.4.2 Using xtmelogit
16.5 A threelevel randomcoefficient logistic regression model
16.6 Estimation of threelevel randomcoefficient logistic regression models
16.6.1 Using gllamm
16.6.2 Using xtmelogit
16.7 Prediction of random effects
16.7.1 Empirical Bayes prediction
16.7.2 Empirical Bayes modal prediction
16.8 Different kinds of predicted probabilities
16.8.1 Predicted populationaveraged or marginal probabilities: New clusters
16.8.2 Predicted median or conditional probabilities
16.8.3 Predicted posterior mean probabilities: Existing clusters
16.9 Do salamanders from different populations mate successfully?
16.10 Crossed randomeffects logistic regression
16.11 Summary and further reading
16.12 Exercises
A Syntax for gllamm, eq, and gllapred: The bare essentials
B Syntax for gllamm
C Syntax for gllapred
D Syntax for gllasim
References