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
where 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 and samples, the standard error is , so a two-standard-error bar is .
You draw samples and average them. The estimate is
Two facts follow, and they are the whole character of the class.
- The error falls as , whatever the dimension. Four times the work halves the error. That is slow, and it is also why the method survives problems with a hundred inputs where a grid would need points.
- Every answer carries an error bar. An average without one is a number with no claim attached.
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 , and the dashed line is the value the method cannot see.
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
- Correlated samples. A Markov chain gives a valid average, but consecutive samples are not independent. The naive error bar is then too small, sometimes by a factor of a hundred.
- Rare events. If the thing you want happens once in draws, sampling will not see it. The method has to be aimed.
- An expensive model. Ten thousand runs of a two-hour simulation is not a plan. A cheap stand-in, itself fitted by a smaller number of runs, is the usual answer.
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 |
| 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; 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 | 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
- How much the camber varies when the bush stiffness is only known to ten per cent.
- Weather and climate ensembles: one model, many starting states.
- Option pricing, where the average is over paths.
- Bayesian parameter fitting: the answer is a distribution, not a number.
- Sensor fusion: where the car is, from noisy measurements.
- Reliability: the probability that a part fails before a mileage.
- Detector and radiotherapy simulation: the average is over millions of histories.
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 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 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
- A-level Mathematics · §14.3 Normal tests for a mean and the significance level
- Leaving Certificate Mathematics · §11.7 Sampling variability and the margin of error
- Leaving Certificate Mathematics · §11.9 Hypothesis testing and confidence intervals
Read next
- Optimisation — fitting a model is an average and a minimum at the same time.
- Parabolic — a distribution that spreads is the same equation as heat.
- When it goes wrong — the symptom table for every class.
Back to the map: the nine kinds puts this class among the other eight.