So you’ve mastered the art of the linear regression, eh? You can build a multiple regression model with the best of them and interpret the coefficients like a pro. But what happens when you get data that isn’t random and independent?
Sometimes we have pockets or clusters of data in our dataset that are more similar to each other than they are to the rest of the dataset. In medical data, these could be patients that each came in several times to get their heartrate monitored; in more publicly available data, these could be average standardized test scores for several counties over 10 years. These all revolve around the idea that datapoints from the same cluster are likely to behave similarly.
We call data where people/cities/clusters have multiple datapoints longitudinal data, and in this tutorial we’ll learn how to build appropriate models for them using R.