Skip to main content

Hierarchical and Mixed Effects Models in R

In this course you will learn to fit hierarchical models with random effects.

Start Course for Free
4 Hours13 Videos55 Exercises13,208 Learners
4750 XP

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

This course begins by reviewing slopes and intercepts in linear regressions before moving on to random-effects. You'll learn what a random effect is and how to use one to model your data. Next, the course covers linear mixed-effect regressions. These powerful models will allow you to explore data with a more complicated structure than a standard linear regression. The course then teaches generalized linear mixed-effect regressions. Generalized linear mixed-effects models allow you to model more kinds of data, including binary responses and count data. Lastly, the course goes over repeated-measures analysis as a special case of mixed-effect modeling. This kind of data appears when subjects are followed over time and measurements are collected at intervals. Throughout the course you'll work with real data to answer interesting questions using mixed-effects models.

  1. 1

    Overview and introduction to hierarchical and mixed models


    The first chapter provides an example of when to use a mixed-effect and also describes the parts of a regression. The chapter also examines a student test-score dataset with a nested structure to demonstrate mixed-effects.

    Play Chapter Now
    What is a hierarchical model?
    50 xp
    Examples of hierarchical datasets
    100 xp
    Multi-level student data
    100 xp
    Exploring multiple-levels: Classrooms and schools
    100 xp
    Parts of a regression
    50 xp
    100 xp
    Slopes and multiple regression
    100 xp
    Random-effects in regressions with school data
    50 xp
    Random-effect intercepts
    100 xp
    Random-effect slopes
    100 xp
    Building the school model
    100 xp
    Interpreting the school model
    100 xp
  2. 3

    Generalized linear mixed-effect models

    This chapter extends linear mixed-effects models to include non-normal error terms using generalized linear mixed-effects models. By altering the model to include a non-normal error term, you are able to model more kinds of data with non-linear responses. After reviewing generalized linear models, the chapter examines binomial data and count data in the context of mixed-effects models.

    Play Chapter Now
  3. 4

    Repeated Measures

    This chapter shows how repeated-measures analysis is a special case of mixed-effect modeling. The chapter begins by reviewing paired t-tests and repeated measures ANOVA. Next, the chapter uses a linear mixed-effect model to examine sleep study data. Lastly, the chapter uses a generalized linear mixed-effect model to examine hate crime data from New York state through time.

    Play Chapter Now

In the following tracks



Nick SolomonChester Ismay
Richard Erickson Headshot

Richard Erickson

Data Scientist

Richard helps people to experience and understand their increasingly numerical world. For his day job he develops new quantitative methods for monitoring and controlling invasive species as well as helping other scientists analyze and understand their data. He has worked on diverse datasets ranging from continent wide species distributions to pesticides in playa wetlands. After hours, he teaches SCUBA Diving as a NAUI Instructor. He has been a member of "UserR" since 2007.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA