Purpose of the One-Sample t-Test
The one-sample t-test is used to determine whether the mean of one sample is significantly different from a known, expected, or hypothesized reference mean.
When is it appropriate?
- There is one sample.
- The dependent variable is continuous.
- The sample mean is compared with a specified value.
- Observations are independent.
- There are no serious outliers.
- The variable is approximately normally distributed.
Level of Significance
α = 0.05
Example 1 — Test Anxiety Score
1. State the Research Problem or Question
Research question: Is the mean test-anxiety score of the students significantly different from the reference score of 8?
This investigates whether the average test-anxiety score observed in one group of students differs from a specified benchmark.
2. Identify the Variables
| Variable | Test Anxiety Score |
|---|---|
| Role | Dependent / outcome variable being compared with a benchmark |
| Measurement Level | Continuous |
| Number of Groups or Conditions | One sample |
| Reference Value | μ₀ = 8 |
3. State the Hypotheses
H₀: μ = 8
H₁: μ ≠ 8
This is a two-tailed test because the question asks whether the mean is different from 8.
4. Set the Level of Significance
α = 0.05
5. Explain Why the Statistical Test Is Appropriate
- Number of groups/conditions: One sample is compared with one reference mean.
- Independent or related observations: Observations are independent because each score belongs to a different student.
- Measurement level: Test-anxiety score is treated as a continuous variable.
- Important assumptions: No significant outliers are observed, and the distribution is approximately normal.
- Normality evidence: Shapiro–Wilk W = 0.961, p = 0.560, so there is no significant evidence of non-normality.
6. Present the Python Results
Only the important output is presented. Lengthy manual computations are not required.
| Sample Size | n = 20 |
|---|---|
| Sample Mean | 8.53 |
| Standard Deviation | 0.61 |
| Reference Mean | 8.00 |
| Test Statistic | t = 3.916 |
| p-value | p = 0.0009 |
7. Make the Statistical Decision
Because p = 0.0009 < α = 0.05, reject H₀.
8. Interpret the Result
Example 2 — Programming Examination Score
1. State the Research Problem or Question
Research question: Is the mean programming examination score of the students significantly different from 85?
This investigates whether the average score of one group of BSIT students differs from the expected benchmark score of 85.
2. Identify the Variables
| Variable | Programming Examination Score |
|---|---|
| Role | Dependent / outcome variable being compared with a benchmark |
| Measurement Level | Continuous |
| Number of Groups or Conditions | One sample |
| Reference Value | μ₀ = 85 |
3. State the Hypotheses
H₀: μ = 85
H₁: μ ≠ 85
4. Set the Level of Significance
α = 0.05
5. Explain Why the Statistical Test Is Appropriate
- Number of groups/conditions: One sample is compared with a reference mean of 85.
- Independent or related observations: Each score comes from a different student, so the observations are independent.
- Measurement level: Examination score is treated as continuous.
- Important assumptions: No serious outliers are observed, and the scores are approximately normally distributed.
- Normality evidence: Shapiro–Wilk W = 0.965, p = 0.419.
6. Present the Python Results
| Sample Size | n = 30 |
|---|---|
| Sample Mean | 88.20 |
| Standard Deviation | 2.23 |
| Reference Mean | 85.00 |
| Test Statistic | t = 7.844 |
| p-value | p < 0.001 |
7. Make the Statistical Decision
Because p < α = 0.05, reject H₀.
8. Interpret the Result
Example 3 — Information-System Response Time
1. State the Research Problem or Question
Research question: Is the average system response time significantly different from 250 milliseconds?
This investigates whether the observed average response time of the system differs from the specified performance benchmark.
2. Identify the Variables
| Variable | System Response Time |
|---|---|
| Role | Dependent / outcome variable being compared with a benchmark |
| Measurement Level | Continuous |
| Number of Groups or Conditions | One sample |
| Reference Value | μ₀ = 250 ms |
3. State the Hypotheses
H₀: μ = 250 ms
H₁: μ ≠ 250 ms
4. Set the Level of Significance
α = 0.05
5. Explain Why the Statistical Test Is Appropriate
- Number of groups/conditions: One set of response-time observations is compared with a benchmark of 250 ms.
- Independent or related observations: Each recorded response is treated as an independent observation.
- Measurement level: Response time measured in milliseconds is continuous.
- Important assumptions: No significant outliers are observed, and the response times are approximately normal.
- Normality evidence: Shapiro–Wilk W = 0.979, p = 0.872.
6. Present the Python Results
| Sample Size | n = 25 |
|---|---|
| Sample Mean | 245.96 ms |
| Standard Deviation | 3.54 ms |
| Reference Mean | 250 ms |
| Test Statistic | t = −5.704 |
| p-value | p < 0.001 |
7. Make the Statistical Decision
Because p < α = 0.05, reject H₀.
8. Interpret the Result
Suggested Python Code
import pandas as pd
from scipy.stats import ttest_1samp, shapiro
data = pd.read_csv("data.csv")
scores = data["Score"]
print("Mean:", scores.mean())
print("Standard deviation:", scores.std())
print("Sample size:", len(scores))
w, p_normal = shapiro(scores)
print("Shapiro-Wilk W:", w)
print("Normality p-value:", p_normal)
t_stat, p_value = ttest_1samp(scores, popmean=85)
print("t-statistic:", t_stat)
print("p-value:", p_value)
Required Presentation Sequence
| Step | What Students Should Present |
|---|---|
| 1. State the research problem or question | Clearly explain what is being investigated. |
| 2. Identify the variables | Identify the relevant variables and their measurement levels. For comparison tests, indicate the groups or conditions being compared. |
| 3. State the hypotheses | Present the null hypothesis (H₀) and alternative hypothesis (H₁). |
| 4. Set the level of significance | Use α = 0.05, unless another level is justified. |
| 5. Explain why the statistical test is appropriate | Discuss the number of groups or conditions, whether observations are independent or related, the measurement level of the variables, and the important assumptions. Explain whether the assumptions are reasonably satisfied. |
| 6. Present the Python results | Report at least the test statistic and p-value. Include other useful values such as descriptive statistics, means, medians, or correlation coefficients when needed. Do not show lengthy manual computations. |
| 7. Make the statistical decision | Compare the p-value with α = 0.05 and state whether H₀ is rejected or not rejected. |
| 8. Interpret the result | Explain the result in ordinary language and in the context of the research problem. Do not simply say “significant” or “not significant.” |