gov.sandia.cognition.statistics.distribution
Class StudentTDistribution

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.AbstractDistribution<NumberType>
          extended by gov.sandia.cognition.statistics.AbstractClosedFormUnivariateDistribution<Double>
              extended by gov.sandia.cognition.statistics.AbstractClosedFormSmoothUnivariateDistribution
                  extended by gov.sandia.cognition.statistics.distribution.StudentTDistribution
All Implemented Interfaces:
Vectorizable, ClosedFormComputableDistribution<Double>, ClosedFormDistribution<Double>, ClosedFormUnivariateDistribution<Double>, ComputableDistribution<Double>, Distribution<Double>, DistributionWithMean<Double>, EstimableDistribution<Double,StudentTDistribution>, SmoothUnivariateDistribution, UnivariateDistribution<Double>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
StudentTDistribution.CDF, StudentTDistribution.PDF

@PublicationReferences(references={@PublicationReference(author="Christopher Bishop",title="Pattern Recognition and Machine Learning",type=Book,year=2006,pages={102,105}),@PublicationReference(author="Wikipedia",title="Student\'s t-distribution",type=WebPage,year=2009,url="http://en.wikipedia.org/wiki/Student_t_distribution")})
public class StudentTDistribution
extends AbstractClosedFormSmoothUnivariateDistribution
implements EstimableDistribution<Double,StudentTDistribution>

Defines a noncentral Student-t Distribution.

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

Nested Class Summary
static class StudentTDistribution.CDF
          Evaluator that computes the Cumulative Distribution Function (CDF) of a Student-t distribution with a fixed number of degrees of freedom
static class StudentTDistribution.MaximumLikelihoodEstimator
          Estimates the parameters of the Student-t distribution from the given data, where the degrees of freedom are estimated from the Kurtosis of the sample data.
static class StudentTDistribution.PDF
          Evaluator that computes the Probability Density Function (CDF) of a Student-t distribution with a fixed number of degrees of freedom
static class StudentTDistribution.WeightedMaximumLikelihoodEstimator
          Creates a UnivariateGaussian from weighted data
 
Field Summary
static double DEFAULT_DEGREES_OF_FREEDOM
          Default degrees of freedom, 3.0.
static double DEFAULT_MEAN
          Default mean, 0.0.
static double DEFAULT_PRECISION
          Default precision, 1.0.
protected  double degreesOfFreedom
          Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.
protected  double mean
          Mean, or noncentrality parameter, of the distribution
protected  double precision
          Precision, which is proportionate to the inverseRootFinder of variance, of the distribution, must be greater than zero.
 
Constructor Summary
StudentTDistribution()
          Default degrees of freedom.
StudentTDistribution(double degreesOfFreedom)
          Creates a new instance of StudentTDistribution
StudentTDistribution(double degreesOfFreedom, double mean, double precision)
          Creates a new instance of StudentTDistribution
StudentTDistribution(StudentTDistribution other)
          Copy constructor
 
Method Summary
 StudentTDistribution clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 void convertFromVector(Vector parameters)
          Sets the parameters of this PDF, which must be a 1-dimensional Vector containing the degrees of freedom
 Vector convertToVector()
          Returns the parameters of this PDF, which is a 1-dimensional Vector containing the degrees of freedom
 StudentTDistribution.CDF getCDF()
          Gets the CDF of a scalar distribution.
 double getDegreesOfFreedom()
          Getter for degreesOfFreedom
 StudentTDistribution.MaximumLikelihoodEstimator getEstimator()
          Gets an estimator associated with this distribution.
 Double getMaxSupport()
          Gets the minimum support (domain or input) of the distribution.
 Double getMean()
          Gets the arithmetic mean, or "first central moment" or "expectation", of the distribution.
 Double getMinSupport()
          Gets the minimum support (domain or input) of the distribution.
 double getPrecision()
          Getter for precision
 StudentTDistribution.PDF getProbabilityFunction()
          Gets the distribution function associated with this Distribution, either the PDF or PMF.
 double getVariance()
          Gets the variance of the distribution.
 ArrayList<Double> sample(Random random, int numSamples)
          Draws multiple random samples from the distribution.
 void setDegreesOfFreedom(double degreesOfFreedom)
          Setter for degreesOfFreedom
 void setMean(double mean)
          Setter for mean
 void setPrecision(double precision)
          Setter for precision
 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_DEGREES_OF_FREEDOM

public static final double DEFAULT_DEGREES_OF_FREEDOM
Default degrees of freedom, 3.0.

See Also:
Constant Field Values

DEFAULT_MEAN

public static final double DEFAULT_MEAN
Default mean, 0.0.

See Also:
Constant Field Values

DEFAULT_PRECISION

public static final double DEFAULT_PRECISION
Default precision, 1.0.

See Also:
Constant Field Values

precision

protected double precision
Precision, which is proportionate to the inverseRootFinder of variance, of the distribution, must be greater than zero. Note that we are using "precision" instead of "variance" because the variance of the Student-t has another scale factor based on the dofs and we want to avoid confusion.


mean

protected double mean
Mean, or noncentrality parameter, of the distribution


degreesOfFreedom

protected double degreesOfFreedom
Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.

Constructor Detail

StudentTDistribution

public StudentTDistribution()
Default degrees of freedom.


StudentTDistribution

public StudentTDistribution(double degreesOfFreedom)
Creates a new instance of StudentTDistribution

Parameters:
degreesOfFreedom - Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.

StudentTDistribution

public StudentTDistribution(double degreesOfFreedom,
                            double mean,
                            double precision)
Creates a new instance of StudentTDistribution

Parameters:
degreesOfFreedom - Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.
mean - Mean, or noncentrality parameter, of the distribution
precision - Precision, inverseRootFinder variance, of the distribution, must be greater than zero.

StudentTDistribution

public StudentTDistribution(StudentTDistribution other)
Copy constructor

Parameters:
other - StudentTDistribution to copy
Method Detail

clone

public StudentTDistribution 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 AbstractClosedFormUnivariateDistribution<Double>
Returns:
A clone of this object.

getDegreesOfFreedom

public double getDegreesOfFreedom()
Getter for degreesOfFreedom

Returns:
Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.

setDegreesOfFreedom

public void setDegreesOfFreedom(double degreesOfFreedom)
Setter for degreesOfFreedom

Parameters:
degreesOfFreedom - Degrees of freedom in the distribution, usually the number of datapoints - 1, DOFs must be greater than zero.

getVariance

public double getVariance()
Description copied from interface: UnivariateDistribution
Gets the variance of the distribution. This is sometimes called the second central moment by more pedantic people, which is equivalent to the square of the standard deviation.

Specified by:
getVariance in interface UnivariateDistribution<Double>
Returns:
Variance of the distribution.

convertToVector

public Vector convertToVector()
Returns the parameters of this PDF, which is a 1-dimensional Vector containing the degrees of freedom

Specified by:
convertToVector in interface Vectorizable
Returns:
1-dimensional Vector containing the degrees of freedom

convertFromVector

public void convertFromVector(Vector parameters)
Sets the parameters of this PDF, which must be a 1-dimensional Vector containing the degrees of freedom

Specified by:
convertFromVector in interface Vectorizable
Parameters:
parameters - 1-dimensional Vector containing the degrees of freedom

sample

public ArrayList<Double> 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<Double>
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.

getCDF

public StudentTDistribution.CDF getCDF()
Description copied from interface: UnivariateDistribution
Gets the CDF of a scalar distribution.

Specified by:
getCDF in interface ClosedFormUnivariateDistribution<Double>
Specified by:
getCDF in interface SmoothUnivariateDistribution
Specified by:
getCDF in interface UnivariateDistribution<Double>
Returns:
CDF of the scalar distribution.

getProbabilityFunction

public StudentTDistribution.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<Double>
Specified by:
getProbabilityFunction in interface SmoothUnivariateDistribution
Returns:
Distribution function associated with this Distribution.

getPrecision

public double getPrecision()
Getter for precision

Returns:
Precision, inverseRootFinder variance, of the distribution, must be greater than zero.

setPrecision

public void setPrecision(double precision)
Setter for precision

Parameters:
precision - Precision, inverseRootFinder variance, of the distribution, must be greater than zero.

setMean

public void setMean(double mean)
Setter for mean

Parameters:
mean - Mean, or noncentrality parameter, of the distribution

getMean

public Double 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<Double>
Specified by:
getMean in interface SmoothUnivariateDistribution
Returns:
Mean of the distribution.

getMinSupport

public Double getMinSupport()
Description copied from interface: UnivariateDistribution
Gets the minimum support (domain or input) of the distribution.

Specified by:
getMinSupport in interface UnivariateDistribution<Double>
Returns:
Minimum support.

getMaxSupport

public Double getMaxSupport()
Description copied from interface: UnivariateDistribution
Gets the minimum support (domain or input) of the distribution.

Specified by:
getMaxSupport in interface UnivariateDistribution<Double>
Returns:
Minimum support.

toString

public String toString()
Overrides:
toString in class Object

getEstimator

public StudentTDistribution.MaximumLikelihoodEstimator getEstimator()
Description copied from interface: EstimableDistribution
Gets an estimator associated with this distribution.

Specified by:
getEstimator in interface EstimableDistribution<Double,StudentTDistribution>
Returns:
A distribution estimator associated for this distribution.