We’ll use some data from a paper by Faaborg et al on bird populations in Puerto Rico. We’ll look at 9 species of warblers, and compare the number of birds captured in mist nests in 1991 and in 2005 to determine if on average birds are declining at this study site Show
Take alook at the dataframe; we have 3 columns, one with the names of the 9 species, one with the number caught in 1991, and one with the nubmer caught in 2005
Paired t-testIts a bit confusing, but there are multiple ways to do a paired t-test in R. (I can think about about 6, will focus on the 2 easiest ones). Paired t-tests are actually just a 1-sample t-test where the “1 sample” is a set of differnces between pairs of data points. Each one of our species has a pair of data points: abundance in 1991 and abundance in 2005. We can give R the raw data and t.test will calcaulte the differnce on the fly, or we can calculate the difference ourselvres. If we let R calcualte the difference, we must tell it that we are looking for a paired t-test by telling it “paired = TRUE”. If we calcualte the difference ourselvees we must tell it we want a 1-sample t-test, which is done by giving it a mean value against which to test the null hypothesis (“mu = 0”). Paired t-test, Version 1Paired t-test carried out by giving the t.test() function 2 columns from from a dataframe.
Paired t-test, Version 2Paired t-test as a 1-sample t-test on the difference between two columns.
Reporting the results of a paired t-testWhen we report a paired t-test we should give the p-value, the t statistic, and the degrees of freedom (df). NOte that for a paired t-test the df are equal to n-1, where n is the number of pairs in the data set (eg, the number of differences calculated), not the total number of seperate datapoinots. We shoudl also report the effect size, which for a paried t-test is mean difference between the pairs; we should also report the 95% confidence interval for the effect size. Here, the mean difference is 8.2, which means on average there were 8 fewer individuals of each species captured in 2005 versus 1991. The 95 CI around this difference is large, from -2.5 to 19. Since it contains 0.0, the p value is greater than 0.05. I would report the results of the t-test like this: “There was a marginally significant difference in the number of birds of the 9 species captured in 1991 versus 2005 (paired t-test: t = 1.76, df = 8, p = 0.12). The mean difference in the number captured between years was 8.2 birds (95%CI: -2.5 to 19).” The mean value of [variable of interest] (M = [Mean], SD = [standard deviation]) was significantly [higher, lower, or different] than the population mean; t(df) = [t-value], p = [p-value].We can use the following format to report the results of an independent two samples t-test:
We can use the following format to report the results of a paired samples t-test:
Note: The “M” in the results stands for sample mean, the “SD” stands for sample standard deviation, and “df” stands for degrees of freedom associated with the t-test statistic. The following examples show how to report the results of each type of t-test in practice. Example: Reporting Results of a One Sample T-TestA botanist wants to know if the mean height of a certain species of plant is equal to 15 inches. She collects a random sample of 12 plants and performs a one sample-test. The following screenshot shows the results of the test: Here’s how to report the results of the test:
Example: Reporting Results of an Independent Samples T-TestResearchers want to know if a new fuel treatment leads to a change in the average miles per gallon of a certain car. To test this, they conduct an experiment in which 12 cars receive the new fuel treatment and 12 cars do not. The following screenshot shows the results of the independent samples t-test: Here’s how to report the results of the test:
Example: Reporting Results of a Paired Samples T-TestResearchers want to know if a new fuel treatment leads to a change in the average mpg of a certain car. To test this, they conduct an experiment in which they measure the mpg of 12 cars with and without the fuel treatment. The following screenshot shows the results of the paired samples t-test: Here’s how to report the results of the test:
|