distributed values.
Example 1
The following example generates 1000 random Geometric distributed values and then uses GeometricFit routine to extract used P parameter: Uses MtxExpr, Math387, Statistics;
procedure Example;
var vec1: Vector;
resp: TSample;
CIp: TTwoElmReal;
begin
// first, generate 1000 randomly geometr. distributed
// numbers with parameter p=0.713
vec1.Size(1000);
RandomGeometric(0.713,vec1);
// Now, extract the p and its 100*(1-0.05) = 95%
// confidence interval
GeometricFit(vec1,resp,CIp);
end;
#include "StatRandom.hpp"
#include "MtxVecCpp.h"
#include "Statistics.hpp"
void __fastcall Example();
{
Vector vec1;
// first, generate 1000 randomly geometr. distributed
// numbers with parameter p=0.713
vec1->Size(1000);
RandomGeometric(0.713,vec1);
// Now, extract the p and its 100*(1-0.05) = 95%
// confidence interval
double resp;
double CIp[2];
GeometricFit(vec1,resp,CIp);
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples;
{
private void Example()
{
Vector vec1 = new Vector(1000,false);
// first, generate 1000 randomly geometr. distributed
// numbers with parameter p=0.713
StatRandom.RandomGeometric(0.713,vec1);
// Now, extract the p and its 100*(1-0.05) = 95%
// confidence interval
double resp;
double[2] CIp;
Statistics.GeometricFit(vec1, out resp, outCIp);
}
}
Declaration
Procedure GeometricFit(X: TVec; out P: Tsample);