Numerical Methods

All books

Averaging

You have one of these when the answer is not a number but a distribution, or an average over possibilities you cannot list.

Averaging, not root finding. The answer is a distribution, or a number with an error bar. A root is the point where a rule comes out zero.

What you are modelling

The system has randomness in it, or so many states that counting them is hopeless. You are not asking where it is. You are asking how likely something is, how spread out it is, or what happens on average when the inputs vary.

This is the statistical half of the map, and it is the same box as the physical half. It is also the whole of that half: one box, and a page that names the methods. Four of them are derived in full under this page, and the rest are named and priced, because a reference work's job is to tell you where your problem belongs. A suspension corner whose bush stiffness is only known to within ten per cent is an averaging problem in exactly the sense that a queue is.

The model you write down

E[g(X)]=∫g(x) p(x) dx,\mathbb{E}[g(X)] = \int g(x)\,p(x)\,\mathrm{d}x ,

where pp is the distribution of the inputs. When the state is only known probabilistically, the model is a rule for how the distribution moves — a transition, a likelihood, and a prior.

What it becomes on a computer

Worked number. With σ=1\sigma=1 and N=1000N=1000 samples, the standard error is 1/1000=0.03161/\sqrt{1000}=0.0316, so a two-standard-error bar is 0.0630.063.

You draw samples and average them. The estimate is

μ^=1N∑i=1Ng(xi),error∼σN.\hat{\mu} = \frac{1}{N}\sum_{i=1}^{N} g(x_i), \qquad \text{error} \sim \frac{\sigma}{\sqrt{N}} .

Two facts follow, and they are the whole character of the class.

The error bar is the answer's honesty. The figure draws the estimate and two standard errors around it as the samples accumulate; the bar narrows as 1/N1/\sqrt{N}, and the dashed line is the value the method cannot see.

Figure 1

The signature

The answer is an estimate. There is no equilibrium to solve, and no region to cut into cells and write the rule on each — nothing to discretise. There is a sample, a variance, and a convergence rate you can measure.

Flags that matter here

Techniques

Every method named here is in Methods, A to Z, with its price and what it will not do.

Start from the model you have. Each row is a property of the model in front of you, the methods that fit it, and what the fit costs. The method-keyed table below is the same list sorted by name.

what your model is the methods that fit the price
anything you can run Monte Carlo a slow 1/N1/\sqrt{N}
a rare event Importance sampling the weights have a huge variance
a smooth integrand, modest dimension Stratified and Latin hypercube sampling, quasi-Monte Carlo, Gaussian quadrature smoothness is the assumption
a cheap correlated model Control variates, antithetic pairs a weak correlation buys little
a distribution known up to a constant Markov chain Monte Carlo the samples are correlated
a state moving as data arrive Particle filter, sequential Monte Carlo the cloud has to be large
a linear model with Gaussian noise Kalman filter non-linear, or multi-modal, and it fails
data, and no formula Bootstrap small or dependent samples
technique what it does when it wins when it is the wrong tool
Monte Carlo Draws independent samples and averages Any dimension, any model you can run You need precision; 1/N1/\sqrt{N} is slow
Importance sampling Draws where the answer is, and reweights Rare events; a known region of interest The weight has huge variance
Stratified and Latin hypercube sampling Spreads the draws over the space Smooth response, modest dimension Discontinuous response
Quasi-Monte Carlo Uses a low-discrepancy sequence instead of random draws Smooth integrands, moderate dimension No reliable error estimate
Control variates, antithetic pairs Uses a known answer to cancel part of the error A cheap correlated model exists The correlation is weak
Markov chain Monte Carlo Walks a chain that settles to pp pp known up to a constant; Bayesian fitting You need independent samples, or speed
Particle filter, sequential Monte Carlo Carries a cloud of weighted samples through time State estimation as data arrive Very high dimension
Kalman filter Exact update for linear models with Gaussian noise The model is linear and the noise is Gaussian Non-linear, or multi-modal state
Bootstrap Resamples your data to get an error bar You have data and no formula Very small samples; dependent data
Gaussian quadrature Chooses points and weights exactly Smooth, low-dimensional integrands Dimension above about ten

Systems that live here

What goes wrong

symptom cause fix
A tiny error bar, and the answer is wrong Samples were not independent, or the model is biased Check the autocorrelation and the model
The chain never settles The target has not been normalised, or the support is wrong Fix the model before tuning the sampler
A rare event never appears Plain sampling, and the event is rare Importance sampling or subset simulation
Ten million samples and still noisy The variance of gg is large A control variate, or a quasi-random sequence
A different run gives a different answer That is the method, not a bug Report the error bar, and the seed

The working under this page

Four pages take one method family each and carry the algebra, a program and the theory. They are optional: the class page is complete without them.

Page What it settles
An average, and its error bar The variance of an estimate, the σ/N\sigma/\sqrt N rate, and what a two-standard-error bar means
When the samples are not independent Autocorrelation, the integrated autocorrelation time, and the effective sample size
Walking a chain that settles Metropolis, detailed balance, R-hat and the effective sample size
Fitting, and what the fit does not say Least squares as maximum likelihood, the normal equations, and the slope's standard error

Used in this collection

Back to the map: the nine kinds puts this class among the other eight.

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Layout

How pages are arranged. Your colours stay the same.

Reading offline

Keep this book on this device and read it offline.