How to do it...

In the following example, we will load a dataset containing performance scores for employees. We will observe four records for each employee. For each time step, each employee will receive either the traditional or the boost compensation package. We want to find out whether there are differences between the two compensation packages:

  1. First, we need to load the necessary libraries and the dataset that we will use:
library(ggplot2)library(nlme)data_company = read.csv("./repeated_measures.csv")
  1. We will plot the responses for each employee. Here, we want to determine whether the Time/Performance slopes are the same between employees or not. We can see that the slopes (Performance-Time) are similar, so it doesn't seem necessary ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.