A t-test is a statistical test that is used to:
- compare the means of two groups
- determine whether a process or treatment actually has an effect on
the population of interest, or whether two groups are different from
one another
Page 1 of 11
The t test assumes your data:
1. are independent
2. continuous or ordinal scale
3. are (approximately) normally distributed
4. have a similar amount of variance within each group being
compared (a.k.a. homogeneity of variance)
When choosing a t test:
• If the groups come from a single population (e.g., measuring
before and after an experimental treatment), perform
a paired t test.
• If the groups come from two different populations (e.g., two
different species, or people from two separate cities), perform
a two-sample t test/ independent t test
• If there is one group being compared against a standard value
(e.g., comparing the acidity of a liquid to a neutral pH of 7),
perform a one-sample t test.
Which type of test:
• If you only care whether the two populations are different from one
another, perform a two-tailed t test.
• If you want to know whether one population mean is greater than
or less than the other, perform a one-tailed t test.
Page 2 of 11
Presenting the results of a test:
Table: Comparison of [dependent variable] of [Group 1] and [Group 2]
Sample Std. Mean p-
Group Mean 𝑡𝑐 df
Size Dev. Difference value
Group 1
Group 2
ns – not significant at 5% level
** significant at 5% level
One-sample t-test:
1. Imagine we have collected a random sample of 31 energy bars from
a number of different stores to represent the population of energy
bars available to the general consumer. The labels on the bars claim
that each bar contains 20 grams of protein.
Table 1: Grams of protein in random sample of energy bars
Energy Bar - Grams of Protein
25.79 27.46 22.15 19.85 21.29 24.75
20.75 22.91 25.34 20.33 21.54 21.08
22.14 19.56 21.10 18.04 24.12 19.95
19.72 18.28 16.26 17.46 20.53 22.12
25.06 22.44 19.08 19.88 21.39 22.33
✓ data values are independent
✓ measurements are continuous (in grams)
✓ sample is normally distributed
Page 3 of 11
Null hypothesis: population mean is equal to 20
Alternative hypothesis: population mean is NOT equal to 20
Performing t-test:
https://www.socscistatistics.com/tests/tsinglesample
Page 4 of 11
Example 2: A manufacturing engineer wants to know if some new
process leads to a significant improvement in mean battery life of some
product. To test this, he measures the mean battery life for 50 products
created using the new process
Battery Life (hrs)
504.99, 505.31, 505.36, 505.36, 506.02, 506.22, 507.25, 507.43,
507.60, 507.66, 507.66, 507.66, 508.62, 508.87, 509.18, 509.20,
509.29, 510.43, 511.57, 511.75, 512.92, 513.52, 513.93, 514.23,
514.97, 515.09, 515.43, 515.65, 516.48, 517.12, 517.67, 517.91,
518.94, 519.13, 520.37, 520.47, 520.62, 520.65, 525.23, 525.79
Null Hypothesis: The mean battery life of the new process is the same
as the mean battery life of the current process.
Alternative Hypothesis: The mean battery life of the new process is
different from the mean battery life of the current process.
Note: This is a two-tailed test since we are testing whether the new
process results in a significant difference, rather than specifically an
improvement or a decline.
Page 5 of 11
Paired (Dependent) t-test:
Example 3: Suppose we want to know whether a certain study program
significantly impacts student performance on a particular exam. To test
this, we have 20 students in a class take a pre-test. Then, we have
each of the students participate in the study program for two weeks.
Then, the students retake a test of similar difficulty.
Data is continuous and independent
Perform normality test:
https://www.statskingdom.com/shapiro-wilk-test-calculator.html
Page 6 of 11
Pre-test
Post-test:
Page 7 of 11
Perform paired t-test:
Page 8 of 11
Table 1: Comparison of pre-test and post-test
Sample Std. Mean p-
Group Mean 𝑡𝑐 df
Size Dev. Difference value
Pre-test 20 82.0 18.42
5.2 1.455𝑛𝑠 19 0.162
Post-test 20 87.2 5.85
ns – not significant at 5% level
Example 4:
Page 9 of 11
Independent t-test:
Example 5: A study aims to determine if there is a significant difference
in test scores between students who received in-person instruction and
those who received online instruction.
Number of Student In-Person Scores Online Scores
1 82.48 75.78
2 79.31 66.94
3 83.24 77.63
4 87.62 70.80
5 78.83 72.96
6 78.83 70.79
7 87.90 87.97
8 83.84 74.91
9 77.65 67.60
10 82.71 80.76
Example 6: In the Applied Statistics course, two sections, 1BSF-A
(Bachelor of Science in Fisheries) and 1BSA-A (Bachelor of Science in
Agriculture), took the same final exam. The instructor wants to
determine whether there is a significant difference in their academic
performance.
Number of Student 1BSF-A Scores 1BSA-A Scores
1 84.98 81.48
2 81.17 77.03
3 85.89 82.53
4 91.14 88.66
5 80.60 76.36
6 80.60 76.36
7 91.48 89.05
8 86.60 83.37
9 79.18 74.71
10 85.26 81.80
Page 10 of 11
1. Is there a significant difference in the average test scores of 1BSF-A
and 1BSA-A?
2. Do students from one section perform significantly better than the
other?
Attendance (Lecture on March 11, 2025)
Present – 36 (Group 1)
Absent – 12 (Group 2)
Individual Task
Instructions:
1. Solve/Answer the assigned problem(s) based on
your group:
Group 1: Example 5
Group 2: Examples 2, 4, and 6
2. Ensure that your solutions are well-organized and
complete.
3. Perform the appropriate statistical analysis for each
problem, where applicable.
4. Your submission may be either computerized or
handwritten.
5. Submit your completed problem set after the
midterm exam.
Page 11 of 11