Linear mixed effect model- Birth rates data

Hierarchiczne i mieszane modele efektów w R

Richard Erickson

Data Scientist

Chapter outline

  • Random-effect intercept model
  • Random-effect slope model
Hierarchiczne i mieszane modele efektów w R

Birth rates data

  • Small populations subject to stochasticity
  • Random-effects one solution to this problem
  • Birth rates one such variable
Hierarchiczne i mieszane modele efektów w R

How does a mothers age impact birth rate?

  • Does a mother's age impact birth rate?
  • Marketing and policy implications
Hierarchiczne i mieszane modele efektów w R

Plot of birth rates against county size

Hierarchiczne i mieszane modele efektów w R

lmer syntax in R

library(lme4)
lmer(y ~ x + (Random-effect), data = my_data)
Hierarchiczne i mieszane modele efektów w R

Random-effect syntax

  • (1 | group): Random intercept with fixed mean
  • (1 | g1/g2): Intercepts vary among g1 and g2 within g1
  • (1 | g1) + (1 | g2): Random intercepts for 2 variables
  • x + (x | g): Correlated random slope and intercept
  • x + (x || g): Uncorrelated random slope and intercept
  • See lme4 for additional details
Hierarchiczne i mieszane modele efektów w R

Let's practice!

Hierarchiczne i mieszane modele efektów w R

Preparing Video For Download...