2.1.24.2.3 ocmath_mann_whitney


Description

Performs a Mann-Whitney U test for on two independent samples of possibley unequal size. The main engine is nag_mann_whitney. This is an OriginPro only function.

Syntax

int ocmath_mann_whitney( const double * pData1, const int nSize1, const double * pData2, const int nSize2, const int nTailType, NPHSummary * MannSummary, NPHRanks * MannRanks, NPHStats * MannStats, bool bExact = false )

Parameters

pData1
[input] pointer to 1st data points for Wilcoxon Rank Sum test
nSize1
[input] number of pData1
pData2
[input] pointer to 2nd data points for Wilcoxon Rank Sum test
nSize2
[input] number of pData2
nTailType
[input] value indicates Tail Type. which containing 3 types:
TAILED_TEST_TWO is 0,
TAILED_TEST_UPPER is 1,
TAILED_TEST_LOWER is 2
MannSummary
[output] structure containing summary statistics of the 2 groups
MannSummary[0]: Summary statistics of 1st group
MannSummary[1]: Summary statistics of 2nd group
MannRanks
[output] structure containing Statistics of Ranks
MannRanks[0]: Ranks of 1st group
MannRanks[1]: Ranks of 2nd group
MannStats
[output] structure containing the test statistic and p-value
bExact
[input] Optional Input flag indicates if exact probalility to computed. return false if exact probability fail to be computed
bExact is true: compute the exact probability
bExact is false: compute the approximate probability.

Return

Returns STATS_NO_ERROR on successful exit or an STATS error code on failure.

Examples

EX1

void ocmath_mann_whitney_ex1()
{
    vector pData1 = {1.0, 2.3, 4.5, 2.0, 5.3};
    int nSize1 = pData1.GetSize();
    vector pData2 = {2.2, 5.6, 4.3, 1.7, 3.8, 1.2};
    int nSize2 = pData2.GetSize();
    int nTailType = TAILED_TEST_TWO;
    NPHSummary MannSummary[2]; 
    NPHRanks MannRanks[2]; 
    NPHStats MannStats;
    bool bExact = true;
    
    int nRet = ocmath_mann_whitney(pData1, nSize1, pData2, nSize2, nTailType, MannSummary, MannRanks, &MannStats, bExact);
    out_int("nRet=", nRet);
}

Remark

See Also

Header to Included

origin.h

Reference