[R] Design package lrm summary and factors
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Fri Apr 4 14:23:29 CEST 2008
> Hello, I have question regarding the lrm function and estimating the odds
> ratio between different levels of a factored variable.
> The following code example illustrates the problem I am having. I have a
> data set with an outcome variable (0,1) and an input variable (A,B,C). I
> would like to estimate the effect of C vs B, but when I perform the summary
> I only get A vs B and A vs C, even though I specify that I want to see C vs
> B. Am I missing something, any help is appreciated.
> input <- sample(rep(c("A","B","C"),10000),1000)
> dset <-data.frame(cbind(outcome,input))
> dd <- datadist(dset)
> mod <- lrm(outcome ~ input,data=dset,x=TRUE,y=TRUE)
The x=c(val1,val2) notation works for continuous predictors. For your
case just specify input='B' and you will get odds ratios against 'B'.
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help