introduction to data analysis in hierarchical linear...

36
Introduction to Data Analysis in Hierarchical Linear Models April 20, 2007 Noah Shamosh & Frank Farach Social Sciences StatLab Yale University

Upload: doananh

Post on 11-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Introduction to Data Analysisin Hierarchical Linear Models

April 20, 2007

Noah Shamosh & Frank FarachSocial Sciences StatLab

Yale University

Page 2: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Scope & Prerequisites Strong applied emphasis Focus on HLM software

Has special functionality Other options: SPSS, SAS, MLWin, R

Familiarity with regression assumed

Page 3: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 4: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

What is HLM? Hierarchical Linear Model

A multilevel statistical model Software program used for such models

Deconstructing the name (in reverse) Model: It’s a statistical model Linear: The model must be linear in the

parameters Hierarchical: Nested data structures are explicitly

modeled

Page 5: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

When are data hierarchical? When units are grouped at higher units of

analysis Such data may be nested within higher levels

(i.e., units) of analysis Nesting can occur between subjects…

Children nested within classrooms Classrooms nested within schools

…and/or within subjects Repeated observations on the same individuals

over time (observations nested within individuals)

Page 6: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Why not use regularregression on nested data? Increased Type I error Model misspecification Miss opportunity to examine potentially

interesting contextual questions These problems increase as

observations become less independent

Page 7: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Hierarchical ModelConceptualization What kind of hierarchical relations might

be present? What factors could I incorporate in my

model to reflect this organization?

Page 8: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

HLM Caveats Adding levels of nesting increases the

complexity of the model exponentially HLM can handle up to three levels Must have several times more lower

level observations than upper levelobservations

Parameter estimation uses maximumlikelihood instead of least squares

Page 9: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 10: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Prep, prep, prep! This is the most labor intensive part of

workflow, and is the source of many problemsthat come to us at the StatLab

Two obstacles HLM doesn’t do data manipulation or basic data

description HLM requires a special data structure

Solutions Plan ahead. Do all data screening, variable

transformations, exploratory analyses, andassumption-checking beforehand

Page 11: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Data prep: SPSS example1

Data set: IQv & language achievement Two files

Level 1: dependent variable (languageachievement) and other childcharacteristics (e.g. IQv)

Level 2: school characteristics (e.g. SES) Children are nested within schools

1 Extensively adapted from Bryk & Raudenbush (2002) and Bauer (2005)

Page 12: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 13: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Creating the Multivariate DataMatrix (MDM) Making an MDM file

A caveat… The procedure… Check your summary statistics before

building any models (cross-reference) Main window: are all of your variables

there?

Page 14: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 15: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Build statistical models Basic model: random-effects ANOVA Test for mean group differences in

population Between-group vs. total variance

Key assumption check of HLM

Page 16: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random-effects ANOVA Choose outcome variable Terms… Toggle Level 2 error term

Level 1 (r) vs. Level 2 (u) error terms The “Mixed” window

Page 17: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects ANOVALa

ngua

ge a

chie

vem

ent

M1 M2 M3GM

Page 18: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 19: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects ANOVA Results

Fixed effects: the intercept Is the grand mean significantly different from

zero? Variance components (random effects)

Level 2 (U0): significant variability betweengroups?

Level 1 (R): significant variability within groups?

Page 20: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects ANOVA Intraclass correlation (ICC)

Proportion of total variance accounted forby between-group differences

Level 2 variance component divided bysum of Level 1 and Level 2 variancecomponents

Ours is .23; HLM is warranted

Page 21: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 22: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects regression Test for relationship between a Level 1

IV and the DV Test whether an IV explains any

between groups variance Terms… We are assuming a fixed slope

Page 23: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects regression

IQ

Lang

uage

ach

ieve

men

t

Page 24: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 25: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects regression Results

Fixed effects Level 1 intercept: Mean of DV where IV is zero Level 1 slope: Change in DV with one unit of

change in IV (just like OLS regression) Random effects

Intercept: Between-group variance that is notexplained by IV

Residual variance: Within-group variance thatis not explained by DV

Page 26: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random effects regression Variance accounted for by IV

Level 1: Compare residual variancecomponent to random effects ANOVAmodel

(8.0 - 6.5) / 8.0 = .19 Level 2: Do the same for the random

intercept variance component (19.6 - 9.6) / 19.6 = .51

Page 27: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Fixed slopes

IQ

Lang

uage

ach

ieve

men

t

Page 28: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random slopes

IQ

Lang

uage

ach

ieve

men

t

Page 29: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Random slopes Goal: test whether the IV - DV

relationship varies between groups Add only if supported by theory Toggle Level 2b error term In output, look at slope variance

component

Page 30: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Slopes as outcomes Goal: test cross level interactions

Does the between-group variability in theIV - DV relation vary by a systematicfactor?

Add Level 2 predictor Terms…

Page 31: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Slopes as outcomes Fixed effects

For Level 1 intercept Intercept: predicted score on DV at mean value of L-1 IV Slope: Influence of Level 2 IV on DV

For Level 1 slope Intercept: Influence of Level 1 IV on DV Slope: Influence of L-2 IV on L-1 IV - DV relation

Random effects (same as before)

Page 32: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Road to HLM Happiness Conceptualize model hierarchically Prepare data Import data into HLM Build statistical models Estimate and interpret models Graph models

Page 33: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Graph: Simple slopes Useful for visualizing cross-level

interactions Just like simple slope plots in

regression Graph Equations > Model graphs Useful for categorical or continuous

data

Page 34: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Graph: Level-1 equations Useful for:

Visualizing variability in intercepts andslopes

Identifying moderators Graph Equations > Level 1 equation

graphing

Page 35: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

Recommended Reading Bickel, R. (2007). Multilevel analysis for applied research: It's

just regression! New York: Guilford Press. Bryk, A. & Raudenbush, S. (2002). Hierarchical Linear Models:

Applications and data analysis methods (2nd ed.). ThousandOaks, CA: Sage.

Luke, D. (2004). Multilevel modeling. Thousand Oaks, CA:Sage.

Heck, R. H., & Thomas, S. L. (2000). An introduction tomultilevel modeling techniques. Lawrence Erlbaum Associates.

Kreft, I. & de Leeuw, J. (1998). Introducing multilevel modeling.Sage.

Singer, J. D., & Willett, J. B. (2003). Applied Longitudinal DataAnalysis: Modeling Change and Event Occurrence. Oxford Univ.Press. (Longitudinal focus)

Page 36: Introduction to Data Analysis in Hierarchical Linear Modelsstatlab.stat.yale.edu/help/workshops/HLMworkshop/statlab... · 2017-05-04 · Introduction to Data Analysis in Hierarchical

HLM Resources on the Web UCLA’s HLM portal

http://statcomp.ats.ucla.edu/mlm Excellent example of analysis

http://www.ats.ucla.edu/stat/hlm/seminars/hlm_mlm/mlm_hlm_seminar.htm