I'm following along with a "learn R" course, and we ran the following multiple linear regression:
regressor = lm(formula = Profit ~ ., data = training_set)
Then a bit later, we added some columns to a different data set:
dataset$Level2 = dataset$Level^2
dataset$Level3 = dataset$Level^3
dataset$Level4 = dataset$Level^4
And ran identical line...
regressor = lm(formula = Profit ~ ., data = training_set)
And somehow now lm
knows not to fit a multiple regression linear line?
It's modifying the original data set before it's even passed into lm
, so unless lm
is somehow trying to interpret my data to figure out which actual model to use, I don't see how it's knowing to do this...?