IndependentTDistribution Class 
Namespace: Accord.Statistics.Distributions.Multivariate
[SerializableAttribute] public class Independent<TDistribution> : MultivariateContinuousDistribution, ISampleableDistribution<double[]>, IDistribution<double[]>, IDistribution, ICloneable, IRandomNumberGenerator<double[]>, IFittableDistribution<double[], IndependentOptions>, IFittable<double[], IndependentOptions>, IFittable<double[]>, IFittableDistribution<double[]> where TDistribution : IUnivariateDistribution
The IndependentTDistribution type exposes the following members.
Name  Description  

IndependentTDistribution(Int32) 
Initializes a new instance of the IndependentTDistribution class.
 
IndependentTDistribution(TDistribution) 
Initializes a new instance of the IndependentTDistribution class.
 
IndependentTDistribution(Int32, FuncTDistribution) 
Initializes a new instance of the IndependentTDistribution class.
 
IndependentTDistribution(Int32, FuncInt32, TDistribution) 
Initializes a new instance of the IndependentTDistribution class.
 
IndependentTDistribution(Int32, TDistribution) 
Initializes a new instance of the IndependentTDistribution class.

Name  Description  

Components 
Gets the components of this joint distribution.
 
Covariance 
Gets the variancecovariance matrix for this distribution.
(Overrides MultivariateContinuousDistributionCovariance.)  
Dimension 
Gets the number of variables for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Item 
Gets or sets the components of this joint distribution.
 
Mean 
Gets the mean for this distribution.
(Overrides MultivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Mode 
Gets the mode for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Variance 
Gets the variance for this distribution.
(Overrides MultivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
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.)  
DistributionFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides MultivariateContinuousDistributionFit(Double, Double, IFittingOptions).)  
Fit(Double, Double, IndependentOptions) 
Fits the underlying distribution to a given set of observations.
 
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Double) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Random) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Double, Random) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Random) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Random) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Double, Random) 
Generates a random vector of observations from the current distribution.
(Overrides MultivariateContinuousDistributionGenerate(Int32, Double, Random).)  
Generate(Int32, Int32, Random) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
InnerComplementaryDistributionFunction 
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.)  
InnerDistributionFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerDistributionFunction(Double).)  
InnerLogProbabilityDensityFunction 
Gets the logprobability density function (pdf)
for this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)  
InnerProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)  
LogProbabilityDensityFunction 
Gets the logprobability density function (pdf)
for this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from MultivariateContinuousDistribution.)  
Reset 
Resets cached values (should be called after reestimation).
 
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual 
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.)  
To(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.)  
ToT  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.) 
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:
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.