Maximum likelihood estimation
Choose the parameter value that makes the data you observed most probable. For k winners in n trades, that is simply the win rate k/n.
01The formula
- the likelihood: the probability of the data you saw, as a function of p
- the unknown win rate
- the number of winning trades
- the number of trades
- the maximum likelihood estimate
- its approximate standard error
02See it move
03Where it is used
- Quant researcherFits distributions, volatility models such as GARCH and order-arrival rates by maximising likelihood.
- Risk managerEstimates the parameters of fat-tailed loss distributions for capital models.
- Market makerFits fill-probability models to their own order history.
04Why traders use it
It is the general recipe behind most fitted models in finance. The width of the likelihood also tells you how precisely the data pin the parameter down.
05Worked example
With 12 winners in 20 trades, the maximum likelihood win rate is 60.0%, with a standard error of 11.0%. The log-likelihood at the peak (without the constant) is −13.460, and a 50% win rate is still 66.9% as likely as the best estimate.
06How it is built
- Write the probability of the data as a function of : .
- Take logs, which turns products into sums: .
- Set the derivative to zero: , so .
- The curvature of at the peak gives the standard error, .
07The common mistake
Reporting the estimate without its width. Twelve wins from twenty trades and sixty from a hundred give the same 60%, but the second is far better evidence.
08In Python and LaTeX
import numpy as np from scipy.optimize import minimize_scalar n, k = 20, 12 nll = lambda p: -(k*np.log(p) + (n - k)*np.log(1 - p)) res = minimize_scalar(nll, bounds=(1e-6, 1 - 1e-6), method='bounded') print(round(res.x, 3), round(-res.fun, 3))
L(p) = \binom{n}{k} p^k (1 - p)^{n - k}, \qquad \hat{p} = \arg\max_p \ln L(p) = \frac{k}{n}, \qquad \operatorname{SE}(\hat p) \approx \sqrt{\frac{\hat p(1 - \hat p)}{n}}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.