Click or drag to resize
Accord.NET (logo)

TDistribution Class

Student's t-distribution.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.DistributionsDistributionBase
    Accord.Statistics.Distributions.UnivariateUnivariateContinuousDistribution
      Accord.Statistics.Distributions.UnivariateTDistribution

Namespace:  Accord.Statistics.Distributions.Univariate
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class TDistribution : UnivariateContinuousDistribution, 
	IFormattable
Request Example View Source

The TDistribution type exposes the following members.

Constructors
  NameDescription
Public methodTDistribution
Initializes a new instance of the TDistribution class.
Top
Properties
  NameDescription
Public propertyDegreesOfFreedom
Gets the degrees of freedom for the distribution.
Public propertyEntropy
Not supported.
(Overrides UnivariateContinuousDistributionEntropy.)
Public propertyMean
Gets the mean for this distribution.
(Overrides UnivariateContinuousDistributionMean.)
Public propertyMedian
Gets the median for this distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertyMode
Gets the mode for this distribution (always zero).
(Overrides UnivariateContinuousDistributionMode.)
Public propertyQuartiles
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertyStandardDeviation
Gets the Standard Deviation (the square root of the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public propertySupport
Gets the support interval for this distribution.
(Overrides UnivariateContinuousDistributionSupport.)
Public propertyVariance
Gets the variance for this distribution.
(Overrides UnivariateContinuousDistributionVariance.)
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)
Public methodComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)
Public methodCumulativeHazardFunction
Gets the cumulative hazard function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodDistributionFunction(Double)
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodDistributionFunction(Double, Double)
Gets the cumulative distribution function (cdf) for this distribution in the semi-closed interval (a; b] given as P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleFit(Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodCode exampleFit(Double, Int32)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, Double, IFittingOptions)
Not supported.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).)
Public methodCode exampleFit(Double, Int32, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Random)
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Double)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Random)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGenerate(Int32, Double, Random)
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetRange
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHazardFunction
Gets the hazard function, also known as the failure rate or the conditional failure density function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Protected methodInnerComplementaryDistributionFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)
Protected methodCode exampleInnerDistributionFunction
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).)
Protected methodCode exampleInnerInverseDistributionFunction
Gets the inverse of the cumulative distribution function (icdf) for this distribution evaluated at probability p. This function is also known as the Quantile function.
(Overrides UnivariateContinuousDistributionInnerInverseDistributionFunction(Double).)
Protected methodCode exampleInnerLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)
Protected methodCode exampleInnerProbabilityDensityFunction
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)
Public methodInverseDistributionFunction
Gets the inverse of the cumulative distribution function (icdf) for this distribution evaluated at probability p. This function is also known as the Quantile function.
(Inherited from UnivariateContinuousDistribution.)
Public methodLogCumulativeHazardFunction
Gets the log of the cumulative hazard function for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProbabilityDensityFunction
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Public methodQuantileDensityFunction
Gets the first derivative of the inverse distribution function (icdf) for this distribution evaluated at probability p.
(Inherited from UnivariateContinuousDistribution.)
Public methodToString
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(IFormatProvider)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String)
Returns a String that represents this instance.
(Inherited from DistributionBase.)
Public methodToString(String, IFormatProvider)
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

In probability and statistics, Student's t-distribution (or simply the t-distribution) is a family of continuous probability distributions that arises when estimating the mean of a normally distributed population in situations where the sample size is small and population standard deviation is unknown. It plays a role in a number of widely used statistical analyses, including the Student's t-test for assessing the statistical significance of the difference between two sample means, the construction of confidence intervals for the difference between two population means, and in linear regression analysis. The Student's t-distribution also arises in the Bayesian analysis of data from a normal family.

If we take k samples from a normal distribution with fixed unknown mean and variance, and if we compute the sample mean and sample variance for these k samples, then the t-distribution (for k) can be defined as the distribution of the location of the true mean, relative to the sample mean and divided by the sample standard deviation, after multiplying by the normalizing term sqrt(n), where n is the sample size. In this way the t-distribution can be used to estimate how likely it is that the true mean lies in any given range.

The t-distribution is symmetric and bell-shaped, like the normal distribution, but has heavier tails, meaning that it is more prone to producing values that fall far from its mean. This makes it useful for understanding the statistical behavior of certain types of ratios of random quantities, in which variation in the denominator is amplified and may produce outlying values when the denominator of the ratio falls close to zero. The Student's t-distribution is a special case of the generalized hyperbolic distribution.

References:

Examples
// Create a new Student's T distribution with d.f = 4.2
TDistribution t = new TDistribution(degreesOfFreedom: 4.2);

// Common measures
double mean = t.Mean;     // 0.0
double median = t.Median; // 0.0
double var = t.Variance;  // 1.9090909090909089

// Cumulative distribution functions
double cdf = t.DistributionFunction(x: 1.4);           // 0.88456136730659074
double pdf = t.ProbabilityDensityFunction(x: 1.4);     // 0.13894002185341031
double lpdf = t.LogProbabilityDensityFunction(x: 1.4); // -1.9737129364307417

// Probability density functions
double ccdf = t.ComplementaryDistributionFunction(x: 1.4); // 0.11543863269340926
double icdf = t.InverseDistributionFunction(p: cdf);       // 1.4000000000000012

// Hazard (failure rate) functions
double hf = t.HazardFunction(x: 1.4);            // 1.2035833984833988
double chf = t.CumulativeHazardFunction(x: 1.4); // 2.1590162088918525

// String representation
string str = t.ToString(CultureInfo.InvariantCulture); // T(x; df = 4.2)
See Also