- Learn
- Mathematics
- Statistics
- Introduction to Statistics
- Two-Sample T-Test
Two-Sample T-Test: Comparing Two Groups
BeginnerLesson 10 of 12 in Introduction to Statistics Course
What you will learn
- Decide whether two sets of measurements come from independent groups or from pairs, name the parameter being compared, and see how the uncertainty of a difference is built from the uncertainty of each group.
- Tell independent samples from paired dataRecognize the study designs that produce two independent groups and those that produce natural pairs, and state the parameter each design compares.
- Understand how a difference between two samples variesExplain how a difference between two sample statistics changes from sample to sample, combine two standard errors correctly, and recognize the shared structure of every test and interval in this unit.
- Tell independent samples from paired data
- Carry out and interpret two-sample t procedures, choose between Welch's method and the pooled-variance method, and estimate how large a difference in means is.
- Run a two-sample t test with Welch's methodSet up hypotheses, check the conditions, compute the Welch t statistic, degrees of freedom and p-value, and state a conclusion in context.
- Choose between Welch's and the pooled-variance t testCompute the pooled-variance t test, compare it with Welch's method, and explain when the choice changes the result.
- Estimate a difference in means and judge its sizeBuild and interpret a confidence interval for the difference between two means, connect it to the test, and describe how large and how important the difference is.
- Run a two-sample t test with Welch's method
- Reduce paired measurements to differences, test and estimate the mean difference, and explain why a paired design can detect effects that an independent comparison misses.
- Carry out a paired t testCompute the differences within each pair, set up hypotheses about the mean difference, check the conditions and carry out the test.
- Estimate a mean difference and explain why pairing helpsBuild and interpret a confidence interval for the mean difference, and show with data how pairing removes variation between individuals.
- Carry out a paired t test
- Test whether two population proportions differ and estimate the difference between them, using the pooled proportion for the test and separate proportions for the interval.
- Carry out a two-proportion z testSet up hypotheses about two proportions, compute the pooled proportion, check the conditions and carry out the z test.
- Estimate a difference in proportionsBuild and interpret a confidence interval for the difference between two proportions, report it in percentage points, and relate it to the test.
- Carry out a two-proportion z test
- Select the right procedure from the study design and the type of response, read software output, and write a complete conclusion.
- Choose the right test from the study designUse a short sequence of questions about the response and the design to pick between the two-sample t, paired t and two-proportion procedures, and avoid the common traps in that choice.
- Read software output and report the resultsFind the statistics that matter in output from common statistics software and spreadsheets, and write a conclusion that a reader can check.
- Choose the right test from the study design
Two-Sample T-Test study guide
1Start with the study design
A comparison begins with the people or objects behind the numbers. Two columns can hold measurements from separate groups or two measurements linked within each person. That link changes both the question and its uncertainty. Learn to identify the response, name the population difference, and fix the order of subtraction before using a formula. Then connect the standard error of a difference with the tests and intervals that follow.
1.1 Independent groups and natural pairs
A study comparing two groups needs two decisions: what was measured, and how the observations were collected. The response tells you whether to compare means or proportions. The design tells you whether to keep a link between measurements.
Find the link between observations
Independent samples have no one-to-one link between observations in the two groups. Randomly chosen nurses and randomly chosen teachers form two independent samples. A randomized experiment also produces independent groups when each participant receives exactly one of two treatments. Observations must be independent within each group as well.
Paired data have a real match for every observation. The same client weighed before and after a program supplies one pair. The two eyes of one patient supply another. Two different people can also form a pair when the study matches them on relevant features, such as twins assigned to different treatments. The match is part of the study design.
Equal sample sizes do not create pairs. Two unrelated groups of 25 people are independent. Sorting both groups and joining their smallest values, next-smallest values, and so on creates artificial matches. Those differences do not represent the design that collected the data.
Name the quantity being compared
A quantitative response, such as a score, time, or weight, leads to means. A response with two outcomes, such as clicked or did not click, leads to proportions.
| Design and response | Population quantity | Sample estimate |
|---|---|---|
| Independent quantitative groups | ||
| Paired quantitative measurements | ||
| Independent two-outcome groups |
For paired data, first calculate one difference for each pair. A study of 30 clients before and after a program becomes a sample of 30 differences. The parameter is the population mean of differences, not the change for one particular client.
Keep one order of subtraction
Write the order in words before calculating. With “new method minus old method,” a positive score difference favors the new method. For completion times, a negative difference means the new method takes less time. The sign tells you which value is higher; the context tells you whether higher is desirable.
Reversing the order changes the signs of the estimate and test statistic. It also reverses and negates the interval endpoints: an interval from 2 to 7 becomes one from −7 to −2. A two-sided p-value stays the same because the distance from zero stays the same.
Classify the study
“A school compares scores from 45 students taught with phonics and 52 other students taught with a whole-language method.” The response is quantitative and the students are different, so compare independent means.
“An optometrist measures the left and right eye of each of 20 patients.” The response is quantitative and the eyes are linked within each patient, so analyze 20 differences. Keeping that link lets the analysis separate differences between eyes from differences between patients.
Key Takeaways
- Pairing comes from the design, including repeated measurements and meaningful matched pairs.
- Quantitative responses lead to means; two-outcome responses lead to proportions.
- For paired data, the sample size is the number of complete pairs.
- Keep the order of subtraction fixed in hypotheses, estimates, intervals, and conclusions.
1.2 The uncertainty in a difference
A sample difference changes when new samples are drawn. Even when the population means are equal, two sample means will usually differ. The standard error describes the typical sampling variation in the difference, in the same units as the response.
Combine independent uncertainty
For independent samples, subtracting the statistics does not subtract their uncertainty. Either sample mean can fall above or below its population mean. Their random errors can pull the observed difference in either direction. Their variances add:
Standard errors are square roots of variances, so square them before adding:
If the two standard errors are 3 and 4, the combined standard error is . Adding gives 7 and subtracting gives 1; neither calculation combines variances correctly.
For independent means estimated from samples, this becomes
For an interval comparing independent proportions, use
Each group contributes a term. If one mean has a standard error of 4, making the other sample enormous still leaves the difference's standard error at least 4. Precision is often limited by the smaller or more variable group.
Connect tests with intervals
The sample difference estimates the population difference. For independent random samples, the sampling distribution of the difference in means is centered on . Large samples make the distribution approximately normal; normal populations also support t procedures for small samples.
A test compares the estimate with a hypothesized difference, usually zero:
A confidence interval starts at the estimate and extends in both directions:
The product of the critical value and standard error is the margin of error. Means use a t critical value because population standard deviations are estimated. Proportions use a z critical value when the normal approximation is suitable.
For paired data, the independent-groups formula loses the relationship between measurements. Calculate the differences and use , the standard error of their mean.
Let the design set the conclusion
Random sampling supports generalization to the populations sampled. Random assignment supports a causal comparison of treatments. These are separate features: a randomized experiment using volunteers can support causation for the participants without making them a random sample of all adults.
In an observational comparison of smokers and nonsmokers, other differences between the groups may explain an observed outcome. A small p-value does not remove that confounding. Report the association and keep the population claim tied to how the sample was obtained.
Key Takeaways
- For independent samples, variances add when statistics are subtracted.
- A test measures distance from the null in standard errors; an interval gives a plausible range for the population difference.
- One large group cannot remove the uncertainty contributed by the other group.
- Paired data use the standard error of the differences.
- Random sampling supports generalization; random assignment supports causation.
2Compare independent means
Independent groups often differ in both their average and their spread. A t procedure compares the averages while allowing for the uncertainty in each sample. Welch’s method estimates that uncertainty separately; the pooled method adds an equal-spread assumption. Work through both approaches, then use a confidence interval and an effect size to distinguish evidence of a difference from a difference large enough to matter.
2.1 Welch’s t test, from question to conclusion
Welch’s t test compares two population means without assuming equal population variances. Define group 1 and group 2, and choose the alternative before examining the results.
State the hypotheses and check the design
For a two-sided question, use and . A directional question uses or in the alternative. The hypotheses concern population means, not the observed sample means.
Check independent random samples or random assignment, independence within each group, and suitable distributions. When sampling without replacement, keep each sample below about 10% of its population. Inspect each group's plot for skewness and outliers.
A rough guide based on the combined sample size is especially cautious below 15: data should look close to normal with no outliers. From 15 to 40, strong skewness or outliers are a concern; at 40 or more, t procedures usually tolerate skewness better. Still inspect each group separately. A very large group cannot rescue a tiny group with a strongly skewed distribution.
Calculate the statistic
A college compares final scores in a flipped class, with 25 students, mean 78.4, and standard deviation 9.2, and a lecture class, with 30 students, mean 72.1, and standard deviation 12.5. Both plots show no strong skewness or outliers. Use flipped minus lecture.
The observed difference is 6.3 points. Under equal population means,
The difference is about 2.15 standard errors above zero.
Find degrees of freedom and the p-value
Software calculates Welch's degrees of freedom. Writing and keeps the formula readable:
Here the value is about 52.27. With that t distribution, the two-sided p-value is about 0.036. A table-based conservative choice is the smaller of the two sample degrees of freedom, here 24. It gives a larger p-value, about 0.042.
If the null is true and the conditions hold, a standardized statistic at least this far from zero occurs in about 3.6% of repeated sample comparisons. This probability concerns the data under the null; it is not the probability that the null is true.
Make the decision in context
At a 0.05 significance level, reject the null. There is evidence that the population mean scores differ, with the flipped class averaging 6.3 points higher in these samples. If students chose their format, describe an association; causal wording requires random assignment.
A prespecified alternative that the flipped mean is higher gives a one-sided p-value of about 0.018. The opposite one-sided alternative gives about 0.982. Halving the two-sided value works only when the observed sign agrees with the prespecified alternative. A p-value above the significance level means insufficient evidence, not that the means have been shown equal.
When both population standard deviations are known, the comparison uses and the standard normal distribution. In most studies they are estimated from the samples, so use a t procedure.
Key Takeaways
- Welch’s method estimates each group’s variance separately.
- Choose the alternative before examining the data.
- Check each group’s distribution and independence, not just the combined sample size.
- Use Welch degrees of freedom or the smaller sample degrees of freedom for a conservative table calculation.
- A p-value measures how unusual the statistic is under the null, not how likely the null is to be true.
- A nonsignificant result leaves uncertainty about the difference.
2.2 When pooling the variances is justified
The pooled-variance t test treats both samples as evidence about one common population variance. It assumes . Welch's method keeps two separate estimates and is a useful default when that equality has no strong justification.
Build the pooled standard error
Pool the sample variances using their degrees of freedom as weights:
Take the square root to obtain the pooled standard deviation. Then calculate
Use that standard error and those degrees of freedom for the pooled confidence interval too.
For the class-score data, the weighted sum of squared deviations is . Divide by 53 to get a pooled variance of about 123.82, then take its square root to get about 11.13 points. The pooled standard error is about 3.013, giving and a two-sided p-value of about 0.041. Welch's p-value, about 0.036, gives the same decision here.
See why the choice can matter
Consider independent group A with size 10, mean 50, and standard deviation 15, and group B with size 40, mean 42, and standard deviation 5. Suppose the distribution checks support a t procedure.
| Method | Standard error | t statistic | Degrees of freedom | Two-sided p-value |
|---|---|---|---|---|
| Pooled | About 2.80 | About 2.86 | 48 | About 0.006 |
| Welch | About 4.81 | About 1.66 | About 9.5 | About 0.13 |
The small group is much more variable. Pooling gives most of its weight to the large, less variable group, understating uncertainty in the small group's mean. The resulting p-value is too optimistic. If the larger group has the larger variance, pooling instead overstates the standard error and can make a difference harder to detect.
When both sample sizes equal , pooling averages the two variances. Both standard error formulas then reduce to . The t statistics match, although the degrees of freedom may differ.
Choose a method for a reason
Use Welch unless the study gives a good reason to assume equal population spreads. Similar sample standard deviations are compatible with equal population spreads, but do not establish equality. A sample standard deviation ratio below 2 is a course rule used in some settings, not a guarantee.
Do not let a preliminary variance test decide the method. Such a test can miss unequal variances in a small sample, and combining that selection step with a t test alters the overall error behavior. In SPSS, select the row for the method chosen on substantive grounds. “Equal variances assumed” is pooled; “Equal variances not assumed” is Welch. In R, t.test(x, y) uses Welch, while t.test(x, y, var.equal = TRUE) requests pooling.
Key Takeaways
- The pooled method assumes equal population variances and weights sample variances by their degrees of freedom.
- Unequal spreads combined with unequal group sizes can make pooling misleading.
- Equal sample sizes give equal Welch and pooled standard errors, but degrees of freedom can differ.
- Use Welch by default; justify pooling from the study setting.
- A preliminary variance test is a poor way to select the t procedure.
2.3 Estimate the size of a mean difference
A test asks whether the data give evidence against a proposed difference. A confidence interval estimates how large the population difference could reasonably be. It keeps the direction and the units visible.
Build and read a Welch interval
Use the same distribution checks, standard error, and degrees of freedom as in Welch's test:
For the class-score comparison, the estimate is 6.3 points and the standard error is about 2.9315. At 95% confidence with about 52.27 degrees of freedom, the critical value is about 2.006. The margin of error is about 5.88 points, giving an interval from about 0.42 to 12.18 points.
“We are 95% confident that the population mean score for flipped classes is between 0.4 and 12.2 points higher than for lecture classes.” The confidence level describes repeated use of the interval method: about 95% of such intervals contain the true difference. This interval estimates a difference in population means, not a range containing 95% of students' scores.
An interval above zero supports a higher group-1 mean; one below zero supports a lower group-1 mean. An interval containing zero is consistent with equal means. A wide interval leaves substantial uncertainty about the size of the difference.
Connect the interval and the test
When a two-sided t test and its interval use the same standard error and degrees of freedom, a 5% test rejects zero exactly when the 95% interval excludes zero. The score interval excludes zero, agreeing with the p-value of about 0.036.
Compare the groups with an interval for their difference. Separate 95% intervals for the score means, about 74.6 to 82.2 and 67.4 to 76.8, overlap even though the difference is significant. Overlap of separate intervals is not the correct test of the difference.
Describe importance as well as evidence
The original units are often easiest to interpret. A 6.3-point difference may matter differently on a 20-point quiz and a 200-point exam. Cohen's d expresses a difference in pooled-standard-deviation units:
For the score data, . Rough benchmarks for the magnitude are 0.2 small, 0.5 medium, and 0.8 large. Use them as guides; importance depends on the setting.
With 10,000 people per group and a standard deviation of 10, a difference of 0.4 gives a standard error of about 0.141 and a t statistic of about 2.83. The p-value is about 0.005, but . A precise study can detect a very small difference. A small study can also leave an important difference undetected.
Larger samples narrow an interval. Quadrupling both sample sizes, with similar spreads, roughly halves its margin of error. Lowering the confidence level also narrows it, while accepting a method with a lower long-run coverage rate.
Key Takeaways
- A confidence interval estimates the population difference, not the spread of individual responses.
- For matching two-sided t procedures, excluding zero agrees with rejecting the null.
- Use an interval for the difference; overlap of separate mean intervals does not settle the comparison.
- Cohen’s d expresses the mean difference in pooled-standard-deviation units.
- Statistical significance and practical importance answer different questions.
- Larger samples improve precision; higher confidence makes intervals wider.
3Analyze measurements in pairs
Repeated measurements let each person or object provide a comparison with itself. A paired analysis follows those links by turning each pair into one difference. Work from the differences to the standard error, t test, and confidence interval. The same calculations also show why strong pairing can improve precision and why an observed before-and-after change needs careful interpretation when there is no comparison group.
3.1 A t test on the differences
A paired t test is a one-sample t test applied to the differences within pairs. Keep each pair together and subtract in one consistent order. The sample size is the number of pairs, not the total number of recorded measurements.
Turn pairs into one sample
Eight adults have their resting heart rates measured before and after a six-week exercise program. Define a difference as before minus after, so a positive value means a decrease.
| Adult | Before | After | Before − after |
|---|---|---|---|
| 1 | 72 | 68 | 4 |
| 2 | 80 | 76 | 4 |
| 3 | 68 | 67 | 1 |
| 4 | 75 | 70 | 5 |
| 5 | 84 | 78 | 6 |
| 6 | 77 | 75 | 2 |
| 7 | 70 | 69 | 1 |
| 8 | 79 | 74 | 5 |
All values are in beats per minute. The differences sum to 28, so their mean is . Calculate their sample standard deviation from these eight differences, giving . Subtracting the original columns' standard deviations would not measure variation in individual changes.
Set hypotheses and inspect the differences
The parameter is , the population mean difference. Test against a two-sided alternative, or a prespecified directional alternative. With before minus after, asks whether the mean heart rate is lower afterward.
The pairs should come from random sampling or an appropriate randomized design. Differences from separate pairs must be independent. Inspect the differences themselves for approximate normality when the number of pairs is small. Two separate normal-looking columns do not establish that their differences have a suitable distribution. Here a plot of the eight differences shows no outliers or strong skewness.
Calculate and interpret the test
The standard error and test statistic are
For these eight pairs,
There are 7 degrees of freedom. The two-sided p-value is about 0.0013; the prespecified one-sided decrease question gives about 0.0007. Both give evidence against zero mean change at a 0.05 significance level.
A suitable conclusion is: “The data give evidence that mean resting heart rate was lower after the program, with a sample mean decrease of 3.5 beats per minute.”
Separate a change from its cause
An uncontrolled before-and-after study records all changes over time together. Exercise, a seasonal change, or growing used to measurement could contribute. The paired test estimates a mean change; it does not isolate which explanation produced it. A randomized comparison group or a crossover study with randomized treatment order provides stronger evidence about treatment effects.
Eight people measured twice supply eight independent differences and 7 degrees of freedom. Counting 16 measurements as the sample size would exaggerate the information available about the mean change.
Key Takeaways
- Compute one consistently ordered difference per pair before calculating the test.
- Use the mean and standard deviation of the differences, with sample size equal to the number of pairs.
- Check independence across pairs and the distribution of differences.
- A before-and-after change alone does not isolate a treatment effect.
3.2 Paired intervals and the benefit of matching
A paired confidence interval estimates the mean difference between linked measurements. Its width depends on how much the differences vary, not on how widely the people differ from one another at the start.
Estimate the population mean change
Use the t critical value with one fewer degree of freedom than the number of pairs:
For the heart-rate differences, the mean is 3.5 and the standard error is about 0.681 beats per minute. At 95% confidence with 7 degrees of freedom, the critical value is about 2.365. The margin of error is about 1.61, producing an interval from about 1.89 to 5.11 beats per minute.
“We are 95% confident that population mean resting heart rate was between about 1.9 and 5.1 beats per minute lower after the program than before it.” The positive interval uses before minus after. Defining after minus before would give a negative interval, from about −5.11 to −1.89, describing the same decrease.
The interval excludes zero, matching the two-sided paired test's rejection at the 5% level. It describes average change. Individual changes can be outside the interval, and an uncontrolled time comparison leaves the cause of the change unresolved.
Understand why the differences can be precise
Some adults have consistently higher heart rates than others. That person-to-person variation appears in both the before and after columns. Subtracting within a person removes the shared baseline, leaving variation in the change.
The before values have a standard deviation of about 5.42 and the after values about 4.12. The differences have a much smaller standard deviation, about 1.93. Before and after measurements are strongly positively correlated, with correlation about 0.955.
The relationship is
A positive correlation subtracts from the variance of the differences. For these data, the calculation is approximately , matching the squared standard deviation of the differences. The more closely each person's two measurements move together, the more baseline variation can cancel.
Preserve the pairing in the analysis
Treating the heart-rate columns as independent gives a standard error of about 2.41 and a two-sided p-value near 0.17. The paired standard error is about 0.681 and its p-value is about 0.0013. The independent analysis misses the information in the links between measurements.
Pairing is most helpful when the matching feature is strongly related to the response. Poor matches with correlation near zero gain little precision. A paired analysis also has only degrees of freedom, compared with up to for two independent groups of size . Create meaningful pairs through the design, and use them as pairs in the calculation.
A compact report gives the estimate and units alongside its uncertainty: “Resting heart rate fell by a mean of 3.5 beats per minute, 95% CI 1.9 to 5.1; t(7) = 5.14, p = .001, two-sided.” The study description supplies the limits on causal interpretation.
Key Takeaways
- A paired interval estimates the population mean of the within-pair differences.
- Strong positive within-pair correlation can reduce the standard error.
- Ignoring genuine pairs discards information about how measurements are linked.
- Weak matching may give little precision benefit and leaves fewer degrees of freedom.
- Report the direction, units, interval, statistic, degrees of freedom, and p-value.
4Compare independent proportions
Click rates, recovery rates, and yes-or-no survey responses call for proportions. Their comparison has the same estimate-and-uncertainty structure as a comparison of means, but the standard error changes between testing and estimation. Learn why the equality test pools the counts, why the confidence interval keeps the two rates separate, and how to describe the result clearly in percentage points.
4.1 The two-proportion z test
A two-proportion z test compares two population proportions using a two-outcome response in independent groups. Label the outcome counted as a success, even if it is an undesirable event, and keep that definition the same in both groups.
Estimate the common proportion under the null
Let each group's success count be out of observations. Its sample proportion is . To test equality, use and a prespecified two-sided or directional alternative.
The null says both groups share one population success probability. Estimate it by combining successes and observations:
Pool counts, not percentages. With 30 successes out of 50 and 100 out of 400, the pooled proportion is . The simple average of 0.60 and 0.25 gives 0.425 and gives the small group too much weight.
Check independence and expected counts
Use independent random samples or random assignment, with independent observations within each group. When sampling without replacement, each sample should be below about 10% of its population.
For the normal approximation, check the expected success and failure counts under the null:
Require all four to be at least 10. These test checks use the pooled proportion because the test models equal population rates.
Work through a click-rate comparison
An online store randomly sends subject line A to 600 customers and B to 600 other customers. The click counts are 156 and 120. The sample proportions are 0.26 and 0.20; their difference is 0.06. Under the null,
Each group has expected counts of 138 clicks and 462 nonclicks. All four exceed 10. Calculate
The two-sided standard normal p-value is about 0.0135. Reject equality at the 0.05 level. Random assignment supports a conclusion that the subject line affected clicks among customers like those in the experiment. The sample rate was 6 percentage points higher for A.
A prespecified alternative that A has the higher population rate gives about 0.007. Do not select a direction after seeing the difference.
Recognize related output and unsuitable designs
For an uncorrected two-sided comparison, a chi-square test of the corresponding two-by-two table gives the same p-value: with 1 degree of freedom. Here the chi-square statistic is about 6.10. Software may apply a continuity correction, changing the reported statistic and p-value slightly.
Two responses from the same person are dependent. A yes-or-no survey before and after a debate supplies paired categorical data, so this independent-groups z test does not fit the design.
Key Takeaways
- Pool successes over total observations when testing equal proportions.
- Check all four expected counts using the pooled proportion.
- Use the standard normal distribution for the two-proportion z statistic.
- A two-sided uncorrected two-proportion test agrees with the two-by-two chi-square test.
- Repeated yes-or-no responses from the same people require a paired categorical procedure.
4.2 Intervals for the difference between rates
A confidence interval for two independent proportions estimates their population difference without assuming equality. It therefore uses each sample's own rate to estimate its contribution to uncertainty.
Use separate sample proportions
The interval is
Use independent random samples or random assignment, independence within each sample, and at least 10 observed successes and 10 observed failures in each group. Check , , , and . The test's pooled expected counts and the interval's observed counts answer different approximation checks.
Common critical values are 1.645 for 90% confidence, 1.960 for 95%, and 2.576 for 99%. A higher confidence level expands the range.
Estimate the click-rate difference
For subject lines A and B, the rates are 0.26 and 0.20 in samples of 600 each. Their difference is 0.06. The unpooled standard error is
At 95% confidence, the margin of error is about . The interval runs from about 0.0125 to 0.1075. Rounded to one decimal percentage point, it is about 1.2 to 10.8 percentage points.
“We are 95% confident that the population click rate for A is between 1.2 and 10.8 percentage points higher than for B.” The interval estimates a difference in rates; it does not describe how many times a particular customer will click.
Keep percentage points separate from relative change
The difference between 26% and 20% is 6 percentage points. A relative percentage increase uses a baseline:
Relative to B, A's sample click rate is 30% higher. The two descriptions refer to the same data but answer different questions. When reporting a proportion difference and its interval, percentage points keep the scale clear.
Read the uncertainty without forcing agreement
An interval entirely above zero supports a higher group-1 rate. An interval crossing zero leaves both directions, including equality, plausible at that confidence level. For the click data, a 99% interval is about −0.002 to 0.122, which includes zero and is wider than the 95% interval.
The equality test uses a pooled standard error; this interval uses separate estimates. Because the methods differ, they can disagree near a cutoff. Do not apply the exact t-test/interval equivalence to these two proportion procedures. Report both the testing method and the estimated difference, especially when the result is close to the significance threshold.
Key Takeaways
- Use separate sample proportions for the interval standard error.
- Check observed successes and failures in both groups.
- State absolute rate differences and their intervals in percentage points.
- Higher confidence produces a wider interval.
- The pooled test and unpooled interval can disagree near a cutoff.
5Choose an analysis and report it clearly
A useful report connects a statistical result to the study that produced it. Start with the response and the links between observations, choose the procedure before inspecting p-values, and check its conditions. Then read the software’s method, subtraction order, estimate, and uncertainty together. A clear conclusion tells the reader what differs, by how much, and how far the study design allows that conclusion to reach.
5.1 Choose the procedure from the question
The choice of a two-group procedure follows the response and the study design. Software can calculate several tests for the same spreadsheet, but only a design-based choice gives the numbers a useful interpretation.
Follow a short decision path
- Identify the response. A score, amount, or time is quantitative, so compare means. A two-outcome response calls for proportions.
- Look for real pairs. Repeated measurements or meaningful matched subjects lead to paired data. Separate unrelated groups lead to independent samples.
- Set the alternative. Choose a directional or two-sided question before examining the results. Fix the order of subtraction too.
- Check conditions. Verify the sampling or assignment process, independence, and the relevant plots or count checks.
| Response and design | Procedure |
|---|---|
| Quantitative, independent groups | Welch t test and interval; pool only with justified equal population spreads |
| Quantitative, paired observations | Paired t test and interval on the differences |
| Two outcomes, independent groups | Two-proportion z test and difference interval |
| Two outcomes, repeated within people | A procedure for paired categorical data |
Apply the path to real designs
“Forty patients have blood pressure recorded before and after eight weeks.” Blood pressure is quantitative and each patient supplies a pair. Use a paired t procedure on 40 differences, checking their distribution.
“A survey asks 500 randomly chosen urban adults and 400 randomly chosen rural adults whether they own a car.” The response has two outcomes and the groups are independent. A two-proportion z procedure fits when the count and independence checks pass.
“Students are randomly assigned to music or silence and take a recall test.” Scores are quantitative and each student receives one condition. Choose an independent two-sample t procedure, with Welch as the default. If instead every student tried both conditions in randomized order, use the paired route.
Test the difference directly
Suppose group A differs significantly from a national average but group B does not. That does not establish a difference between A and B. Each separate test has its own uncertainty. Calculate and test the between-group difference itself.
Likewise, do not try pooled, Welch, one-sided, and two-sided tests and keep the smallest p-value. Repeatedly selecting the most favorable analysis increases the chance of a false positive. A research question determines the direction; the design determines the procedure.
Respond to failed conditions
A small quantitative sample with strong skewness or an extreme outlier can make a t procedure unreliable. Check for recording errors and investigate the data before choosing an appropriate method. Do not delete an accurate unusual observation simply to obtain significance.
For proportions, small success or failure counts weaken the normal approximation. A z test or normal-approximation interval is not supported when its count conditions fail. A design with real pairing also needs that dependence represented in the analysis; a large sample does not turn pairs into independent groups.
Key Takeaways
- Choose the procedure from response type and dependence before calculating a p-value.
- Test a group difference directly; comparing separate significance decisions is insufficient.
- Fix the alternative and method in advance to avoid selecting the most favorable result.
- Failed plot or count checks require a suitable analysis, not a more favorable significance threshold.
5.2 Read the output and write the conclusion
Software output reports a method's calculations, but the reader still needs the design, units, and meaning of the comparison. Begin by checking which group comes first and whether the chosen method matches the design.
Find the estimate and its uncertainty
Locate sample sizes, means and standard deviations, or counts and proportions. Then find the estimated difference, confidence interval, statistic, degrees of freedom for t procedures, and p-value. A negative statistic may simply mean that the program subtracted the groups in the reverse order.
For the class-score data, R-style output gives “Welch Two Sample t-test,” a statistic of 2.149, degrees of freedom 52.269, a p-value about 0.03628, and a 95% interval from 0.418 to 12.182. The heading identifies the method. Fractional degrees of freedom are common for Welch, though a whole-number result can occur too. With formula-based grouping, factor levels determine the order of subtraction; inspect the labels.
In SPSS, “Equal variances assumed” gives the pooled result and “Equal variances not assumed” gives Welch. Levene's significance value tests spreads, not means. Read the t-test p-value in the row for the method you selected.
Know what a spreadsheet returns
Excel's T.TEST(array1, array2, tails, type) returns a p-value. Set type to 1 for paired data, 2 for pooled independent samples, or 3 for Welch. Set tails to 2 for a two-sided comparison. The function does not also return the difference, interval, or test statistic.
With tails set to 1, Excel returns half the two-sided value, regardless of the observed sign. If the data point in the prespecified direction, that is the appropriate one-sided p-value. If they point the opposite way, use one minus the returned value. Check the sign separately; a small returned tail area can otherwise support the wrong direction.
R's prop.test can apply a continuity correction by default, so its result can differ from an uncorrected hand calculation. Read the method details when comparing outputs.
Build a report a reader can check
State the design and population question, the procedure and conditions checked, the estimated difference with units and interval, and the test result. For example:
“Students in the flipped class (M = 78.4, SD = 9.2, n = 25) averaged 6.3 points higher than those in the lecture class (M = 72.1, SD = 12.5, n = 30). Welch's t(52.3) = 2.15, p = .036; 95% CI for the difference, 0.4 to 12.2 points.”
Add how the students entered the classes. Random assignment supports a causal comparison; self-selection leaves possible confounding, such as prior achievement. Generalization depends on the sampling process.
Report very small p-values as “p < .001” when appropriate. A displayed value of .000 is rounded, not a probability of exactly zero. Pair evidence with the estimated effect and interval: a tiny p-value alone does not tell the reader whether the difference is important.
Key Takeaways
- Read the method, group order, and interval together before interpreting the sign.
- Levene’s p-value concerns variances; it is not the t-test p-value for means.
- Excel’s test type selects paired, pooled, or Welch; a one-sided result also needs a direction check.
- Report the estimate, units, confidence interval, statistic, degrees of freedom where relevant, and p-value.
- Match causal and population claims to assignment and sampling.
Two-Sample T-Test examples
1Find the design and the uncertainty
10 steps
- 1IntroductionStart behind the numbers
Two columns of measurements can represent very different studies. One may compare unrelated people; another may measure each person twice.
That link decides what counts as an independent piece of information. First identify the response and the design. Then name the difference you want to estimate and calculate its uncertainty. A formula is useful only when it represents the way the observations were collected.
- 2ExplanationLook for a real match
Independent samples have no specific links between observations across groups. Separate random samples of nurses and teachers are an example.
Paired data connect observations one to one: before and after on the same client, two eyes of the same patient, or meaningful matched subjects. A pair contributes one difference. Equal column lengths alone say nothing about whether those links exist.
- 3ExampleChoose the population quantity
The response tells you what kind of difference to estimate.
- Quantitative, independent groups: population mean difference .
- Quantitative, paired measurements: population mean difference within pairs .
- Two outcomes, independent groups: population rate difference .
A time in seconds is quantitative. “Completed” or “not completed” has two outcomes, even when the responses are stored as 1 and 0.
- 4ChallengeClassify a machine comparison
A factory samples 18 machines. Each machine makes one part using setting A and one using setting B, with order randomized. Part mass is recorded. What design and population quantity fit this comparison?
---reveal---
The masses are quantitative and linked within machines, so use a paired analysis. Define a difference, such as A minus B, and estimate the population mean within-machine difference. The 18 machines provide 18 differences.
- 5TipWrite the order in words
With “new minus old,” a positive difference means the new value is higher. For a score that may be desirable; for a task time it may mean slower performance.
If you reverse the order, negate and reverse the interval endpoints. An interval from 1 to 6 becomes −6 to −1. The two-sided p-value stays the same because the standardized distance from zero is unchanged.
- 6ExplanationCombine variances, not standard errors
Independent samples each add sampling variation to a difference. Their variances add even though their statistics are subtracted.
With standard errors of 3 and 4, the variance contributions are 9 and 16. Their sum is 25, so the combined standard error is 5. Subtracting the errors would wrongly make a comparison seem more precise merely because two sources of uncertainty are present.
- 7ConnectionUse one structure for tests and intervals
A test measures how far the estimate lies from a null difference, usually zero:
An interval estimates the population difference:
The critical value reflects the confidence level and reference distribution. Means use t procedures when spreads are estimated. Suitable proportion comparisons use the standard normal distribution.
- 8ChallengePredict the limit on precision
Two independent mean estimates have standard errors of 2 and 6 points. The first sample becomes much larger, with similar spread. What value does the standard error of the difference approach?
---reveal---
It approaches 6 points. The first variance contribution approaches zero, but the second stays at 36. The square root of their sum therefore approaches 6. One huge sample cannot remove uncertainty from the other group's estimate.
- 9ChallengeConnect design with the conclusion
A random sample of 24 volunteers each tries two reading settings in randomized order. Each supplies a reading-time difference. Would the independent-groups standard error preserve this design? What is the correct standard error?
---reveal---
No. The measurements are linked within volunteers, so form 24 differences and use . The original columns are dependent. Randomized order strengthens the comparison, while the population claim depends on the population from which those volunteers were sampled.
- 10RecapCarry the design into the calculation
Identify the response, preserve meaningful pairs, and fix the subtraction order. Independent differences combine variance contributions; paired measurements become one sample of differences.
Tests standardize a difference from the null. Intervals attach a margin of error to an estimate. Random sampling supports generalization, and random assignment supports causal comparison. Keep those design features visible when stating what the result means.
2Compare means with a test and an interval
17 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionHow different are the class means?
- 2ExplanationSet the question before the result
- 3ExampleFind each group’s uncertainty
- 4ExampleStandardize the observed difference
- 5Key InsightRead the p-value in the correct direction
- 6ChallengeCalculate a new Welch statistic
- 7ExplanationPooling adds an assumption
- 8ExampleCompare the two calculations
- 9Key InsightUnequal sizes can expose the problem
- 10ChallengeDecide whether a variance test settles the choice
- 11ExampleAttach an interval to the estimate
- 12ExplanationKeep means separate from individual scores
- 13ConnectionPut the effect on a common scale
- 14ChallengeSeparate detection from importance
- 15TipChange precision deliberately
- 16ChallengeConnect the interval to a testing decision
- 17RecapReport evidence and size together
3Turn pairs into differences
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionUse the links within each pair
- 2ExampleForm the heart-rate differences
- 3ExplanationCheck the sample that is actually tested
- 4ExampleStandardize the mean change
- 5ChallengeFind the right count and error
- 6TipA measured change still needs an explanation
- 7ExampleBuild the paired interval
- 8Key InsightCancel shared baseline variation
- 9ChallengePredict when pairing helps less
- 10ConnectionKeep the sign and its meaning together
- 11ChallengeCombine a test decision with interval meaning
- 12RecapAnalyze changes at the pair level
4Test and estimate a rate difference
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionTwo rates, two kinds of uncertainty
- 2ExplanationPool successes under equality
- 3ExampleCheck the null model’s expected counts
- 4ExampleCalculate the z statistic
- 5ChallengePool unequal groups
- 6ConnectionRecognize a different output label
- 7ExplanationUse separate rates for estimation
- 8ExampleBuild the rate-difference interval
- 9ChallengeChoose the scale of the difference
- 10Key InsightDo not force exact cutoff agreement
- 11ChallengeCarry the method through a new interval
- 12RecapKeep testing and estimation distinct
5Choose the method and audit the report
10 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionA report starts before software
- 2ExplanationFollow the decision path
- 3ChallengeIdentify the right analysis
- 4Key InsightCompare the groups directly
- 5ExplanationCheck labels before signs
- 6TipCheck the spreadsheet’s type and tail
- 7ChallengeRead the requested tail
- 8ExampleWrite an estimate with its uncertainty
- 9ChallengeAudit a complete conclusion
- 10RecapGive the reader enough to judge
Two-Sample T-Test practice questions
Set 1: Designs, estimates, and first calculations10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Carry out the comparison10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Interpret evidence and diagnose errors10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Evaluate a complete analysis10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Alternative hypothesis
C
Cohen’s d
Condition check
Confidence interval for a mean difference
Confidence level
Confounding
Conservative degrees of freedom
Continuity correction
Crossover design
D
Degrees of freedom
E
Equal-variance assumption
Expected count
F
False positive
I
Independent samples
L
Levene’s test
M
Margin of error
Mean paired difference
N
Null hypothesis
O
Observed count
One-sided test
Order of subtraction
P
P-value
Paired confidence interval
Paired data
Paired t test
Percentage point
Pooled proportion
Pooled standard deviation
Pooled variance
Pooled-variance t test
Population mean difference
Practical importance
Precision
Preliminary variance test
R
Random assignment
Random sampling
Relative percentage increase
Response variable
Result report
S
Sample proportion
Sampling distribution
Software subtraction order
Standard deviation of differences
Standard error of a difference
Statistical significance
T
Test statistic
Two-proportion z test
Two-sided test
U
Unpooled proportion standard error
V
Variance of differences
W
Welch’s t test
Within-pair correlation
Within-pair difference
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.