Probably a very basic stats question:
I've applied the 2by2 (from the epiR library) function with the chisq.test to the same 2x2 contingency table but I get different X-squared and p-values.
I use the 2by2 function as it gives me the OR and it's 95% CI, which I don't see in the chisq.test result. But I expect them to both give the same X-squared and p-values.
Why the difference?
The data:
Infection NoInfection
Yes 6 36
No 50 1326
The output from 2by2 function:
Point estimates and 95% CIs:
-------------------------------------------------------------------
Inc risk ratio 3.93 (1.79, 8.66)
Odds ratio 4.42 (1.78, 10.97)
Attrib risk * 10.65 (0.02, 21.28)
Attrib risk in population * 0.32 (-1.10, 1.73)
Attrib fraction in exposed (%) 74.56 (44.00, 88.45)
Attrib fraction in population (%) 7.99 (-0.46, 15.73)
-------------------------------------------------------------------
Test that odds ratio = 1: chi2(1) = 12.191 Pr>chi2 = < 0.001
Wald confidence limits
CI: confidence interval
* Outcomes per 100 population units
The output from chisq.test function:
X-squared = 9.5446, df = 1, p-value = 0.002005