Holding on to independence: The Linear model
Continuing to ignore the repeated-measures structure of the data, we will fit a multiple linear regression model with weight as response and Time
and Group
as explanatory variables.
Recall again from Chapter 1: Multiple regression that this is done by defining explanatory variables with the formula
argument of lm()
, as below
y ~ x1 + x2 + ..
Here y
is again the target variable and x1, x2, ..
are the explanatory variables.
This exercise is part of the course
Helsinki Open Data Science
Exercise instructions
- Create a regression model with
Weight
as the response variable andTime
andGroup
as explanatory variables - Print out the summary of the model
- Observe 1) How Group2 and Group3 differ from Group1
conditional on
Time
and 2) The significance of the regression onTime
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# dplyr, tidyr, RATS and RATSL are available
# create a regression model RATS_reg
RATS_reg <- "Regression model here!"
# print out a summary of the model