> Subject: Re: [R] Why removing the (Intercept) from lm is done by adding -1?
>
> And in R, - means omit, as in
> mydataframe[, -1]
> right?

## Advertising

Not really, no.
In the specific interpretation of an R model formula, '-' means 'remove the
_term_ following '-' ...'. As below:
> This is all in the help for formula, where it says "The - operator removes the
> specified terms".
Almost everywhere else, '-' it means negate as a unary operator and subtract
as a binary operator.
In '[', '-' still means negate, not remove. It's just that '[' uses negative
_numbers_ as a special case to denote omission. As a recent post noted,
[-"601",] does not work.
> > Adding (or setting the (Intercept) term) zero seems more logical than
> > subtracting one, but why is there the method of subtracting one? Why
> > does subtracting one mean that the (Intercept) term disappears?
See above; '-' _in a formula_ means 'remove the following term'
Following that consistently, if there's a weirdness there, it's that ~0+x works
to omit the intercept, not that ~x-1 does.
But that arises from a slightly different, but still fairly reasonable,
perspective on describing the model.
S Ellison
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.