On 24 Jun 2014, at 16:41 , Tahira Jamil <tahja...@gmail.com> wrote: > Hi, > > I am interested in generating all possible contingency table (2 by 2) with > fixed row margins and column margins. Can anyone help me. >
It's pretty easy, just find one compatible solution and add or subtract 1 -1 -1 1 until one of the numbers would go negative. Or put differently, if you know one entry, you know the other three, so it is just a matter of working out the range of (say) possible top-left entries. With more than 2x2 tables it is much harder, but fisher.test() does it internally. -pd > Best regards, > Tahira > [[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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ 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.