Click or drag to resize
Accord.NET (logo)

TrapezoidalDistribution Class

Trapezoidal distribution.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.DistributionsDistributionBase
    Accord.Statistics.Distributions.UnivariateUnivariateContinuousDistribution
      Accord.Statistics.Distributions.UnivariateTrapezoidalDistribution

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

The TrapezoidalDistribution type exposes the following members.

Constructors
  NameDescription
Public methodTrapezoidalDistribution(Double, Double, Double, Double)
Creates a new trapezoidal distribution.
Public methodTrapezoidalDistribution(Double, Double, Double, Double, Double, Double)
Creates a new trapezoidal distribution.
Public methodTrapezoidalDistribution(Double, Double, Double, Double, Double, Double, Double)
Creates a new trapezoidal distribution.
Top
Properties
  NameDescription
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.
(Inherited from UnivariateContinuousDistribution.)
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 methodFit(Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, Double)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, Int32)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(Double, Double, IFittingOptions)
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)
Public methodFit(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 methodInnerDistributionFunction
Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).)
Protected methodInnerInverseDistributionFunction
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.)
Protected methodInnerLogProbabilityDensityFunction
Gets the log-probability density function (pdf) for this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)
Protected methodInnerProbabilityDensityFunction
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 MethodToT
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

Trapezoidal distributions have been used in many areas and studied under varying scopes, such as in the excellent work of (van Dorp and Kotz, 2003), risk analysis (Pouliquen, 1970) and (Powell and Wilson, 1997), fuzzy set theory (Chen and Hwang, 1992), applied phyisics, and biomedical applications (Flehinger and Kimmel, 1987).

Trapezoidal distributions are appropriate for modeling events that are comprised by three different stages: one growth stage, where probability grows up until a plateau is reached; a stability stage, where probability stays more or less the same; and a decline stage, where probability decreases until zero (van Dorp and Kotz, 2003).

References:

Examples

The following example shows how to create and test the main characteristics of a Trapezoidal distribution given its parameters:

// Create a new trapezoidal distribution with linear growth between
// 0 and 2, stability between 2 and 8, and decrease between 8 and 10.
// 
// 
//            +-----------+
//           /|           |\
//          / |           | \
//         /  |           |  \
//  -------+---+-----------+---+-------
//   ...   0   2   4   6   8   10  ...
// 
var trapz = new TrapezoidalDistribution(a: 0, b: 2, c: 8, d: 10, n1: 1, n3: 1);

double mean = trapz.Mean;     // 2.25
double median = trapz.Median; // 3.0
double mode = trapz.Mode;     // 3.1353457616424696
double var = trapz.Variance;  // 17.986666666666665

double cdf = trapz.DistributionFunction(x: 1.4);           // 0.13999999999999999
double pdf = trapz.ProbabilityDensityFunction(x: 1.4);     // 0.10000000000000001
double lpdf = trapz.LogProbabilityDensityFunction(x: 1.4); // -2.3025850929940455

double ccdf = trapz.ComplementaryDistributionFunction(x: 1.4); // 0.85999999999999999
double icdf = trapz.InverseDistributionFunction(p: cdf);       // 1.3999999999999997

double hf = trapz.HazardFunction(x: 1.4);            // 0.11627906976744187
double chf = trapz.CumulativeHazardFunction(x: 1.4); // 0.15082288973458366

string str = trapz.ToString(CultureInfo.InvariantCulture); // Trapezoidal(x; a=0, b=2, c=8, d=10, n1=1, n3=1, α = 1)
See Also