| ocmath_opt_summary_stats  DescriptionFunction to compute descriptive statistics other than basic ones from raw data, like Mode, Geometric Standard Deviation, The dConfLevel confidence interval of mean, etc. Syntax
OCMATH_API int ocmath_opt_summary_stats(UINT nSize, const double *pData, const double dConfLevel, double* pMode = NULL,  bool* pmultimodes = NULL, 
                                                            double* pGSD = NULL, double* pLCL = NULL, double* pUCL = NULL, double* pSDx2 = NULL, 
                                                            double* pSDx3 = NULL, int MomentDenFlag = DS_SAS1_DOF, const double *pWt = NULL)
Parameters
    nSize[input] Size of raw data arraypData[input] Pointer to raw data arraydConfLevel[input] Confidence LevelpMode[output] The mode is the element that appears most often in the data range. If multiple modes are found, the smallest will be chosen.pmultimodes[input] Flag indicating whether using multitpGSD[output] The geometric standard deviation. Weights are ignored for the geometric standard deviation.pLCL[output] Lower limit of the dConfLevel confidence interval of meanpUCL[output] Upper limit of the dConfLevel confidence interval of meanpSDx2[output]Standard deviation times 2pSDx3[output]Standard deviation times 3MomentDenFlag[input] Variance Divisor of Moment. This option decides the method to compute variance divisor d. You can use one of the following options: DS_SAS1_DOF, DS_SAS2_N, DS_SAS3_WDF, DS_SAS4_WGT and DS_NAG. They will compute d as degree of freedom, number of non-missing observations, degree of Sum of weights, sum of weights and WVR, respectivelypWt[input] Pointer to Weights ReturnReturn STATS_NO_ERROR (0) on success. Otherwise returns error. ExamplesEX1 
//This example is to calculate Mode and Geometric Standard Deviation
ocmath_opt_summary_stats_ex1()
{
        vector vData={3,2,1,4,2,5,4,6,9};
        int nSize = vData.GetSize();
        double dConfLevel = 0.95;
        bool bMultiModes = TRUE;
        double dMode, dGSD;
        int nRet = ocmath_opt_summary_stats(nSize, vData, dConfLevel, &dMode, &bMultiModes, &dGSD);
        if(0 == nRet)
        {
                out_double("Mode = ",dMode);
                out_double("GSD = ",dGSD);
        }
}
EX2 
//This example is to calculate upper and lower limit of the 95% confidence interval of mean
ocmath_opt_summary_stats_ex2()
{
        vector vData={3.1,3.2,4.1,4.2,5.4,6.9};
        int nSize = vData.GetSize();
        double dConfLevel = 0.95;
        bool bMultiModes = TRUE; 
        double dLCL, dUCL;
        int nRet = ocmath_opt_summary_stats(nSize, vData, dConfLevel, NULL, &bMultiModes, NULL, &dLCL, &dUCL);
        if(0 == nRet)
        {
                out_double("LCL = ",dLCL);
                out_double("UCL = ",dUCL);
        }
}
RemarkFunction to compute descriptive statistics other than basic ones. See Alsoocmath_basic_summary_stats header to Includeorigin.h Reference |