ocmath_two_sample_confidence_levels_for_mean_pair

 

Description

Function to compute confidence levels for the mean of pData1 minus the mean of pData2, assuming equal variance.

Syntax

int ocmath_two_sample_confidence_levels_for_mean_pair( const double * vLevels, int nLevelSize, const tTestMean2SampleResults * tTestRes, const HypotTestOptions * opt, double * vLCLs, double * vUCLs )

Parameters

vLevels
[Input] vector containing confidence levels, e.g. {0.9, 0.95, 0.99}
nLevelSize
[Input] number of levels in vLevels.
tTestRes
[Input] structure containing t-Test results from ocmath_two_sample_t_test_pair
opt
[Input]structure containing t-Test options
vLCLs
[Output] pointers to Lower Confidence Limits for mean
vUCLs
[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_two_sample_confidence_levels_for_mean_pair_ex1()
{
      vector vData1 = { 1.7, 2.1, 3.9, 7.2, 8.6, 8.5, 7.3, 5.1, 2.8, 1.8, 1.7 };
      vector vData2 = { 3.2, 3.9, 4.9, 5.3, 5.5, 6.2, 6.5, 6.9, 7.5, 8.3, 9.4 };  
       HypotTestOptions HTO;
    tTestMean2SampleResults tRes;
    double mean = 0.0;
    int tail = 1;
    HTO.HypotValue = mean;
    HTO.TailType=tail;
    //get t-Test results from ocmath_two_sample_t_test_pair
    int nRet = ocmath_two_sample_t_test_pair(vData1, vData1.GetSize(), vData2, vData2.GetSize(), &HTO, &tRes);
    
    vector vLevels = {0.9, 0.95, 0.99};
    UINT nLevels = vLevels.GetSize();
    vector vLCLs, vUCLs;
    vLCLs.SetSize(nLevels);
    vUCLs.SetSize(nLevels);
    
    nRet = ocmath_two_sample_confidence_levels_for_mean_pair(vLevels, nLevels, &tRes, &HTO, 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_two_sample_t_test_pair

Header to Included

origin.h

Reference