Free lesson · Research & robust tuning
Dependent returns, block bootstrap and realistic stress tests
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Many trading returns arrive in clusters. Treating every bar or overlapping trade as independent can exaggerate the amount of evidence. Uncertainty should preserve the dependence relevant to the strategy.
Symbols, units & horizon
- n: number of returns
- ρ: AR(1) autocorrelation assumed for this large-sample approximation
- n_eff: equivalent sample size for the mean
- s: standard deviation of individual returns
- r̄: sample mean
- SE: approximate standard error
- |ρ|<1: stationarity requirement
- This approximation: not a general estimator for arbitrary dependence
When and why to use this
Use dependence-aware uncertainty when judging whether an average net return is distinguishable from noise or comparing nearby model variants.
Use daily portfolio returns rather than overlapping trade-level returns when assessing the portfolio. Inspect autocorrelation and cluster dependence before choosing standard errors. Heteroskedasticity/autocorrelation-consistent estimates and block bootstrap methods address different aspects of dependence under assumptions.
A block bootstrap resamples contiguous blocks, retaining short-range serial patterns. Block length is a modelling choice; compare plausible lengths without selecting the one that makes significance strongest. Bootstrap uncertainty remains conditional on the historical regimes represented.
Stress assumptions directly: widen spreads, worsen fills, delay signals, remove the best asset, exclude the best year, perturb costs and change volatility regimes. Scenario analysis addresses risks absent from the historical sample, while resampling measures variation within it. Keep those interpretations separate.
Dependent returns, block bootstrap and realistic stress tests
- For stationary returns, mean variance contains the individual variance plus twice the autocovariance sum.
- Under AR(1), autocorrelations are ρ^k; the infinite sum is ρ/(1−ρ). The variance inflation factor becomes (1+ρ)/(1−ρ).
- Equate s²/n_eff with s²/n times that factor and solve for n_eff. Take its square root in the standard-error formula.
With n=252, ρ=.5 and daily SD=.01, n_eff≈84 and SE≈.001091, versus the iid value .000630. Under this illustrative dependence model, the standard error is √3 times the iid estimate.
Apply it in a strategy
- Build a consistent daily net portfolio series and inspect dependence and exceptional observations.
- Compare justified HAC or block-bootstrap uncertainty across prespecified sensitivity settings.
- Run separate execution and regime stresses, reporting economic failure conditions rather than a single confidence number.
Research deliverable
Report mean-return uncertainty, block-length sensitivity and a table of cost, delay, asset and regime stresses.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
from math import sqrt
from random import Random
def ar1_mean_se(n,sd,rho):
if n<=0 or sd<0 or not -1<rho<1: raise ValueError("Invalid AR(1) inputs")
effective=n*(1-rho)/(1+rho)
return effective,sd/sqrt(effective)
def moving_block_sample(values,block,seed=7):
if not 1<=block<=len(values): raise ValueError("Invalid block length")
rng=Random(seed); out=[]
while len(out)<len(values):
start=rng.randrange(len(values)-block+1)
out.extend(values[start:start+block])
return out[:len(values)]
print(ar1_mean_se(252,.01,.5))Continue learning
Strategy Research, Backtesting & Robust Optimisation — all lessons- Write the experiment before the strategy
- Walk-forward validation, overlapping labels and purging
- Hyperparameter optimisation without an unrestricted search
- Multiple trials, false discoveries and selection diagnostics
- Dependent returns, block bootstrap and realistic stress tests
- Fine-tuning, retraining and the research-to-production decision
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations