2.13.2.4 ttest2
Brief Information
TwoSample ttest
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;
XFunction Execution Options
Please refer to the page for additional option switches when accessing the xfunction from script
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 twosample ttest. 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 ttest should be performed. (Suppose m1 and m2 are sample means and m is the mean difference)
Option list
 This variable indicates the twotailed ttest is performed.
 This variable indicates the uppertailed ttest is performed.
 This variable indicates the lowertailed ttest 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

TStatistic

stat

Output
double

<unassigned>

Value of the ttest statistic

Degrees of freedom

df

Output
double

<unassigned>

Degrees of freedom for the sample data

Pvalue

prob

Output
double

<unassigned>

Associated pvalue of the test. Users can compare it with their desirable significance level (commonly 0.05). If the pvalue 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 twosample ttest 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 twosample ttest 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 twosample ttest is inappropriate and you should use the pairedsample ttest instead.
The test could be either onetailed or twotailed. 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 pvalue will be calculated so that you can decide whether or not to reject the null hypothesis. A small pvalue, which less than a significance level , 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. PrenticeHall, Inc.
Related XFunctions
ttestpair, ttest1
