Of course, we are in no way restricted to using polynomial transformations of the predictors. We can also perform a log transformation.
summary(lm(medv ~ log(rm), data = Boston))
...
Create a model with a log transformation of both the dependent (medv
) and the independent variable lstat
.
You see that this also works for the dependent variable.
Assume that:
MASS
library has been loadedBoston
dataset has been loaded and attached