A sharp peak or a flat one
Lesson 5.9.1 found from 7 heads in 10 tosses. Seventy heads in 100 tosses give the same estimate. But 100 tosses pin down far better, and the log-likelihood shows how: its peak is sharper.
Here is how far falls below its peak at a few values of .
| 0.5 | 0.6 | 0.65 | 0.75 | 0.8 | |
|---|---|---|---|---|---|
| drop, 7 heads in 10 | 0.8228 | 0.216 | 0.0563 | 0.064 | 0.2817 |
| drop, 70 heads in 100 | 8.2283 | 2.1601 | 0.563 | 0.6401 | 2.8168 |
Ten times the data, ten times the drop, at every . A drop of 8.2283 means the data are times less likely under a fair coin than under . With 10 tosses the factor is only 2.28.
The log-likelihood below its peak for 10 and 100 tosses, with the parabola its curvature gives (dashed). The same peak, ten times the curvature. The dotted line 1.92 below the peak marks the interval of the last section.
The curvature at the peak
Near its peak, is close to its quadratic copy (lesson 2.7.1). At the slope is zero, so only the bend term is left:
is negative at a peak (lesson 2.4.2). The bigger its size, the faster falls away, and the fewer values of explain the data almost as well as .
Observed information and the standard error
The size of the bend at the peak is called the observed information, . Its inverse square root is the standard error of : the typical distance between the estimate and the true value.
Rule: Standard error from the curvature
is in units of 1 over 's units squared, so the standard error is in the units of . At one standard error from the quadratic copy has dropped by .
For the coin, lesson 5.9.1 found . At this simplifies to
| data | standard error | |
|---|---|---|
| 7 heads in 10 | 47.62 | 0.1449 |
| 70 heads in 100 | 476.19 | 0.0458 |
This is the standard error that case study 4.7.5 attached to a share of hits; maximum likelihood gives the same formula. The quadratic copy, , gives drops of 0.2381 at 0.6 and at 0.8, close to the true 0.216 and 0.2817.
Try it
The loop prints the table of drops for both data sets, then the quadratic copy for 10 tosses. The next line turns the drops at 0.5 into likelihood ratios.
The last lines compute two ways: by the formula, and by lesson 2.4.2's second difference of at the peak. The standard error follows.
Fisher information
Before any data arrive, the curvature is random: it depends on the sample. Its expected value is the Fisher information. For independent observations the log-likelihood is a sum of terms, so the information is times the information in one observation.
Rule: Fisher information
is the information in one observation. Information adds up over independent data, so the standard error shrinks like : four times the data halve it. For the three models below, and are equal.
| model | standard error | |
|---|---|---|
| coin, | ||
| exponential, | ||
| normal, | ||
| normal, |
For one toss, with the 0 or 1 it shows. Its mean, with , is . For one exponential wait, whatever the data.
The waits of lesson 5.9.1, five of them with per minute, have a standard error of per minute. The normal's is the of a sample mean that case study 5.3.5 used.
Try it
The first lines average the coin's over 100,000 seeded tosses, one seeded run. The mean, , lands near : the information in one toss, with its sign flipped.
Then the waits: , its standard error, and the interval of the last section.
Several parameters: the Hessian
With several parameters the curvature is the Hessian of at (lesson 4.3.1), with the vector of parameters. The observed information matrix is , the Hessian of the negative log-likelihood. Its inverse approximates the covariance matrix of the estimates.
Rule: Standard errors from the Hessian
Take the diagonal of the inverse, not 1 over the diagonal. The two agree only when is diagonal; otherwise the inverse gives larger standard errors.
For the normal fit of lesson 5.9.1 (data 2, 4, 5, 6, 8), . Its inverse is , so and . These are and , the table's formulas.
When estimates trade off
Lessons 3.5.3 and 4.4.1 fitted the line to five points by least squares. There is the matrix whose columns are the ones and the values.
Suppose each has a normal error with standard deviation . Then is times the sum of squared misses, plus terms without and , so its peak is the least-squares line.
Take , the fit's own estimate . The Hessian of in the intercept and slope is :
The standard errors are for and for . One over the square root of the diagonal would give 0.1789 and 0.073, far too small.
The reason is the off-diagonal entry. A steeper slope with a lower intercept fits almost as well, so the two estimates move together, with correlation . Lesson 5.10.3 meets this matrix again as the covariance of regression estimates.
Try it
The first lines invert the normal fit's and take square roots of the diagonal.
Then the line: M holds the ones and the values, and . The last line compares the two ways of reading standard errors, then prints the correlation.
Checked by simulation
The standard error claims to be the spread of over many samples. A simulation can test that. Draw many samples from a model with a known , compute for each, and compare their standard deviation with .
| 10 | 30 | 100 | 1,000 | |
|---|---|---|---|---|
| mean of | 2.2178 | 2.0734 | 2.0195 | 2.0025 |
| spread of | 0.7956 | 0.3956 | 0.2034 | 0.0627 |
| 0.6325 | 0.3651 | 0.2 | 0.0632 |
With 10 waits, the true spread is a quarter larger than the formula, and is biased upwards (lesson 5.8.1). From about 100 on, both match well. The numbers are from one seeded run of 10,000 samples for each .
Rule: Large samples
Stated, not proved: for large , a maximum likelihood estimate is close to normal, centred on the true , with variance . Like the central limit theorem of lesson 5.7.3, it says nothing exact about a small sample.
Try it
Each row of X is one sample of exponential waits with mean ; est holds the 10,000 estimates.
The last column is the share of samples whose interval covers 2, used in the next section.
Confidence intervals
If is close to normal with standard deviation , then covers the true value about 95% of the time, as in lesson 5.8.2.
Rule: Interval from the standard error
An approximate 95% interval, called a Wald interval. For 90% or 99%, use 1.645 or 2.576 in place of 1.96 (lesson 5.4.3).
- 7 heads in 10: , from 0.416 to 0.984.
- 70 heads in 100: from 0.6102 to 0.7898. The width is times the first, because the information grew tenfold.
- The waits: , from 0.062 to 0.938 per minute.
The simulation above found the exponential intervals covering 2 in 95.01% to 95.29% of samples, close to 95% at every . For the coin with , a seeded run gives 84.14% with 10 tosses and 95.04% with 100.
Where these intervals break
Near the edge of the range the Wald interval misbehaves. With 9 heads in 10 it runs from 0.714 to 1.086, past 1.
With 10 heads in 10, , so the standard error is 0. The interval is the single point 1: it claims certainty from 10 tosses.
The cause is the quadratic copy. Near an edge the log-likelihood is far from a parabola, so its curvature at the peak says little about its shape further out.
The likelihood-ratio interval
A sounder interval keeps every whose log-likelihood is within 1.92 of the peak. The number is , where is the 0.95-quantile of (lesson 5.4.4). For an exact parabola this is the Wald interval again.
Rule: Likelihood-ratio interval
An approximate 95% interval read off the log-likelihood itself, not its parabola. It need not be symmetric about , and it stays inside the range of .
| data | Wald | likelihood ratio |
|---|---|---|
| 7 heads in 10 | 0.416 to 0.984 | 0.3935 to 0.9154 |
| 70 heads in 100 | 0.6102 to 0.7898 | 0.6059 to 0.784 |
| 9 heads in 10 | 0.714 to 1.086 | 0.6284 to 0.994 |
| 10 heads in 10 | 1 to 1 | 0.8252 to 1 |
With 100 tosses the two nearly agree. With 10 they differ, and the likelihood-ratio interval leans towards the middle, where the log-likelihood falls more slowly.
For 10 tosses with it covers the truth with probability 0.9612, against 0.8401 for the Wald interval. Case study 5.9.4 uses it for the degrees of freedom of a t.
Try it
wald and lr return the two intervals for heads in . brentq (lesson 1.3.2) finds where crosses the line 1.92 below its peak; at an edge, the interval stops at 0 or 1.
The next lines simulate 100,000 counts for each with , in one seeded run, and print how often the Wald interval covers 0.7. The last lines give the exact coverage for 10 tosses: the probability of the counts whose interval covers 0.7.
Common mistakes
- The standard error is , not and not . For 7 heads in 10, and the standard error is 0.1449.
- Take the curvature at the peak, of , not of . Elsewhere is a different number.
- More data, smaller error, but slowly. The information grows like , the standard error shrinks like : four times the data halve it.
- With several parameters, invert first. The standard errors are the square roots of the diagonal of . For the line they are 0.3098 and 0.1265, not 0.1789 and 0.073.
- The formula is for large samples. With 10 waits the true spread of is 0.7956, against 0.6325 from the formula.
- Wald intervals break at the edges. 10 heads in 10 give a standard error of 0. Use the likelihood-ratio interval there.
Fisher information and standard errors
0 of 12 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- Near its peak , with the observed information . A sharper peak means a more precise estimate.
- , in the units of . Coin: ; exponential: ; normal: for and for .
- Fisher information adds over independent data, so standard errors shrink like .
- Several parameters: , , and each standard error is the square root of a diagonal entry of .
- For large , ; a simulation confirms it, and shows it is rough for small .
- Wald interval ; it breaks near edges. The likelihood-ratio interval keeps every with .