distributed values.
Example 1
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 : TSample;
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 "MtxVecCpp.h"
#include "Statistics.hpp"
#include "StatRandom.hpp"
void __fastcall Example()
{
Vector 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;
double cia[2];
double cib[2];
// 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);
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples;
{
private void Example()
{
Vector v = new Vector(1000,false);
// first, generate 1000 randomly beta distributed
// numbers with parameters a=3 and b =2
StatRandom.RandomBeta(3.0, 2.0, v);
double esta,estb;
double[2] cia,cib;
// Now extract the a,b and their 95% confidence intervals.
//Use at max 300 iterations and tolerance 0.001
Statistics.BetaFit(v,out esta, out estb, out cia, out cib, 300, 1.0e-3, 0.05);