13  GEE v. Mixed Effects

Settling In

Sit with your Longitudinal Partner!

  • Check out my feedback about HW5; should inform HW6.
  • Reminder: Kyle S. is a preceptor for this course!

Everything on the slides is in the online manual: https://bcheggeseth.github.io/452_fall_2025/

Wisdom from a 5 Year Old

You are doing the best you can right now.

W’s of Study Design

Let’s return to STAT 155:

https://mac-stat.github.io/Stat155Notes/data-context.html

When describing data from a study, make sure you cover all of these W’s of the data context (at a minimum).

  • Depending on the “Who” and “How”, more details may be needed.

Citations & References in Quarto

Citations and References with Bibtex

Merge Conflicts in GitHub

A Merge Conflict happens when two different people make changes on the same line at the same time (relative to commit history).

. . .



Solving Merge Conflicts:

In qmd files:

  • open up the file in RStudio and search for <<<. You’ll find a section of code that looks like the following.
<<<<<<< HEAD
open an issue
=======
ask your question in IRC.
>>>>>>> branch-a
  • Between <<<<<<< and ======= is one person’s code/text. The alternative code is between ======= and >>>>>>>.

  • You must choose one or both to keep in the file.

  • Delete the <<<<<<<, =======, and >>>>>>> lines. Done!

If you have a conflict with the html or a pdf,

  • you have to choose one version and then recreate that document from the final qmd.

. . .



Let’s try an example!

Learning Goals

  • Explain and illustrate the differences between GEE and Mixed Effects Models

To GEE or Not To GEE

Discussion

  • What was familiar?
  • What was striking?
  • What was confusing?

Academic “Fight”

Commentary

Response to Commentary

GEE v. Mixed Effects - Models

GEE

Population Mean Model: \(E(\mathbf{Y}_i | \mathbf{X}_i) = \mathbf{X}_i\boldsymbol\beta\)


Covariance Model: choose a working correlation

  • Independence
  • Exchangeable
  • AR1 (exponential decay)
  • M-dependent

Explicitly model the covariance matrix structure

Mixed Effects

Population Mean Model (fixed effects): \(E(\mathbf{Y}_i | \mathbf{X}_i) = \mathbf{X}_i\boldsymbol\beta\)

Subject-Specific Mean Model: \(E(\mathbf{Y}_i | \mathbf{X}_i,\mathbf{b}_i) = \mathbf{X}_i\boldsymbol\beta + \mathbf{Z}_i\mathbf{b}_i\)

Covariance Model: choose random effects

\[Cov(\mathbf{Y}_i ) = \mathbf{Z}_i\mathbf{G}\mathbf{Z}_i^T + \boldsymbol\Sigma\]

  • Random Intercept Model: \(\mathbf{Z}_i = \mathbf{1}, \mathbf{G} = \sigma^2_{0}\) Exchangeable structure

Implicitly model the covariance matrix structure

GEE v. Mixed Effects - Interpretations

GEE

Population Mean Model: \(E(Y_{ij} | x_{ij}) = \beta_0 + \beta_1x_{ij1} + \cdots + \beta_px_{ijp}\)

\(\beta_k = E(Y_{ij} | x_{ij1},x_{ij2},...,x_{ijk} = x+1,...,x_{ijp} ) - E(Y_{ij} | x_{ij1},x_{ij2},...,x_{ijk} = x,...,x_{ijp} )\)

Difference in population mean outcome between a 1 unit difference in that variable, keeping all other variables fixed.

. . .



Mixed Effects

Population Mean Model (fixed effects): \(E(Y_{ij} | x_{ij}) = \beta_0 + \beta_1x_{ij1} + \cdots + \beta_px_{ijp}\)

\(\beta_k = E(Y_{ij} | x_{ij1},x_{ij2},...,x_{ijk} = x+1,...,x_{ijp} ) - E(Y_{ij} | x_{ij1},x_{ij2},...,x_{ijk} = x,...,x_{ijp} )\)

Difference in population mean outcome between a 1 unit difference in that variable, keeping all other variables fixed.

. . .



Subject-Specific Mean Model: \(E(Y_{ij} | x_{ij}, b_{0i}) = (b_{0i} + \beta_0) + \beta_1x_{ij1} + \cdots + \beta_px_{ijp}\)

\(\beta_k = E(Y_{ij} | b_{0i}, x_{ij1},x_{ij2},...,x_{ijk} = x+1,...,x_{ijp} ) - E(Y_{ij} | b_{0i}, x_{ij1},x_{ij2},...,x_{ijk} = x,...,x_{ijp} )\)

Difference in subject mean outcome between a 1 unit difference in that variable, keeping all other variables fixed.

. . .



Note: With logistic regression, it is not as straightforward but there is still a population average and subject-specific interpretation.

GEE v. Mixed Effects - Estimates

GEE

Coefficient estimates:

  • We use GEE for parameter estimation of marginal models -> estimates are consistent (if mean model is correct)

Standard Errors:

  • Robust SE’s are valid even when the covariance model is wrong

Mixed Effects

Coefficient estimates:

  • We use MLE for parameter estimation of mixed effects models -> estimates are consistent (if mean model is correct)

Standard Errors:

  • SE’s are valid only when the covariance model is correct

To do inference [confidence intervals, hypothesis testing, etc], you need valid SE’s.

GEE v. Mixed Effects - Inference & Diagnostics

GEE

Inference

  • Test individual coefficients \((H_0: \beta_k = 0)\); p-values provided in output
  • Compare Full and Nested Models code manually with L matrix

Diagnostics

  • Check for patterns in Residuals

Mixed Effects

Inference

  • Test individual coefficients \((H_0: \beta_k = 0)\); p-values not provided in output
  • Compare Full and Nested Models anova(); fixed or random, not both at same time

Diagnostics

  • Check for patterns in Residuals
  • Check distribution of predicted random effects

Small Group Work

Go to HW 6 and work with your partner.

Wrap-Up

Finishing the Activity

  • If you didn’t finish the activity, no problem! Be sure to complete the activity outside of class, review the solutions in the online manual, and ask any questions on Slack or in office hours.
  • Re-organize and review your notes to help deepen your understanding, solidify your learning, and make homework go more smoothly!

After Class

Before the next class, please do the following:

  • Take a look at the Schedule page to see how to prepare for the next class.