Two-Sample t Test

Statistics > Basic Statistics > 2-Sample t


Tests whether two samples from a normal distribution could have the same mean when the standard deviations are unknown but assumed to be equal.

Use Two-Sample t Test to perform a hypothesis test and compute a confidence interval of the difference between two population means when the population standard deviations, s's, are unknown. For a two-sided two-sample t

H0: µ1 - µ2 = µ0     versus     H1: µ1 - µ2 ≠ µ0

where µ1 and µ2 are the population means and µ0 is the hypothesized difference between the two population means.

Independent-Sample t-Test is used to test if two unrelated samples come from populations with the same mean. When you have dependent samples, use Two-Sample Paired t Test.


Dialog box items

Samples in one column:
Choose if the sample data are in a single column, differentiated by factor levels in a second column.

oSamples: Enter the columns containing the sample data.

oFactor and Levels: Enter the columns containing the sample factor, and select the levels.

Samples in different columns:
Choose if the data of the two samples are in separate columns.

oFirst Sample: Enter the column containing one sample.

oSecond Sample: Enter the column containing the other sample

Summarized data:
Choose if you have summary values for the sample size, mean, and standard deviation.

oFirst Sample

-Sample size: Enter the value for the sample size.

-Sample Mean: Enter the value for the sample mean.

-Sample Std Dev: Enter the value for the sample standard deviation.

oSecond Sample

-Sample size: Enter the value for the sample size.

-Sample Mean: Enter the value for the sample mean.

-Sample Std Dev: Enter the value for the sample standard deviation.

The display of outputs of VisualStat.



Data can be entered in one of two ways:

Both samples in a single numeric column with another grouping column (called factor) to identify the population. The grouping column may be categorical, numeric or text.

Each sample in a separate numeric column.

The sample sizes do not need to be equal. Missing values are ignored.



Displays a histogram, a histogram with a normal curve, and a boxplot.

Choose to display a histogram for each variable

Histogram with Normal Curve:
Choose to display a histogram with a normal curve for each variable

Boxplot of data:
Choose to display a boxplot for each variable

Choose the options you want.

oExclude missing values: Check to excludes rows that have missing values.

oInverted Bar: Check to reverse the axes.



Alternative Hypothesis:
Enter Two-sided, Upper One-sided, or Lower One-sided. If you choose an One-sided hypothesis test, an upper or lower confidence bound will be constructed, respectively, rather than a confidence interval.

Confidence Level:
Enter the level of confidence desired. Enter any number between 0 and 100. Entering 90 will result in a 90% confidence interval. The default is 95%.



Results of an experiment to test whether directed reading activities in the classroom help elementary school students improve aspects of their reading ability. A treatment class of 21 third-grade students participated in these activities for eight weeks, and a control class of 23 third-graders followed the same curriculum without the activities. After the eight-week period, students in both classes took a Degree of Reading Power (DRP) test which measures the aspects of reading ability that the treatment is designed to improve.


1.Open the DataBook compare.vstz

2.Select the sheet DRP Scores

3.Choose the tab Statistics, the group Basic Statistics and the command 2-Sample t

4.Select group Samples in one column

5.In Response, select Response. In Factor, select Treatment.

6.Click OK


Report window output


Two-Sample t Test


Two-sample T-Test of difference = 0 vs not = 0

alternative hypothesis: true difference in means is not equal to 0

                                     N     Mean    StDev  SE Mean     Corr    95% Conf Interval        t  df  p-value  Alt Hypothesis

Response-Control - Response-Treated  44  -9.9545  14.5512   4.3919  -0.1907  [-18.8176; -1.0913]  -2.2666  42   0.0286          Accept




Interpreting the results


VisualStat gives a table of confidence interval for the difference in population means. For this example, a 95% confidence interval is [-18.8176; -1.0913] which excludes zero, thus suggesting that there is a difference. Next is the hypothesis test result. The test statistic is -2.2666, with p-value of 0.0286, and 42 degrees of freedom. Since the $$p-value$ is little than commonly chosen a-levels, there is a difference between treated class and control class.




See Also:

One-sample t Test | One-Way Analysis of Variance | Report | Numeric Formats

Web Resource: NIST e-Handbook of Statistical Methods, 2006 | Probability and statistics EBook