You are here: Symbol Reference > Statistics Namespace > Functions > Statistics.NormalFit Function
Stats Master VCL
ContentsIndex
PreviousUpNext
Statistics.NormalFit Function

Calculate parameters for normally distributed values.

Pascal
procedure NormalFit(const X: TVec; out mu: double; out sigma: double; var PCIMu: TTwoElmReal; var PCISigma: TTwoElmReal; Alpha: double = 0.05); overload;
Parameters 
Description 
Stores data which is assumed to be normaly distributed. 
mu 
Return normal distribution parameter estimator Mu. 
sigma 
Return normal distribution parameter estimator Sigma. 
PCIMu 
Mu (1-Alpha)*100 percent confidence interval. 
PCISigma 
Sigma (1-Alpha)*100 percent confidence interval. 
Alpha 
Confidence interval percentage. 

RandomNormal, NormalStat

The following example generates 100 random standard normally distributed values and then uses NormalFit routine to extract used Mu and Sigma parameters

var vec1: Vector;
resMu, resSigma : double;
CIMu,CISigma: TTwoElmReal;
begin
    // 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.
    // Use at max 400 iterations and tolerance 0.0001
  NormalFit(vec1,resMu,resSigma,CIMu,CISigma);
end;
#include "StatRandom.hpp"
#include "MtxExpr.hpp"
#include "Statistics.hpp"
void __fastcall Example();
{
  sVector vec1;
    // 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);
  double resMu, resSigma;
  TTwoElmReal CIMu, CISigma;
  // 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);
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!