 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)

# Paired t- test    #### Worked example 1

We will base our first example on a trial of a deworming drug against cyathostome worms in horses. The researchers infected each of twelve pony foals with 150,000 third-stage cyathostome larvae. Twenty-one days after infection the animals were assigned to replicates on the basis of their bodyweight. One animal from each replicate was then given a dose of ivermectin. The other animal of each replicate was left untreated as a control.

 Adult worms in lumen Replicate Untreated Treated Difference 123456 305202022024120142001762015660 3000100000 302202022024020142001762015660 Mean difference = 20323

The worm burdens at post mortem examination, 56 days after infection, are given here. Since observations are paired by weight category, the paired t- test is the appropriate statistical test. The null hypothesis is that the treatment has no effect, so the mean difference between paired observations would be zero. The alternative hypothesis is that treatment reduces the number of worms so we will be carrying out a one-tailed test.

But do your data meet the assumptions for the paired t- test?

For this you need to ask if the differences between treated and untreated are normally distributed. We have assessed this using QQ-plots (rankit plots would have been a better choice given the small sample size, but they are not available on most software packages)

The first plot suggests that the distribution is skewed. This was expected given that parasite numbers are generally overdispersed. Square root (√(Y+0.5)) and log (log10(Y+1)) transformations indicate that only the square root transformation will normalize this distribution - a log transformation will actually make the situation worse! This is problematic because the confidence interval for a difference cannot be interpreted on the detransformed scale for a square root transformation. Hence since the deviation from normality is not very great, we will carry out the analysis on both the untransformed data and square root transformed data.

Estimate t with (n − 1) degrees of freedom by subtracting the known parametric mean (in this case zero) from the sample mean, and standardizing the difference by dividing by the standard error.

 tdf = 5 = 20323 − 0 = 8.34 5969.4/√6

 Using R Paired t-test [untransformed] data: untreated and treated t = 8.3395, df = 5, p-value = 0.0002027 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 15412.65 Inf sample estimates: mean of the differences 20323.33 Paired t-test [square root (Y + 0.5) transformed] data: sqrt(untreated + 0.5) and sqrt(treated + 0.5) t = 23.3152, df = 5, p-value = 1.351e-06 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 124.7134 Inf sample estimates: mean of the differences 136.5116

A one-tailed comparison gives a P-value of 0.0002. If we apply the same test to square root transformed differences we get an even lower P-value of 0.000001. Hence our result with untransformed data is conservative. Notice that, if we double these P-values, both 2-tailed tests are still highly significant - and 2-tailed tests are less controversial than 1-tailed tests.

To avoid needless controversy, let us calculate 2-sided 95% confidence limits - on the basis that each limit is equivalent to a 1-sided 97.5% limit, and compatible with our 1-tailed alternate hypothesis (treatment reduces burden).

The normal approximation 95% confidence limits of the untransformed difference (20323) are given by:

20323 − (2.571 × 2437) = 14059
20323 + (2.571 × 2437) = 26588

The lower limit of which is equivalent to a one-sided 97.5% limit of 14059 (compared to the 1-sided 95% limit of 15412.65, given above).

None of our differences being negative, a square-root transformation is reasonable. The detransformed mean difference between pairs is 19978, and its detransformed normal approximation 95% confidence limits are 14396 to 26472.

In conclusion we can say the ivermectin treatment was associated with a highly significant reduction in the number of worms.

Although this statistical test is valid, it is only one way of looking at the data. We could for example use a quite different variable here, for example the proportion of ponies with any worms (a dichotomous variable). Here we would be comparing a proportion of 1.0 (for untreated) with 0.33 (for treated), a less dramatic improvement than if we use number of worms as the variable. #### Worked example 2

Our second worked example uses hypothetical data, but is based on results of an observational before-and-after study published by Thakur et al. (1998). Fifteen patients suffering from kala-azar are treated with sodium stibogluconate and pre- and post-treatment haemoglobin level of each patient is determined. The null hypothesis is that the treatment has no effect. The alternative hypothesis is that treatment affects the haemoglobin level so we will be carrying out a two-tailed test. Pre- and post-treatment levels are given in the table below:

 Pre- and post-treatment haemoglobin values (g/dl) for kala azar patients treated with sodium stibogluconate No. Pre Post No. Pre Post No. Pre Post 12345 7.36.87.34.85.6 9.18.67.19.69.7 678910 6.25.64.56.36.7 9.89.15.29.49.3 1112131415 5.46.86.57.78.3 4.910.16.310.210.9

Mean haemoglobin level was 6.39 g/dl pre-treatment and 8.62 g/dl post-treatment. This is a paired before-and-after study using a measurement variable, so the paired t-test should be an appropriate way to analyse the data. But before we examine the distribution of the differences, let us first look at the distributions of the pre and post treatment levels separately. Given the larger sample size we will use histograms for ease of interpretation: Clearly the distribution of the data has changed from something approximating to a normal distribution to a skewed distribution. This is not immediately relevant for a paired t-test because we are interested in the distribution of differences. But the change in distribution should prompt some serious thought about what is happening before proceeding to a statistical test.

In fact it turned out that that treatment was only effective (assessed by whether parasites are present) in 12 of the 15 patients. Patient numbers 8,11 and 13 are treatment failures and have to be treated again with another drug. In this situation it makes sense to not only investigate the overall impact of the drug on haemoglobin levels, but also examine the situation just for treatment successes.

The distributions of the differences for all patients and for treatment successes only are shown below: The distributions are not highly skewed, so with sample sizes of 12-15 we can probably rely on central limit theorem to validate the assumptions. Hence we estimate t with (n − 1) degrees.

#### All patients

 tdf = 14 = 2.233 − 0 = 5.263   P=0.0001 1.643/√15

The 95% normal approximation confidence interval of the difference is given by:

2.233 ± (2.131 × .4242) = 1.32 to 3.14 Using R Paired t-test [All patients] data: post and pre t = 5.2631, df = 14, p-value = 0.0001200 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.323217 3.143450 sample estimates: mean of the differences 2.233333

#### Treatment successes only

 tdf = 11 = 2.792 − 0 = 7.491   P=0.00001 1.291/√12

The 95% normal approximation one-sided confidence interval of the difference is given by:

2.792 − (2.201 × .3727) = 1.97 to 3.61 Using R Paired t-test [Treatment successes only] data: post2 and pre2 t = 7.4917, df = 11, p-value = 1.213e-05 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.971501 3.611832 sample estimates: mean of the differences 2.791667

In each case the treatment effect is highly significant (P<0.001). Therefore we can say that treatment with the drug is associated with an increased haemoglobin level in patients.

 Except where otherwise specified, all text and images on this page are copyright InfluentialPoints, all rights reserved. Images not copyright InfluentialPoints credit their source on web-pages attached via hypertext links from those images.