Namespaces

Types in MathNet.Numerics.Distributions

Type NormalGamma

Namespace MathNet.Numerics.Distributions

Interfaces IDistribution

Multivariate Normal-Gamma Distribution.

The NormalGamma distribution is the conjugate prior distribution for the Normal distribution. It specifies a prior over the mean and precision of the Normal distribution.

It is parameterized by four numbers: the mean location, the mean scale, the precision shape and the precision inverse scale.

The distribution NG(mu, tau | mloc,mscale,psscale,pinvscale) = Normal(mu | mloc, 1/(mscale*tau)) * Gamma(tau | psscale,pinvscale).

The following degenerate cases are special: when the precision is known, the precision shape will encode the value of the precision while the precision inverse scale is positive infinity. When the mean is known, the mean location will encode the value of the mean while the scale will be positive infinity. A completely degenerate NormalGamma distribution with known mean and precision is possible as well.

.

Constructors

Static Functions

Methods

Properties

Public Constructors

NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale, Random randomSource)

Initializes a new instance of the NormalGamma class.
Parameters
double meanLocation

The location of the mean.

double meanScale

The scale of the mean.

double precisionShape

The shape of the precision.

double precisionInverseScale

The inverse scale of the precision.

Random randomSource

The random number generator which is used to draw random samples.

NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale)

Initializes a new instance of the NormalGamma class.
Parameters
double meanLocation

The location of the mean.

double meanScale

The scale of the mean.

double precisionShape

The shape of the precision.

double precisionInverseScale

The inverse scale of the precision.

Public Static Functions

bool IsValidParameterSet(double meanLocation, double meanScale, double precShape, double precInvScale)

Tests whether the provided values are valid parameters for this distribution.
Parameters
double meanLocation

The location of the mean.

double meanScale

The scale of the mean.

double precShape

The shape of the precision.

double precInvScale

The inverse scale of the precision.

MeanPrecisionPair Sample(Random rnd, double meanLocation, double meanScale, double precisionShape, double precisionInverseScale)

Generates a sample from the NormalGamma distribution.
Parameters
Random rnd

The random number generator to use.

double meanLocation

The location of the mean.

double meanScale

The scale of the mean.

double precisionShape

The shape of the precision.

double precisionInverseScale

The inverse scale of the precision.

Return
MeanPrecisionPair

a sample from the distribution.

IEnumerable<MeanPrecisionPair> Samples(Random rnd, double meanLocation, double meanScale, double precisionShape, double precisionInvScale)

Generates a sequence of samples from the NormalGamma distribution
Parameters
Random rnd

The random number generator to use.

double meanLocation

The location of the mean.

double meanScale

The scale of the mean.

double precisionShape

The shape of the precision.

double precisionInvScale

The inverse scale of the precision.

Return
IEnumerable<MeanPrecisionPair>

a sequence of samples from the distribution.

Public Methods

double Density(MeanPrecisionPair mp)

Evaluates the probability density function for a NormalGamma distribution.
Parameters
MeanPrecisionPair mp

The mean/precision pair of the distribution

Return
double

Density value

double Density(double mean, double prec)

Evaluates the probability density function for a NormalGamma distribution.
Parameters
double mean

The mean of the distribution

double prec

The precision of the distribution

Return
double

Density value

double DensityLn(MeanPrecisionPair mp)

Evaluates the log probability density function for a NormalGamma distribution.
Parameters
MeanPrecisionPair mp

The mean/precision pair of the distribution

Return
double

The log of the density value

double DensityLn(double mean, double prec)

Evaluates the log probability density function for a NormalGamma distribution.
Parameters
double mean

The mean of the distribution

double prec

The precision of the distribution

Return
double

The log of the density value

bool Equals(object obj)

int GetHashCode()

Type GetType()

StudentT MeanMarginal()

Returns the marginal distribution for the mean of the NormalGamma distribution.
Return
StudentT

the marginal distribution for the mean of the NormalGamma distribution.

Gamma PrecisionMarginal()

Returns the marginal distribution for the precision of the NormalGamma distribution.
Return
Gamma

The marginal distribution for the precision of the NormalGamma distribution/

MeanPrecisionPair Sample()

Generates a sample from the NormalGamma distribution.
Return
MeanPrecisionPair

a sample from the distribution.

IEnumerable<MeanPrecisionPair> Samples()

Generates a sequence of samples from the NormalGamma distribution
Return
IEnumerable<MeanPrecisionPair>

a sequence of samples from the distribution.

string ToString()

A string representation of the distribution.
Return
string

a string representation of the distribution.

Public Properties

MeanPrecisionPair Mean get;

Gets the mean of the distribution.
Value:

double MeanLocation get;

Gets the location of the mean.

double MeanScale get;

Gets the scale of the mean.

double PrecisionInverseScale get;

Gets the inverse scale of the precision.

double PrecisionShape get;

Gets the shape of the precision.

Random RandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

MeanPrecisionPair Variance get;

Gets the variance of the distribution.
Value: