Statistics & Finance

Statistics is the study of how much you are allowed to conclude. Every tool here answers a version of one question: given this much data, what could still be a coincidence?

Newest in this category

Chapters

Short sequences rather than single tools. Each step hands the next one something specific, so they are worth doing in order.

L3: undergraduate

Fitting a line to data

MATHSeven tools that turn a picture of scattered points into a number you can defend, then ask how the number is found, how much of it to believe, what happens when nobody tells you the answer — and finally how to grade a prediction that was only ever a probability. The route runs through geometry rather than statistics, because the geometry is what makes the statistics honest.

  1. 01Vectors
  2. 02Least-squares geometry
  3. 03Linear regression
  4. 04Gradient descent
  5. 05Overfitting
  6. 06k-means
  7. 07Calibration

L3: undergraduate

The Fourier transform in practice

COMPA signal is a sum of spinning arrows, and every practical way of reading them off costs something the textbook formula leaves out. A finite window smears a tone that does not fit it across every bin; a shorter window buys time and pays in pitch; an average is a filter with a shape of its own; and the last page is the reason any of it is affordable.

  1. 01Discrete Fourier transform
  2. 02Spectrogram
  3. 03Moving average as a filter
  4. 04Fast Fourier transform

Problems solved in full

What you find out here

Articles written from these tools

Every tool on this shelf

Probability Distributions

Binomial Distribution Explorer
A normal curve built from σ alone gets P(X = 7) within 1.4% at n = 20 and runs 4.7 times too high at k = 0. Percentage errors in the middle, factor errors in the tails.
Central Limit Theorem Explorer
The standard error σ/√n is exact at n = 1, so a larger n buys shape rather than width. An exponential source still leans at skewness 0.365 when n = 30, and reaching 0.1 takes n = 400.
Confidence Interval Calculator
Two 95% intervals stop overlapping only once they are 3.92 standard errors apart, where p = 0.0056. Significance at 0.05 arrives at 2.77, so demanding a visible gap is nine times harsher than intended.
Kanji Frequency & Probability Explorer
The 158 most frequent kanji cover half this corpus and 1,162 cover 95%. A rank-1,500 character turns up once every 15,428, so in a 10,000-character story your chance of meeting it at all is 47.7%.
Mean vs Median Lab
Understand how an outlier drags the mean while leaving the median unchanged, and why in a right-skewed distribution most individuals lie below the mean.
Normal Distribution Explorer
Explore the bell curve: set mean and standard deviation with sliders, shade a region between x1 and x2, and calculate the probability live.
Poisson Distribution Explorer
A process averaging 3 events an interval hits exactly 3 only 22.4% of the time and sees an empty interval once in twenty. Mean and variance are the same number, so there is no width knob to turn.
Slope and Aspect
The same numbers drawn twice, side by side, with the angle of the line printed under each. How steep a line looks is set by the axis range and the shape of the box, not by the data.
Spread and Deviation
A value of 20 among seven between 4 and 7 scores z = 2.42, and no z past 2.4749 exists in eight numbers at all. Three standard deviations needs eleven observations before it is even reachable.
Z-Score Calculator
A z is a description; the percentile beside it is a model. Beyond ±2 the normal curve says 4.55% where Chebyshev allows 25%, and z = 4 is impossible with fewer than 18 data points.

Statistical Tests & Modeling

ANOVA F-Test
Explore how between-group and within-group variance combine into the F-statistic used to test whether group means differ.
Benford's Law Explorer
Test whether a set of numbers has the leading-digit distribution real data has, and see which datasets never could.
Causality Sandbox
X and Y correlate at −0.8871 across 400 points, and at −0.0553 once Z is held fixed: 28 standard errors from zero against 1.1. Confounder, collider and Simpson scenarios from one generator.
Chi-Square and Residual Map
Edit contingency tables and inspect expected counts, standardized residual heatmaps, and chi-square contributions.
False Findings
A field tests 1,000 hypotheses and one in ten is true. With 80% power, 64.0% of its significant results are real; with 20% power, 30.8%, from the same 45 false alarms. A 10% bias makes 80% power worth an honest 28.3%, and an honest replication of every finding brings back 53.0% of them even when nobody cheated.
Linear Regression
Fit a least-squares line to your data with scatter plot, residuals, Pearson r and Spearman ρ.
Multiple Comparisons
Twenty tests of pure noise turn up a result below 5% with probability 64.15%, and fourteen are enough to make it more likely than not. Run a family test by test, then let Bonferroni, Holm or Benjamini–Hochberg decide which results count, with every rate computed exactly beside 2,000 families drawn the same way.
Optional Stopping
Test after every batch of data, stop at the first p < 0.05, and an experiment with no effect in it reports one 19.34% of the time with ten looks and 37.36% with a hundred. Pocock's and O'Brien–Fleming's boundaries bring the rate back to 5%, and cost different amounts of power. Exact rates by numerical integration, beside 1,000 seeded experiments you can run one batch at a time.
Regression to the Mean
Pick the top 10% on one test and they average 124.8. Test them again and they average 112.4, with no change in anyone's ability: half of what lifted them the first time was luck. Give the worst 10% a treatment that does nothing and they improve by 12.4 points.
Student's t-Test
One-sample and two-sample Welch t-test with t-distribution curve and rejection region visualization.
SVD Decomposition Explorer
Keeping 95% of the energy still leaves a 22% reconstruction error, and 99% leaves 10%, because energy counts squared singular values and error does not. No other matrix of that rank does better.
The Moving Average as a Filter
A 7-day average removes any pattern that repeats exactly every week, whatever its shape, because it is a filter with zeros at one, two and three cycles a week. Just past the first zero it turns waves upside down. Real German case reports, a synthetic week and a pure wave, with the frequency response drawn beside them.

Probability Paradoxes & Demos

Bayes Theorem / False Positive Explorer
At 0.1% prevalence a 99% accurate test turns one positive into 9.0% and two independent positives into 90.75%. Repeat the same test in the same way and you get 16.4%, because the errors repeat too.
Bayes' Billiard — The Bean You Threw Over Your Shoulder
Watch a uniform prior turn into a Beta posterior, one hidden bean throw at a time.
Birthday Paradox Explorer
Twenty-three people reach 50.7% because there are 253 pairs among them; matching your birthday in particular needs 253 people. The same √N rule collapses a 32-bit hash after 77,162 items.
Coincidence Cluster (Streak Paradox)
Coin-toss streak explorer: compare theoretical streak probability against Monte Carlo simulation.
Deja-Vu Detector
See how often repeated local patterns appear in random symbol streams.
Gambler's Ruin
A fair coin, 10 chips against 1,000: you go broke 99.0099% of the time, and the average result is exactly zero. At roulette the edge is charged on every chip you stake, so turning 100 chips into 200 one chip at a time loses 99.11 of them on average, while one spin of all 100 loses 2.70. Four hundred players drawn at once, with the exact odds beside them.
Martingale Betting
Bet one unit, double after every loss, stop at the first win. With 1,023 units on European red a session ends one unit up 99.8725% of the time, and the expected result is −0.3056 against 11.308 staked: −2.7027% of every unit, the house edge to the last digit. After 1,000 sessions 72.08% of players are behind. Four hundred players drawn at once, with the exact distribution beside them.
Monte Carlo Pi Explorer
Error falls as 1/√N, so one more correct digit costs about 100 times more points. At N = 2000 the default run gives 3.122, and no seed at that N can beat an error of 4.073 × 10⁻⁴.
Queueing Theory Simulator (M/M/1)
Explore utilization and waiting time in M/M/1 queues.
Sample Size & Margin of Error Planner
Plan sample size or margin of error from confidence level and expected proportion.
The Monty Hall Problem
Pick one of three doors, watch the host open another to show a goat, and switching wins the car 2 times in 3. Change only the host's rule, to a host who opens a door without knowing what is behind it, and the same view gives 1 in 2.
The St Petersburg Paradox
A coin is tossed until it lands heads and the pot doubles with every tail: 1, 2, 4, … ducats. The expected value is infinite, yet against a bank that can pay 16,777,216 ducats the game is worth 13. Two hundred seeded players show why the average of many games never settles, and Daniel Bernoulli's logarithm of 1738 makes a man worth W, from 1,000 ducats up, pay within a few hundredths of a ducat what the game is worth against a bank of W.
The Winner's Curse
A true effect of 0.20 standard deviations, 50 people per group: 17.0% of studies reach p < 0.05, and those that do average 0.498, 2.49 times the truth. At 50% power or less every significant estimate overstates the size of the effect, and at 5.7% power 23.7% of them have the wrong sign. Run the studies yourself, one at a time, beside the exact figures.

Finance & Economics

Annuity Future Value
See how regular deposits compound into wealth over time — balance, contributions, and annual growth in one chart.
Bills, Notes and Bonds: What a Yield Does to a Price
Price a Treasury bill, note or bond from its yield and see every discounted cash flow. Why the 30-year lost 5.72% in 2026 while its yield moved 38 basis points, and the 2-year lost 1.71% on a move of 90.
Buy vs Rent: Net Worth Compared
Two households, the same cash, the same monthly budget: one buys a 400,000 home and one rents for 1,800 and invests the difference. After ten years they are 2,952 apart, and one percentage point on the home's growth or the investment return decides which way.
Compound Interest Explorer
10,000 at 7% for thirty years is 76,122.55 compounded annually and 81,164.97 monthly, and the step from hourly to compounding infinitely often is worth 69 cents.
Demography + Economics Lab
Interactive population-economy simulator with equation-driven insight and scenario decomposition.
Drawdown and Volatility Drag
How far a portfolio fell below its high-water mark, what it takes to climb back, and the return that volatility quietly costs you even in a good decade.
Inflation Adjuster
See how inflation erodes purchasing power and inflates nominal values over time.
Linear Programming (2D)
A feasible region is not a promise of an answer: the unbounded preset has one and no best corner. At the optimum the shadow prices are 2, 1 and 0, and the first of them expires at a budget of 5.
Loan Payment Calculator
Doubling the term cuts the payment by 42% and raises the interest by 108%. 25,000 at 6.2% is 485.65 a month over five years and 280.07 over ten, for 4139 of interest against 8608.
Markup vs Margin
Cost 40 selling at 60 is a 50% markup and a 33.33% margin on one profit of 20. Pricing for a 40% margin needs 66.67; adding 40% to the cost gives 56 and a margin of only 28.6%.
Portfolio Diversification Check
See whether a portfolio is spread across assets that behave differently, using snapshot-based correlations and volatility.
Real Return After Tax
Interest is taxed on the whole nominal amount, inflation included. Set what the account pays, what prices do and what the tax takes, and read the share of your real gain that actually leaves. A 25% tax takes 62.5% of the real gain at the page's own defaults, and at 40% you stand exactly still.
Rebalancing vs Letting It Drift
Compare selling the winner back to target every year against never touching it, on real returns from 1928 — and see which one is really being compared.
Risk Premia and How Sure You Can Be
Four premia investors are told they are paid for, measured on 98 years of returns — with the statistical certainty attached to each, which is usually far less than the average suggests.
Sequence of Returns
See why two portfolios with the same average return can end up worlds apart, using real annual returns from 1928 onward.
Simple vs Compound Interest
10,000 at 7% for twenty years pays 24,000 simple and 40,387.39 compounded monthly. Annual to monthly gains 1,690.54, monthly to daily another 159.17, and infinite compounding 5.44 more.
Supply-Demand Shock Simulator
Shift supply and demand curves and observe equilibrium.
Tax bands: marginal and effective rates
What a band system does to take-home pay: the rate charged on your next unit of income, the rate you actually paid on all of it, and the withdrawals that pull the two apart.
The Efficient Frontier, Out of Sample
Fit a mean-variance efficient frontier on one stretch of history, hold those weights through the next, and watch where they actually land — usually inside the curve that promised them.
The Kelly Criterion
A coin that lands your way 60% of the time at even money: stake everything and the average bankroll after 100 bets is 8.28×10⁷ times the start, while the chance of having anything left is 6.53×10⁻²³. Kelly's fraction, 0.2, maximises how fast one player's money grows; past 0.3894 every bet is still in your favour and the player is ruined with probability one. Exact distributions beside two hundred seeded players.
Unit Pricing
Cost per unit across pack sizes, and the two things a shelf does to make that comparison awkward. "50% extra free" is not a 50% discount, and the bigger box is not reliably cheaper.
Related categories: Mathematics, Computing