if (a >= b || a >= c || c >= b) { return undefined; }
var dfs = {
mean: (a + b + c) / 3,
median: (function () {
if (c > (a + b) / 2) {
return a + Math.sqrt((b - a) * (c - a)) / Math.sqrt(2);
} else {
return b - Math.sqrt((b - a) * (b - c)) / Math.sqrt(2);
}
})(),
mode: c,
variance: (Math.pow(a, 2) + Math.pow(b, 2) + Math.pow(c, 2) - (a * b) - (a * c) - (b * c)) / 18,
skewness: (Math.sqrt(2) * (a + b - (2 * c)) * ((2 * a) - b - c) * (a - (2 * b) + c)) / (5 * Math.pow(Math.pow(a, 2) + Math.pow(b, 2) + Math.pow(c, 2) - (a * b) - (a * c) - (b * c), 1.5)),
entropy: 0.5 + Math.log((b - a) / 2),
domain: { min: a, max: b },
range: { min: 0, max: Infinity },
Triangular Distribution
The Triangular Distribution is a family of continuous probability distributions characterized by a single mode bracketed by minimum and maximum values.
Assumptions
a
,b
, andc
are real numbers, the minimum, maximum, and modal values, with a < c < b; a may be thought of as a location parameter, (b - a) as a scale parameter, c as a shape parameter.Use
mctad.triangular(a, b, c)
Inline Comments