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
______________________________________________
R-help@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.