Re: [R] Ordinal Independent Variables

From: Frank E Harrell Jr <>
Date: Tue 23 May 2006 - 08:55:57 EST

Rick Bilonick wrote:
> When I run "lrm" from the Design package, I get a warning about
> contrasts when I include an ordinal variable:
> Warning message:
> Variable ordfac is an ordered factor.
> You should set
> options(contrasts=c("contr.treatment","contr.treatment"))
> or Design will not work properly. in: Design(eval(m, sys.parent()))
> I don't get this message if I use glm with family=binomial. It produces
> linear and quadratic contrasts.
> If it's improper to do this for an ordinal variable, why does glm not
> balk?
> Rick B.

Standard regression methods don't make good use of ordinal predictors and just have to treat them as categorical. Design is a bit picky about this. If the predictor has numeric scores for the categories, you can get a test of adequacy of the scores (with k-2 d.f. for k categories) by using scored(predictor) in the formula. Or just create a factor( ) variable to hand to Design.

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Tue May 23 10:09:00 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 23 May 2006 - 20:10:19 EST.

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