You are here: Symbol Reference > Dew.Stats Namespace > Statistics Class > Statistics Methods > GammaFit Method > GammaFit Method (TVec, TSample, TSample, TTwoElmReal, TTwoElmReal, Integer, TSample, TSample)
Dew Stats for .NET
Contents
PreviousUpNext
Statistics.GammaFit Method (TVec, TSample, TSample, TTwoElmReal, TTwoElmReal, Integer, TSample, TSample)

Calculate parameters for Gamma distributed values.

C#
public GammaFit(TVec X, ref double A, ref double B, ref TTwoElmReal PCIA, ref TTwoElmReal PCIB, int MaxIter, double Tolerance, double alpha);
Parameters
Parameters 
Description 
Stores data which is assumed to be Gamma distributed. 
Return Gamma distribution parameter estimator A. 
Return Gamma 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. 

RandomGamma, GammaStat

The following example generates 100 random Gamma distributed values and then uses GammaFit routine to extract used a and b parameters

using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples;
{
  private void Example()
  {
    Vector vec1 = new Vector(0);
    // first, generate 1000 randomly gamma distributed
    // numbers with parameters a=0.5 and b =1.2
    vec1.Size(1000,false);
      StatRandom.RandomGamma(0.5,1.2,vec1);
    // Now extract the a,b and their 95% confidence intervals.
    // Use at max 400 iterations and tolerance 0.0001
    double resA, ResB;
    double[2] CIA;
    double[2] CIB;
    GammaFit(vec1,out resA,out resB,out CIA,out CIB,400,1e-4,0.05);
  }
}
What do you think about this topic? Send feedback!
Copyright (c) 1999-2010 by Dew Research. All rights reserved.