Linear regression is of the form
y = mx + b
right?
And in R, - means omit, as in
mydataframe[, -1]
right?
But when you specify a formula within lm(), the intercept is implicit.
That is, you write:
y ~ x
and m and b are fitted.
So if you want to omit the intercept, you use 1 as a
So I found out that to remove the (Intercept) term from lm's model one
can add -1 to the predictors. I.e. do lm(resp ~ x1 + x2 - 1)
Another way is to add 0, e.g. lm(resp ~ 0 + x1 + x2).
Adding (or setting the (Intercept) term) zero seems more logical than
subtracting one, but why is there the
2 matches
Mail list logo