Statistics::NormalFit Function

Overload List

#SignatureDescription
1void NormalFit(TVec *X, double &mu, double &sigma);Calculate parameters for normally distributed values.
2void NormalFit(TVec *X, double &mu, double &sigma, DewArray<double> &PCIMu, DewArray<double> &PCISigma, double Alpha = 0.05);Calculate parameters for normally distributed values.

Overload 1: void NormalFit(TVec *X, double &mu, double &sigma);

Calculate parameters for normally distributed values.

#NameTypeDescription
1XTVec *
2mudouble &
3sigmadouble &
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 resMu, resSigma;
    DewArray<double> CIMu(2), CISigma(2);

    // first, generate 1000 normaly distributed
    // numbers with Mu a=0.0 and Sigma =1.0
    vec1.Size(1000);
    RandomNormal(0.0,1.0,vec1);
    // Now extract the Mu,Sigma and their 95% confidence intervals.
    NormalFit(vec1,resMu,resSigma,CIMu,CISigma);
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: void NormalFit(TVec *X, double &mu, double &sigma, DewArray<double> &PCIMu, DewArray<double> &PCISigma, double Alpha = 0.05);

Calculate parameters for normally distributed values.

#NameTypeDescription
1XTVec *Stores data which is assumed to be normaly distributed.
2mudouble &Return normal distribution parameter estimator Mu.
3sigmadouble &Return normal distribution parameter estimator Sigma.
4PCIMuDewArray<double> &Mu (1-Alpha)*100 percent confidence interval.
5PCISigmaDewArray<double> &Sigma (1-Alpha)*100 percent confidence interval.
6Alpha = 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 normaly distributed
    // numbers with Mu a=0.0 and Sigma =1.0
    vec1.Size(1000, false);
    RandomNormal(0.0, 1.0, vec1, -1);
    double resMu, resSigma;
    DewArray<double> CIMu(2);
    DewArray<double> CISigma(2);
    // Now extract the Mu,Sigma and their 95% confidence intervals.
    // Use at max 400 iterations and tolerance 0.0001
    NormalFit(vec1, resMu, resSigma, CIMu, CISigma, 0.05);
}
See Also: RandomNormal, NormalStat
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler