Vlatka Matkovic Puljic
2013-Jun-10 16:27 UTC
[R] woby2 (Odds Ratio) for variables with 3 or more levels
Dear all, I am using Epi package to calculate Odds ratio in my bivariate analysis. How can I make *twoby2 *in variables that have 3 or more levels. For example: I have 4 level var (Age) m=matrix(c(290, 100,232, 201, 136, 99, 182, 240), nrow=4, ncol=2) library (Epi) twoby2(m) R gives me only Comparing : Row 1 vs. Row 2 While I would like to have reference value in Row 1, and compare Row 2, Row 3 and Row 4 with it. Thanks for your help! [[alternative HTML version deleted]]
David Winsemius
2013-Jun-10 17:58 UTC
[R] woby2 (Odds Ratio) for variables with 3 or more levels
On Jun 10, 2013, at 9:27 AM, Vlatka Matkovic Puljic wrote:> Dear all, > > I am using Epi package to calculate Odds ratio in my bivariate analysis. > How can I make *twoby2 *in variables that have 3 or more levels.I hope looking at that again you will see how odd it sounds to be requesting advice about how to use a program for 2 x 2 tables on data that doesn't meet those requirements. If you want to stay within the Epi package world, you can probably use the 'mh' function since it says it can handle multi-way tables (or you can learn to use 'glm' in the regular stats package to do either logistic regression or Poisson regression.)> > For example: > I have 4 level var (Age) > m=matrix(c(290, 100,232, 201, 136, 99, 182, 240), nrow=4, ncol=2) > library (Epi) > twoby2(m) > > R gives me only > Comparing : Row 1 vs. Row 2 > > While I would like to have reference value in Row 1, and compare Row 2, Row > 3 and Row 4 with it.That is the default set of contrasts for 'glm' (and probably for 'mh' although it's not clear from the help page.) (Epi does have its own mailing list.) -- David Winsemius Alameda, CA, USA
James C. Whanger
2013-Jun-10 19:30 UTC
[R] woby2 (Odds Ratio) for variables with 3 or more levels
You may want to consider a cumulative logit model which effectively bifurcates an ordinal variable by utilizing the odds of being in a given level or below (depending on your coding). On Mon, Jun 10, 2013 at 12:27 PM, Vlatka Matkovic Puljic <vlatka.m@gmail.com> wrote:> Dear all, > > I am using Epi package to calculate Odds ratio in my bivariate analysis. > How can I make *twoby2 *in variables that have 3 or more levels. > > For example: > I have 4 level var (Age) > m=matrix(c(290, 100,232, 201, 136, 99, 182, 240), nrow=4, ncol=2) > library (Epi) > twoby2(m) > > R gives me only > Comparing : Row 1 vs. Row 2 > > While I would like to have reference value in Row 1, and compare Row 2, Row > 3 and Row 4 with it. > > > Thanks for your help! > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- *James C. Whanger* * * [[alternative HTML version deleted]]
Michael Friendly
2013-Jun-11 12:16 UTC
[R] woby2 (Odds Ratio) for variables with 3 or more levels
You may want loddsratio in the vcdExtra package On 6/10/2013 12:27 PM, Vlatka Matkovic Puljic wrote:> Dear all, > > I am using Epi package to calculate Odds ratio in my bivariate analysis. > How can I make *twoby2 *in variables that have 3 or more levels. > > For example: > I have 4 level var (Age) > m=matrix(c(290, 100,232, 201, 136, 99, 182, 240), nrow=4, ncol=2) > library (Epi) > twoby2(m) > > R gives me only > Comparing : Row 1 vs. Row 2 > > While I would like to have reference value in Row 1, and compare Row 2, Row > 3 and Row 4 with it. > > > Thanks for your help! > > [[alternative HTML version deleted]] >-- 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