[R] Is the Intercept Term always in First Position?

2010-01-05 Thread Viechtbauer Wolfgang (STAT)
Dear All, I have a question about formulas and model.matrix(). If one specifies a model via a formula, the corresponding design matrix can be obtained with the model.matrix() function. For example: x1 - c(1,4,2,3,5) x2 - c(1,1,2,2,2) myformula - ~ x1 + factor(x2) model.matrix(myformula) My

Re: [R] Is the Intercept Term always in First Position?

2010-01-05 Thread Prof Brian Ripley
On Tue, 5 Jan 2010, Viechtbauer Wolfgang (STAT) wrote: Dear All, I have a question about formulas and model.matrix(). If one specifies a model via a formula, the corresponding design matrix can be obtained with the model.matrix() function. For example: x1 - c(1,4,2,3,5) x2 - c(1,1,2,2,2)