I believe you are looking for a detailed construction of Fisher's Exact
Test.  I have an example
with code in my book and R package.

The book discussion is Section 15.2 of
Heiberger, Richard M., and Burt Holland (2004). Statistical Analysis and
Data
Display: An Intermediate Course with Examples in S-Plus, R, and SAS.
Springer--Verlag, New York.
http://springer.com/0-387-40270-5

Table 15.2 shows the full set of tables for the example.

The package is HH
install.packages("HH")
The code to construct Table 15.2 is in file
library/HH/scripts/Ch15-twtb.r
Search for the line:
## study the construction of the Fisher Exact test
and read through to the end of the glasses example.

Rich



On Sat, Dec 1, 2012 at 7:25 AM, Christofer Bogaso <
bogaso.christofer@gmail.com> wrote:

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

	[[alternative HTML version deleted]]


