A service team has a target mean visit duration of 22 minutes, fixed before any data were collected. A sample of 25 independently measured visits averages 24 minutes with a sample standard deviation of 5 minutes. Two minutes above the target could reflect a real shift in the population mean or only the ordinary variation of a sample mean, and the population standard deviation is unknown. This lesson builds the one-sample t test for that question, separates the size of the difference from the strength of the evidence, and shows how the test and the matching confidence interval answer the same question.
Key terms
One-sample t test
Definition Let , with , be observations from a population with mean , and let be a benchmark fixed without using these observations. The one-sample t test tests against an alternative chosen before the data are seen, either the two-sided or one of the one-sided and . It computes the t statistic of the next card and, with a random variable having the t distribution with degrees of freedom, reports the p-value for the chosen alternative.
| Alternative | p-value |
|---|---|
These p-values are exact when the observations are independent draws from a normal population. For independent draws from other populations they are approximations, whose quality the card on conditions discusses.
In plain words The test asks whether the sample mean sits farther from the benchmark than the sampling variation of a mean would ordinarily produce, with that variation estimated from the same sample. The alternative is part of the question, so it is chosen in advance.
Example For the visits, , minutes, minutes and minutes, and the next card finds with degrees of freedom. With the two-sided alternative the p-value is , so a test at does not reject. That does not show that , since the data are also compatible with means a few minutes above it. Had the question fixed in advance been whether , the p-value would be the upper tail , and the test at would reject. The lower alternative would give . These numbers answer three different questions, and choosing the smallest after seeing the data is not a valid test.
t statistic
Definition For a sample of size with mean and sample standard deviation , computed with the denominator, the t statistic for the benchmark is
where is the estimated standard error of the sample mean. If the observations are independent draws from with , the statistic, viewed as a random variable, has the t distribution with degrees of freedom, written . This distribution is symmetric about , has heavier tails than for every finite number of degrees of freedom, and approaches as the degrees of freedom grow. The count is because the deviations always sum to zero, so the standard deviation rests on only freely varying deviations.
In plain words The t statistic counts how many estimated standard errors separate the sample mean from the benchmark. Because the denominator is estimated from the same sample, the statistic varies more than it would with a known , and the heavier tails of the t distribution account for that extra variation.
Example For the visits,
with degrees of freedom. The minutes describe how much individual visits vary, and the minute describes how much the mean of visits varies from sample to sample. Reading against instead of would give the two-sided p-value instead of and would reject at , a conclusion that ignores the uncertainty in . The matching critical values are for the normal distribution and about for .
Conditions for the one-sample t test
Definition The p-values of the one-sample t test are exact when three conditions hold. The observations are independent, they come from a single normal population with unknown standard deviation , and is a fixed number chosen without using the sample. Without normality the test is approximate. For independent observations from one population with finite positive variance, the distribution of the t statistic under approaches as grows, and so does , so the p-values become accurate for large enough samples. How large depends on the population, and strong skewness or heavy tails call for larger samples, especially for one-sided tests. Independence, and the link between the sample and the population it is meant to describe, come from how the data were collected.
In plain words The normal model matters most when the sample is small, and a plot of the data can reveal skewness or outliers that make it doubtful. No plot can show that the observations are independent or that they represent the population of interest. The benchmark must be a fixed target, not another estimate with its own uncertainty.
Example Suppose the visit records came from customers with visits each, and visits by the same customer tend to have similar durations. The records are then not independent observations, and understates the uncertainty of the mean. If the customers were sampled independently, one analysis that respects the dependence uses the customer means as the observations, with degrees of freedom. If instead the minutes were the mean of an earlier sample of visits, the question would compare two estimates and would call for a two-sample comparison.
Standardized mean difference
Definition For a one-sample comparison with benchmark , the standardized mean difference is
the difference between the sample mean and the benchmark in units of the sample standard deviation of individual observations. It estimates the population quantity . It has no units, its sign gives the direction of the difference, and it is related to the t statistic by
Because estimates a fixed population quantity, more data make it more precise rather than larger, while tends to grow like whenever .
In plain words The t statistic measures how clearly the data separate the mean from the benchmark, and the standardized difference measures how big the gap is compared with the spread of individual values. Report the raw difference in its original units as well, because whether a gap matters depends on the setting, not on a universal scale.
Example For the visits, , so the sample mean lies standard deviations of individual visits above the target, and . The raw difference is minutes. Whether a -minute delay is important depends on the service, for example on how long customers wait or how many visits fit into a day, and neither nor can decide that.
Duality of tests and confidence intervals
Definition For a level with , the two-sided percent t interval for is
where is the quantile of the t distribution with degrees of freedom. For every benchmark , the two-sided one-sample t test of on the same data has exactly when lies strictly inside this interval, exactly when is an endpoint, and exactly when lies outside. The interval is therefore the set of benchmarks that the test at level does not reject, apart from the two endpoints, where the decision depends on the rule for . The match needs the same data, model, standard error, degrees of freedom, level and sidedness. A one-sided test against at level matches the one-sided lower confidence bound instead.
In plain words Apart from its two endpoints, a confidence interval lists the benchmarks that the matching test would not reject, so one calculation answers both whether a particular value is compatible with the data and which values are. The interval also shows the whole range of means compatible with the data under this procedure, which a p-value alone does not.
Example With and a standard error of minute, the percent interval is
The benchmark lies inside, matching . A benchmark of minutes lies outside, and its test gives and . The interval estimates the population mean, so it is not a range meant to hold percent of individual visit times. The percent describes how often the procedure captures over repeated samples, not a probability that this particular interval contains it.
Check yourself
- A second sample of independent observations has mean and sample standard deviation , and the fixed benchmark is . Assuming the conditions hold, find the standard error, the t statistic, its degrees of freedom and the standardized mean difference. Then use to decide whether the two-sided test at the percent level rejects, and find the matching interval.
Show the answer
The standard error is , so
with degrees of freedom, and the standardized mean difference is . Since , the two-sided test at the percent level does not reject, and software gives the p-value . The matching interval is , which contains , as duality requires. The negative sign says the sample mean is below the benchmark, while the two-sided p-value uses only the size of . Not rejecting does not show that , because the interval also contains means as low as about .
- Suppose the visit study had measured independent visits with the same mean of minutes and the same standard deviation of minutes. Find the t statistic and the standardized mean difference and compare them with the sample of . Software gives the two-sided p-value .
Show the answer
The standard error is minutes, so with degrees of freedom, while is unchanged. The relation gives . The larger sample locates the mean more precisely, and the percent interval narrows to about minutes. The evidence against is much stronger, but the estimated difference is the same minutes. A smaller p-value does not make the delay larger or more important.
- Before collecting the visits, the team planned a one-sided test of against at . The p-value leads to rejection, yet the two-sided percent interval contains . A colleague calls this a contradiction. Resolve it, using .
Show the answer
There is no contradiction, because the two procedures answer different questions. The one-sided test at matches the one-sided percent lower confidence bound
and lies below it, in agreement with the rejection. The two-sided percent interval matches the two-sided test at , whose p-value does not lead to rejection. The bound is also the lower end of the two-sided percent interval. The one-sided analysis is legitimate only because its direction was fixed before the data were seen.