Continuous distribution

Triangular distribution

A quantity known only by its smallest, most likely and largest values: a task estimate of "at least 2 days, probably 4, at most 10", the rough cost of a project, a prior when that is all an expert will commit to. The density rises in a straight line from to the peak at and falls in a straight line to . The sum of two independent uniforms is triangular.

Triangular probability calculator

P(X ≤ 1.3) = 0.518333

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.

PDF

00.20.40.6−2024f(x)mean

CDF

00.250.50.751−2024F(x)

mean 1.333 · variance 0.3889 · sd 0.6236 · mode 1 · entropy 0.9055 nats

Formulas

Parameters
  • , the minimum
  • , the most likely value
  • , the maximum
Support
PDF
CDF
Mean
Variance
Mode
MGF
Entropy

SciPy's triang takes the peak as a fraction of the way along, c , with loc and scale ; NumPy's triangular takes the three values directly.

Worked example

A task will take at least 2 days, most likely 4 and at most 10. Modelled as triangular, what is the probability it is done within 5 days?

5 is past the peak, so The mean is days: the long right side pulls it past the most likely value. answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.triang(c=1/3, loc=0, scale=3)
X.pdf(1.5)  # f(1.5) = 0.5
X.cdf(1.5)  # P(X ≤ 1.5) = 0.625
X.mean(), X.var()  # 1.333, 0.3889
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
rng.triangular(left=0, mode=1, right=3, size=10)

Choosing between this and its neighbours? Which distribution for proportions and probabilities?

← UniformNormal →