Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-09 Thread Jim Silverton
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  wrote:

>
> On Jul 7, 2011, at 05:01 , Thomas Lumley wrote:
>
> > On Thu, Jul 7, 2011 at 12: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.
> >> 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.


Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-07 Thread peter dalgaard

On Jul 7, 2011, at 05:01 , Thomas Lumley wrote:

> On Thu, Jul 7, 2011 at 12: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.
>> 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

__
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.


Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-06 Thread Thomas Lumley
On Thu, Jul 7, 2011 at 12: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.
> 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

__
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.


Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-06 Thread Bert Gunter
Homework?

If not, context?

-- Bert

On Wed, Jul 6, 2011 at 5: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.
> Anyone has any idea how to do this?
>
> --
> 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.
>



-- 
"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

__
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.


Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-06 Thread David Winsemius


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@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

__
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.


Re: [R] Simulating from the null distribution of a 2 x 3 table

2011-07-06 Thread Jim Silverton
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@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.