- The Student's t-Distribution CDF transforms a min-max normalized price into the cumulative distribution function of Student's t-distribution, produ...
The Student's t-Distribution CDF transforms a min-max normalized price into the cumulative distribution function of Student's t-distribution, producing an output in $[0, 1]$. The t-distribution is the normal distribution's heavier-tailed cousin: as degrees of freedom $\nu$ increase, it converges to the Gaussian; at low $\nu$ it accommodates extreme values that the normal distribution would assign negligible probability. The implementation normalizes price to $[0, 1]$, maps to a t-statistic via linear scaling to $[-3, +3]$, then evaluates the CDF through the regularized incomplete beta function. This makes TDIST a robust percentile ranking that is less sensitive to outliers than NORMDIST.
## Historical Context
The t-distribution was derived by William Sealy Gosset (1908), publishing under the pseudonym "Student" while employed at the Guinness brewery. Gosset needed to make statistical inferences from small sample sizes where the population variance was unknown. Ronald Fisher (1925) generalized the distribution and introduced the degrees-of-freedom parameter.
In finance, the t-distribution has become central to fat-tailed modeling. Empirical studies consistently show that asset returns have heavier tails than the normal distribution (Mandelbrot, 1963; Fama, 1965). The t-distribution with $\nu \approx 4\text{-}6$ provides a reasonable fit to daily equity returns, and it underpins GARCH-t models, Student-t copulas in credit risk, and robust regression in factor modeling.
The CDF is computed via the identity connecting it to the regularized incomplete beta function:
where $x = \nu/(\nu + t^2)$. This reuses the same Lanczos log-gamma and Lentz continued fraction infrastructure as BETADIST and FDIST.
## Architecture and Physics
The computation follows a four-phase pipeline:
**Phase 1: Min-max normalization** scans `period` bars for extrema, maps the current source to $x \in [0, 1]$.
**Phase 2: t-statistic mapping** transforms $x$ to a t-value via linear scaling:
$$t = (x - 0.5) \times 6.0$$
This maps $[0, 1]$ to $[-3, +3]$, covering approximately 99.7% of the standard normal range and the bulk of any t-distribution with $\nu \ge 3$.
**Phase 3: Beta function argument** converts the t-statistic to the incomplete beta argument:
$$\text{bx} = \frac{\nu}{\nu + t^2}$$
For $t = 0$, $\text{bx} = 1$ and the CDF returns 0.5 (symmetric around zero). As $|t|$ grows, $\text{bx}$ approaches 0.
**Phase 4: Regularized incomplete beta** evaluates $I_{\text{bx}}(\nu/2, 1/2)$ via the Lentz continued fraction with symmetry flip for numerical stability. The sign of $t$ determines whether the result is in the lower or upper tail.
**Degrees-of-freedom effects**: $\nu = 1$ gives the Cauchy distribution (extremely heavy tails, no finite mean). $\nu = 5$ gives moderately heavy tails. $\nu = 30$ is nearly indistinguishable from the normal. $\nu \to \infty$ converges to $N(0, 1)$.
## Mathematical Foundation
The Student's t-distribution with $\nu$ degrees of freedom has PDF:
**Convergence to normal**: As $\nu \to \infty$, $t_\nu \to N(0,1)$. For practical purposes, $\nu \ge 30$ produces CDF values within $10^{-3}$ of the normal CDF.