distributed values.
Example 1
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 : TSample;
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 "MtxVecCpp.h"
#include "Statistics.hpp"
void __fastcall Example();
{
Vector 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;
double CIMu[2];
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);
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples;
{
private void Example()
{
Vector vec1 = new Vector(0);
// first, generate 1000 normaly distributed
// numbers with Mu a=0.0 and Sigma =1.0
vec1.Size(1000,false);
StatRandom.RandomNormal(0.0,1.0,vec1);
double resMu, resSigma;
double[2] CIMu;
double[2] CISigma;
// Now extract the Mu,Sigma and their 95% confidence intervals.
// Use at max 400 iterations and tolerance 0.0001
Statistics.NormalFit(vec1,out resMu,out resSigma,out CIMu,out CISigma,0.05);
}
}