[R] lm with ordered factors
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Sat Nov 22 11:35:23 CET 2003
On 22-Nov-03 Ted Harding wrote:
> [...]
> I have a quantitative variable Y and a 4-level ordered factor A
> (with very unequal numbers at the different levels, by the way).
>
> The command
>
> lm(Y ~ A)
>
> returns (amongst other stuff) an intercept, and coefficients
> A.L, A.Q and A.C for the Linear, Quadratic and Cubic effects.
>
> I'm trying to verify how R computes A.L, A.Q and A.C [...]
Thanks to Brian Ripley ('"contr.poly" and see MASS Ch 6'),
and Berwin Turlach (private response).
In particular, Berwin's revelation
fm <- lm(Y ~ A)
model.matrix(fm)
shows me exactly what is going on!
Best wishes to all,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 22-Nov-03 Time: 10:35:23
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list