tell me the difference between y 1 y 0 and y -1 in r formulas?

From the ?formula documentation:

 The ‘-’ operator removes the specified terms, so that ‘(a+b+c)^2 -
 a:b’ is identical to ‘a + b + c + b:c + a:c’.  It can also used to
 remove the intercept term: when fitting a linear model ‘y ~ x - 1’
 specifies a line through the origin.  A model with no intercept
 can be also specified as ‘y ~ x + 0’ or ‘y ~ 0 + x’.

So:

  • y ~ 1 includes an intercept
  • y ~ 0 does not include an intercept
  • y ~ -1 does not include an intercept

The last two are functionally equivalent.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top