1. Linear mixed effect model- Birth rates data
We've seen a basic example of a linear mixed effects regression, that is, building a model using lmer.
2. Chapter outline
Now, we're going to dive deeper into this type of model. First, we will examine a random-effects intercept model to examine birth rates in counties across the United States. To do this, we will plot the dataset, run a lmer, examine the importance of regression coefficients, and learn how to summarize the results. We will then see how to apply random-effect slopes model to crime data from Maryland.
3. Birth rates data
Small populations can be subject to random, stochastic events. In population biology, this is called demographic stochasticity. As a thought-experiment, let's assume the average birth rate is 1 baby per 10 women of childbearing age. In a population of 10,000 such women, we would expect there to be close to 1,000 births per year. In contrast, in a population of 10 such women, we could reasonably have 10 births or 0 births due to chance alone.
In the United States, in each state, with the exception of Louisiana, the population lives in subdivided areas called counties. Louisiana has "parishes" due to its French history. Counties are often used for marketing and academic studies. For example, a marketing firm might wonder which counties have higher birth-rates so that they can sell more baby formula ads in that county or a political scientist might examine how policies vary across counties and possibly affect birth rates.
4. How does a mothers age impact birth rate?
For our case study, we are going to examine if a mother's age impacts the birth rate. Researchers or marketers could be interested in this data for their respective purposes.
5. Birth rates
The plot on this slide shows each county's total population on the x-axis and its birth rate on the y-axis. Why do both the highest and lowest birth rates appear in smaller counties? Is something weird going on in rural America? No, the reason is demographic stochasticity. On a similar note, notice the birth rates in the largest counties are pretty close to average.
6. lmer syntax in R
Recall that the random-effect syntax in the lmer function within the lme4 package uses a formula similar to a linear model in base R. However, lmer must include a random-effect in parentheses or it produces an error telling you to include a random-effect. The specific formula depends on the model being fit.
7. Random-effect syntax
The random-effect can take several different forms including a random intercept with a fixed mean, nested intercepts, multiple intercepts, and both correlated and uncorrelated random slopes and intercepts. We will revisit these more during the exercises. These are also described more in the lme4 documentation.
8. Let's practice!
Now, you can dive into the birth-data!