This class simulates a "gamma" distribution. More...
#include <Gamma.h>
Public Member Functions | |
| Gamma (double k=1, double theta=1) | |
| Creates a new instance of the gamma random number generator, initializes the shape and scale parameter. | |
| Gamma (double k, double theta, RNG &r) | |
| Creates a new gamma random generator instance by using the pseudo random number generator r nd initializes the range of the numbers and internal variables. | |
| void | seed (long s) |
| Initializes the pseudo random number generator used by this class with value s. | |
| double | mean () const |
Returns the current mean value . | |
| double | variance () const |
Returns the current variance . | |
| void | shape (double s) |
| Sets the current shape parameter. | |
| void | scale (double s) |
| Sets the current scale parameter of the distribution. | |
| double | operator() (double k, double theta) |
| Returns gamma distributed random number. | |
| double | operator() () |
| Returns a gamma distributed random number. | |
| double | p (const double &x) const |
| Returns the probability desity function evaluated at x. | |
Protected Member Functions | |
| double | U01 () |
Protected Attributes | |
| double | pK |
Shape parameter of the gamma distribution. | |
| double | pTheta |
Scale parameter of the distribution. | |
This class simulates a "gamma" distribution.
The gamma distribution is a two-parameter family of continuous probability distributions having a scale parameter
and a shape parameter
. Samples from the gamma distribution are positive.
The probability density function is
and the mean is
and the variance
.
Definition at line 75 of file Gamma.h.
| Gamma::Gamma | ( | double | k = 1, |
|
| double | theta = 1 | |||
| ) |
| Gamma::Gamma | ( | double | k, | |
| double | theta, | |||
| RNG & | r | |||
| ) |
| double Gamma::mean | ( | ) | const |
| double Gamma::operator() | ( | ) | [virtual] |
Returns a gamma distributed random number.
Implements RandomVar< double >.
| double Gamma::operator() | ( | double | k, | |
| double | theta | |||
| ) |
| double Gamma::p | ( | const double & | x | ) | const [virtual] |
Returns the probability desity function evaluated at x.
Implements RandomVar< double >.
| void Gamma::scale | ( | double | s | ) |
| void Gamma::seed | ( | long | s | ) | [virtual] |
Initializes the pseudo random number generator used by this class with value s.
The pseudo random number generator as defined in class RNG is initialized by using the seed value s.
| s | initialization value for the pseudo random number generator |
Reimplemented from RandomVar< double >.
Definition at line 54 of file Gamma.cpp.
Referenced by Rng::seed().
| void Gamma::shape | ( | double | s | ) |
| double Gamma::U01 | ( | ) | [inline, protected] |
Definition at line 191 of file Gamma.h.
References RandomVar< double >::rng.
Referenced by operator()().
| double Gamma::variance | ( | ) | const |
double Gamma::pK [protected] |
Shape parameter
of the gamma distribution.
Definition at line 185 of file Gamma.h.
Referenced by Gamma(), mean(), operator()(), p(), shape(), and variance().
double Gamma::pTheta [protected] |
Scale parameter
of the distribution.
Definition at line 188 of file Gamma.h.
Referenced by Gamma(), mean(), operator()(), p(), scale(), and variance().