Statistical
Log-Gamma Scaling and Erlang Multi-Stage Waiting-Time Probability (GAMMALN & GAMMA.DIST)
Evaluate exact log-gamma LN(FACT(k - 1)), gamma density ordinates, and closed-form Erlang k-stage waiting-time cumulative probabilities using EXP, LN, and FACT.
Connecting Gamma(k), GAMMALN, and Erlang multi-stage waiting times
For any positive integer shape k, Euler's Gamma function satisfies Gamma(k) = (k - 1)! and its natural logarithm GAMMALN(k) = LN(FACT(k - 1)), preventing factorial overflow when computing Poisson-Gamma probabilities.
When a workflow consists of k independent exponential stages each with scale theta (mean stage time theta, total mean k * theta), total completion time follows GAMMA.DIST(x, k, theta, TRUE)—the Erlang distribution—whose exact cumulative probability for integer k is 1 - EXP(-x / theta) * sum_{j=0..k-1} ((x / theta)^j / j!).
| Shape (k) | Scale (theta) | Elapsed Time (x) | Gamma PDF f(x) | Cumulative CDF F(x) |
|---|---|---|---|---|
| k = 3 stages | 2.0 min | 4.0 min | 0.135335 | 0.323324 |
| k = 1 stage (Exponential) | 2.0 min | 4.0 min | 0.067668 | 0.864665 |
| k = 2 stages | 2.0 min | 4.0 min | 0.135335 | 0.593994 |
| GAMMALN(6) = ln(5!) | — | — | ln(120) | 4.787492 |
Closed-Form Erlang / GAMMA.DIST Cumulative Probability (k = 1..4)
Evaluates 1 - EXP(-u) * Poisson_partial_sum where u = x / theta for integer stage counts k in B2 (1 to 4).
=LET(k_sh, B2, th, B3, x_val, B4, u_val, x_val / th, p_sum, 1 + IF(k_sh >= 2, u_val, 0) + IF(k_sh >= 3, POWER(u_val, 2) / 2, 0) + IF(k_sh >= 4, POWER(u_val, 3) / 6, 0), ROUND(1 - EXP(-u_val) * p_sum, 6))Exact Gamma PDF Ordinate & Integer GAMMALN Formula
Computes the Gamma probability density f(x; k, theta) = EXP((k - 1)*LN(x) - x/theta - k*LN(theta) - LN(FACT(k - 1))) in log-space to avoid overflow.
=ROUND(EXP((B2 - 1) * LN(B4) - (B4 / B3) - B2 * LN(B3) - LN(FACT(B2 - 1))), 6)Try the example
Use the original values or change them to test your understanding.