[R] Simulating from the null distribution of a 2 x 3 table
peter dalgaard
pdalgd at gmail.com
Thu Jul 7 10:29:57 CEST 2011
On Jul 7, 2011, at 05:01 , Thomas Lumley wrote:
> On Thu, Jul 7, 2011 at 12:58 PM, Jim Silverton <jim.silverton at 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 at 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.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list