2.1.24.6.8 ocmath_two_sample_tTest_powers


Description

Function to compute actual or hypothetical powers for a two sample t-Test.

Syntax

int ocmath_two_sample_tTest_powers( const double dSigLevel, const HypotTestOptions * opt, const double * pSampleSizes, UINT nSizes, tTestMean2SampleResults * tTestRes, double * pPowers )

Parameters

dSigLevel
[Input]Significance level for power computations
opt
[Input]structure containing t-Test options
pSampleSizes
[Input]pointers to actual and hypothetical sample sizes
nSizes
[Input]number of sample size in pSampleSizes
tTestRes
[Input]structure containing t-Test results output from ocmath_two_sample_t_test
pPowers
[Output]pointers to powers

Return

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

Examples

EX1

void ocmath_two_sample_tTest_powers_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;
    HTO.HypotValue = 1;
    HTO.TailType = TAILED_TEST_TWO;
    //get t-Test results from ocmath_two_sample_t_test
    int nRet = ocmath_two_sample_t_test(vData1, vData1.GetSize(), vData2, vData2.GetSize(), &HTO, &tRes);
        
    const double dSigLevel = 0.5;
    vector vOutput;
    vOutput.SetSize(vData1.GetSize());
    
    nRet = ocmath_two_sample_tTest_powers(dSigLevel, &HTO, vData1, vData1.GetSize(), &tRes, vOutput);
    out_int("nRet=", nRet); //nRet = 0;

    //print out powers
    printf("vOutput = {");
    for(int ii=0; ii<vOutput.GetSize(); ii++)
    {
        printf("%f\t", vOutput[ii]);
    }
    printf("}\n");                                                    
}

Remark

See Also

ocmath_two_sample_tTest_powers_pair, ocmath_two_sample_t_test

Header to Included

origin.h

Reference