We will use the mtcars
data set to explore how to deal with Dummy variables.
We will be interested in three of the variables mpg
, hp
, and am
.
Start by plotting the data, find a way to visualize the am
variable alongside mpg
and hp
.
Fit the simple linear regression model where \(Y\) is mpg
, \(X\) is hp
. Plot the fitted line along with the data.
Fit the multiple linear regression model where both hp
and am
is included as predictors. Plot the regression lines for am == 0
and am == 1
.