aifinhub

Methodology · Calculator · Last updated 2026-04-20

How Returns Distribution Analyzer works

How the Returns Distribution Analyzer tool actually works — assumptions, algorithms, limitations.

Scope

Quantifies deviation of a univariate return series from a normal distribution — the precondition behind Sharpe, parametric VaR, and most mean-variance reasoning. Outputs both visual diagnostics (histogram, normal QQ plot) and numeric tests (moments, Jarque-Bera, tail mass at ±3σ).

Input format

date,returns
2024-01-02,0.0012
2024-01-03,-0.0005
...

Any CSV with a header row is accepted. The first non-date numeric column is analyzed. A date / timestamp / time column is optional and ignored for computation. Simple or log returns both work because all moments used here are location/scale invariant except for the mean.

Algorithms

Sample moments

μ = (1/n) · Σ x_i
σ = √[(1 / (n − 1)) · Σ (x_i − μ)²]
skew = (1/n) · Σ ((x_i − μ) / σ)³
excess_kurt = (1/n) · Σ ((x_i − μ) / σ)⁴ − 3

Skewness uses the population formula (divide by n), not n−1, consistent with the Jarque-Bera derivation below. Excess kurtosis subtracts 3 so that a normal distribution reads 0.

Jarque-Bera normality test

JB = (n / 6) · (skew² + excess_kurt² / 4)

Under H₀ (returns are normally distributed), JB is asymptotically χ²-distributed with 2 degrees of freedom. The p-value uses the closed-form χ²(2) CDF: P(X > x) = exp(−x / 2). The test converges slowly; for small samples (n < 200), interpret borderline p-values with caution.

Normal QQ plot

For each sorted observation at rank i (0-indexed), the empirical quantile position is p = (i + 0.5) / n. The theoretical quantile is Φ⁻¹(p), computed via the Beasley-Springer-Moro rational approximation. The plotted point is (Φ⁻¹(p), (x_(i) − μ) / σ). Points on the 45° line indicate normality; S-shaped deviation at the extremes is the classic fat-tail signature.

Tail mass

Fraction of observations beyond ±3σ from the sample mean. A normal distribution has ≈0.27% of mass beyond ±3σ. The tail-excess ratio is the observed total ÷ 0.27%; values > 2× flag the regime where Sharpe materially understates realised risk.

Assumptions + limitations

  1. Stationarity. All tests assume the returns are drawn from a single fixed distribution. Regime shifts (e.g. pre- and post-Fed pivots) bias the moments. Split by regime for cleaner diagnostics.
  2. Independence. Serial correlation inflates the effective sample size and weakens JB's asymptotic validity. For strongly autocorrelated series, deflate n heuristically or use a block-bootstrap p-value (not implemented here).
  3. Sample size. A minimum of 30 observations is enforced. JB is asymptotic; tail-mass estimates are especially noisy below 200 observations.
  4. Normal reference. The tool measures deviation from normality. Fat tails are a fact of financial returns — failing the test is usually correct, not surprising.
  5. Single series. Multivariate non-normality (copula asymmetry, tail dependence) is not addressed. See the Correlation Matrix Visualizer for cross-asset structure.

Privacy

All parsing, moment computation, QQ-plot construction, and tail-mass measurement run in the browser. Nothing is uploaded. No cookies or tracking scripts.

References

  • Jarque, C. M., & Bera, A. K. (1987). "A Test for Normality of Observations and Regression Residuals." International Statistical Review 55(2).
  • Beasley, J. D., & Springer, S. G. (1977). "Algorithm AS 111: The Percentage Points of the Normal Distribution." Applied Statistics 26(1).
  • Cont, R. (2001). "Empirical Properties of Asset Returns: Stylized Facts and Statistical Issues." Quantitative Finance 1(2).
  • Taleb, N. N. (2020). Statistical Consequences of Fat Tails. STEM Academic Press.

Connects to

Changelog

  • 2026-04-20 — Initial release with histogram, QQ plot, moments, Jarque-Bera, and 3σ tail-mass diagnostics.
Planning estimates only — not financial, tax, or investment advice.