2.1.24.6.2 ocmath_confidence_levels_for_mean


Description

Function to compute confidence levels for a mean.

Syntax

int ocmath_confidence_levels_for_mean( const double * pLevels, UINT nLevels, const tTestMean1SampleResults * tTestRes, double * pLCLs, double * pUCLs )

Parameters

pLevels
[Input] pointer to confidence levels, e.g. {0.9, 0.95, 0.99}
nLevels
[Input] number of levels in pLevels.
tTestRes
[Input] structure containing t-Test results from ocmath_one_sample_t_test
pLCLs
[Output] pointers to Lower Confidence Limits for mean
pUCLs
[Output] pointers to Upper Confidence Limits for mean

Return

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

Examples

EX1

void ocmath_confidence_levels_for_mean_ex1()
{
    vector vLevels = {0.9, 0.95, 0.99};
    UINT nLevels = vLevels.GetSize();
      HypotTestOptions HTO;
    tTestMean1SampleResults tRes;
    double mean = 0.0;
    int tail = 1;
    HTO.HypotValue = mean;
    HTO.TailType = tail;
    
    int nRet = ocmath_one_sample_t_test(vLevels, nLevels, &HTO, &tRes);
    
    vector vLCLs, vUCLs;
    vLCLs.SetSize(nLevels);
    vUCLs.SetSize(nLevels);

    nRet = ocmath_confidence_levels_for_mean(vLevels, nLevels, &tRes, vLCLs, vUCLs);
    out_int("nRet=", nRet); //nRet = 0;
    int ii;
    
    //print out Lower Confidence Limits for mean
    printf("vLCLs = {");
    for(ii=0; ii<vLCLs.GetSize(); ii++)
    {
        printf("%f\t", vLCLs[ii]);
    }
    printf("}\n");
    
    //print out Upper Confidence Limits for mean
    printf("vUCLs = {");
    for(ii=0; ii<vUCLs.GetSize(); ii++)
    {
        printf("%f\t", vUCLs[ii]);
    }
    printf("}\n");
}

Remark

See Also

ocmath_one_sample_t_test

Header to Included

origin.h

Reference