Meet and Repeat: PART II
Welcome to the PART II of Analysis of longitudinal data chapter.
Longitudinal data, where a response variable is measured on each subject on several different occasions poses problems for their analysis because the repeated measurements on each subject are very likely to be correlated rather than independent. In PART II of this chapter methods for dealing with longitudinal data which aim to account for the correlated nature of the data and where the response is assumed to be normally distributed are discussed.
To investigate the use of linear mixed effects models in practice, we shall use data from a nutrition study conducted in three groups of rats. The groups were put on different diets, and each animal’s body weight (grams) was recorded repeatedly (approximately) weekly, except in week seven when two recordings were taken) over a 9-week period. The question of most interest is whether the growth profiles of the three groups differ.
This exercise is part of the course
Helsinki Open Data Science
Exercise instructions
- Read the
RATS
data into memory - Factor variables
ID
andgroup
- Glimpse the data
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# dplyr is available
# read the RATS data
RATS <- read.table("https://raw.githubusercontent.com/KimmoVehkalahti/MABS/master/Examples/data/rats.txt", header = TRUE, sep = '\t')
# Factor variables ID and Group
# Glimpse the data