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)



Binomial test

Worked example I

Let us look at some hypothetical data based on research carried out on the effects of exposure to dioxin on the sex ratio of human births. Exposure of men to dioxin is linked to a lowered male/female sex ratio in their offspring, which may persist for years after exposure. If we found 1003 of 2017 births were male (that is 49.73%), can we accept that this is evidence for a lowered male to female ratio. Our null hypothesis is that the proportion of males is equal to 0.5.

The sample size is large with proportions close to 0.5 - hence the normal approximation test should be adequate. However, the exact P-value can be obtained using R - this comes out at 0.4032.

For the normal approximation test we first calculate the difference between our sample proportion (0.4973) and the parametric value (0.5) which is 0.0027. We then calculate the estimated variance of the expected proportion. For a sample size of 2003 this is pq/n = 0.5 × 0.5/2003 =0.0001248. The standard error is the square root of this which is 0.01117.

We then convert the difference between the proportions to a standard normal deviate by dividing it by the estimated standard error of the proportion under the null hypothesis. This gives us a z-score of 0.2417 standard normal deviates. For a one-sided test this has a P-value of 0.4045. Hence our result does not provide support for our alternative hypothesis of a lowered male/female sex ratio, and we accept the null hypothesis of no difference from a proportion of 0.5.

The normal approximation 95% confidence interval to the sample proportion is given by:

0.4973 ± 1.96 × 0.01117 = 0.4754 - 0.5192



Sign Test

Worked example II

Ten couples were questioned about their views on whether the husband should normally wear a condom. Each couple was rated + if the female was more in favour, − if the male was more in favour, or 0 if their views were the same.

Attitude of married couples towards the
husband using a condom on scale of 1-5
(1 = strongly against; 5 = strongly in favour)
Mr & Mrs Clinton51+
Mr & Mrs Bush42+
Mr & Mrs Thatcher24
Mr & Mrs Blair330
Mr & Mrs Yeltsin52+
Mr & Mrs Chiraq43+
Mr & Mrs Berlesconi51+
Mr & Mrs Gates32+
Mr & Mrs Castro32+
Under the null hypothesis there would be no difference in attitudes and the frequency of +'s and −'s would be the same. In the event we have 7 +'s and only 1 −. The frequency of zeros is not considered. We will test the alternative hypothesis that the wives are more in favour of their husbands wearing a condom than their husbands are (in other words a one-tailed test).

Since the number of observations is small (< 20) we use the exact test and work out the probability of getting as extreme an occurrence as 7 +'s out of a total of 8 observations. The probabilities of the observed result and of results more extreme are summed to give the required probability.

Alternatively we can use the mass probability function for the binomial distribution:
P   =   8! × 0.57 × 0.51   +   8! × 0.58 × 0.50  =  0.03125 + 0.00391  = 0.03516
7! × 1!8! × 0!

We conclude that we can reject the null hypothesis and accept the alternative hypothesis that these wives are more in favour of their husbands wearing condoms than are their husbands. Note, however, that the P-value is not very convincing probably because of the very small sample size. Also it could scarcely be called a random sample of couples, so we can only apply our conclusions to these particular couples.

Note that if our rating is consistent between couples, then we have lost information on the magnitude of the difference between each couple by using the sign test. If such information is meaningful, then the Wilcoxon matched pairs test covered in the next Unit is more powerful and hence is preferred.



McNemar's test for significance of change

Worked example I

Our worked example here is on the impact of a play about AIDS on the change of attitude of men towards wearing condoms. One hundred men are questioned about their attitude towards wearing condoms, and then again a week after seeing a play about the dangers of AIDS.

Attitude of men towards using condoms
before and after seeing an AIDS education play
Before playAfter play
AgainstIn favour
In favour1020

Ten men were against wearing condoms both before and after the play, 60 changed from 'against' to 'in favour', 10 changed from 'in favour' to 'against', and 20 were in favour both before and after the play. If we compare the percentage in favour before and after we get only 30% (30/100) in favour before the play and 80% (80/100) in favour after the play. This appears to be a major change in attitude, with the difference between paired proportions equal to 0.5. But is the change significant?

We compare only the number that changed from 'against' to 'in favour' with the number that changed in the opposite direction using McNemar's test for the significance of change.

Hence -

z   =    |60 − 10|− 1   =    5.857(P < 0.000001)
√(60 + 10)
Alternately estimate
X2 = 34.3 (P < 0.000001)

This change is clearly highly significant.

The standard error of the difference between proportions (0.5) is given by:

SE (difference between proportions)
  =    1 [ 60 + 10 − (60 − 10)2 ]   =  0.0671
100 100

Hence the 95% normal approximation confidence interval for the difference between proportions = 0.5 ± 1.96 × 0.0671 = 0.4329 − 0.5671.

Worked example II

Let us now consider a similar study but with rather different results:

Attitude of men towards using condoms
before and after seeing an AIDS education play
Before playAfter play
AgainstIn favour
In favour10290

Here the same percentage as before are in favour before the play (30%) but this only changed to 35% in favour after the play. The attitude of the majority of people (93% in fact), whether 'in favour' or 'against', has not been changed by the play. But because we only consider the people changing their views (for which the numbers are the same as before), we get exactly the same significance level (P < 0.000001) as above.

In order to properly interpret the results we must also look at the magnitude of the difference between proportions which in this case is only 0.05 compared to 0.5 in the previous table.

The standard error of this difference between proportions is given by:
1 [ 60 + 10 − (60 − 10)2 ]   =  0.0082
1000 1000

Hence the 95% normal approximation confidence interval for the difference between proportions = 0.05 ± 1.96 × 0.0082 = 0.0418 to 0.0582.

In other words the impact of the play was much less, but because we had a larger sample, we obtained the same P-value as before and a narrower confidence interval around the difference in proportions.



Cox and Stuart test for trend

Worked example I

We will take the results of Günther & Assmann (2004) that we use as an ecological example in this More Information page.
Total yearly catch of the beetle Carabus violaceus in eight pitfall traps over 9 years
Year1994 1995 1996 1997 1998 1999 2000 2001 2002
Catch129 33 52 208 482 400 351 450 305

Here we have 9 observations, so c = 10/2 = 5. Hence observations are paired as follows:
Carabid catches paired
with numbers caught 5 years later
YearsIncrease (+) or
Decrease (−)
We can then use the mass probability function for the binomial distribution to obtain the probability of getting 4 +'s and 0 −'s :

P(r = 0) = {4! × 0.50 × 0.54} / {0! × 4!} = 0.0625

Since we are doing a two-tailed test we have to double this to give a P-value of 0.125 which is not significant at the conventional P = 0.05 level.

Not that with such a small number of pairs of observations the test could never have come out significant, at least using conventional P-values and a two-tailed test.