2.13.4.5 mwtest(Pro)

Menu Information

Statistics: Nonparametric Tests: Mann-Whitney test

Brief Information

Preform Mann-Whitney test

Additional Information

This feature is for OriginPro only.

Command Line Usage

1. mwtest  type:=1 irng:=(1,2) 
2. mwtest  irng:=(1,2) tail:=upper; 
3. mwtest  irng:=(1,2) tail:=lower rt:=<new MW>

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Data Form type

Input

int

0
Specify the input data form.

Option list:

  • Indexed
    Input data range, including input group range and data range.
Example:
mediantest (1,2)
In this example, the input group should be stored in the first column and the input data should be stored in the second column.
  • Raw
    Specify two data columns as input data.
Note: With the Stack and Unstack tool, you can convert indexed data to raw data, and raw data to indexed data.
Input irng

Input

Range

<active>
Specify the input data.
Null Hypothesis null

Input

string

0
Specify the null hypothesis of Mann-Whiney test.
Alternate Hypothesis tail

Input

int

Radio
Indicates whether an upper, lower, or two-tailed MW-test should be performed.

Option list:

  • 0=Radio:two:Median1 <> Median2
Performs a 2-tailed MW-test
  • 1=upper:Median1 > Median2
Performs an upper-tailed MW-test
  • 2=lower:Median1 < Median2
Performs an lower-tailed MW-test
Significance Level alpha

Input

double

0.05
Specify the significance level of the test.
Exact P Value exact

Input

int

0
Specify whether to calculate exact p value.
Output Results rt

Output

ReportTree

[<input>]<new>
Include Notes table, Descriptive table, Ranks table, and Test Statistics table.

Examples

  • To perform a two-tailed MW-test on columns 1 and 2 of the active worksheet, using default settings:
mwtest irng:=(1,2)
  • To perform a lower-tailed MW-test on columns 1 and 3 of the active worksheet, and save the result table with the name MW, use the script command:
mwtest irng:=(1,3) tail:=2 rt:=<new name:=MW>
  • Sample Code
/*
This example is used to show how to test whether the two populations have identical distribution or not,
when the normality is questionable.
The sample data used is in
  OriginPath\Samples\Statistics folder.
1. Import the sample data into a book in Origin
2. use mwtest XF to calculate the U-statistics and p-value.
3. put the result into a new sheet
*/
/*Import the sample data into a new book*/
String fname$=system.path.program$+"Samples\Statistics\mw-test.dat";
newbook;
impASC;
string bkn$=%H;

/*Use the mwtest XF to calculate the U statistics and p-value*/
mwtest irng:=[bkn$]1!(col(1),col(2)) rt:=<new name:="Manny-Whitney">;

/*New a sheet to stor the results of the Manny-Whitney test*/
newsheet book:=bkn$ name:="Result" label:="MW_U|Zstat|Sig";
range MW_U=[bkn$]Result!col(1);
range Zstat=[bkn$]Result!col(2);
range Sig=[bkn$]Result!col(3);
getresults iw:=[bkn$]2 tr:=mytree;
MW_U[1]=mytree.stats.stats.c1;
Zstat[1]=mytree.stats.stats.c2;
Sig[1]=mytree.stats.stats.c3;

More Information

For more information, please refer to our User Guide.

Related X-Functions

kstest2, ttest2