[R] Odds Ratios in rms package
peter dalgaard
pdalgd at gmail.com
Thu Jun 21 12:02:42 CEST 2012
On Jun 20, 2012, at 21:05 , David Winsemius wrote:
>
> On Jun 20, 2012, at 12:12 PM, Sebastian Pölsterl wrote:
>
>> Hi,
>>
>> I'm using the rms package to do regression analysis using the lrm
>> function. Retrieving odds ratios is possible using summary.rms. However,
>> I could not find any information on how exactly the odds ratios for
>> continuous variables are calculated. It doesn't appear to be the odds
>> ratio at 1 unit increase, because the output of summary.rms did not
>> match the coefficient's value.
>>
>> E.g. print gives me:
>>
>> Coef S.E. Wald Z Pr(>|Z|)
>> age 0.1166 0.0289 4.04 <0.0001
>>
>> whereas summary gives me:
>>
>> Factor Low High Diff. Effect S.E. Lower 0.95 Upper 0.95
>> age 27.0000 37.00000 10.0000 0.78 0.20 0.40 1.17
>> Odds Ratio 27.0000 37.00000 10.0000 2.19 NA 1.49 3.22
>>
>> Does anybody know how these values are obtained, especially in the
>> presence of interactions?
>
> It is explained in the first paragraph of ?summary.rms, :
>
> " By default, inter-quartile range effects (odds ratios, hazards ratios, etc.) are printed for continuous factors,"
>
> ... and the labeling makes it fairly clear (at least it was for me) that it is an odds ratio for a change in predictor value from the 25th to the 75th percentile (which are the values in the Low and High columns)
Begparding?
Seems to me that would require (37-27)*0.1166 == 0.78, which doesn't quite hold in the arithmetic that I was taught...
Rather the Effect/Coef ratio is about 6.69 on both the effect and its SE, so I think it is a fair guess (being too lazy to check the actual code) that Low and High columns define the full range of ages, not the quartiles.
-pd
> In the presence of interactions you should not be looking at the coefficients, but rather at the predictions.
>
> ?Predict
>
> --
> David.
>
>
>>
>> Best regards,
>> Sebastian
>>
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> 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.
--
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list