Re: [R] Ordinal Independent Variables

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.