Thanks for all your help thus far. My final question is this, if I want to simulate all the 2 x 3 tables (with column totals and row totals fixed), how do I do this using r2dtable(), and find the one that gives me the smallest fisher's exact test. Will r2table() generate unique tables everytime to a certain point and is there a function which can give the unique tables?
Jim On Thu, Jul 7, 2011 at 4:29 AM, peter dalgaard <pda...@gmail.com> wrote: > > On Jul 7, 2011, at 05:01 , Thomas Lumley wrote: > > > On Thu, Jul 7, 2011 at 12:58 PM, Jim Silverton <jim.silver...@gmail.com> > wrote: > >> Dear all, > >> > >> I want to simulate from the null distribution of the following 2 x 3 > table, > >> > >> 2 5 10 > >> 4 8 5 > >> > >> I am using a chi-squared test. > >> Anyone has any idea how to do this? > > > > The r2dtable() function will simulate tables with a given set of row > > and column totals. > > Or, as a shortcut, maybe look into chisq.test(..., simulate.p.value=TRUE). > > Notice that both use hypergeometric-type sampling. One could also consider > sampling with rmultinom (either of order 6, twice of order three, or thrice > of order 2), or even rpois, assuming a Poisson distribution of the total > count. > > > > > > -thomas > > > > -- > > Thomas Lumley > > Professor of Biostatistics > > University of Auckland > > > > ______________________________________________ > > 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 > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Email: pd....@cbs.dk Priv: pda...@gmail.com > > -- Thanks, Jim. [[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.