# What would be the right statistical test and why am I getting different results using Z-test and confidence intervals?

I am trying to determine whether the observed differences in the proportions for two samples are significantly different.

• 0-hypothesis: The proportions are the same for both samples
• Alternative hypothesis: The proportions are different.

These are the known factors:

• SampleSize1 = 200
• SampleSize2 = 1800
• SampleOccurrences1 = 90
• SampleOccurrences2 = 680
• SampleProportion1 = 45 %
• SampleProportion2 = 38 %

I conducted two different tests, but arrive at different conclusions.

Calculating confidence intervals (95 %)

I calculate the confidence interval for each of the samples using Excel:

z = 1.96 StdError = SQRT(SampleProportionX*(1-SampleProportionX)/SampleSizeX) MarginOfError = z * StdError Confidence interval = SampleProportionX +/- MarginOfError

As the confidence intervals are overlapping, I can't reject the 0-hypothesis.

Calculating the Z-value

I calculate the Z-value as follows:

p1 = SampleProportion1 p2 = SampleProportion2 p = (SampleOccurrences1 + SampleOccurrences2) / (SampleSize1 + SampleSize2)

Z = (SampleProportion1 - SampleProportion2) / SQRT(p*(1-p)*(1 / SampleSize1 + 1 / SampleSize2))

As Z > 1.96, I reject the 0-hypothesis.

Why do I get different results, and which test is the correct to use?

$$H_0: (p_1 - p_2) =0 \\ H_1: (p_1 -p_2) \neq 0$$