InfluentialPoints.com Biology, images, analysis, design... 

"It has long been an axiom of mine that the little things are infinitely the most important" 

Binomial and related testsOn this page: Binomial test Sign Test McNemar's test for significance of chang Cox & Stuart test for trendBinomial testWorked example ILet 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 The sample size is large with proportions close to 0.5  hence the normal approximation test should be adequate. However, the exact Pvalue can be obtained using R  this comes out at 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 zscore of The normal approximation 95% confidence interval to the sample proportion is given by:
Sign TestWorked example IITen 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.
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 onetailed 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
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 Pvalue 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
McNemar's test for significance of changeWorked example IOur 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.
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 Hence 
This change is clearly highly significant. The standard error of the difference between proportions (0.5) is given SE (difference between proportions)
Hence the 95% normal approximation confidence interval for the difference between proportions = 0.5 ± 1.96 × 0.0671 = 0.4329 − 0.5671. Worked example IILet us now consider a similar study but with rather different results:
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:
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 Pvalue as before and a narrower confidence interval around the difference in proportions.
Cox and Stuart test for trendWorked example IWe will take the results of Günther & Assmann
Here we have 9 observations, so c = 10/2 = 5. Hence observations are paired as follows:
We can then use the mass probability function for the binomial Since we are doing a twotailed test we have to double this to give a Pvalue 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 Pvalues and a twotailed test.
