what is a hierarchical model
play

What is a hierarchical model? Richard Erickson Quantitative - PowerPoint PPT Presentation

DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R What is a hierarchical model? Richard Erickson Quantitative Ecologist DataCamp Hierarchical and Mixed Effects Models in R Why do we use a


  1. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R What is a hierarchical model? Richard Erickson Quantitative Ecologist

  2. DataCamp Hierarchical and Mixed Effects Models in R Why do we use a hierarchical model? Data nested within itself Pool information across small sample sizes Repeated observations across groups or individuals

  3. DataCamp Hierarchical and Mixed Effects Models in R Other names for hierarchical models Hierarchical models: Nested models, Multi-level models Regression framework: "Pool" information, "Random-effect" versus a "fixed- effect", "Mixed-effect" (linear mixed-effect model; LMM), Linear mixed-effect regression (lmer) Repeated sampling: "Repeated-measures", "Paired-tests"

  4. DataCamp Hierarchical and Mixed Effects Models in R School test scores Meta-data: Student-level variables: Gain in math scores for individual Student ID: childid students from kindergarten to 1st Math test-score gain: mathgain grade Math kindergarten score: mathdind Part of a national-level assessment in Student's sex: sex US Student's minority status: minority Subset of data from West, Welch, and Galecki

  5. DataCamp Hierarchical and Mixed Effects Models in R School test scores Classroom-level variables: School-level variables: Classroom id: classid School ID: schoolid Teacher's math training: mathprep School's household poverty level: Teacher's math test knowledge test housepov score: mathknow School's socioeconomic status: ses Teacher's years teaching: yearstea

  6. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Let's practice!

  7. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Parts of a regression Richard Erickson Quantitative Ecologist

  8. DataCamp Hierarchical and Mixed Effects Models in R An intercept y = β + ϵ

  9. DataCamp Hierarchical and Mixed Effects Models in R Multiple intercepts y = β + β x + β x + ϵ 0 2 2 3 3 y = β x + β x + β x + ϵ 1 1 2 2 3 3

  10. DataCamp Hierarchical and Mixed Effects Models in R Linear models in R lm( formula, data) lm( y ~ x, data = myData) anova(lm( y ~ x, data = myData))

  11. DataCamp Hierarchical and Mixed Effects Models in R A simple linear regression with slopes y ∼ β + β x + ϵ 0 1

  12. DataCamp Hierarchical and Mixed Effects Models in R Multiple regression y ∼ β + β x + β x + … + ϵ 0 1 1 2 2

  13. DataCamp Hierarchical and Mixed Effects Models in R Multiple regression caveats Independence of predictor variables "corrected for..." Simpson's paradox Only linear Interactions may be important

  14. DataCamp Hierarchical and Mixed Effects Models in R Multiple regression in R tips lm( y ~ x -1 ) estimates an intercept for each x Numeric versus factors Scaling parameters and slopes lm(y ~ x1 + x2 + x1:x2) can be written as lm(y ~ x1 * x2)

  15. DataCamp Hierarchical and Mixed Effects Models in R Refresher of running and plotting a linear regression in R regModel <- lm( response ~ predictor, data = regDemo) summary( regModel ) regModel regCoefPlot <- tidy(regModel) ggplot( regDemo, aes(x = predictor, y = response) ) + geom_point() + theme_minimal() + geom_abline( intercept = regCoefPlot$estimate[1], slope = regCoefPlot$estimate[2])

  16. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Let's practice!

  17. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Random-effects in regressions Richard Erickson Quantitative Ecologist

  18. DataCamp Hierarchical and Mixed Effects Models in R

  19. DataCamp Hierarchical and Mixed Effects Models in R

  20. DataCamp Hierarchical and Mixed Effects Models in R Algebraic representation y ∼ β x + ϵ i β ∼ Normal( μ , σ ) i

  21. DataCamp Hierarchical and Mixed Effects Models in R R syntax library(lme4) lmer( y ~ x + (1|randomGroup), data = myData) lmer( y ~ x + (randomSlope|randomGroup), data = myData)

  22. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Let's practice!

  23. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R School data Richard Erickson Quantitative Ecologist

  24. DataCamp Hierarchical and Mixed Effects Models in R Data questions 1. Does the sex of a student impact their knowledge gain? 2. Does the teacher's training impact the gain and does the teacher's math knowledge impact the gain?

  25. DataCamp Hierarchical and Mixed Effects Models in R HIERARCHICAL AND MIXED EFFECTS MODELS IN R Let's practice!

Recommend


More recommend