What is the difference between a one-tailed and a two-tailed test?
A two-tailed test looks for a difference in either direction; a one-tailed test looks only for an increase or only for a decrease. The one-tailed p-value is half the two-tailed one, so the direction must be decided before seeing data.
Explain it simply
A two-tailed test asks: has the average changed, up or down? A one-tailed test asks a narrower question: has it gone up? The one-tailed version puts the whole 5% of rejection area on one side, so it detects an increase more easily, but it can never flag a decrease.
Example
A courier firm claims average delivery time is 50 minutes. You time 8 deliveries: 52, 55, 49, 58, 51, 56, 54, 53 (mean 53.5).
from scipy import stats
d = [52, 55, 49, 58, 51, 56, 54, 53]
t, p = stats.ttest_1samp(d, 50)
print(round(t, 2), round(p, 4)) # 3.44 0.0109
print(round(p / 2, 4)) # 0.0054 (one-tailed, mean > 50)The two-tailed p is 0.0109. The one-tailed p for "slower than 50" is half, about 0.0054. Both are below 0.05 here, but with a borderline result the choice could flip the conclusion, which is why it must be fixed in advance.
What to say in the interview
"Two-tailed is the default when any difference matters. One-tailed is justified only when a change in the other direction is impossible or irrelevant, and it must be chosen before looking at the data. Switching to one-tailed afterwards to get below 0.05 is p-hacking."
Common mistakes
- Choosing one-tailed after seeing which direction the data points.