class: center, middle, inverse, title-slide # Multilevel Modeling ## Introduction and Recent Advances for Behavioral Research
### Mark Lai ### 2018/12/04 --- # Different Names Hierarchical linear model .font60[(HLM; Raudenbush and Bryk, 2002)] Mixed/Mixed-effects model .font60[(Littell, Milliken, Stroup, and Wolfinger, 1996)] Random coefficient model .font60[(de Leeuw and Kreft, 1986)] Variance component model .font60[(Aitkin and Longford, 1986)] --- # Roadmap What are multilevel data? Why use MLM? - Avoid underestimated _SE_ - Cluster-specific (or person-specific) regression lines - Avoid Ecological Fallacy Recent advances --- class: clear, inverse, center, middle # What Are Multilevel Data? --- # Multilevel Data Nested Data - Students in classrooms/schools - Siblings in families - Clients in therapy groups/therapists/clinics - Employees in organizations in countries .center[ ![](images/students_in_schools.png) ] --- # Multilevel Data - Repeated measures in individuals .center[ ![](images/rm_in_persons.png) ] ### Network Graph
??? Talk about level 1 and level 2 --- class: clear .center[ <img src="images/Bronfenbrenner.svg" width="60%", align="middle"> ] --- # Applications of MLM Psychotherapy - Heterogeneity of treatment effectiveness across therapists Educational research - Teacher expectations on students' performance Organizational research - Job strain and ambulatory blood pressure --- # Applications of MLM (cont'd) Cross-national/neighborhood research - Sociopolitical influence on psychological processes (e.g., age and generalized trust) - Post-materialism, locus of control, and concern for global warming Longitudinal analysis/repeated measures - Aging, self-esteem, and stress appraisal --- # Example Data Sample simulated data on students' popularity .font60[(Hox, Moerbeek, and Van de Schoot, 2018)] - 2000 pupils (level 1) in 100 classrooms (level 2) Main outcome: - `popular`: popularity teacher evaluation (0 to 10) --- class: clear .font60[
] --- # Intraclass Correlation .font80[ICC = ave _r_ between 2 obs (students) in same cluster (class)] .center[ ![](images/overlap_circles_icc.png) ] --- class: clear, inverse, middle .right-column[ ## Why Use MLM? - <span style="color:black">Avoid underestimated _SE_</span> - <span style="color:black">Cluster-specific (or person-specific) regression lines</span> - <span style="color:black">Avoid Ecological Fallacy</span> ] --- # Dependent (Correlated) Observations With clustered data, an assumption of OLS regression is violated One score informs another score in the same cluster Overlap: reduces effective information (\\(N_\text{eff}\\)) in data .center[ ![](images/overlap_circles2.png) ] ??? Two students in the same class give less than two pieces of information --- # Consequences Assuming independent obs, OLS understates the uncertainty in the estimates - _SE_ too small; CI too narrow `$${\uparrow}\, t = \frac{\hat\beta}{\mathit{SE}(\hat \beta)\, \downarrow}$$` --- # Comparing OLS with MLM
.font80[ <table cellspacing="0" align="center" style="border: none;"> <tr> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b></b></th> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b>OLS</b></th> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b>MLM</b></th> </tr> <tr> <td style="padding-right: 12px; border: none;">(Intercept)</td> <td style="padding-right: 12px; border: none;">4.205 (0.071)</td> <td style="padding-right: 12px; border: none;">4.197 (0.186)</td> </tr> <tr> <td style="padding-right: 12px; border: none;">texp</td> <td style="padding-right: 12px; border: none;">0.061 (0.005)</td> <td style="padding-right: 12px; border: none;">0.062 (0.012)</td> </tr> <tr> <td style="border-top: 1px solid black;">Num. obs.</td> <td style="border-top: 1px solid black;">2000</td> <td style="border-top: 1px solid black;">2000</td> </tr> <tr> <td style="border-bottom: 2px solid black;">Num. groups: class</td> <td style="border-bottom: 2px solid black;"></td> <td style="border-bottom: 2px solid black;">100</td> </tr> <tr> <td style="padding-right: 12px; border: none;" colspan="4"><span style="font-size:0.8em"></span></td> </tr> </table> ] --- class: clear .pull-left[ ![](mlm_intro_recent_advances_files/figure-html/unnamed-chunk-6-1.svg)<!-- --> OLS: 95% CI [0.052, 0.070]. ] .pull-right[ ![](mlm_intro_recent_advances_files/figure-html/unnamed-chunk-7-1.svg)<!-- --> MLM: 95% CI [0.038, 0.085]. ] --- # Type I Error Inflation .center[ ![](images/Barcikowski_1983.png) ] Depends on <span style="color:red">_design effect_</span>: 1 + (cluster size - 1) × ICC --- class: clear Lai and Kwok (2015): MLM needed when __design effect > 1.1__ For the popularity data, design effect = 1 + (20 - 1) × .365 = 7.934 \\(N_\text{eff}\\) reduces by almost 8 times: 2000 → 252 --- class: clear, inverse, middle .right-column[ ## Why Use MLM? - Avoid underestimated _SE_ - <span style="color:black">Cluster-specific (or person-specific) regression lines</span> - <span style="color:black">Avoid Ecological Fallacy</span> ] --- # Random Coefficient Model Lv-1 predictor: not just problem on _SE_, OLS also ignore potential heterogeneity in regression lines Consider `extrav` --> `popular` (with `extrav` mean centered)
--- # OLS With All Data <img src="mlm_intro_recent_advances_files/figure-html/p-1.svg" style="display: block; margin: auto;" /> --- # Think About Just One Classroom `$$\texttt{popular}_i = \beta_0 + \beta_1 \texttt{extrav}_i + e_i$$` <img src="mlm_intro_recent_advances_files/figure-html/p1-1.svg" style="display: block; margin: auto;" /> --- # Think About Just One Classroom `$$\texttt{popular}_{i\color{red}{1}} = \beta_{0\color{red}{1}} + \beta_{1\color{red}{1}} \texttt{extrav}_{i\color{red}{1}} + e_{i\color{red}{1}}$$` <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-9-1.svg" style="display: block; margin: auto;" /> --- # Think About Classroom 35 `$$\texttt{popular}_{i\color{blue}{35}} = \beta_{0\color{blue}{35}} + \beta_{1\color{blue}{35}} \texttt{extrav}_{i\color{blue}{35}} + e_{i\color{blue}{35}}$$` <img src="mlm_intro_recent_advances_files/figure-html/p2-1.svg" style="display: block; margin: auto;" /> --- # Classroom 14 `$$\texttt{popular}_{i\color{green}{14}} = \beta_{0\color{green}{14}} + \beta_{1\color{green}{14}} \texttt{extrav}_{i\color{green}{14}} + e_{i\color{green}{14}}$$` <img src="mlm_intro_recent_advances_files/figure-html/p3-1.svg" style="display: block; margin: auto;" /> --- class: clear ### MLM: efficiently get cluster-specific regression lines `$$\texttt{popular}_{i\color{purple}{j}} = \beta_{0\color{purple}{j}} + \beta_{1\color{purple}{j}} \texttt{extrav}_{i\color{purple}{j}} + e_{i\color{purple}{j}}$$` <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-10-1.svg" style="display: block; margin: auto;" /> --- class: clear With heterogeneity in slopes, OLS gives underestimated _SE_ .font60[(Lai and Kwok, 2015)] .pull-left[ .font80[ Detecting and explaining heterogeneity in slopes (i.e., cross-level interaction) ] ] .pull-right[ <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-11-1.svg" style="display: block; margin: auto;" /> ] --- # Growth Curve Analysis Individual as "cluster" <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-12-1.svg" style="display: block; margin: auto;" /> --- class: clear, inverse, middle .right-column[ ## Why Use MLM? - <span style="color:black">Avoid underestimated _SE_</span> - Cluster-specific (or person-specific) regression lines - <span style="color:black">Avoid Ecological Fallacy</span> ] --- # Ecological Fallacy Association between two variables can be different across levels
??? students' self-perception in academics --- # Ecological Fallacy Association between two variables can be different across levels
--- # Ecological Fallacy Association between two variables can be different across levels
--- # Big Fish Small Fond Effect Ignoring clustering <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-16-1.svg" style="display: block; margin: auto;" /> --- # Big Fish Small Fond Effect +ve at student level <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-17-1.svg" style="display: block; margin: auto;" /> --- # Big Fish Small Fond Effect -ve contextual effect in a more competitive school <img src="mlm_intro_recent_advances_files/figure-html/unnamed-chunk-18-1.svg" style="display: block; margin: auto;" /> --- class: clear, inverse, middle .right-column[ ## Why Use MLM? - <span style="color:black">Avoid underestimated _SE_</span> - <span style="color:black">Cluster-specific (or person-specific) regression lines</span> - Avoid Ecological Fallacy ] --- class: clear, inverse, center, middle # Recent Advances --- # Other Forms of Clustering Three-level
--- # Other Forms of Clustering Cross-classification
Partial Nesting
--- # Effect Size for Multilevel Trials Effect size (e.g., Cohen's _d_) required by many reporting standards - Little guidance on how to compute them --- # Effect Size for Multilevel Trials Two-level trials: Hedges (2007) Lai and Kwok (2014): (partially) cross-classified Lai and Kwok (2016): partially nested Rights and Sterba (2018): Defining `\(R^2\)` for MLM --- # Stice, Shaw, Burton, and Wade (2006) Eating disorder prevention Outcome: Thin-ideal internalization (TII) .center[ ![](images/eating_disorder.jpg) ] .font50[ [Photo](https://www.flickr.com/photos/daniellehelm/3967455172) by [daniellehelm](https://www.flickr.com/photos/daniellehelm/) / [CC BY](https://creativecommons.org/licenses/by/2.0/) ] --- class: clear
<table> <thead> <tr> <th style="text-align:left;"> Dissonance-based (Treatment) </th> <th style="text-align:left;"> Expressive writing (Control) </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> \(N^T\) = 114 females </td> <td style="text-align:left;"> \(N^C\) = 126 females </td> </tr> <tr> <td style="text-align:left;"> 17 groups </td> <td style="text-align:left;"> </td> </tr> <tr> <td style="text-align:left;"> \(n\) = 6 to 10 </td> <td style="text-align:left;"> </td> </tr> <tr> <td style="text-align:left;"> ICC = .08, \(\mathit{deff}\) = 1.5 </td> <td style="text-align:left;"> </td> </tr> </tbody> </table> --- class: clear `\(\hat \beta_\text{TREAT}\)` = -0.44, _SE_ = 0.09<sup>[1]</sup> How many *SD*s does that correspond to? .footnote[ [1] OLS underestimates _SE_ by 25%; falsely assuming full clustering underestimates _SE_ by 15%. ] --- # Lai and Kwok (2016) `$$\hat \delta = \frac{\hat \beta_\text{TREAT}}{\hat \sigma^2_\text{person}}$$` `$$V(\hat \delta) = \frac{V(\hat \beta_\text{TREAT})}{\hat \sigma^2_\text{person}} + \frac{\hat \delta^2 V(\hat \sigma^2_\text{person})}{4 (\hat \sigma^2_\text{person})^2}$$` For Stice, Shaw, Burton, et al. (2006), `\(\hat \delta\)` = -0.98, 95% CI = [-1.4, -0.6] --- # Multilevel Bootstrapping Useful for - CI for effect size - testing multilevel mediation `bootmlm` R package .font60[(Lai, 2018)]: currently implements 6 flavors of bootstrapping and 5 types of CI estimates --- class: clear, top
.center[ <img src="images/mlm_boot_cis.png" width="90%"> ] --- # Accounting for Survey Design Lai, Kwok, Hsiao, and Cao (2018) - Apply finite population correction for cross-cultural research to obtain more accurate _SE_ (and improved power) Wen & Lai (in preparation) - A multilevel Bayesian semi-parametric bootstrap procedure to handle sampling weights with unequal probability samples --- class: clear, top .font60[(Lai, Kwok, Hsiao, et al., 2018, Figure 5)] .center[ <img src="images/Lai2018_fig5.png" width="70%"> ] --- # MLM of Non-Normal Outcomes Ordinal? Counts? Zero-inflated? Proportions? Response time? Survival? These are made easy with Bayesian estimation and the `brms` package .font60[(Bürkner, 2018)]. .center[ <img src="images/Guo2018_outcome_dist.png" width="100%"> ] --- # Final Remarks Reasons for MLM: correct _SE_, model heterogeneity, avoid ecological fallacy Methodological research: translate methods in single-level research + methods for new RQ More truly multilevel theories --- # Bibliography .font70[ Aitkin, M. and N. Longford (1986). "Statistical modelling issues in school effectiveness studies". In: _Journal of the Royal Statistical Society. Series A (General)_ 149, pp. 1-43. DOI: [10.2307/2981882](https://doi.org/10.2307/2981882). Bürkner, P. (2018). "Advanced Bayesian Multilevel Modeling with the R Package brms". In: _The R Journal_ 10.1, pp. 395-411. Hedges, L. V. (2007). "Effect sizes in cluster-randomized designs". In: _Journal of Educational and Behavioral Statistics_ 32, pp. 341-370. DOI: [10.3102/1076998606298043](https://doi.org/10.3102/1076998606298043). Hox, J. J, M. Moerbeek and R. Van de Schoot (2018). _Multilevel analysis: Techniques and applications_. 3rd ed. New York, NY: Routledge. ] --- class: clear .font70[ Lai, M. H. C. (2018). _marklhc/bootmlm: bootmlm: bootstrap resampling for multilevel models_. DOI: [10.5281/zenodo.1879127](https://doi.org/10.5281/zenodo.1879127). Lai, M. H. C. and O. Kwok (2014). "Standardized mean differences in two-level cross-classified random effects models". In: _Journal of Educational and Behavioral Statistics_ 39.4, pp. 282-302. DOI: [10.3102/1076998614532950](https://doi.org/10.3102/1076998614532950). Lai, M. H. C. and O. Kwok (2015). "Examining the rule of thumb of not using multilevel modeling: The “design effect smaller than two” rule". En. In: _The Journal of Experimental Education_ 83.3, pp. 423-438. DOI: [10.1080/00220973.2014.907229](https://doi.org/10.1080/00220973.2014.907229). Lai, M. H. C. and O. Kwok (2016). "Estimating standardized effect sizes for two- and three-level partially nested data". In: _Multivariate Behavioral Research_, pp. 1-17. DOI: [10.1080/00273171.2016.1231606](https://doi.org/10.1080/00273171.2016.1231606). Lai, M. H. C, O. Kwok, Y. Hsiao, et al. (2018). "Finite population correction for two-level hierarchical linear models.". In: _Psychological Methods_ 23.1, pp. 94-112. DOI: [10.1037/met0000137](https://doi.org/10.1037/met0000137). ] --- class: clear .font70[ Leeuw, J. de and I. Kreft (1986). "Random coefficient models for multilevel analysis". In: _Journal of Educational Statistics_ 11, pp. 57-85. DOI: [10.2307/1164848](https://doi.org/10.2307/1164848). Littell, R. C, G. A. Milliken, W. W. Stroup, et al. (1996). _SAS System for mixed models_. Cary, NC: SAS. Raudenbush, S. W. and A. S. Bryk (2002). _Hierarchical linear models: Applications and data analysis methods_. 2nd ed. Thousand Oaks, CA: Sage. Rights, J. D. and S. K. Sterba (2018). "Quantifying explained variance in multilevel models: An integrative framework for defining R-squared measures.". In: _Psychological Methods_. ISSN: 1939-1463. DOI: [10.1037/met0000184](https://doi.org/10.1037/met0000184). Stice, E, H. Shaw, E. Burton, et al. (2006). "Dissonance and healthy weight eating disorder prevention programs: A randomized efficacy trial.". In: _Journal of Consulting and Clinical Psychology_ 74, pp. 263-275. DOI: [10.1037/0022-006X.74.2.263](https://doi.org/10.1037/0022-006X.74.2.263). ] --- class: clear, center, middle, inverse # Thanks! Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan). --- # Fixed Effect Estimates .font70[ <table cellspacing="0" align="center" style="border: none;"> <tr> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b></b></th> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b></b></th> </tr> <tr> <td style="padding-right: 12px; border: none;">(intercept)</td> <td style="padding-right: 12px; border: none;">5.031 (0.097)</td> </tr> <tr> <td style="padding-right: 12px; border: none;">extravc</td> <td style="padding-right: 12px; border: none;">0.493 (0.025)</td> </tr> <tr> <td style="border-top: 1px solid black;">Var(intercept)</td> <td style="border-top: 1px solid black;">0.892</td> </tr> <tr> <td style="padding-right: 12px; border: none;">Var(slope)</td> <td style="padding-right: 12px; border: none;">0.026</td> </tr> <tr> <td style="padding-right: 12px; border: none;">Cov(int, slope)</td> <td style="padding-right: 12px; border: none;">-0.134</td> </tr> <tr> <td style="border-bottom: 2px solid black;">Var(residual)</td> <td style="border-bottom: 2px solid black;">0.895</td> </tr> <tr> <td style="padding-right: 12px; border: none;" colspan="3"><span style="font-size:0.8em"></span></td> </tr> </table> ] Average slope of `extrav` = 0.493, 95% CI [0.442, 0.543]. --- # Random Effect __Variance__ Estimates .font70[ <table cellspacing="0" align="center" style="border: none;"> <tr> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b></b></th> <th style="text-align: left; border-top: 2px solid black; border-bottom: 1px solid black; padding-right: 12px;"><b></b></th> </tr> <tr> <td style="padding-right: 12px; border: none;">(intercept)</td> <td style="padding-right: 12px; border: none;">5.031 (0.097)</td> </tr> <tr> <td style="padding-right: 12px; border: none;">extravc</td> <td style="padding-right: 12px; border: none;">0.493 (0.025)</td> </tr> <tr> <td style="border-top: 1px solid black;">Var(intercept)</td> <td style="border-top: 1px solid black;">0.892</td> </tr> <tr> <td style="padding-right: 12px; border: none;">Var(slope)</td> <td style="padding-right: 12px; border: none;">0.026</td> </tr> <tr> <td style="padding-right: 12px; border: none;">Cov(int, slope)</td> <td style="padding-right: 12px; border: none;">-0.134</td> </tr> <tr> <td style="border-bottom: 2px solid black;">Var(residual)</td> <td style="border-bottom: 2px solid black;">0.895</td> </tr> <tr> <td style="padding-right: 12px; border: none;" colspan="3"><span style="font-size:0.8em"></span></td> </tr> </table> ] <!-- Variance of intercepts = 0.892 (_SD_ = 0.944) --> Variance of slopes = 0.026 (_SD_ = 0.161) - For a majority of schools (within +/- 1 _SD_), slope expected in the range [0.332, 0.654]. ??? for linear relations, only need to know the intercept and the slope;