1. Learn
  2. /
  3. Courses
  4. /
  5. Hierarchical and Mixed Effects Models in R

Connected

Exercise

Building models

In this exercise, you will build a simple linear model (lm()) and then build a linear mixed-effects model (lmer()). The purpose of the first step is to make sure the data works well with a simple model because lm() outputs are easier to debug than lmer() outputs. During the next exercise, you will compare two different methods of statistical inference on the model.

Instructions 1/2

undefined XP
  • 1
    • Build a linear model using lm(). The goal of this step is to simply make sure the model builds without errors or warnings. Have extra predicted by fixed-effects group (1st) and ID (2nd) from the sleep data.
  • 2
    • Build a lmer() model with extra predicted by the fixed-effect group and random-effect intercept ID using the sleep data.