On Fri, Mar 09, 2012 at 05:37:42AM -0800, hubinho wrote: > Hello. > > I'm looking for a method to simulate n different 2x2 tables having all the > same odds ratio. > > For example. > > I need > 100 tables with odds ratio 1 > 100 tables with odds ratio 2 > 100 tables with odds ratio 3 > > and so on. > > All tables should have the same marginal frequencies.
Hi. Marginal frequencies together with the odds ratio determine the matrix uniquely. So, some of the requirements should be relaxed. If we start with a matrix (a, b) (c, d) then all matrices with the same marginal frequencies have the form (a + t, b - t) (c - t, d + t) The odds ratio is (a+t)(d+t)/(c-t)/(b-t) which is a strictly increasing function of t and so the equation (a+t)(d+t)/(c-t)/(b-y) = odds for a given odds has a unique solution t. Petr Savicky. ______________________________________________ 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.