1. Learn
  2. /
  3. Courses
  4. /
  5. Helsinki Open Data Science

Connected

Exercise

Time to interact: Random Intercept and Random Slope Model with interaction

Finally, we can fit a random intercept and slope model that allows for a group × time interaction.

Instructions

100 XP
  • Write the same model as in the previous exercise but add Time * Group interaction.
  • Print out the summary of the model
  • Compute the analysis of variance tables of the models RATS_ref2 and RATS_ref1
  • Again pay attention to the likelihood ratio test chi-squared value and the according p-value. The lower the value the better the fit against the comparison model.
  • Draw the plot of observed values of RATSL (this is the same plot drawn earlier)
  • Create a vector of the fitted values of the model using the function fitted()
  • Use for example mutate() to add the vector Fitted as a new column to RATSL
  • Draw the plot of fitted values of RATSL