# 2.13.2.1 rowttest2(Pro)

Statistics: Hypothesis Testing: Two-Sample t-test on Rows.

## Brief Information

Perform a two-sample t-test on rows, with and/or without the assumption of equal variance.

This feature is for OriginPro only.

This feature is updated in Origin 2015 SR0, again in Origin 2022.

## Command Line Usage

 1. rowttest2 irng1:=(1,2,3) irng2:=(4,5,6); 

2. rowttest2 irng1:=col(a)[1]:col(c)[8] irng2:=col(d)[1]:col(f)[8] prob:=wcol(8)[1:8]; 

3. rowttest2 irng1:=(1,2,3) irng2:=(4,5,6) sig:=<new>; 

4. rowttest2 -r 2 irng1:=[Book6]data!B"1994"[1]:AC"1994"[5] irng2:=[Book6]data!AD"2004"[1]:AK"2004"[5] statistic:=<new> wt:=<new> wprob:=<new>; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
1st Data Range irng1

Input

Range

<unassigned>

Specify data range(multiple columns) of the first sample. Each row represents a data variable.

2nd Data Range irng2

Input

Range

<unassigned>

Specify data range(multiple columns) of the second sample. Each row represents a data variable.

Test Mean mean

Input

double

0

Hypothetical difference between the means of the two samples

Alternate Hypothesis tail

Input

int

Specify the alternative hypothesis of the t-test.

Option list

• two:Mean1 - Mean2 <> 0
Specify the alternative hypothesis is that if the means of the two samples are equal or not.
• upper:Mean1 - Mean2 > 0
Specify the alternative hypothesis is that if the mean of the sample 1 is greater than the mean of sample 2.
• lower:Mean1 - Mean2 < 0
Specify the alternative hypothesis is that if the mean of the sample 1 is less than the mean of sample 2.
t-statistic statistic

Output

vector

<new>

Select to output the t-statistic, and you can specify the column for the values. Each row represents the t-statistic of the data in the row.

Degree of Freedom df

Output

vector

<new>

Select to output the degree of freedom, and you can specify the column for the values. Each row represents the degree of freedom of the data in the row.

P-value prob

Output

vector

<new>

Select to output the p-value, and you can specify the column for the values. Each row represents the p-value of the data in the row.

Significant sign

Output

vector

<new>

Select to output the flag of decision and specify the column for the values. the value equals to 1 indicates that the difference of the means is significant at the 0.05 level, 0 indicates that the means are not significant different at the 0.05 level

t-statistic (Welch) wt

Output

vector

<new>

Select to output the t-statistic (Welch - equal variance not assumed), and you can specify the column for the values. Each row represents the t-statistic of the data in the row.

Degree of Freedom (Welch) wdf

Output

vector

<new>

Select to output the degrees of freedom (Welch - equal variance not assumed), and you can specify the column for the values. Each row represents the degrees of freedom of the data in the row.

P-value (Welch) wprob

Output

vector

<new>

Select to output the p-value (Welch - equal variance not assumed), and you can specify the column for the values. Each row represents the p-value of the data in the row.

Significant (Welch) wsign

Output

vector

<new>

Select to output the decision flag (Welch - equal variance not assumed) and specify the column for the values. Value equal to 1 indicates that the difference of the means is significant at the 0.05 level, 0 indicates that the means are not significant different at the 0.05 level

## 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.

This function performs independent two-sample t-test for the rows. The data of both samples is set in one row to perform this two-sample t-test of this row.

## Examples

1. Import rowttest2.dat on the\Sample\Statistics\ folder.

2. Use the default setting, run the script below in Script Window or Command Window:

rowttest2 irng1:=(1,2,3,4) irng2:=(5,6,7);

This script specifies that for each rows, column 1 to column 4 is sample one, column 5 to column 7 is sample two. These two samples are used to do independent two-sample t-test. And the p-value will output to a new column of source worksheet.

3. To output both p-value and significant flag, the p-value will be put in the 8the column and the significant flag will be put in the 8th column, run the script below

rowttest2 irng1:=(1,2,3,4) irng2:=(5,6,7) prob:=wcol(8) sig:=<new>;
 Notes: We can specify an existing range such as wcol(8) for the output variables such as prob ect. However, if specifying an existing column, header of the column won't be updated to indicate the name of the output variable.