InfluentialPoints.com
Biology, images, analysis, design...
Use/Abuse Principles How To Related
"It has long been an axiom of mine that the little things are infinitely the most important" (Sherlock Holmes)

 

 

z-test for independent proportions

Worked example I

We take for our first example results of a trial in Uganda to compare the efficacy of two artemisinin combination therapies for the treatment of uncomplicated falciparum malaria. Children with the disease were randomized to receive either amodiaquine + artesunate or artemether - lumefantrine. Both treatments were similarly effective but the risk of recurrent malaria due to new infections appeared to differ:

Antimalarial
drug
Recurrent symptomatic malaria TotalsPropn affected
YesNo
Amodiaquine +
artesunate
841172010.4179
Artemether -
lumefantrine
551472020.2723
Totals139264 403 

No expected frequency is less than 5 so we will not use a continuity correction.

Using
 z  =   0.4179  −  0.2723   =   3.075
0.3449 × 0.6551 [   1     +     1   ]
   
201202

This has a P-value of 0.002 so we can reject the null hypothesis and accept that the proportions are significantly different. We therefore proceed to calculate the risk difference and its 95% normal approximation confidence interval.

SE (p1 − p2)   =  
0.4179 0.5821   +   0.2723 0.7277
201202
 = 0.0468
95% CI (p1 − p2)  =     0.1456 ± 1.96 0.0468
 =  0.0539 to 0.2373

We therefore obtain a risk difference of 14.6% with a 95% normal approximation confidence interval of 5.39% to 23.73%. The authors obtained a similar exact confidence interval (5.9% to 24.2%.) using the package STATA.

 

Worked example II

Our second example is the same as one we use for Pearson's chi square test. We stay with trials of antimalarials but here consider a fictitious trial to assess the side effects of two prophylactic drugs. Individuals with falciparum malaria are randomly allocated to two treatment groups - one group receives drug A and the other drug B. The proportion of patients suffering neuropsychiatric side effects is compared between drug A and drug B.
Antimalarial
drug
Neuropsychiatric reactions TotalsPropn affected
PresentAbsent
A3 (a)22 (b) 250.12
B9 (c)16 (d) 250.36
Totals1238 50 

As the smallest expected frequency is only 6.5 we will use the continuity correction to obtain a conventional P-value (although a mid-P-value would be perfectly acceptable).

Using
 z   =   |0.12  −  0.36|  −  (1/25 + 1/25)/2   =   1.6556
0.24 × 0.76 [   1     +     1   ]
   
2525

Note that if we square the z-value we obtained (1.6556) we get 2.7412, the value of Pearson's chi square statistic for these data.

This has a P-value of 0.098 indicating that the proportions are not significantly different at the conventionally accepted level of P = 0.05.

However, if you had not used the continuity correction, the z-value would have come out at 1.987, which would have indicated that the proportions were indeed (just) significantly different (P = 0.047). Similarly, if you had had any justification to use a one-tailed test (say there was already evidence that drug B produced more neuropsychiatric reactions), the test would have come out significant (P = 0.049).

Since statisticians differ over whether or not the correction should be used, the only conclusion one can draw is that drug B may have had a higher incidence of undesirable side effects. Do not fall into the trap of the P = 0.05 syndrome and believe that a value of 0.098 really tells you anything different from a value of 0.047. What the result is trying to tell you is that further trials should be carried out with a larger sample size and hence greater power to detect any real difference between the drugs.

 

Worked example III - a cautionary tale

Our last worked example is based on research carried out to investigate the seroprevalence of toxoplasmosis in pigs. Pigs were sampled from farms selected randomly from several distinct ecological zones of Ghana. This was therefore a comparative cross-sectional study. We will consider results from two zones - the coastal savannah and the forest belt. You wish to determine whether the proportions of pigs seropositive for Toxoplasma differ between the two zones.

 Toxoplasmosis TotalsPropn. infected
PositiveNegative
Coastal savannah94 120 214 0.43925
Forest belt39 89 128 0.30469
Totals133209 342 

Sample sizes and proportions are quite large, so the continuity correction is not used.

Applying the standard formula for the z-test to compare independent proportions:

Using

 z   =   0.43925 − 0.30469
0.61111 × 0.38889 [   1     +     1   ]
   
214128
     =   0.13456 / 0.05447 = 2.47035

This value of z is referred to the probability calculator on your software package which gives a P-value of 0.0135. If you square the z-value to get 6.1026, and refer it to the χ2 distribution with 1 df, you will obtain precisely the same P-value.

This would appear to indicate that the seroprevalence rate is significantly higher in the coastal savanna zone than in the forest. But our confidence in this statement depends on whether the assumptions of the statistical test were met. Unfortunately it seems that it is the farms that were sampled randomly, not the individual pigs. It is quite possible that in the coastal savanna many pigs came from just one farm with an unusually high rate. Hence we are not dealing with randomly selected independent samples, so our test is invalid.