# Association between two proportions using p-value

I have two proportions and I need to see if they are associated somehow. The null hypothesis is that they are equal. I'm using R.

So I get the pooled proportion:

pp = (prop_1+prop_2)/(dim(dist_1)+dim(dist_2))


then the standard error:

se = sqrt((pp*(1-pp))/dim(dist_1)+(pp*(1-pp))/dim(dist_2))


then the z value:

z = ((prop_1-prop_2)-0)/se


and then p value:

pvalue = 2*(1-pnorm(abs(z)))


The problem is that using this formula the p value is 0 since the z value is too big. Should I use pt instead of pnorm in this case?

• No Atirag, it would not make sense to using the $t$-distribution (via pt). There's at least an asymptotic argument for using a normal distribution in this case; there isn't a good basis for using the $t$. [Your surprise at the smallness of the p-value is certainly not a good reason to use a different null distribution.] – Glen_b Jan 27 '15 at 3:59
+1 to @Harvey Motulsky. Let me add a quick note, just to address your explicit question. You should not use pt() instead of pnorm(). When you are working with normally distributed data, but you have to estimate the group SDs from the same data, you have to account for the fact that the SDs you are using are not exact. This 'inexactness' means that the sampling distribution will vary a little differently (and a little more widely) than the normal. In fact, the specific distribution is the $t$-distribution. That is why, with normally distributed data, we use $t$-tests, and to look up the $p$-value from a $t$-distribution, you use pt(). However, with binomial proportions, the SD is a function of the mean. Once you have estimated the proportion, you already have the SD; there isn't an extra source of uncertainty. Thus, you use pnorm().