[R] Ordinal Independent Variables
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Tue May 23 14:09:19 CEST 2006
Prof Brian Ripley wrote:
> On Mon, 22 May 2006, Frank E Harrell Jr wrote:
>
>> 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.
>
>
> Contrasts in S/R are used to set the coding of factors, and
> model.matrix() does IMO 'make good use of ordinal predictors'.
>
> I don't know what is meant by 'Standard regression methods': the
> charitable interpretation is that these are the overly restrictive
> methods used by certain statistical packages. (I first learnt of the
> use of polynomial codings for ordinal factors in the late 1970s, when I
> first learnt anything about ANOVA, so to me they are 'standard'.)
>
> So are you saying this is a design deficiency in package Design, or that
> the authors of S ca 1991 were wrong to allow arbitrary contrasts?
>
Brian,
What I meant was that unlike the case of ordinal response varables where
multiple intercepts in logistical models do not cost degrees of freedom
because the ordering constraint is fully utilized, ordinal predictors
require k-1 degrees of freedom for k levels using any standard contrast.
Special methods (e.g. pool adjacent violators to impose a
monotonicity constraint) would have to be used to get a lot out of the
ordinal nature of the predictor.
There's nothing wrong with allowing arbitrary contrasts; more progress
has been made in statistics for ordinal responses than ordinal predictors.
Frank
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list