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

Calculate parameters for log-normally distributed values.

Pascal
procedure LogNormalFit(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 log-normaly distributed. 
mu 
Return log-normal distribution parameter estimator M u. 
sigma 
Return log-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. 

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

Uses StatRandom, Statistics, MtxExpr;
procecure Example;
  var Data :Vector;
  mu,sigma: double;
  MuCI, SigmaCI : TTwoElmReal;
begin
  Data.Size(100);
  RandomLogNormal(3,0.2,Data);
  LogNormalFit(Data,mu,sigma,MuCI,SigmaCI);
  // mu approx 3.0
  // sigma approx 0.2
end;
#include "StatRandom.hpp"
#include "MtxExpr.hpp"
#include "Statistics.hpp"
void __fastcall Example();
{
  sVector Data;
  Data.Size(100,false);
  RandomLogNormal(3,0.2,Data);
  double mu, sigma;
  TTwoElmReal MuCI;
  TTwoElmReal SigmaCI;
  LogNormalFit(Data,mu,sigma,MuCI,SigmaCI,0.05);

  // mu approx 3.0
  // sigma approx 0.2
}
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!