Jim Silverton
2011-Jul-07 00:58 UTC
[R] Simulating from the null distribution of a 2 x 3 table
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? -- Thanks, Jim. [[alternative HTML version deleted]]
David Winsemius
2011-Jul-07 01:18 UTC
[R] Simulating from the null distribution of a 2 x 3 table
On Jul 6, 2011, at 8:58 PM, Jim Silverton 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.Yeah. Right. A "chi-squared test". That certainly narrows it down ... to maybe one quarter of all statistical tests ever invented.> Anyone has any idea how to do this?Depending on what you actually mean by "the null distribution of a 2 X 3 table". possibly: ?r2dtable -- David.> > -- > Thanks, > Jim. > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT
Bert Gunter
2011-Jul-07 02:34 UTC
[R] Simulating from the null distribution of a 2 x 3 table
Homework? If not, context? -- Bert On Wed, Jul 6, 2011 at 5: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? > > -- > Thanks, > Jim. > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- "Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions." -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics
Thomas Lumley
2011-Jul-07 03:01 UTC
[R] Simulating from the null distribution of a 2 x 3 table
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. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland
peter dalgaard
2011-Jul-07 08:29 UTC
[R] Simulating from the null distribution of a 2 x 3 table
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