lm(mpg~hp+wt+am+cyl-1, mtcars)
Call: lm(formula = mpg ~ hp + wt + am + cyl - 1, data = mtcars)
Coefficients:
hp wt am0 am1 cyl6 cyl8
-0.03211 -2.49683 33.70832 35.51754 -3.03134 -2.16368
lm(mpg~hp+wt+am+cyl, mtcars)
Call: lm(formula = mpg ~ hp + wt + am + cyl, data = mtcars)
Coefficients:
(Intercept) hp wt am1 cyl6 cyl8
33.70832 -0.03211 -2.49683 1.80921 -3.03134 -2.16368
When I excluded the intercept, I am getting a coefficient for am0. And when the intercept is included, I am only getting a coefficient for am1 an not for am0, why is it so??