Statistical inference with Maryland crime data

Hierarchical and Mixed Effects Models in R

Richard Erickson

Data Scientist

Maryland crime data

  • Number of violent crimes per year by County
             County    Year Crime
        ANNE ARUNDEL   2006  3167
        BALTIMORE CITY 2006 10871
  • Useful for policy/crime analysis or insurance
  • Is the crime rate changing through time across counties?
Hierarchical and Mixed Effects Models in R

Null hypothesis test

  • $H_0$ : No difference exists
  • $H_a$: A difference exists
Hierarchical and Mixed Effects Models in R

P-values with lmer

library(lmerTest)
summary(lmer(...))
Hierarchical and Mixed Effects Models in R

ANOVA

  • Analysis of Variance (ANOVA)
  • Compare variability of model with and without parameter
  • lmer(response ~ (1 | group)) vs. lmer(response ~ predictor + (1 | group))
Hierarchical and Mixed Effects Models in R

Summary

  • Null hypothesis testing and ANOVAs
  • Build and compare models
  • High-level details, important assumptions covered in other DataCamp courses
Hierarchical and Mixed Effects Models in R

Let's practice!

Hierarchical and Mixed Effects Models in R

Preparing Video For Download...