Statistical inference with Maryland crime data

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?
R 中的分层与混合效应模型

Null hypothesis test

  • $H_0$ : No difference exists
  • $H_a$: A difference exists
R 中的分层与混合效应模型

P-values with lmer

library(lmerTest)
summary(lmer(...))
R 中的分层与混合效应模型

ANOVA

  • Analysis of Variance (ANOVA)
  • Compare variability of model with and without parameter
  • lmer(response ~ (1 | group)) vs. lmer(response ~ predictor + (1 | group))
R 中的分层与混合效应模型

Summary

  • Null hypothesis testing and ANOVAs
  • Build and compare models
  • High-level details, important assumptions covered in other DataCamp courses
R 中的分层与混合效应模型

Let's practice!

R 中的分层与混合效应模型

Preparing Video For Download...