JointDistribution Class |
Namespace: Accord.Statistics.Distributions.Multivariate
[SerializableAttribute] public class JointDistribution : MultivariateDiscreteDistribution, IFittableDistribution<int[], GeneralDiscreteOptions>, IFittable<int[], GeneralDiscreteOptions>, IFittable<int[]>, IFittableDistribution<int[]>, IDistribution<int[]>, IDistribution, ICloneable, IFittableDistribution<double[]>, IFittable<double[]>, IDistribution<double[]>
The JointDistribution type exposes the following members.
Name | Description | |
---|---|---|
JointDistribution(Array) |
Constructs a new joint discrete distribution.
| |
JointDistribution(Int32) |
Constructs a new joint discrete distribution.
| |
JointDistribution(Int32, Array) |
Constructs a new joint discrete distribution.
| |
JointDistribution(Int32, Int32) |
Constructs a new joint discrete distribution.
|
Name | Description | |
---|---|---|
Covariance |
Gets the variance for this distribution.
(Overrides MultivariateDiscreteDistributionCovariance.) | |
Dimension |
Gets the number of variables for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Frequencies |
Gets the frequency of observation of each discrete variable.
| |
Item |
Gets or sets the probability value attached to the given index.
| |
Lengths |
Gets the number of symbols in the distribution.
| |
Maximum |
Gets the integer value where the
discrete distribution ends.
| |
Mean |
Gets the mean for this distribution.
(Overrides MultivariateDiscreteDistributionMean.) | |
Median |
Gets the median for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Minimum |
Gets the integer value where the
discrete distribution starts.
| |
Mode |
Gets the mode for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Support |
Gets the support interval for this distribution.
(Overrides MultivariateDiscreteDistributionSupport.) | |
Symbols | Obsolete.
Gets the number of symbols for each discrete variable.
| |
Variance |
Gets the mean for this distribution.
(Overrides MultivariateDiscreteDistributionVariance.) |
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 MultivariateDiscreteDistribution.) | |
DistributionFunction |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Estimate |
Estimates a new JointDistribution from a given set of observations.
| |
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(Int32) |
Fits the underlying distribution to a given set of observations.
| |
Fit(Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Int32, Double) |
Fits the underlying distribution to a given set of observations.
| |
Fit(Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Int32) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Overrides MultivariateDiscreteDistributionFit(Double, Double, IFittingOptions).) | |
Fit(Int32, Double, GeneralDiscreteOptions) |
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 MultivariateDiscreteDistribution.) | |
Generate |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Double) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Double, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Double) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Double, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
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 MultivariateDiscreteDistribution.) | |
InnerDistributionFunction |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Overrides MultivariateDiscreteDistributionInnerDistributionFunction(Int32).) | |
InnerInverseDistributionFunction |
Not supported.
(Inherited from MultivariateDiscreteDistribution.) | |
InnerLogProbabilityMassFunction |
Gets the log-probability mass function (pmf) for
this distribution evaluated at point x.
(Overrides MultivariateDiscreteDistributionInnerLogProbabilityMassFunction(Int32).) | |
InnerProbabilityMassFunction |
Gets the probability mass function (pmf) for
this distribution evaluated at point x.
(Overrides MultivariateDiscreteDistributionInnerProbabilityMassFunction(Int32).) | |
InverseDistributionFunction |
Not supported.
(Inherited from MultivariateDiscreteDistribution.) | |
LogProbabilityMassFunction |
Gets the log-probability mass function (pmf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
MarginalDistributionFunction(Int32) |
Gets the marginal distribution of a given variable.
(Inherited from MultivariateDiscreteDistribution.) | |
MarginalDistributionFunction(Int32, Int32) |
Gets the marginal distribution of a given variable evaluated at a given value.
(Inherited from MultivariateDiscreteDistribution.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProbabilityMassFunction |
Gets the probability mass function (pmf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
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).) | |
Uniform |
Constructs a new multidimensional uniform discrete distribution.
|
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.) |
This class builds a (potentially huge) lookup table for discrete symbol distributions. For example, given a discrete variable A which may take symbols a, b, c; and a discrete variable B which may assume values x, y, z, this class will build the probability table:
x y z a p(a,x) p(a,y) p(a,z) b p(b,x) p(b,y) p(b,z) c p(c,x) p(c,y) p(c,z)
Thus comprising the probabilities for all possible simple combination. This distribution is a generalization of the GeneralDiscreteDistribution for multivariate discrete observations.
The following example should demonstrate how to estimate a joint distribution of two discrete variables. The first variable can take up to three distinct values, whereas the second can assume up to five.
// Lets create a joint distribution for two discrete variables: // the first of which can assume 3 distinct symbol values: 0, 1, 2 // the second which can assume 5 distinct symbol values: 0, 1, 2, 3, 4 int[] symbols = { 3, 5 }; // specify the symbol counts // Create the joint distribution for the above variables JointDistribution joint = new JointDistribution(symbols); // Now, suppose we would like to fit the distribution (estimate // its parameters) from the following multivariate observations: // double[][] observations = { new double[] { 0, 0 }, new double[] { 1, 1 }, new double[] { 2, 1 }, new double[] { 0, 0 }, }; // Estimate parameters joint.Fit(observations); // At this point, we can query the distribution for observations: double p1 = joint.ProbabilityMassFunction(new[] { 0, 0 }); // should be 0.50 double p2 = joint.ProbabilityMassFunction(new[] { 1, 1 }); // should be 0.25 double p3 = joint.ProbabilityMassFunction(new[] { 2, 1 }); // should be 0.25 // As it can be seem, indeed {0,0} appeared twice at the data, // and {1,1} and {2,1 appeared one fourth of the data each.