Solved – Test whether difference in proportions differs from a non-zero constant

hypothesis testingproportion;

I am using the prop.test function in R to test the differences of proportions against the alternative that the difference of the two proportions are significantly different from zero, however I wish to perform the same test, but instead of testing if they are significantly different from zero I want to test if they are different from some constant (lets say C) where more often then not C is not equal to 0.

Does anyone know of a function in R to do this?

Best Answer

The standard formula for testing equality of 2 proportions (using the normal approximation) uses a pooled estimate of the proportion that is appropriate when the null of equal proportions is true. In your case the proportions are not equal, so the pooled proportion is not appropriate.

One option is that you can code the formula that does not pool the proportion, then compute the p-value, etc. from the normal approximation.

Another option is to just use prop.test but ignore the p-value part and look to see if the confidence interval includes the C value that you are interested in. If C is not in the interval then that is equivalent to rejecting the null and if C is in the interval then that is equivalent of a p-value greater than alpha (not enough evidence to reject). You don't get an exact p-value, but you get the same decision.

Related Question