Gamma Structure 
Namespace: MicrosoftResearch.Infer.Distributions
[SerializableAttribute] [Quality(QualityBand.Mature)] public struct Gamma : IDistribution<double>, ICloneable, HasPoint<double>, CanGetLogProb<double>, SettableTo<Gamma>, SettableToProduct<Gamma>, SettableToProduct<Gamma, Gamma>, Diffable, SettableToUniform, SettableToRatio<Gamma>, SettableToRatio<Gamma, Gamma>, SettableToPower<Gamma>, SettableToWeightedSum<Gamma>, Sampleable<double>, CanGetMean<double>, CanGetVariance<double>, CanGetMeanAndVarianceOut<double, double>, CanSetMeanAndVariance<double, double>, CanGetLogAverageOf<Gamma>, CanGetLogAverageOfPower<Gamma>, CanGetAverageLog<Gamma>, CanGetLogNormalizer, CanGetMode<double>
The Gamma type exposes the following members.
Name  Description  

Gamma(Gamma) 
Copy constructor.
 
Gamma(Double, Double) 
Creates a Gamma distribution with given shape and scale parameters (scale = 1/rate)

Name  Description  

Clone 
Clones this Gamma.
 
FromDerivatives 
Construct a Gamma distribution whose pdf has the given derivatives at a point.
 
FromLogMeanAndMeanLog 
Constructs a Gamma distribution with the given log mean and mean logarithm.
 
FromMeanAndMeanLog 
Constructs a Gamma distribution with the given mean and mean logarithm.
 
FromMeanAndVariance 
Creates a new Gamma distribution from mean and variance
 
FromNatural 
Constructs a Gamma distribution from its natural parameters.
 
FromShapeAndRate 
Constructs a Gamma distribution with the given shape and rate parameters.
 
FromShapeAndScale 
Constructs a Gamma distribution with the given shape and scale parameters.
 
GetAverageLog 
The expected logarithm of that distribution under this distribution.
 
GetLogAverageOf 
The log of the integral of the product of this Gamma and that Gamma
 
GetLogAverageOfPower 
Get the integral of this distribution times another distribution raised to a power.
 
GetLogNormalizer 
Gets log normalizer
 
GetLogProb(Double) 
Logarithm of this Gamma density function.
 
GetLogProb(Double, Double, Double) 
Logarithm of the Gamma density function.
 
GetMean 
Gets the expected value E(x)  calculated as shape/rate
 
GetMeanAndVariance 
Gets the mean (shape/rate) and variance (shape/rate^2)
 
GetMeanInverse 
Computes E[1/x]
 
GetMeanLog 
Computes E[log(x)]
 
GetMeanPower 
Computes E[x^power]
 
GetMode 
The most probable value
 
GetProbLessThan 
Compute the probability that a sample from this distribution is less than x.
 
GetScale 
Gets the scale (1/rate)
 
GetShapeAndScale 
Gets the shape and scale (1/rate)
 
GetVariance 
Gets the variance  calculated as shape/rate^2
 
IsProper 
Asks whether this Gamma instance is proper or not. A Gamma distribution
is proper only if Shape > 0 and Rate > 0.
 
IsProper(Double, Double) 
Asks whether a Gamma distribution is proper or not. A Gamma distribution
is proper only if Shape > 0 and Rate > 0.
 
IsUniform 
Asks whether this instance is uniform
 
MaxDiff 
The maximum difference between the parameters of this Gamma
and that Gamma
 
PointMass 
Creates a point mass Gamma distribution
 
Sample 
Samples from this Gamma distribution
 
Sample(Double) 
Samples from this Gamma distribution
 
Sample(Double, Double) 
Samples from a Gamma distribution with given shape and scale
 
SampleFromMeanAndVariance 
Samples from a Gamma distribution with given mean and variance
 
SetMeanAndVariance 
Sets the mean and variance
 
SetNatural 
Sets the natural parameters of the distribution.
 
SetShapeAndRate 
Sets the shape and rate (rate = 1/scale) parameters of the distribution.
 
SetShapeAndScale 
Sets the shape and scale for this instance
 
SetTo 
Sets this Gamma instance to have the parameter values of that Gamma instance
 
SetToPower 
Sets the parameters to represent the power of a source Gamma to some exponent.
 
SetToProduct 
Sets the parameters to represent the product of two Gammas.
 
SetToRatio 
Sets the parameters to represent the ratio of two Gammas
 
SetToSum 
Set the mean and variance to match the moments of a mixture of two Gammas.
 
SetToUniform 
Sets this Gamma instance to be a uniform distribution
 
Uniform 
Create a uniform Gamma distribution.

Name  Description  

Division 
Creates a new Gamma which the ratio of two other Gammas
 
Equality 
Equals operator
 
ExclusiveOr 
Raises a distribution to a power.
 
Inequality 
Not equals operator
 
Multiply 
Creates a new Gamma which the product of two other Gammas

Name  Description  

Rate 
Rate parameter for the distribution
 
Shape 
Shape parameter for the distribution

Name  Description  

IsPointMass 
Asks whether the instance is a point mass
 
Point 
Sets/gets the instance as a point mass

The distribution is p(x) = x^(a1)*exp(x*b)*b^a/Gamma(a). In this code, the a parameter is called the "Shape" and the b parameter is called the "Rate". The distribution is sometimes also parameterized by (shape,scale) where scale = 1/rate. The mean of the distribution is shape/rate and the variance is shape/rate^2.
Special cases: When the shape is 1 and rate is 0, the distribution is uniform. When the shape is infinity, the distribution is a point mass and the density is delta(xPoint) where the Point property gives the mean. When a <= 0 or b <= 0 the b^a/Gamma(a) term is dropped.