9.1 Two Sample Mean T-Test for Dependent Groups
Dependent samples or matched pairs, occur when the subjects are paired up, or matched in some way. Most often, this model is characterized by selection of a random sample where each member is observed under two different conditions, before/after some experiment, or subjects that are similar (matched) to each other are studied under two different conditions.
There are 3 types of hypothesis tests for comparing two dependent population means µ1 and µ2, where, µD is the expected difference of the matched pairs.

Note: If each pair were equal to one another then the mean of the differences would be zero. We could also use this model to test with a magnitude of a difference, but we rarely cover that scenario, therefore we are usually test against the difference of zero.
The t-test for dependent samples is a statistical test for comparing the means from two dependent populations (or the difference between the means from two populations). The t-test is used when the differences are normally distributed. The samples also must be dependent.
Note we will usually only use the case where µD equals zero.
The subscript “D” denotes the difference between population one and two. It is important to compute D = x1 – x2 for each pair of observations. However, this makes setting up the hypotheses more challenging for one-tailed tests.
If we were looking for an increase in test scores from before to after, then we would expect the after score to be larger. When we take a smaller number minus a larger number then the difference would be negative. If we put the before group first and the after group second then we would need a left-tailed test μD < 0 to test the “increase” in test scores. This is opposite of the sign we associate for “increase.” If we swap the order and use the after group first, then the before group would have a larger number minus a smaller number which would be positive and we would do a right-tailed test μD > 0.
Always subtract in the same order the data is presented in the question. An easier way to decide on the one-tailed test is to write down the two labels and then put a less than symbol between them depending on the question. For example, if the research statement is a weight loss program significantly decreases the average weight, the sign of the test would change depending on which group came first. If we subtract before weight – after weight, then we would want to have before > after and use μD > 0. If we have the after weight as the first measurement then we would subtract the after weight – before weight and want after < before and use μD < 0. If you keep your labels in the same order as they appear in the question, compare them and carry this sign down to the alternative hypothesis.
The traditional method (or critical value method), the p-value method, and the confidence interval method are performed with steps that are identical to those when performing hypothesis tests for one population.
P-Value Method Example
Confidence Interval Method
Definition
A (1 – )*100% confidence interval for the difference between two population means with matched pairs: μD = mean of the differences.
\(\bar{D}-t_{\frac{\alpha}{2}}\left(\frac{s_{D}}{\sqrt{n}}\right)<\mu_{D}<\bar{D}+t_{\alpha / 2}\left(\frac{s_{D}}{\sqrt{n}}\right)\]
Or more compactly as
Where the t-distribution has degrees of freedom, df = n – 1, where n is the number of pairs.
Example 3
Hands-On Café records the number of online orders for eight randomly selected locations for two consecutive days. Assume the number of online orders is normally distributed. Find the 95% confidence interval for the mean difference. Is there evidence of a difference in mean number of orders for the two days?
Try it in XYZ Crunch
Build the paired interval instead of the test
The first link loads Thursday in L1 and Friday in L2; pick the matched-pairs interval at 95% to get (-3.4662, -0.0338) from D-bar = -1.75 and sD = 2.05287. The second link is the only lookup in the formula. Drop the level to 90% and watch the interval narrow while still missing 0 entirely -- the same verdict a two-tailed test would give.
Location
1 2 3 4 5 6 7 8
Thursday
67 65 68 68 68 70 69 70
Friday
68 70 69 71 72 69 70 70
Show solution
First set up the hypotheses. We are testing to see if Thursday Friday orders. The hypotheses would be:
H0: µD = 0
H1: µD ≠ 0
Next, compute the \(\frac{t_
ParseError: invalid DekiScript
(click for details)
Callstack: at (Bookshelves/Introductory_Statistics/Mostly_Harmless_Statistics_(Webb)/09:_Hypothesis_Tests_and_Confidence_Intervals_for_Two_Populations/9.01:_Two_Sample_Mean_T-Test_for_Dependent_Groups), /content/body/section[5]/div/table/div/p[4]/span, line 1, column 1
\) critical value for a 95% confidence interval and df = 7. Use the t-distribution with technology using confidence level 95%, lower tail area of /2 = 0.025 to get t
/2
= t
0.025
= ±2.36462. Compute the differences of Thursday – Friday for each pair.
| Thursday | 67 | 65 | 68 | 68 | 68 | 70 | 69 | 70 |
|---|---|---|---|---|---|---|---|---|
| Friday | 68 | 70 | 69 | 71 | 72 | 69 | 70 | 70 |
| D | –1 | –5 | –1 | –3 | –4 | 1 | –1 | 0 |
Use technology to compute the mean, standard deviation and sample size.
Note if you use a TI calculator then and sD = sx.
Find the interval estimate:
\(\begin{aligned}
&\Rightarrow-1.75 \pm 2.36462\left(\frac{2.05287}{\sqrt{8}}\right) \\
&\Rightarrow-1.75 \pm 1.7162.
\end{aligned}\)
Write the answer using standard notation –3.4662 < μD < –0.0335 or interval notation (–3.4662, –0.0338).
For an interpretation of the interval, if we were to use the same sampling techniques, approximately 95 out of 100 times the confidence interval (–3.4662, –0.0338) would contain the population mean difference in the number of orders between Thursday and Friday.
Since both endpoints are negative, we can be 95% confident that the population mean number of orders for Thursday is between 3.4662 and 0.0338 orders lower than Friday.
Excel: Type in both samples in two adjacent columns, and then subtract each pair in a third column and label the column Difference.
| Thursday | Friday | Difference |
|---|---|---|
| 67 | 68 | =A2-B2 |
| 65 | 70 | =A3-B3 |
| 68 | 69 | =A4-B4 |
| 68 | 71 | =A5-B5 |
| 68 | 72 | =A6-B6 |
| 70 | 69 | =A7-B7 |
| 69 | 70 | =A8-B8 |
| 70 | 70 | =A9-B9 |
Select Data > Data Analysis > Descriptive Statistics and click OK.

Select the Difference column for the input range including the label, then check the box next to Labels in first row (do not select this box if you did not highlight a label in the input range). Use the default new worksheet or select a single cell for the Output Range where you want your top left-hand corner of the table to start. Check the boxes Summary Statistics and Confidence Level for Mean. Change the confidence level to fit the question, and then select OK.

You get the following output:

The confidence interval is the mean ± margin of error. In two different cells subtract and then add the margin of error from the mean to get the confidence interval limits and then put your answer in interval notation (–3.4662, – 0.0338).
TI-84: First, find the differences between the samples. Then on the TI-83 press the [STAT] key, arrow over to the [TESTS] menu, arrow down to the [8:TInterval] option and press the [ENTER] key. Arrow over to the [Data] menu and press the [ENTER] key. The defaults are List: L1, Freq:1. If this is set with a different list, arrow down and use [2nd] [1] to get L1. Then type in the confidence level. Arrow down to [Calculate] and press the [ENTER] key. The calculator returns the confidence interval, and sD = sx.
TI-89: First, find the differences between the samples. Go to the [Apps] Stat/List Editor, then enter the differences into list 1. Press [2nd] then F7 [Ints], then select 2: T-Interval. Select the [Data] menu. Enter in List: list1, Freq:1. Then type in the confidence level. Press the [ENTER] key to calculate. The calculator returns the confidence interval, and sD = sx.
Adapted from Mostly Harmless Statistics by Rachel Webb (Portland State University), hosted on LibreTexts (stats.libretexts.org) and licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.