*45*

In statistics, there are three commonly used t-tests:

One Sample t-test: Used to compare a population mean to some value.

Two Sample t-test: Used to compare two population means.

Paired Samples t-test: Used to compare two population means when each observation in one sample can be paired with an observation in the other sample.

When performing each t-test, youâ€™ll have to calculate a test statistic and a corresponding **degrees of freedom**.

Here is how to calculate the degrees of freedom for each type of test:

**One Sample t-test: df = n-1** where *n* is the total number of observations.

**Two Sample t-test: df = n _{1} + n_{2} â€“ 2** where

*n*,

_{1}*n*are the total observations from each sample.

_{2}**Paired Samples t-test: n-1** where *n* is the total number of pairs.

The following examples show how to calculate the degrees of freedom for each type of t-test in practice.

**Example 1: Degrees of Freedom for One Sample t-test**

Suppose we want to know whether or not the mean weight of a certain species of turtle is equal to 310 pounds.

SupposeÂ we collect a random sample of turtles with the following information:

- Sample sizeÂ n = 40
- Sample mean weightÂ xÂ = 300
- Sample standard deviation s = 18.5

We will perform a one sample t-test with the following hypotheses:

- H
_{0}:Â Î¼ = 310Â (population mean is equal to 310 pounds) - H
_{A}:Â Î¼ â‰ 310Â (population mean is not equal to 310 pounds)

First, weâ€™ll calculate the test statistic:

t = (xÂ â€“ Î¼) / (s/âˆšn) = (300-310) / (18.5/âˆš40) =Â -3.4187

Next, **weâ€™ll calculate the degrees of freedom:**

df = n -1 = 40 â€“ 1 = 39

Lastly, weâ€™ll plug in the test statistic and degrees of freedom into the T Score to P Value Calculator to find that the p-value is **0.00149**.

Since this p-value is less than ourÂ significance level Î± = 0.05, we reject the null hypothesis. We have sufficient evidence to say that the mean weight of this species of turtle is not equal to 310 pounds.

**Example 2: Degrees of Freedom for Two Sample t-test**

Suppose we want to know whether or not the mean weight between two different species of turtles is equal.

SupposeÂ we collect a random sample of turtles from each population with the following information:

**Sample 1:**

- Sample sizeÂ n
_{1}= 40 - Sample mean weightÂ x
_{1}Â = 300 - Sample standard deviationÂ s
_{1}= 18.5

**Sample 2:**

- Sample sizeÂ n
_{2}= 38 - Sample mean weightÂ x
_{2}Â = 305 - Sample standard deviationÂ s
_{2}= 16.7

We will perform a two sample t-test with the following hypotheses:

- H
_{0}:Â Î¼_{1}Â = Î¼_{2}(the two population means are equal) - H
_{A}:Â Î¼_{1}Â â‰ Î¼_{2}(the two population means are not equal)

First, we will calculate the pooled standard deviation s_{p}:

s_{p} =Â âˆšÂ (n_{1}-1)s_{1}^{2}Â +Â Â (n_{2}-1)s_{2}^{2}Â /Â (n_{1}+n_{2}-2)Â =Â âˆšÂ (40-1)18.5^{2}Â +Â Â (38-1)16.7^{2}Â /Â (40+38-2)Â = 17.647

Next, we will calculate the test statisticÂ *t*:

t =Â (x_{1}Â â€“Â x_{2})Â /Â s_{p}(âˆš1/n_{1}Â + 1/n_{2}) =Â (300-305) / 17.647(âˆš1/40Â + 1/38) =Â -1.2508

Next, **weâ€™ll calculate the degrees of freedom:**

df = n_{1} + n_{2} â€“ 2 = 40 + 38 â€“ 2 = 76

Lastly, weâ€™ll plug in the test statistic and degrees of freedom into the T Score to P Value Calculator to find that the p-value is **0.21484**.

Since this p-value is not less than ourÂ significance level Î± = 0.05, we fail to reject the null hypothesis. We do not have sufficient evidence to say that the mean weight of turtles between these two populations is different.

**Example 3: Degrees of Freedom for Paired Samples t-test**

Suppose we want to know whether or not a certain training program is able to increase the max vertical jump (in inches) of college basketball players.

To test this, we may recruit a simple random sample of 20 college basketball players and measure each of their max vertical jumps. Then, we may have each player use the training program for one month and then measure their max vertical jump again at the end of the month.

To determine whether or not the training program actually had an effect on max vertical jump, we will perform a paired samples t-test.

First, weâ€™ll calculate the following summary data for the differences:

- x
_{diff}:Â sample mean of the differences =Â -0.95 - s:Â sample standard deviation of the differences =Â 1.317
- n:Â sample size (i.e. number of pairs) =Â 20

We will perform a paired samples t-test with the following hypotheses:

- H
_{0}:Â Î¼_{1}Â = Î¼_{2}(the two population means are equal) - H
_{A}:Â Î¼_{1}Â â‰ Î¼_{2}(the two population means are not equal)

Next, weâ€™ll calculate the test statistic:

t = x_{diff}Â / (s_{diff}/âˆšn)Â = -0.95 / (1.317/âˆš20) =Â -3.226

Next, **weâ€™ll calculate the degrees of freedom**:

df = n â€“ 1 = 20 â€“ 1 = 19

According to the T Score to P Value Calculator, the p-value associated with t = -3.226 and degrees of freedom = n-1Â = 20-1 = 19 isÂ **0.00445**.

Since this p-value is less than ourÂ significance level Î± = 0.05, we reject the null hypothesis. We have sufficient evidence to say that the mean max vertical jump of players is different before and after participating in the training program.

**Additional Resources**

The following calculators can be used to automatically perform t-tests based on data that you provide:

One Sample t-test Calculator

Two Sample t-test Calculator

Paired Samples t-test Calculator