Click or drag to resize
Accord.NET (logo)

IndependentTDistribution, TObservation Class

Joint distribution assuming independence between vector components.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.DistributionsDistributionBase
    Accord.Statistics.Distributions.MultivariateMultivariateContinuousDistribution
      Accord.Statistics.Distributions.MultivariateIndependentTDistribution
        Accord.Statistics.Distributions.MultivariateIndependentTDistribution, TObservation
          Accord.Statistics.Distributions.MultivariateIndependentTDistribution, TObservation, TOptions

Namespace:  Accord.Statistics.Distributions.Multivariate
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.5.0
Syntax
[SerializableAttribute]
public class Independent<TDistribution, TObservation> : Independent<TDistribution>, 
	IMultivariateDistribution<TObservation[]>, IDistribution<TObservation[]>, IDistribution, 
	ICloneable, IFittableDistribution<TObservation[], IndependentOptions>, IFittable<TObservation[], IndependentOptions>, 
	IFittable<TObservation[]>, IFittableDistribution<TObservation[]>, ISampleableDistribution<TObservation[]>, 
	IRandomNumberGenerator<TObservation[]>
where TDistribution : Object, IUnivariateDistribution<TObservation>, IUnivariateDistribution
Request Example View Source

Type Parameters

TDistribution
The type of the underlying distributions.
TObservation
The type for the observations being modeled by the distribution (i.e. double).

The IndependentTDistribution, TObservation type exposes the following members.

Constructors
  NameDescription
Public methodIndependentTDistribution, TObservation(TDistribution)
Public methodIndependentTDistribution, TObservation(Int32, FuncTDistribution)
Public methodIndependentTDistribution, TObservation(Int32, FuncInt32, TDistribution)
Public methodIndependentTDistribution, TObservation(Int32, TDistribution)
Top
Properties
  NameDescription
Public propertyComponents
Gets the components of this joint distribution.
(Inherited from IndependentTDistribution.)
Public propertyCovariance
Gets the variance-covariance matrix for this distribution.
(Inherited from IndependentTDistribution.)
Public propertyDimension
Gets the number of variables for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyItem
Gets or sets the components of this joint distribution.
(Inherited from IndependentTDistribution.)
Public propertyMean
Gets the mean for this distribution.
(Inherited from IndependentTDistribution.)
Public propertyMedian
Gets the median for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyMode
Gets the mode for this distribution.
(Inherited from MultivariateContinuousDistribution.)
Public propertyVariance
Gets the variance for this distribution.
(Inherited from IndependentTDistribution.)
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
(Overrides IndependentTDistributionClone.)
Public methodComplementaryDistributionFunction(TObservation)
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
Public methodComplementaryDistributionFunction(Double)
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 MultivariateContinuousDistribution.)
Public methodDistributionFunction(Double)
Gets the probability density function (pdf) for this distribution evaluated at point x.
(Inherited from IndependentTDistribution.)
Public methodDistributionFunction(TObservation)
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
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(TObservation)
Fits the underlying distribution to a given set of observations.
Public methodFit(Double)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodCode exampleFit(TObservation, Double)
Fits the underlying distribution to a given set of observations.
Public methodFit(Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Double)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodFit(Double, Int32)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodCode exampleFit(Double, Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from IndependentTDistribution.)
Public methodCode exampleFit(Double, Double, IndependentOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from IndependentTDistribution.)
Public methodCode exampleFit(TObservation, Double, IndependentOptions)
Fits the underlying distribution to a given set of observations.
Public methodFit(Double, Int32, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(TObservation)
Generates a random observation from the current distribution.
Public methodGenerate(Double)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32)
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGenerate(Int32, Double)
Generates a random vector of observations from the current distribution.
(Inherited from IndependentTDistribution.)
Public methodGenerate(Int32, TObservation)
Generates a random vector of observations from the current distribution.
Public methodGenerate(Int32, Int32)
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Inherited from IndependentTDistribution.)
Public methodLogProbabilityFunction
Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
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 IndependentTDistribution.)
Public methodProbabilityFunction
Gets the probability density function (pdf) for this distribution evaluated at point x.
Protected methodReset
Resets cached values (should be called after re-estimation).
(Inherited from IndependentTDistribution.)
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.
(Inherited from IndependentTDistribution.)
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 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.)
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 Matrix.)
Top
Remarks

In probability and statistics, given at least two random variables X, Y, ..., that are defined on a probability space, the joint probability distribution for X, Y, ... is a probability distribution that gives the probability that each of X, Y, ... falls in any particular range or discrete set of values specified for that variable. In the case of only two random variables, this is called a bivariate distribution, but the concept generalizes to any number of random variables, giving a multivariate distribution.

References:

Examples

The following example shows how to declare and initialize an Independent Joint Gaussian Distribution using known means and variances for each component.

// Declare two normal distributions
NormalDistribution pa = new NormalDistribution(4.2, 1); // p(a)
NormalDistribution pb = new NormalDistribution(7.0, 2); // p(b)

// Now, create a joint distribution combining these two:
var joint = new Independent<NormalDistribution>(pa, pb);

// This distribution assumes the distributions of the two components are independent,
// i.e. if we have 2D input vectors on the form {a, b}, then p({a,b}) = p(a) * p(b). 

// Lets check a simple example. Consider a 2D input vector x = { 4.2, 7.0 } as
// 
double[] x = new double[] { 4.2, 7.0 };

// Those two should be completely equivalent:
double p1 = joint.ProbabilityDensityFunction(x);
double p2 = pa.ProbabilityDensityFunction(x[0]) * pb.ProbabilityDensityFunction(x[1]);

bool equal = p1 == p2; // at this point, equal should be true.

The following example shows how to fit a distribution (estimate its parameters) from a given dataset.

  // Let's consider an input dataset of 2D vectors. We would
  // like to estimate an Independent<NormalDistribution>
  // which best models this data.

 double[][] data =
 {
                 // x, y
     new double[] { 1, 8 },
     new double[] { 2, 6 },
     new double[] { 5, 7 },
     new double[] { 3, 9 },
 };

 // We start by declaring some initial guesses for the
 // distributions of each random variable (x, and y):
 // 
 var distX = new NormalDistribution(0, 1);
 var distY = new NormalDistribution(0, 1);

 // Next, we declare our initial guess Independent distribution
 var joint = new Independent<NormalDistribution>(distX, distY);

 // We can now fit the distribution to our data,
 // producing an estimate of its parameters:
 // 
 joint.Fit(data);

 // At this point, we have estimated our distribution. 

 double[] mean = joint.Mean;     // should be { 2.75,  7.50  }
 double[] var  = joint.Variance; // should be { 2.917, 1.667 } 

                                   //        | 2.917,  0.000 |
 double[,] cov = joint.Covariance; //  Cov = |               |
                                   //        | 0.000,  1.667 |

// The covariance matrix is diagonal, as it would be expected
// if is assumed there are no interactions between components.
See Also