Error in model.frame.default

linear_regression
r

#1

I am currently working on linear regression problem but when I am modeling the model quality vs rest of variable I am getting the error


#2

Your syntax is wrong when building the model.

Try this
ml <- lm(quality~.,data=white)

The above command means dependent variable is quality. “.” stands for all variables.

You cannot write quality~white[,-12] : because you need to supply the names of variables to be used as predictors for the model not the whole matrix intself. We supply that through data = white.


#3

If you do not want all other variables, you can also separate the variables that you would like to test against by a plus sign on the RHS of the formula like:

lm(quality ~ fixed.acidity + volatile.acidity + chloride, white)