ocmath_one_sample_t_test

 

Description

Function to perform a One Sample t-Test.

Syntax

int ocmath_one_sample_t_test( const double * pData, UINT nSize, const HypotTestOptions * opt, tTestMean1SampleResults * res )

Parameters

pData
[Input] pointer to data points for One Sample t-Test
nSize
[Input] number of data points in pData
opt
[Input] structure containing t-Test options
res
[Output] structure containing t-Test Results

Return

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

Examples

EX1

void ocmath_one_sample_t_test_ex1()
{
    vector vData = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
       HypotTestOptions HTO;
    tTestMean1SampleResults tRes;
    double mean = 0.0;
    int tail = 1;
    HTO.HypotValue = mean;
    HTO.TailType=tail;

    int nRet = ocmath_one_sample_t_test(vData, vData.GetSize(), &HTO, &tRes);
    out_int("nRet=", nRet); //nRet = 0;
    
    //print out tRes
    printf("value of tRes:\n");
    printf("tRes.N=%d, tRes.Mean=%f, tRes.SD=%f, tRes.SEM=%f\n", tRes.N, tRes.Mean, tRes.SD, tRes.SEM);
    printf("tRes.DOF=%d, tRes.tValue=%f, tRes.Prob=%f\n", tRes.DOF, tRes.tValue, tRes.Prob);
}

Remark

See Also

header to Included

origin.h

Reference