I am trying to do a chi-square test of independence on two samples of counts. You can download the data from here (just click the "download" button):
http://www.wikiupload.com/XFEGRHE8B0ECSJU
http://www.wikiupload.com/M9BTIKQIF4BHSIC
Sample 1 and sample 2 are from different populations. You should just treat them as two categories. For the first csv file, I ran chisq.test in R on sample1 and sample2 directly.
chisq.test(chi.test1, simulate.p.value=T)
and the result is the Null hypothesis rejected:
Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
data: chi.test1
X-squared = 6067.4, df = NA, p-value = 0.0004998
However, if I ran the same test on the second .csv file, where I compare sample1 with the sum of sample 1 and sample 2. Then the null cannot be rejected and p-value is 1. I got the same results if I compare sample2 and the sum.
Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
data: chi.test2
X-squared = 3948.316, df = NA, p-value = 1
The results here seem counter-intuitive: if the distribution is independent of the sample we choose, why would we obtain different results when we use combinations of samples? And how do we interpret the results? It seems that I made a mistake here but I don't know what exactly it is.
Thank you in advance!