**Learning Objectives**

- Define mixed effects models and population average models
- Perform model diagnostics for random effects models
- Interpret random intercepts and random slopes
- Define and perform population average models
- Define assumptions on correlation structure in hierarchical models
- Choose between hierarchical modeling strategies

**Outline**

- Review of fecal fat dataset
- Summary of non-hierarchical approaches
- Mixed effects models
- Longitudinal data and the Georgia Birthweights dataset
- Population average models and Generalized Estimating Equations (GEE)

- Vittinghoff sections 7.2, 7.3, 7.5

**Learning objectives**

- Gain an intuitive understanding of ICC through simulated data
- Simulate correlated grouped data
- Use a heatmap and spaghetti plot to visualize correlated grouped data
- Create a custom color-blind friendly palette for any plot using https://colorbrewer2.org/ and the RColorBrewer library
- Fit random and mixed-effects models to correlated grouped data
- Make QQ plots for mixed-effects models
- Calculate ICC from a random or mixed-effects model
- Fit a population average model, aka marginal model, using GEE

**Exercises**

- Simulation of correlated grouped data
- Create a heatmap of simulated data to visualize the group effect
- Create a spaghetti plot of the simulated data to visualize the group effect
- Fit a random effects model with no covariates and a random intercept. Does it recover the group and residual variances you simulated?
- Estimate ICC from the model above. Is it what you expected from the group and residual variances you simulated?
- Estimate ICC simply by calculating the correlation between fecfat1 and fecfat2. Is it similar to the estimate above?
- Load and do basic cleaning of the Georgia Birthweights dataset.
- Make a boxplot and spaghetti plot for the Georgia Birthweights dataset
- Test the null hypotheses that baseline birth weights do not vary by mother
- Create QQ plots of residuals and random intercepts for this model.
- Test the null hypotheses that the effect of birth order not modified by mother’s age at first birth or weight of first infant.
- Repeat above hypothesis tests using GEE