Skip to content
LeetQuant
F5 Statistics and Inference

F5 · Statistics and Inference · Lesson 1 of 4

Estimation & Hypothesis Testing

Bias, variance, standard errors, z- and t-tests, and multiple testing in backtests.

30 min

Estimators and their errors

An estimator θ^\hat\theta is a rule that turns data into a guess of an unknown parameter θ\theta. Two numbers describe how good it is:

  • Bias: E[θ^]−θ\mathbb{E}[\hat\theta] - \theta.
  • Variance: Var⁡(θ^)\operatorname{Var}(\hat\theta), whose square root is the standard error.

They combine into the mean squared error, MSE=bias2+variance\text{MSE} = \text{bias}^2 + \text{variance}. A slightly biased estimator with much lower variance can be the better choice.

The sample mean of nn i.i.d. observations with standard deviation σ\sigma is unbiased with

SE⁡(Xˉ)=σn.\operatorname{SE}(\bar X) = \frac{\sigma}{\sqrt n} .

The n\sqrt n is the most important number in statistics: to halve your error you need four times the data.

The central limit theorem and confidence intervals

For large nn, Xˉ\bar X is approximately normal whatever the distribution of each observation (as long as it has finite variance):

Xˉ−μσ/n  ≈  N(0,1).\frac{\bar X - \mu}{\sigma / \sqrt n} \;\approx\; N(0, 1) .

So Xˉ±1.96 σ/n\bar X \pm 1.96\,\sigma/\sqrt n is an approximate 95% confidence interval. Numbers worth memorising: P(∣Z∣<1)≈68%P(|Z| < 1) \approx 68\%, P(∣Z∣<2)≈95%P(|Z| < 2) \approx 95\%, P(∣Z∣<3)≈99.7%P(|Z| < 3) \approx 99.7\%, and P(Z>1.645)=5%P(Z > 1.645) = 5\%.

For a sum of nn i.i.d. variables, the mean is nμn\mu and the standard deviation is n σ\sqrt n\,\sigma. Ten dice have mean 3535 and standard deviation 10⋅35/12≈5.4\sqrt{10 \cdot 35/12} \approx 5.4.

Hypothesis tests

A test asks whether the data are surprising under a null hypothesis H0H_0.

  1. Choose a test statistic, for example z=Xˉ−μ0σ/nz = \dfrac{\bar X - \mu_0}{\sigma/\sqrt n}, or t=Xˉ−μ0s/nt = \dfrac{\bar X - \mu_0}{s/\sqrt n} when σ\sigma is estimated by the sample standard deviation ss.
  2. The p-value is the probability, under H0H_0, of a statistic at least as extreme as the one observed.
  3. Reject H0H_0 if the p-value is below the significance level α\alpha (often 5%).

A type I error rejects a true null (probability α\alpha). A type II error fails to reject a false null; power is one minus its probability. A p-value is not the probability that the null is true.

Worked example

is this strategy real?

A strategy returned an average of 0.05% per day with a daily standard deviation of 1% over one year of 252 trading days. Is the mean return significantly positive?

Show solution

The t-statistic is

t=0.00050.01/252=0.05×15.87≈0.79.t = \frac{0.0005}{0.01 / \sqrt{252}} = 0.05 \times 15.87 \approx 0.79 .

That is far below 2, so one year of data cannot distinguish this from luck. A useful identity: t≈annualised Sharpe×yearst \approx \text{annualised Sharpe} \times \sqrt{\text{years}}. Here the Sharpe ratio is about 0.790.79, and you would need roughly (2/0.79)2≈6.4(2 / 0.79)^2 \approx 6.4 years for t≈2t \approx 2.

Multiple testing: the backtest trap

Test mm strategies with no edge at α=5%\alpha = 5\% and you should expect 0.05 m0.05\,m false discoveries. The chance of at least one is 1−0.95m1 - 0.95^m, which is 64% for m=20m = 20.

Defences:

  • Bonferroni: use threshold α/m\alpha / m. Simple and conservative.
  • Hold-out data: decide what to test before looking at the out-of-sample period, then look once.
  • Raise the bar: many researchers ask for t>3t > 3 for a new factor, because so many have been tried.
  • Count your trials honestly, including the parameter settings you tried and discarded.

Knowledge check

400 observations have a standard deviation of 2. What is the standard error of their mean?

Knowledge check

You want a confidence interval one third as wide. By what factor must the sample size grow?

Knowledge check

You test 50 strategy variants and want a 5% chance of any false discovery overall. Under Bonferroni, what p-value should each test need?

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).