# How to test for equality of means for proportions? And two-sided or one-sided?

I have the following problem: two groups A and B.

The proportions of married and single are ($p_1$) and ($p_2$) respectively, and the standard deviations ($s_1$) and ($s_2$). The sample consists of ($n_1$) A and ($n_2$) B observations.

Now I want to test whether the proportions are equal. I use the following formula to compute the z-statistic:

z = $abs(p_1 - p_2) / \sqrt{ \frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2} }$

and test the hypothesis: h0: $p_1 \neq p_2$

An alternative approach I tried is to estimate the t-value based on the standard deviations (hence just comparing means), that is by the formula (assuming unequal variances):

t = $abs(p_1-p_2)/\sqrt{ s_1^2/n_1 + s_2^2/n_2 }$

My question are:

1. do you agree with my approach or;
2. should it be two-sided or one-sided?

Thank you.

• Why "should" the outcome be 0.610? – Stephan Kolassa Nov 16 '12 at 16:45

here's what R's prop.test (Test of Equal or Given Proportions) says:

> p = c (0.559, 0.555)
> n <- c(16753, 5378)
> n*p
[1] 9364.927 2984.790
> prop.test (round (n*p), n)

2-sample test for equality of proportions with continuity correction

data:  round(n * p) out of n
X-squared = 0.2437, df = 1, p-value = 0.6215
alternative hypothesis: two.sided
95 percent confidence interval:
-0.01141974  0.01935036
sample estimates:
prop 1    prop 2
0.5590044 0.5550390


So far, I cannot see any reason in your question why $p_{Single}$ cannot be larger than $p_{Married}$.
Obviously, neither did you specify the alternative hypothesis that $p_{Married} > p_{Single}$ beforehand (there'd not be any discussion about it now).
So unless you/your prof can give a hard reason why $p_{Married} \leq p_{Single}$ (like a law that Singles are allowed to enter the group only if they bring each at least one Married who is not yet member into the group), the test should be two-sided.

Deciding for "larger" afterwards just because the observed $p_{Married}$ happens to be a bit larger than the observed $p_{Single}$ at the third digit is cherry-picking.

The "simple" way to analyse these data would be the chi-squared test (as walked through by cbeleites in R, and available in pretty much any stats package or web-based calculator like www.openepi.com.)

But in a large sample where the event is not rare (true here where $p \approx 0.5$), we'd expect the z-test to provide a reasonable approximation for the chi-squared test (in terms of p-value for the hypothesis test).

There is often some confusion on two-tailed vs. one-tailed tests for comparing proportions -- while your alternative hypothesis is usually a two-tailed one ($p1 \neq p2$) rather than a one-tailed one (e.g. $p1$ $>$ $p2$) the chi-squared distribution is really a one-sided distribution. I hope someone might be able to explain this latter point more clearly than I can :-)