0

I have code below using the build-in dataset mtcars:

data(mtcars)
model_1 <- lm(mpg ~ wt + log(wt), data = mtcars)
summary(model_1)

model_2 <- lm(mpg ~ wt + wt^2, data = mtcars)
summary(model_2)

In model_1, things work well and I have two features wt and log(wt) in my regression result.

But in model_2, I only have wt in the result, and I don't have the square of wt. Why and how to fix?

Wilson Souza
  • 416
  • 2
  • 10
H42
  • 613
  • 1
  • 6
  • 21

0 Answers0