SYS-501 Probability and statistics

Probability you can
change and watch.

The problems from my probability and statistics notebooks, turned into live models: café arrivals, pooled blood tests, shaft tolerances, motorcycle reliability, a dart game, highway accidents and a test of gasoline prices. Change a parameter and every probability, chart and conclusion recomputes.

  • Poisson · Binomial · Normal · Weibull
  • Monte Carlo
  • t, χ² and F tests

Tesla battery survey

Full-charge range of 1,417 owner-reported vehicles, from notebook 01

241.8 mimean range
238 mimedian range
256 mi80th percentile
−0.58correlation of capacity with mileage
Range runs from 158 to 345 mi (standard deviation 22.4 mi, IQR 22 mi) and declines slightly with mileage.

Notebook 02

Probability distributions in practice

Four applied problems, each a different distribution. The defaults are the notebook's numbers; the results match its outputs.

P(Y = y) for the chosen period. The darker bars are the ones counted in P(Y ≥ m).

With many people and a small p, the binomial is close to a Poisson with λ = np. The chart compares the two.

Survival curves S(x): the chance of riding x thousand miles without a failure. A shape k above 1 means wear-out, so a used motorcycle is less reliable than a new one; the exponential has no memory.

Notebook 03

Monte Carlo simulation

When the answer is hard to derive, simulate it. Throw darts at random, drop accidents on a highway, and watch the estimate settle. Each run is seeded, so it can be repeated.

The dart game

A 12 in square board, rings of radius 2, 4 and 6 in scoring 25, 15 and 5

The running estimate of the expected score as throws accumulate, against the exact value.

Accidents on a 10-mile highway

One uniform location, two normal ones: how often are all three at least the minimum distance apart?

The estimate from ten seeds. When they agree to within 5 %, the simulation has converged, as the notebook checks.

Airline accidents

A Poisson rate of accidents per month

Notebook 04

Estimation and hypothesis testing

Are the gas prices of two cities different? How precisely do we know a battery's remaining capacity? How many measurements does an astronomer need? Edit the data and the answers follow.

Gas prices in two cities

Welch's t-test for the means and an F-test for the variances

Significance level

Confidence intervals

For a mean (t) and a variance (χ²); defaults are the Tesla battery capacity sample

Confidence

How many measurements?

The sample size that puts the mean within a margin of error

n = (z σ / E)², rounded up. The notebook's astronomer, σ = 2 light-years and ±0.5, needs 62 measurements for 95 % and 107 for 99 %.