[R] woby2 (Odds Ratio) for variables with 3 or more levels

David Winsemius dwinsemius at comcast.net
Mon Jun 10 19:58:26 CEST 2013


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



More information about the R-help mailing list