Click or drag to resize
Gamma Structure
Microsoft Research
A Gamma distribution on positive reals.

Namespace: MicrosoftResearch.Infer.Distributions
Assembly: Infer.Runtime (in Infer.Runtime.dll) Version: 2.6.41128.1 (2.6.41128.1)
Syntax
[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.

Constructors
  NameDescription
Public methodGamma(Gamma)
Copy constructor.
Public methodGamma(Double, Double)
Creates a Gamma distribution with given shape and scale parameters (scale = 1/rate)
Top
Methods
  NameDescription
Public methodClone
Clones this Gamma.
Public methodStatic memberFromDerivatives
Construct a Gamma distribution whose pdf has the given derivatives at a point.
Public methodStatic memberFromLogMeanAndMeanLog
Constructs a Gamma distribution with the given log mean and mean logarithm.
Public methodStatic memberFromMeanAndMeanLog
Constructs a Gamma distribution with the given mean and mean logarithm.
Public methodStatic memberFromMeanAndVariance
Creates a new Gamma distribution from mean and variance
Public methodStatic memberFromNatural
Constructs a Gamma distribution from its natural parameters.
Public methodStatic memberFromShapeAndRate
Constructs a Gamma distribution with the given shape and rate parameters.
Public methodStatic memberFromShapeAndScale
Constructs a Gamma distribution with the given shape and scale parameters.
Public methodGetAverageLog
The expected logarithm of that distribution under this distribution.
Public methodGetLogAverageOf
The log of the integral of the product of this Gamma and that Gamma
Public methodGetLogAverageOfPower
Get the integral of this distribution times another distribution raised to a power.
Public methodGetLogNormalizer
Gets log normalizer
Public methodGetLogProb(Double)
Logarithm of this Gamma density function.
Public methodStatic memberGetLogProb(Double, Double, Double)
Logarithm of the Gamma density function.
Public methodGetMean
Gets the expected value E(x) - calculated as shape/rate
Public methodGetMeanAndVariance
Gets the mean (shape/rate) and variance (shape/rate^2)
Public methodGetMeanInverse
Computes E[1/x]
Public methodGetMeanLog
Computes E[log(x)]
Public methodGetMeanPower
Computes E[x^power]
Public methodGetMode
The most probable value
Public methodGetProbLessThan
Compute the probability that a sample from this distribution is less than x.
Public methodGetScale
Gets the scale (1/rate)
Public methodGetShapeAndScale
Gets the shape and scale (1/rate)
Public methodGetVariance
Gets the variance - calculated as shape/rate^2
Public methodIsProper
Asks whether this Gamma instance is proper or not. A Gamma distribution is proper only if Shape > 0 and Rate > 0.
Public methodStatic memberIsProper(Double, Double)
Asks whether a Gamma distribution is proper or not. A Gamma distribution is proper only if Shape > 0 and Rate > 0.
Public methodIsUniform
Asks whether this instance is uniform
Public methodMaxDiff
The maximum difference between the parameters of this Gamma and that Gamma
Public methodStatic memberPointMass
Creates a point mass Gamma distribution
Public methodSample
Samples from this Gamma distribution
Public methodSample(Double)
Samples from this Gamma distribution
Public methodStatic memberSample(Double, Double)
Samples from a Gamma distribution with given shape and scale
Public methodStatic memberSampleFromMeanAndVariance
Samples from a Gamma distribution with given mean and variance
Public methodSetMeanAndVariance
Sets the mean and variance
Public methodSetNatural
Sets the natural parameters of the distribution.
Public methodSetShapeAndRate
Sets the shape and rate (rate = 1/scale) parameters of the distribution.
Public methodSetShapeAndScale
Sets the shape and scale for this instance
Public methodSetTo
Sets this Gamma instance to have the parameter values of that Gamma instance
Public methodSetToPower
Sets the parameters to represent the power of a source Gamma to some exponent.
Public methodSetToProduct
Sets the parameters to represent the product of two Gammas.
Public methodSetToRatio
Sets the parameters to represent the ratio of two Gammas
Public methodSetToSum
Set the mean and variance to match the moments of a mixture of two Gammas.
Public methodSetToUniform
Sets this Gamma instance to be a uniform distribution
Public methodStatic memberUniform
Create a uniform Gamma distribution.
Top
Operators
  NameDescription
Public operatorStatic memberDivision
Creates a new Gamma which the ratio of two other Gammas
Public operatorStatic memberEquality
Equals operator
Public operatorStatic memberExclusiveOr
Raises a distribution to a power.
Public operatorStatic memberInequality
Not equals operator
Public operatorStatic memberMultiply
Creates a new Gamma which the product of two other Gammas
Top
Fields
  NameDescription
Public fieldRate
Rate parameter for the distribution
Public fieldShape
Shape parameter for the distribution
Top
Properties
  NameDescription
Public propertyIsPointMass
Asks whether the instance is a point mass
Public propertyPoint
Sets/gets the instance as a point mass
Top
Remarks

The distribution is p(x) = x^(a-1)*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(x-Point) where the Point property gives the mean. When a <= 0 or b <= 0 the b^a/Gamma(a) term is dropped.

See Also