Christopher:

Don't do this!

 If I understand you correctly, you want FIsher's exact test. This is
already available in R, using far smarter algorithms then you would. See:

?fisher.test

-- Bert

On Sat, Dec 1, 2012 at 5:48 AM, Christofer Bogaso <
bogaso.christo...@gmail.com> wrote:

> Thanks John for your reply. However still not clear how I should proceed.
>
> My goal is to generate all possible contingency tables. Basically I want
> to see the distribution of Chi-squared Statistic under independence (NULL).
>
> So I was thinking if I can generate all possible permutation of integer
> numbers having sum equal to (8 + 10 + 12 + 6) = 36. Is there any R function
> to do that?
>
> Thanks and regards,
>
>
> On 01-12-2012 18:39, John Kane wrote:
>
>> Are you basically asking for all possible permutations of the table?  If
>> so see ?permn in the combinat package.
>>
>> John Kane
>> Kingston ON Canada
>>
>>
>>  -----Original Message-----
>>> From: bogaso.christo...@gmail.com
>>> Sent: Sat, 01 Dec 2012 18:10:15 +0545
>>> To: r-help@r-project.org
>>> Subject: [R] Getting all possible contingency tables
>>>
>>> Hello all,
>>>
>>> Let say I have 2-way contingency table:
>>>
>>> Tab <- matrix(c(8, 10, 12, 6), nr = 2)
>>>
>>> and the Chi-squared test could not reject the independence:
>>>
>>>   > chisq.test(Tab)
>>>
>>>           Pearson's Chi-squared test with Yates' continuity correction
>>>
>>> data:  Tab
>>> X-squared = 1.0125, df = 1, p-value = 0.3143
>>>
>>>
>>> However I want to get all possible contingency tables under this
>>> independence scenario (one of them would obviously be the given table
>>> as, we could not reject the independence), and for each such table I
>>> want to calculate the Ch-sq statistic.
>>>
>>> Can somebody help me how to generate all such tables?
>>>
>>> Thanks and regards,
>>>
>>> ______________________________**________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>> ______________________________**______________________________
>> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
>> family!
>> Visit 
>> http://www.inbox.com/**photosharing<http://www.inbox.com/photosharing>to 
>> find out more!
>>
>>
>>
>>
> ______________________________**________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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

Reply via email to