TriangularDistribution Class |
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class TriangularDistribution : UnivariateContinuousDistribution, ISampleableDistribution<double>, IDistribution<double>, IDistribution, ICloneable, IRandomNumberGenerator<double>, IFittableDistribution<double, TriangularOptions>, IFittable<double, TriangularOptions>, IFittable<double>, IFittableDistribution<double>
The TriangularDistribution type exposes the following members.
Name | Description | |
---|---|---|
TriangularDistribution |
Constructs a Triangular distribution
with the given parameters a, b and c.
|
Name | Description | |
---|---|---|
Entropy |
Gets the entropy for this distribution,
defined as 0.5 + log((max-min)/2)).
(Overrides UnivariateContinuousDistributionEntropy.) | |
Max |
Gets the triangular parameter B (the maximum value).
| |
Mean |
Gets the mean for this distribution,
defined as (a + b + c) / 3.
(Overrides UnivariateContinuousDistributionMean.) | |
Median |
Gets the median for this distribution.
(Overrides UnivariateContinuousDistributionMedian.) | |
Min |
Gets the triangular parameter A (the minimum value).
| |
Mode |
Gets the mode for this distribution,
also known as the triangular's c.
(Overrides UnivariateContinuousDistributionMode.) | |
Quartiles |
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.) | |
StandardDeviation |
Gets the Standard Deviation (the square root of
the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.) | |
Support | (Overrides UnivariateContinuousDistributionSupport.) | |
Variance |
Gets the variance for this distribution, defined
as (a² + b² + c² - ab - ac - bc) / 18.
(Overrides UnivariateContinuousDistributionVariance.) |
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 UnivariateContinuousDistribution.) | |
CumulativeHazardFunction |
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.) | |
DistributionFunction(Double) |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.) | |
DistributionFunction(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.) | |
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.) | |
FindMax |
Finds the index of the last largest value in a set of observations.
| |
FindMin |
Finds the index of the first smallest value in a set of observations.
| |
Fit(Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.) | |
Fit(Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.) | |
Fit(Double, Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.) | |
Fit(Double, Int32) |
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.) | |
Fit(Double, Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).) | |
Fit(Double, Double, TriangularOptions) |
Fits the underlying distribution to a given set of observations.
| |
Fit(Double, Int32, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateContinuousDistributionFit(Double, Int32, IFittingOptions).) | |
Fit(Double, Int32, TriangularOptions) |
Fits the underlying distribution to a given set of observations.
| |
Generate |
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.) | |
Generate(Random) |
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Random).) | |
Generate(Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.) | |
Generate(Int32, Double) |
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.) | |
Generate(Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.) | |
Generate(Int32, Double, Random) |
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double, Random).) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetMax(Double, Double, Int32) |
Gets the maximum value in a set of weighted observations.
| |
GetMax(Double, Int32, Int32) |
Finds the index of the last largest value in a set of weighted observations.
| |
GetMin(Double, Double, Int32) |
Gets the minimum value in a set of weighted observations.
| |
GetMin(Double, Int32, Int32) |
Finds the index of the first smallest value in a set of weighted observations.
| |
GetRange |
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
HazardFunction |
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.) | |
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 UnivariateContinuousDistribution.) | |
InnerDistributionFunction |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).) | |
InnerInverseDistributionFunction |
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.) | |
InnerLogProbabilityDensityFunction |
Gets the log-probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.) | |
InnerProbabilityDensityFunction |
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerProbabilityDensityFunction(Double).) | |
InverseDistributionFunction |
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.) | |
LogCumulativeHazardFunction |
Gets the log of the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.) | |
LogProbabilityDensityFunction |
Gets the log-probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.) | |
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 UnivariateContinuousDistribution.) | |
QuantileDensityFunction |
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateContinuousDistribution.) | |
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 theory and statistics, the triangular distribution is a continuous probability distribution with lower limit a, upper limit b and mode c, where a < b and a ≤ c ≤ b.
References:
This example shows how to create a Triangular distribution with minimum 1, maximum 6, and most common value 3.
// Create a new Triangular distribution (1, 3, 6). var trig = new TriangularDistribution(a: 1, b: 6, c: 3); double mean = trig.Mean; // 3.3333333333333335 double median = trig.Median; // 3.2613872124741694 double mode = trig.Mode; // 3.0 double var = trig.Variance; // 1.0555555555555556 double cdf = trig.DistributionFunction(x: 2); // 0.10000000000000001 double pdf = trig.ProbabilityDensityFunction(x: 2); // 0.20000000000000001 double lpdf = trig.LogProbabilityDensityFunction(x: 2); // -1.6094379124341003 double ccdf = trig.ComplementaryDistributionFunction(x: 2); // 0.90000000000000002 double icdf = trig.InverseDistributionFunction(p: cdf); // 2.0000000655718773 double hf = trig.HazardFunction(x: 2); // 0.22222222222222224 double chf = trig.CumulativeHazardFunction(x: 2); // 0.10536051565782628 string str = trig.ToString(CultureInfo.InvariantCulture); // Triangular(x; a = 1, b = 6, c = 3)