Skip to content
All library documents

Using a Stationary Bootstrap to Test Trading Strategy Returns

Article Quant Q&A · Author: Pavlov

Summary

The document asks how to calculate a p-value for a trading rule’s return series using a stationary bootstrap, in the context of controlling data snooping with a false discovery rate procedure. It describes resampling with a geometric block-length scheme and compares the resulting bootstrap statistics with the observed statistic after centering the bootstrap results under a null hypothesis.

The example is an R function using `tsboot` with 500 replications and a block-length parameter of 10, but the author reports p-values around 0.4 or 0.5 and is unsure whether the statistic and centering are correctly specified. No resolution or empirical validation is provided. The post does not establish that the proposed calculation is valid: the statistic passed to the bootstrap, its null distribution, and the comparison used for the p-value need careful specification. The example is therefore useful as a question about inference on strategy returns, rather than as a confirmed procedure.

Key ideas

  • The author considers a stationary bootstrap for inference on trading-rule returns.
  • The question arises in an analysis intended to control data snooping through a false discovery rate approach.
  • The example uses geometric blocks and 500 bootstrap replications.
  • The proposed p-value centers resampled statistics and compares their magnitudes with the observed statistic.
  • The document provides no answer confirming that this implementation produces a valid p-value.

Tags

Full text
# Generate P Value from stationary bootstrap following Politis & Romano (1994)


# Generate P Value from stationary bootstrap following Politis & Romano (1994)












For my master thesis I am analyzing the performance of trading strategies. For this I need to avoid data snooping by utilising the FDR approach. I follow closely the procedure presented by Bajgrowicz & Scaillet (2012) in their paper Technical Trading revisited: False discoveries, persistence tests, and transaction costs. Journal of Financial Economics, Volume 106, Issue 3, December 2012, Pages 473-491 link

However I became a bit stuck. I have several different time series of returns generated with trading rules and a buy and hold portfolio. These trading rules are either on an intraday or daily basis. Now, Bajwgrowicz & Scaillet describe the following procedure (see attached picture, i hope it is fine to copy from the paper).

I now want to integrate this into R. For this i utilize the tsboot function and specified the parameters. Lets take for example one time series generated by the trading rules and name it ma.bt. However I am not sure if the formula and the parameters as I specified them are correct. the output I get from running the function is always somewhere around 0.4 or 0.5 - which does not make much sense for me as a p-value.

Hope everything is clear in my posted question. Excuse me if anything is posted wrong - it is my first time asking a question around here.

```
bootstrap.p <- function(rule, statistic = ts_function, b = 10) {
  # statistic used as per step 2: AR function
  ts_function <- function(tsb) {
    ar.fit <- ar(tsb, demean = T)
    c(ar.fit$order, mean(tsb), tsb)
  }
  # bootstrapping sample
  set.seed(1)
  ts <- tsboot(rule, statistic, R = 500, l = b, sim = "geom")

  # reshifting theta so that is meaned at 0
  ts.H0 <- ts$t - mean(ts$t)
  p.value <- (mean(abs(ts.H0) > abs(ts$t0)))

  return(p.value)
}

bootstrap.p(ma.bt)
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.