2.13.2.4 ttest2

Brief Information

Two-Sample t-test

Command Line Usage

1. ttest2 irng:=(Col(a), Col(b));

2. ttest2 irng:=( Col(a), Col(b)) mdiff:=0.5;

3. ttest2 irng:=( Col(a), Col(b)) tail:=2 equal:=0;

4. ttest2 irng:=(Col(a), Col(b)) prob:=myprob;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input irng

Input

Range

<active>

This variable specifies the input data ranges on which to perform a two-sample t-test. It should contain two columns.

Hypothetical means difference mdiff

Input

double

0

This variable specifies the hypothetical difference between the sample means

Tail tail

Input

int

two

This variable indicates whether an upper-, lower-, or 2- tailed t-test should be performed. (Suppose m1 and m2 are sample means and m is the mean difference)

Option list

  • two:Two Tailed
This variable indicates the two-tailed t-test is performed.
  • upper:Upper Tailed
This variable indicates the upper-tailed t-test is performed.
  • lower:Lower Tailed
This variable indicates the lower-tailed t-test is performed.
Significance level alpha

Input

double

0.05

This variable specifies alpha value, or the significance level value. With this value, the associated confidence interval will be computed. It should be larger than 0 and less than 1.

Equal variances equal

Input

int

1

This variable indicates whether or not the sample variances are assumed to be equal

T-Statistic stat

Output

double

<unassigned>

Value of the t-test statistic

Degrees of freedom df

Output

double

<unassigned>

Degrees of freedom for the sample data

P-value prob

Output

double

<unassigned>

Associated p-value of the test. Users can compare it with their desirable significance level (commonly 0.05). If the p-value is greater than or equal to alpha, the null hypothesis will not be rejected.

Lower confidence limit lcl

Output

double

<unassigned>

Specifies the lower limit of confidence levels for which the confidence intervals will be computed. This option is only available when Confidence Interval(s) is chosen.

Upper confidence limit ucl

Output

double

<unassigned>

Specifies the upper limit of confidence levels for which the confidence intervals will be computed. This option is only available when Confidence Interval(s) is chosen.

Description

The independent two-sample t-test analysis tests whether or not the means of two independent samples from a normal distribution are equal or whether they differ by a given value, and creates a confidence interval for the difference of the sample means. The two-sample t-test also enables you to test whether or not the means of two samples differ by a specified amount. The two variables are assumed to be independent and variances between two variables can be equal or unequal. Note that if the two samples are not independent, the two-sample t-test is inappropriate and you should use the paired-sample t-test instead.

The test could be either one-tailed or two-tailed. Therefore, you can test if the sample mean difference is 1) greater than, 2) less than, or 3) different from the hypothetical value. The test statistic and p-value will be calculated so that you can decide whether or not to reject the null hypothesis. A small p-value, which less than a significance level \alpha, indicates that you can reject the null hypothesis

To estimate the difference between two population means, the sample mean difference with confidence interval is also computed for each confidence levels.

Algorithm

Detail algorithms please read the help of TwoSampletTest

References

Snedecor, George W. and Cochran, William G. (1989), Statistical Methods, Eighth Edition, Iowa State University Press.

David F. Groebner, etc. (2001), Business Statistics, 4th ed. Prentice-Hall, Inc.

Related X-Functions

ttestpair, ttest1