For 1,000,000 observations, I observed a discrete event, X, 3 times for the control group and 10 times for the test group. How do I determine for a large number of observations (1,000,000), if three is statistically different than ten?
|
|
I think a simple chi-squared test will do the trick. Do you have 1,000,000 observations for both control and test? If so, your table of observations will be (in R code) Edit: Woops! Left off a zero!
And chi-squared test will be
Which returns chi-squared = 2.7692, df = 1, p-value = 0.0961, which is not statistically significant at the p < 0.05 level. I'd be surprised if these could be clinically significant anyway. |
|||||||||||||
|
|
The huge denominators throw off one's intuition. Since the sample sizes are identical, and the proportions low, the problem can be recast: 13 events occurred, and were expected (by null hypothesis) to occur equally in both groups. In fact the split was 3 in one group and 10 in the other. How rare is that? The binomial test answers. Enter this line into R: binom.test(3,13,0.5,alternative="two.sided") The two-tail P value is 0.09229, identical to four digits to the results of Fisher's test. Looked at that way, the results are not surprising. The problem is equivalent to this one: If you flipped a coin 13 times, how surprising would it be to see three or fewer, or ten or more, heads. One of those outcomes would occur 9.23% of the time. |
|||||
|
|
A (two-sided) Fisher's Exact test gives p-value = 0.092284.
For your example, try |
|||||
|
|
In this case Poisson is good approximation for distribution for number of cases. There is simple formula to approximate variance of log RR (delta method) . log RR = 10/3 = 1.2, se log RR = sqrt(1/3+1/10) = 0.66, so 95%CI = (-0.09; 2.5) It is not significant difference at 0.05 level using two-sided test. LR based Chi-square test for Poisson model gives p=0.046 and Wald test p=0.067. This results are similar to Pearson Chi-square test without continuity correction (Chi2 with correction p=0.096). Another possibility is chisq.test with option simulate.p.value=T, in this case p=0.092 (for 100 000 simulations). In this case test statistics is rather discrete, so Fisher test can be conservative. There is some evidence that difference can be significant. Before final conclusion data collecting process should be taken into account. |
|||
|
|
|
I would be really surprised if you find the difference statistically significant. Having said that you may want to use a test for a difference of proportions (3 out of 1M vs 10 out of 1M). |
|||
|
|
|
In addition to the other answers: If you have 1,000,000 observations and when your event comes up only a few times, you are likely to want to look at a lot of different events. If you look at 100 different events you will run into problems if you work with p<0.05 as criteria for significance. |
|||
|
|
|
If you wanted to check non-parametrically for significance, you could bootstrap the confidence intervals on the ratio, or you could do a permutation test on the two classes. For example, to do the bootstrap, create two arrays: one with 3 ones and 999,997 zeros, and one with 10 ones and 999,990 zeros. Then draw with replacement a sample of 1m items from the first population and a sample of 1m items from the second population. The ratio we're interested in is the ratio of "hits" in the first group to the ratio of "hits" in the second group, or: (proportion of ones in the first sample) / (proportion of ones in the second sample). We do this 1000 times. I don't have matlab handy but here's the R code to do it:
The output is: 5% 95% 0.0000000 0.8333333 and: 1% 99% 0.00 1.25 Since the 95% confidence interval doesn't overlap the null hypothesis (1), but the 99% confidence interval does, I believe that it would be correct to say that this is significant at an alpha of .05 but not at .01. Another way to look at it is with a permutation test to estimate the distribution of ratios given the null hypothesis. In this case you'd mix the two samples together and randomly divide it into two 1,000,000 item groups. Then you'd see what the distribution of ratios under the null hypothesis looks like, and your empirical p-value is how extreme the true ratio is given this distribution of null ratios. Again, the R code:
The output is ~ .0412 (of course this will vary run to run since it's based on random draws). So again, you could potentially call this significant at the .05 value. I should issue the caveats: it depends too on how your data was collected and the type of study, and I'm just a grad student so don't take my word as gold. If anyone has any criticism of my methods I'd love to hear them since I'm doing this stuff for my own work as well and I'd love to find out the methods are flawed here rather than in peer review. For more stuff like this check out Efron & Tibshirani 1993, or chapter 14 of Introduction to the Practice of Statistics by David Moore (a good general textbook for practitioners). |
|||
|