Get startedGet started for free

Sleep study

1. Sleep study

For our first repeated measures case study, we will apply a repeated measures linear mixed-effects model to a sleep study dataset.

2. Overview of sleep study

Our dataset examines how two different drugs helped people sleep. The data followed 10 patients over time. The dataset includes the patient ID, their treatment group, and the increase in hours of sleep in comparison to the control subjects. This classic dataset was used by Gosett who published under the pseudonym "student" because his employer, Guinness Brewing, prohibited their employees from publishing research results. We're going to examine the effectiveness of the drug during the exercise.

3. Research question

We will analyze the data using two different statistical approaches. Although we will use the same model, how we examine the results will be different. First, we will use an ANOVA type approach and examine if the drug impacts the amount of sleep. Specifically, we will examine if the drug covariate explains a significant amount of variability within the model. Our null hypothesis will be that the amount of sleep that study participants get does not differ as a result of the different treatments. Our alternative hypothesis will be that the drugs have different effects on the amount of sleep participants get. Second, we will use a regression framework for modeling. With a regression framework, we build a linear mixed model and then examine if the treatment coefficient differs from zero. This is the same model as the ANOVA, but rather than trying to explain variability, we examine if the one drug differs from another. A benefit of this approach is that we do not need to run a post-hoc test to see how the coefficient is different. A downside is that more complex regression models can be harder to understand than ANOVAs.

4. Modeling approach

For our modeling, we will use a five step process. First, we'll look at our data to see what is going on. Second, we will build a simple regression model to make sure everything works. Third, we will build a more complex model. Fourth, we will extract the information we are interested in from the model. And fifth, we will visualize the results. These are the five steps I use often when analyzing data as part of my job helping scientists to understand their data. They can also be iterative. When dealing with real world problems, I might build a model and realize that it doesn't work or do what I need it to do only after examining at the results. This process also demonstrates how modeling can be an art as much as a science. One thing I like about DataCamp courses is that we can see how many different and bright minds address their data science questions.

5. Let's practice!

Now, let's examine some sleep study data!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.