Example #1
0
 /// Assigns new values to the parameters.
 /// This method assumes that the parameters have been already checked.
 public void DefineParameters(double shape, double scale)
 {
     _alpha = shape;
     _beta  = scale;
     _norm  = Math.Log(_beta) * _alpha + GammaFunction.LogGamma(_alpha);
     if (_alpha < 1)
     {
         _b = (Math.E + _alpha) / Math.E;
     }
     else if (_alpha > 1)
     {
         _a = Math.Sqrt(2 * _alpha - 1);
         _b = _alpha - Math.Log(4.0);
         _q = _alpha + 1 / _a;
         _d = 1 + Math.Log(4.5);
     }
     _incompleteGammaFunction = null;
 }
Example #2
0
 /// Returns the probability of finding a random variable smaller
 /// than or equal to x.
 /// @return integral of the probability density function from 0 to x.
 /// @param x double upper limit of integral.
 public override double DistributionValue(double x)
 {
     return(IncompleteGammaFunction.Value(x / _beta));
 }
 /// Assigns new values to the parameters.
 /// This method assumes that the parameters have been already checked.
 public void DefineParameters(double shape, double scale)
 {
     _alpha = shape;
     _beta = scale;
     _norm = System.Math.Log(_beta) * _alpha + GammaFunction.LogGamma(_alpha);
     if (_alpha < 1)
         _b = (System.Math.E + _alpha) / System.Math.E;
     else if (_alpha > 1)
     {
         _a = System.Math.Sqrt(2 * _alpha - 1);
         _b = _alpha - System.Math.Log(4.0);
         _q = _alpha + 1 / _a;
         _d = 1 + System.Math.Log(4.5);
     }
     _incompleteGammaFunction = null;
 }