The following example generates 100 random Beta distributed values and then uses BetaFit routine to extract used a and b parameters:
Uses MtxExpr, Math387, Statistics, StatRandom; procedure Example; var vec1: Vector; resA, resB : double; CIA,CIB: TTwoElmReal; begin // first, generate 1000 randomly beta distributed // numbers with parameters a=3 and b =2 vec1.Size(1000); RandomBeta(3,2,vec1); // Now extract the a,b and their 95% confidence intervals. //Use at max 300 iterations and tolerance 0.001 BetaFit(vec1,resA,resB,CIA,CIB,300,1e-3); end;
#include "MtxExpr.hpp" #include "Statistics.hpp" #include "StatRandom.hpp" #include "RndImport.hpp" void __fastcall Example() { sVector vec1; vec1.Size(1000,false); // first, generate 1000 randomly beta distributed // numbers with parameters a=3 and b =2 RandomBeta(3,2,vec1); double esta,estb; TTwoElmReal cia, cib; // Now extract the a,b and their 95% confidence intervals. //Use at max 300 iterations and tolerance 0.001 BetaFit(vec1,esta,estb,cia,cib,300,1.0E-3,0.05); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
|