gov.sandia.cognition.statistics.distribution
Class NormalInverseGammaDistribution

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.AbstractDistribution<Vector>
          extended by gov.sandia.cognition.statistics.distribution.NormalInverseGammaDistribution
All Implemented Interfaces:
Vectorizable, ClosedFormComputableDistribution<Vector>, ClosedFormDistribution<Vector>, ComputableDistribution<Vector>, Distribution<Vector>, DistributionWithMean<Vector>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
NormalInverseGammaDistribution.PDF

@PublicationReferences(references={@PublicationReference(author="Christopher M. Bishop",title="Pattern Recognition and Machine Learning",type=Book,year=2006,pages=101),@PublicationReference(author="Wikipedia",title="Normal-scaled inverse gamma distribution",type=WebPage,year=2010,url="http://en.wikipedia.org/wiki/Normal-scaled_inverse_gamma_distribution")})
public class NormalInverseGammaDistribution
extends AbstractDistribution<Vector>
implements ClosedFormComputableDistribution<Vector>

The normal inverse-gamma distribution is the product of a univariate Gaussian distribution with an inverse-gamma distribution. It is the conjugate prior of a univariate Gaussian with unknown mean and unknown variance. (As far as I know, it has no other purpose.)

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
static class NormalInverseGammaDistribution.PDF
          PDF of the NormalInverseGammaDistribution
 
Field Summary
static double DEFAULT_LOCATION
          Default location, 0.0.
static double DEFAULT_PRECISION
          Default precision, 1.0.
static double DEFAULT_SCALE
          Default scale, 1.0.
static double DEFAULT_SHAPE
          Default shape, 3.0.
 
Constructor Summary
NormalInverseGammaDistribution()
          Creates a new instance of NormalInverseGammaDistribution
NormalInverseGammaDistribution(double location, double precision, double shape, double scale)
          Creates a new instance of NormalInverseGammaDistribution
NormalInverseGammaDistribution(NormalInverseGammaDistribution other)
          Copy constructor
 
Method Summary
 NormalInverseGammaDistribution clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 void convertFromVector(Vector parameters)
          Converts the object from a Vector of parameters.
 Vector convertToVector()
          Converts the object to a vector.
 double getLocation()
          Getter for location.
 Vector getMean()
          Gets the arithmetic mean, or "first central moment" or "expectation", of the distribution.
 double getPrecision()
          Getter for precision
 NormalInverseGammaDistribution.PDF getProbabilityFunction()
          Gets the distribution function associated with this Distribution, either the PDF or PMF.
 double getScale()
          Getter for scale
 double getShape()
          Getter for shape
 ArrayList<Vector> sample(Random random, int numSamples)
          Draws multiple random samples from the distribution.
 void setLocation(double location)
          Setter for location.
 void setPrecision(double precision)
          Setter for precision.
 void setScale(double scale)
          Setter for scale
 void setShape(double shape)
          Setter for shape
 String toString()
           
 
Methods inherited from class gov.sandia.cognition.statistics.AbstractDistribution
sample
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.statistics.Distribution
sample
 

Field Detail

DEFAULT_LOCATION

public static final double DEFAULT_LOCATION
Default location, 0.0.

See Also:
Constant Field Values

DEFAULT_PRECISION

public static final double DEFAULT_PRECISION
Default precision, 1.0.

See Also:
Constant Field Values

DEFAULT_SHAPE

public static final double DEFAULT_SHAPE
Default shape, 3.0.

See Also:
Constant Field Values

DEFAULT_SCALE

public static final double DEFAULT_SCALE
Default scale, 1.0.

See Also:
Constant Field Values
Constructor Detail

NormalInverseGammaDistribution

public NormalInverseGammaDistribution()
Creates a new instance of NormalInverseGammaDistribution


NormalInverseGammaDistribution

public NormalInverseGammaDistribution(double location,
                                      double precision,
                                      double shape,
                                      double scale)
Creates a new instance of NormalInverseGammaDistribution

Parameters:
location - Location of the Gaussian kernel.
precision - Precision of the Gaussian kernel, must be greater than zero.
shape - Shape parameter of the Inverse Gamma kernel, must be greater than zero.
scale - Scale parameter of the Inverse Gamma kernel, must be greater than zero.

NormalInverseGammaDistribution

public NormalInverseGammaDistribution(NormalInverseGammaDistribution other)
Copy constructor

Parameters:
other - NormalInverseGammaDistribution to copy
Method Detail

clone

public NormalInverseGammaDistribution clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface Vectorizable
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

getMean

public Vector getMean()
Description copied from interface: DistributionWithMean
Gets the arithmetic mean, or "first central moment" or "expectation", of the distribution.

Specified by:
getMean in interface DistributionWithMean<Vector>
Returns:
Mean of the distribution.

sample

public ArrayList<Vector> sample(Random random,
                                int numSamples)
Description copied from interface: Distribution
Draws multiple random samples from the distribution. It is generally more efficient to use this multiple-sample method than multiple calls of the single-sample method. (But not always.)

Specified by:
sample in interface Distribution<Vector>
Parameters:
random - Random-number generator to use in order to generate random numbers.
numSamples - Number of samples to draw from the distribution.
Returns:
Samples drawn according to this distribution.

convertToVector

public Vector convertToVector()
Description copied from interface: Vectorizable
Converts the object to a vector.

Specified by:
convertToVector in interface Vectorizable
Returns:
The Vector form of the object.

convertFromVector

public void convertFromVector(Vector parameters)
Description copied from interface: Vectorizable
Converts the object from a Vector of parameters.

Specified by:
convertFromVector in interface Vectorizable
Parameters:
parameters - The parameters to incorporate.

getProbabilityFunction

public NormalInverseGammaDistribution.PDF getProbabilityFunction()
Description copied from interface: ComputableDistribution
Gets the distribution function associated with this Distribution, either the PDF or PMF.

Specified by:
getProbabilityFunction in interface ComputableDistribution<Vector>
Returns:
Distribution function associated with this Distribution.

getLocation

public double getLocation()
Getter for location.

Returns:
Location of the Gaussian kernel.

setLocation

public void setLocation(double location)
Setter for location.

Parameters:
location - Location of the Gaussian kernel.

getPrecision

public double getPrecision()
Getter for precision

Returns:
Precision of the Gaussian kernel, must be greater than zero.

setPrecision

public void setPrecision(double precision)
Setter for precision.

Parameters:
precision - Precision of the Gaussian kernel, must be greater than zero.

getShape

public double getShape()
Getter for shape

Returns:
Shape parameter of the Inverse Gamma kernel, must be greater than zero.

setShape

public void setShape(double shape)
Setter for shape

Parameters:
shape - Shape parameter of the Inverse Gamma kernel, must be greater than zero.

getScale

public double getScale()
Getter for scale

Returns:
Scale parameter of the Inverse Gamma kernel, must be greater than zero.

setScale

public void setScale(double scale)
Setter for scale

Parameters:
scale - Scale parameter of the Inverse Gamma kernel, must be greater than zero.

toString

public String toString()
Overrides:
toString in class Object