Statistics::GammaFit Function

Overload List

#SignatureDescription
1void GammaFit(TVec *X, double &A, double &B, int MaxIter = 500, double Tolerance = 1E-8);Calculate parameters for Gamma distributed values using MLE.
2void GammaFit(TVec *X, double &A, double &B, DewArray<double> &PCIA, DewArray<double> &PCIB, int MaxIter = 500, double Tolerance = 1E-8, double Alpha = 0.05);Calculate parameters for Gamma distributed values.

Overload 1: void GammaFit(TVec *X, double &A, double &B, int MaxIter = 500, double Tolerance = 1E-8);

Calculate parameters for Gamma distributed values using MLE.

#NameTypeDescription
1XTVec *
2Adouble &
3Bdouble &
4MaxIter = 500int
5Tolerance = 1E-8double
Examples
#include "MtxExpr.h"
#include "Units.StatRandom.h"
#include "Units.Statistics.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::StatRandom;
using namespace Dew::Stats::Units::Statistics;

void Example()
{
    Vector vec1;
    double resA, resB;
    DewArray<double> CIA(2), CIB(2);

    // first, generate 1000 randomly gamma distributed
    // numbers with parameters a=0.5 and b =1.2
    vec1.Size(1000);
    RandomGamma(0.5,1.2,vec1);
    // Now extract the a,b and their 95% confidence intervals.
    // Use at max 400 iterations and tolerance 0.0001
    GammaFit(vec1,resA,resB,CIA,CIB,400,1e-4);
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: void GammaFit(TVec *X, double &A, double &B, DewArray<double> &PCIA, DewArray<double> &PCIB, int MaxIter = 500, double Tolerance = 1E-8, double Alpha = 0.05);

Calculate parameters for Gamma distributed values.

#NameTypeDescription
1XTVec *Stores data which is assumed to be Gamma distributed.
2Adouble &Return Gamma distribution parameter estimator A.
3Bdouble &Return Gamma distribution parameter estimator B.
4PCIADewArray<double> &A (1-Alpha)*100 percent confidence interval.
5PCIBDewArray<double> &B (1-Alpha)*100 percent confidence interval.
6MaxIter = 500intMaximum number of iterations needed for deriving a and b.
7Tolerance = 1E-8doubleDefines the acceptable tolerance for calculating a and b.
8Alpha = 0.05doubleConfidence interval percentage.
Examples
#include "MtxExpr.h"
#include "Units.StatRandom.h"
#include "Units.Statistics.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::StatRandom;
using namespace Dew::Stats::Units::Statistics;

void Example()
{
    Vector vec1(0);
    // first, generate 1000 randomly gamma distributed
    // numbers with parameters a=0.5 and b =1.2
    vec1.Size(1000, false);
    RandomGamma(0.5, 1.2, vec1, -1);
    // Now extract the a,b and their 95% confidence intervals.
    // Use at max 400 iterations and tolerance 0.0001
    double resA, resB;
    DewArray<double> CIA(2);
    DewArray<double> CIB(2);
    GammaFit(vec1, resA, resB, CIA, CIB, 400, 1e-4, 0.05);
}
See Also: RandomGamma, GammaStat
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler