1

When using prop.test() in R, I noticed that changing my confidence interval does not impact the p value. I use correct = FALSE, conf.level = 0.95, alternative = "two-sided" as parameters in prop.test().

Here, I use 95% CI.

    2-sample test for equality of proportions without continuity correction

data:  c(332, 307) out of c(382, 333)
X-squared = 5.2235, df = 1, p-value = 0.02228
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.097245583 -0.008378365
sample estimates:
   prop 1    prop 2 
0.8691099 0.9219219

Here, I use 99% CI, however, the p-value is the same:

     2-sample test for equality of proportions without continuity correction

data:  c(332, 307) out of c(382, 333)
X-squared = 5.2235, df = 1, p-value = 0.02228
alternative hypothesis: two.sided
99 percent confidence interval:
 -0.111207635  0.005583686 
sample estimates:
   prop 1    prop 2 
0.8691099 0.9219219

I would presume then the p-value is calculated from the X-squared test statistic, which doesn't incorporate confidence intervals in its calculation? I'd love clarification on this. The similar posts I found on StackExchange included a warning error in the output about the chi-square test possibly being incorrect, which my output did not include.

My second question would be that the 99% CI now includes 0. How, then, can we have a p value < 0.05?

grantog
  • 33
  • 7

1 Answers1

1

The $p$-value is for the test that the two proportions are equal. You can then make that test at whatever significance level you like by seeing whether the $p$-value is less than your chosen criterion value.

The $p$-value is less than 0.05 but not less than 0.01 so it is consistent with the confidence intervals. The 95% one does not include zero, the 99% one does.

mdewey
  • 16,541
  • 22
  • 30
  • 57
  • Thank you, that makes sense and is now obvious reading your response. Probably just being too deep in code/stats and needed to step back and look at it. Thanks! – grantog Dec 06 '17 at 17:33