Re: [R] Design package lrm summary and factors

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Fri, 04 Apr 2008 07:23:29 -0500

sj wrote:
> 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.
>
>
>
> outcome<-sample(rep(c(0,1),10000),1000)
> input <- sample(rep(c("A","B","C"),10000),1000)
> dset <-data.frame(cbind(outcome,input))
> dd <- datadist(dset)
> options(datadist='dd')
>
> mod <- lrm(outcome ~ input,data=dset,x=TRUE,y=TRUE)
> summary(mod,est.all=FALSE,input=c("C","B"))

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

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 04 Apr 2008 - 12:26:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Apr 2008 - 13:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive