ocmath_chi_square_test

 

Description

Function to perform a Chi-Square Test for equal variance.

Syntax

int ocmath_chi_square_test( UINT nSize, const double * pData, const HypotTestOptions * opt, tTestResults * pChiSqRes )

Parameters

nSize
[input] number of data points in pData
pData
[input] pointer to data points for One Sample t-Test
opt
[input] structure containing t-Test options
pChiSqRes
[output] pointer to structure containing Chi-Square Test Results

Return

Returns STATS_NO_ERROR on successful exit and a non-zero STATS error code on failure.

Examples

EX1

void ocmath_chi_square_test_ex1()
{
    vector vData = {1, 2, 3, 4};
    double var = 2.0;
    int tail = 1;
    
    HypotTestOptions HTO;
    tTestResults chi2Res;
    HTO.HypotValue = var;
    HTO.TailType = tail;
    int nRet = ocmath_chi_square_test(vData.GetSize(), vData, &HTO, &chi2Res);
    
    out_int("nRet=", nRet); //nRet = 0;
    //print out Chi-Square Test Results.
    printf("chi2Res.DOF = %f, chi2Res.tValue = %f, chi2Res.Prob = %f", chi2Res.DOF,  chi2Res.tValue, chi2Res.Prob);
}

Remark

See Also

header to Included

origin.h

Reference