Statistics::BetaFit Function

Overload List

#SignatureDescription
1void BetaFit(TVec *X, double &A, double &B, int MaxIter = 500, double Tolerance = 1E-8);Calculate parameters for Beta distributed values using MLE.
2void BetaFit(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 Beta distributed values.

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

Calculate parameters for Beta 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 beta distributed
    // numbers with parameters a=3 and b =2
    vec1.Size(1000);
    RandomBeta(3,2,vec1);
    // Now extract the a,b and their 95% confidence intervals.
    //Use at max 300 iterations and tolerance 0.001
    BetaFit(vec1,resA,resB,CIA,CIB,300,1e-3);
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: void BetaFit(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 Beta distributed values.

#NameTypeDescription
1XTVec *Stores data which is assumed to be Beta distributed.
2Adouble &Return Beta distribution parameter estimator a.
3Bdouble &Return Beta 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 <random>
#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 v(1000, false);
    // first, generate 1000 randomly beta distributed
    // numbers with parameters a = 3 and b = 2
    std::random_device rnd;
    RandomBeta(3.0, 2.0, v, (int)(rnd() % 2147483647u));

    double esta, estb;
    DewArray<double> cia(2);
    DewArray<double> cib(2);
    // Now extract the a,b and their 95% confidence intervals.
    //Use at max 300 iterations and tolerance 0.001
    BetaFit(v, esta, estb, cia, cib, 300, 1.0e-3, 0.05);
}
See Also: RandomBeta, BetaStat
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler