2
$\begingroup$

I have N objects which can have either 1 or both properties, A & B. I want to know if having property A raises the chance of having property B.

My data is:

data

Where S means they have the property, and N means they dont (ie, 263 objects have A & B, while 188 have B but not A).

What is the correct test to see whether having property A raises the chance of having property B?

I guess I can just use a 2 proportion test , but I feel like theres somethnig more specialized to this problem...

Thanks!

$\endgroup$

1 Answer 1

3
$\begingroup$

You can certainly use a two sample proportions test.

Indeed, since it sounds like your alternative is one tailed, that's probably what you want; the other common choice - the chi-square - doesn't do one-tailed alternatives.

For small samples, you could use the fact that (given the usual assumptions, at least) the proportions are discrete. Depending on whether you condition on one margin or both, either binomial or hypergeometric. [However, it's actually a bit tricky to do the calculations if you avoid conditioning on the second margin when computing the discrete distribution; there are a couple of approaches to doing it which I won't explore here].

For larger samples (where 'large' is actually pretty small for this problem) you could use the normal approximation (possibly with continuity correction).

Your example numbers are easily large enough to use the normal approximation.

Example of the calculations, on those numbers:

      A   notA  Tot
   B 263  188   451
notB 172  231   403
 Tot 435  419   854

What is the correct test to see whether having property A raises the chance of having property B?

This is equivalent to considering the following hypothesis:

Let $\pi_B$ be the population proportion with property B, $\pi_{B|A}$ be the population proportion with property B among those with property A, and $\pi_{B|\bar A}$ be the population proportion with property B among those without property A,

$H_0:\, \pi_{B|A} = \pi_{B|\bar A} = \pi_B $ vs

$H_{a^1}:\, \pi_{B|A} > \pi_{B|\bar A}$ (for a one tailed test)

$H_{a^2}:\, \pi_{B|A} \neq \pi_{B|\bar A}$ (for a two tailed test)

Let $p_B$ (etc) be the corresponding sample proportions.

Then $Z = \frac{p_{B|A}-\, p_{B|\bar A}}{\sqrt{\text{Var}_0(p_{B|A}-\, p_{B|\bar A})}}$ is a suitable test statistic.

The usual pooled estimate of the variance is:

$\text{Var}_0(p_{B|A}-\, p_{B|\bar A}) = p_B(1-p_B)(\frac{1}{n_{A}} +\frac{1}{n_{\bar A}})$

(which under $H_0$ should be the best estimate of the variance of the numerator), though some packages use the unpooled estimate:

$\text{Var}(p_{B|A}-\, p_{B|\bar A}) = p_{B|A}(1-p_{B|A})/{n_{A}} +p_{B|\bar A}(1-p_{B|\bar A})/{n_{\bar A}}$

From the above data,

$p_B = 451/854 $, $ $ $p_{B|A} = 263/435 $, $ $ $p_{B|\bar A} = 188/419 $

$n_{A} = 435$, $ $ $n_{\bar A} = 419$

$\text{Var}_0(p_{B|A}-\, p_{B|\bar A}) = \frac{451}{854} \frac{403}{854} (\frac{1}{435} +\frac{1}{419})=0.001168$

without continuity correction,

$Z = \frac{263/435-\, 188/419}{\sqrt{0.001168}} = 4.56$

The one tailed p-value for which is $2.53\times 10^{-5}$ (the two tailed p-value is twice that)

(with continuity correction, Z = 4.494)

You'd reject $H_0$ and conclude that property B is more likely with property A than without it.

$\endgroup$
3
  • $\begingroup$ Thanks Glen! So my input proportions will be: P(B)=[n1/N1]=total objects w/ propertyB/total objects = 451/854. P(B|A)=[n2/N2]=total objects w/ propertyA&B/total objects w/ propertyA = 263/435 $\endgroup$ Commented Dec 3, 2013 at 21:42
  • $\begingroup$ Thanks Glen! And would I be correct to be the shift estimate (or how much more likely B is given A if P(B|A)-P(B) (or would it be P(B|A)-P(B|A') ? $\endgroup$ Commented Dec 3, 2013 at 23:20
  • $\begingroup$ DankMasterDan -- It depends on what population shift you want to estimate. Normally, it would be the second of those two. If you want an interval for that shift, the second of the two variance terms I gave would be appropriate for the calculation (we're no longer assuming the null, we're estimating the difference). Further, if you want your test and interval to correspond, you'd then shift your test to using that variance as well. $\endgroup$
    – Glen_b
    Commented Dec 3, 2013 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.