Dear Sir Many papers calculated the p value of trends for odds ratios of ordered category variables. I have found the tabodds command in Stata. But how to do it in R? Thanks *Yao Zhu* *Department of UrologyFudan University Shanghai Cancer CenterShanghai, China* [[alternative HTML version deleted]]
On 04.01.2014 06:39, zhu yao wrote:> Dear Sir > Many papers calculated the p value of trends for odds ratios of ordered > category variables. I have found the tabodds command in Stata. But how to > do it in R?Depends on the method you want to use ... and most ladies and gents on this list won't know Stata well enough to know what tabodds does. Best, Uwe Ligges> Thanks > > *Yao Zhu* > > > *Department of UrologyFudan University Shanghai Cancer CenterShanghai, > China* > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >
Michael Friendly
2014-Jan-05 15:09 UTC
[R] p value of trends for odds ratios (or hazard ratios)
On 1/4/2014 12:39 AM, zhu yao wrote:> Dear Sir > Many papers calculated the p value of trends for odds ratios of ordered > category variables. I have found the tabodds command in Stata. But how to > do it in R? > Thanks > > *Yao Zhu*If what you are looking at is a 2 x 2 x k table, where you want the odds ratios for the k strata, which are ordered, perhaps something like this: data("CoalMiners", package="vcd") ## Log Odds Ratio Plot lodds <- oddsratio(CoalMiners) summary(lodds) plot(lodds, lwd=2, cex=1.25, pch=16, xlab = "Age Group", main = "Breathlessness and Wheeze in Coal Miners") age <- seq(25, 60, by = 5) mod <- lm(lodds ~ poly(age,2)) lines(fitted(mod), col = "red", lwd=2) Tests of the coefficients in mod give the tests of linear and quadratic changes in the odds ratio with age. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. & Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele Street Web: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA