Twenty people complete a task with interface A, and thirty different people complete the same task with interface B. Group A averages 18 minutes and group B averages 22 minutes, a gap of 4 minutes between the sample means. Could chance variation in two sample means easily produce a gap of that size, and which differences between the population means are consistent with the data? This lesson builds the standard error of a difference from both groups, uses it in Welch’s t test and confidence interval, and shows when the pooled-variance t test fits instead.
Key terms
Independent samples
Definition Two samples are independent when the values in one sample are statistically independent of the values in the other. In practice this means that no unit contributes observations to both samples, and nothing links an observation in one sample to a particular observation in the other. Two random samples drawn separately from two populations are independent in this sense. Groups formed by randomly assigning units to two conditions, with each unit measured once, are analyzed in the same way. The methods of this lesson also need independent observations within each sample. The target is the difference of population means , with the order of the groups fixed before the analysis, and its estimate is the difference of sample means .
In plain words Each observation belongs to exactly one group, and knowing a value in group A tells you nothing about any particular value in group B. Two columns of the same length in a spreadsheet are not evidence either way. What matters is how the data were produced. If the same people, or deliberately matched people, appear in both groups, the samples are paired, and the analysis works with the within-pair differences instead.
Example In the opening study each of the 50 people used one interface and was timed once.
| Group | Size | Mean in minutes | SD in minutes |
|---|---|---|---|
| A | 20 | 18 | 4 |
| B | 30 | 22 | 6 |
In the order A minus B the estimate of is minutes, and the negative sign says that group A had the lower sample mean. The order is a choice, but once chosen it stays the same in the hypotheses, the interval and the interpretation. If instead each of 25 people had used both interfaces, the two sets of times would be linked person by person, and they would not be independent samples.
Standard error of a difference
Definition Suppose is the mean of independent observations from a population with standard deviation , is the mean of independent observations from a population with standard deviation , and the two samples are independent. Then the variance of the difference is the sum of the two variances,
and the standard error of the difference is its square root, the standard deviation of the sampling distribution of . The population standard deviations are usually unknown, so the methods below use the estimated standard error
where and are the sample standard deviations with the denominator. If the two means were dependent, the variance of their difference would also contain the term .
In plain words Subtracting two means does not subtract their uncertainty. Each sample mean can miss its population mean in either direction, and the two misses can add up, so both groups contribute to the uncertainty of the difference. Variances add, standard deviations do not. When both contributions are positive, the standard error of the difference is therefore larger than either group’s own standard error and smaller than the sum of the two. The sample standard deviations describe individual measurements, while the standard error describes how much the difference of means would vary from sample to sample.
Example For the interface data the two estimated variance contributions, in square minutes, are
Their sum is , so minutes. Adding the two separate standard errors instead, , would overstate the uncertainty, and using a sample standard deviation such as minutes would confuse the spread of individual times with the precision of a mean.
Welch t test
Definition Suppose the two samples are independent, the observations within each sample are independent, each sample has at least two observations, and each sample mean is approximately normal. The last condition holds when the populations are close to normal, or when the samples are large enough that moderate skewness has little effect. To test , most often with , Welch’s t test computes
and compares it with the t distribution whose degrees of freedom come from the Welch-Satterthwaite formula in the next card. For the alternative the p-value is , where has that t distribution, and for a one-sided alternative it is the single tail in the direction of . The test does not assume . Even for normal populations its t reference is an approximation, because the exact null distribution of the statistic depends on the unknown ratio . Pairing, clustering and strong skewness or outliers in small samples call for other methods.
In plain words The statistic counts how many estimated standard errors the observed difference lies from the value named by the null hypothesis. The p-value then asks how often a statistic at least that far out would arise if the null hypothesis and the model were true. Welch’s test lets each group keep its own spread, which is why it is a common default for comparing two independent means.
Example For against a two-sided alternative,
so the observed difference lies about estimated standard errors below zero. With degrees of freedom, computed in the next card, the two-sided p-value is about , and the test rejects at the significance level . The p-value is the probability, computed assuming equal population means and the model, of a statistic at least this far from zero. It is not the probability that the population means are equal.
Welch-Satterthwaite degrees of freedom
Definition Write and for the two estimated variance contributions, with , and at least one of and positive. The Welch-Satterthwaite degrees of freedom are
The formula comes from matching the mean and variance of , computed for normal populations, with those of a multiple of a chi-square distribution, and then replacing the unknown population variances by their estimates. The value of is never below the smaller of and and never above , and it is usually not a whole number.
In plain words The degrees of freedom describe how much information the estimated standard error carries. When one group’s contribution dominates, is close to that group’s , because the standard error then rests mostly on one sample variance. The value reaches its maximum exactly when . A fractional value is fine, since it labels a t distribution, not a number of observations.
Example For the interface data and , so
This is just below the upper limit , because the two contributions are nearly balanced relative to their degrees of freedom, with and . The lower limit is .
Welch confidence interval
Definition Under the conditions of the Welch t test, an approximate 95 percent confidence interval for is
where is the quantile of the t distribution with Welch-Satterthwaite degrees of freedom. Other confidence levels use the matching quantile. The confidence level describes the procedure. Over repeated samples, intervals built this way capture about 95 percent of the time. The interval excludes a value exactly when the two-sided Welch test of gives a p-value below .
In plain words The interval reports how large the difference might be, which a p-value alone does not. It concerns the difference between two population means. It is not a range for individual times, and a difference in means does not say that every member of one group finishes faster than every member of the other.
Example With the quantile is , so the margin is minutes, and the interval runs from about to minutes. Both endpoints are negative, so in the order A minus B the data are consistent with a population mean for interface A that is lower by roughly 1.2 to 6.8 minutes. The interval excludes zero, in agreement with the p-value . Reversing the order to B minus A gives the estimate and the interval from about to minutes, while the standard error, the degrees of freedom and the two-sided p-value stay the same.
Pooled variance and the equal-variance t test
Definition Suppose the two populations have a common standard deviation, . The pooled variance
estimates by weighting each sample variance by its degrees of freedom. The equal-variance t test, also called the pooled t test, uses the statistic
with degrees of freedom. If the samples are independent random samples from normal populations with equal variances, this statistic has exactly that t distribution when is true. The matching confidence interval replaces by and takes from the t distribution with degrees of freedom. Equal variances are an extra assumption of this model, and computing does not establish them.
In plain words Pooling assumes one shared spread. In return, under its assumptions, it gives an exact t reference distribution and at least as many degrees of freedom as Welch’s method. If both the spreads and the sample sizes differ, the pooled estimate of the variance of is biased. On average it is too small when the smaller sample comes from the population with the larger variance, which tends to make the test reject a true null hypothesis too often, and too large in the opposite case. When the pooled and Welch standard errors are equal, although their degrees of freedom usually differ. Choose the method from the design and from what is known about the spreads before seeing the results, not by a preliminary test of equal variances and not by whichever p-value is smaller.
Example For the interface data , so
square minutes. Since , the pooled standard error is minutes. The statistic is with degrees of freedom, and the two-sided p-value is about . The pooled standard error is larger than Welch’s here because the larger sample also has the larger standard deviation, and pooling gives group A a variance of about in place of its own . Both methods reject at the level for these data, but that agreement is a feature of these numbers, not a rule.
Check yourself
- A study randomly assigns 29 volunteers to two checkout pages, 9 to page P and 20 to page Q, and records each person’s completion time in seconds. Page P gives and , and page Q gives and . Using the order P minus Q, find the estimate, its standard error, the Welch degrees of freedom and a 95 percent Welch interval, given for those degrees of freedom. What changes if the order is Q minus P?
Show the answer
The estimate is seconds. The variance contributions are and square seconds, so the estimated standard error is seconds. The degrees of freedom are
which lies between and as it must. The margin is seconds, so the interval runs from about to seconds. Because the pages were randomly assigned, the interval supports the conclusion that page P lowered the mean completion time for these volunteers, by an amount the interval puts between about 0.8 and 13.2 seconds. In the order Q minus P the estimate becomes and the interval runs from about to seconds. The standard error, the degrees of freedom and the two-sided p-value stay the same, and the t statistic changes sign.
- A classmate analyzes the data of question 1 with both the Welch test and the equal-variance t test. The Welch test gives a two-sided p-value of about and the pooled test about . The classmate reports the Welch result because it is significant and adds that the pooled test shows the two pages perform the same. What is wrong with this?
Show the answer
There are two mistakes. Choosing between analyses after seeing which one gives the smaller p-value gives the procedure two chances to reject, so the reported p-value overstates the evidence. The method should be fixed in advance, and Welch’s test is a reasonable advance choice here, since nothing in the design guarantees equal spreads and the sample sizes differ. The pooled analysis also assumes a common variance and gives page P the pooled variance in place of its own , which inflates the standard error of the difference to about seconds.
The second mistake is reading a p-value above as evidence of no difference. Even the pooled analysis gives a 95 percent interval from about to seconds, which contains differences of up to 14 seconds in favor of page P. Not significant means the data did not rule out zero, not that the effect is zero.
-
Return to the interface data with means 18 and 22 minutes. What does the Welch analysis support in each of the following designs?
- Fifty volunteers were randomly assigned, 20 to interface A and 30 to interface B.
- Random samples were drawn of 20 people who already use interface A at work and 30 who already use interface B.
- Each of 25 people completed the task once with each interface.
Show the answer
In the first design random assignment supports a causal conclusion, that interface A lowers the mean completion time for these volunteers, by roughly 1.2 to 6.8 minutes according to the interval. The volunteers were not sampled from a wider population, so extending the result to other people needs a separate argument.
In the second design random sampling supports a conclusion about the two populations of users, namely that the population mean time is lower among users of interface A. The people did not get their interfaces by chance, though, so the difference could come from experience, job type or other variables. This is an association, not evidence that the interface causes the difference.
In the third design every person contributes a time to both groups, so the samples are paired, not independent, and the Welch standard error does not apply. The analysis should use the 25 within-person differences with a paired t test, ideally with the order of the interfaces randomized for each person. The p-value itself cannot tell which design produced the data.