Calculate parameters for Beta distributed values.
procedure BetaFit(const X: TVec; out A: double; out B: double; var PCIA: TTwoElmReal; var PCIB: TTwoElmReal; MaxIter: Integer = 500; Tolerance: double = 1e-8; Alpha: double = 0.05); overload;
Parameters |
Description |
X |
Stores data which is assumed to be Beta distributed. |
A |
Return Beta distribution parameter estimator a. |
B |
Return Beta distribution parameter estimator b. |
PCIA |
a (1-Alpha)*100 percent confidence interval. |
PCIB |
b (1-Alpha)*100 percent confidence interval. |
MaxIter |
Maximum number of iterations needed for deriving a and b. |
Tolerance |
Defines the acceptable tolerance for calculating a and b. |
Alpha |
Confidence interval percentage. |
RandomBeta, BetaStat
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.
|
What do you think about this topic? Send feedback!
|