Re: [Rd] y ~ X -1 , X a matrix

From: Dirk Eddelbuettel <>
Date: Wed, 17 Mar 2010 20:41:54 -0500

On 17 March 2010 at 16:32, Ross Boylan wrote:
| While browsing some code I discovered a call to lm that used a formula y
| ~ X - 1, where X was a matrix.
| Looking through the documentation of formula, lm, model.matrix and maybe
| some others I couldn't find this useage (R 2.10.1). Is it anything I
| can count on in future versions? Is there documentation I've
| overlooked?

>From help(formula):


       In addition to ‘+’ and ‘:’, a number of other operators are useful
       in model formulae.  [...] 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: ‘y ~ x - 1’ is a line through the
       origin.  A model with no intercept can be also specified as ‘y ~ x
       + 0’ or ‘y ~ 0 + x’.

What exactly are you questioning? That X is a matrix? That doesn't take away from the fact that the rest is a formula.


  Registration is open for the 2nd International conference R / Finance 2010
  See for details, and see you in Chicago in April!

______________________________________________ mailing list
Received on Thu 18 Mar 2010 - 01:43:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 18 Mar 2010 - 11:11:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive