2.1.17.8.3 ocmath_check_order


Description

Check a segment of curve's X value is monotonic increase, monotonic decrease, or not monotonic.

Syntax

int ocmath_check_order( UINT nSize, const double * pData, double * pMeanInc = NULL, double * pSDInc = NULL, int * pSegSize = NULL, double dProb = 0.8 )

Parameters

nSize
[input] size of the segment's data array.
pData
[input] pointer to the segment's data array.
pMeanInc
[output] if not NULL, pointer to the segment X value's mean increment,
its default value is NULL.
pSDInc
[output] if not NULL, pointer to standard deviation of the segment X value's
increment array, its default value is NULL.
pSegSize
[output] if not NULL, pointer to the segment's size, its default value is NULL.
dProb
[input] after t-test, the hypothysis will be accepted when P-value < (1 - dProb).
Its default value is 0.8.

Return

if succeed, return MONO_INCREASE if monotonic increase,

return MONO_DECREASE if monotonic decrease,

return MONO_NOT if not monotonic;

orthewise, negetive error code is returned.

Examples

EX1

void ocmath_check_order_ex1()
{ 
    vector vSegData = {0.2, 0.4, 0.1, -0.1, 0.4, -0.7};
    double dMeanInc, dSDInc;
    int nSegSize;
    int nRet = ocmath_check_order(vSegData.GetSize(), vSegData, &dMeanInc, &dSDInc, &nSegSize);    
}
// At the end of example: nRet = 0 (MONO_NOT).

EX2

void ocmath_check_order_ex2()
{ 
    vector vSegData = {0.2, 0.4, 0.1, 0.1, 0.4, 0.7};
    int nRet = ocmath_check_order(vSegData.GetSize(), vSegData, NULL, NULL, NULL);    
}
// At the end of example: nRet = 2 (MONO_INCREASE).

Remark

This function checks a segment of curve's X value is monotonic increase, monotonic

decrease, or not monotonic use t- test(if X value's increment array's min value

!= max value) or check the X value's increment array directly(if X value's increment

array's min value == max value).

it can handle that the curve has some outliers.

See Also

ocmath_check_order_curve, ocmath_check_order_multiple_curves

Header to Include

origin.h

Reference