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

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);
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.