Skip to content

setting contrasts for a logistic regression

2 messages · w_poet, Frank E Harrell Jr

#
Hi everyone,

I'm doing a logistic regression with an ordinal variable. I'd like to set
the contrasts on the ordinal variable. However, when I set the contrasts,
they work for ordinary linear regression (lm), but not logistic regression
(lrm):

ddist = datadist(bin.time, exp.loc)
options(datadist='ddist')
contrasts(exp.loc) = contr.treatment(3, base = 3, contrasts = TRUE)
lrm.loc = lrm(bin.time ~ exp.loc, data = Dataset)

In this case, lrm still uses exp.loc = 1 as the base, at least in terms of
notation, even though I set exp.loc = 3 as the base.

Is there a way to set contrasts for lrm?

Thanks for any advice,
Stephen
#
w_poet wrote:
In the Design package and its replacement the rms package, the package 
wants control of the contrasts used during fitting.  But one should not 
in my view be too concerned with this, as after-the-fit contrasts are 
simple to get using the contrast.rms or contrast.Design functions.  They 
use the philosophy that getting predicted values is the safest way to go 
because you don't need keep track of contrasts/coding.  The summary and 
plot function in rms and Design are also helpful here.

Frank