[R] Simulating contingency table (Basic question, help please)

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Tue Feb 24 20:56:45 CET 2009


On Tue, 24 Feb 2009, bbbnc wrote:

> I'd like to carry out a Monte Carlo simulation test where given data is a
> contingency table. I think this is something to do with using rmultinonom(),
> but I'm not sure how to code this, to simulate contingency tables. Could
> anyone please help with how to use R to simulate contingency tables like
> this?

If you want a two-way table with certain fixed margins, you can use 
r2dtable() which implements the Patefield algorithm. For testing 
(conditional) independence of two variables based on r2dtable(), you can 
use coindep_test() in package "vcd".
Z

> -- 
> View this message in context: http://www.nabble.com/Simulating-contingency-table-%28Basic-question%2C-help-please%29-tp22184961p22184961.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
>




More information about the R-help mailing list