1

I am replicating some techniques from Advances in Financial Machine Learning by Marcos López de Prado. In Chap 17, I am doing the Supremum ADF test and Quantile ADF test. It seems that they do not follow a standard ADF t-distribution. I wonder how to use Monte Carlo simulation to calculate the right tale critical values.

Text or code solutions would be much appreciated!

  • Would putting a max over the ADF distribution as described here https://stats.stackexchange.com/questions/213551/how-is-the-augmented-dickey-fuller-test-adf-table-of-critical-values-calculate?rq=1 help? – Christoph Hanck Aug 22 '22 at 09:06
  • Maybe you can post some details regarding the functional to be simulated? – Christoph Hanck Aug 22 '22 at 13:31
  • @ChristophHanck Thank you! I actually referenced your answer for my code. BTW, for those who may encounter the same problem, I found the following R code: https://github.com/cran/MultipleBubbles/blob/master/R/SADF.R – dragondragon Aug 22 '22 at 15:47

1 Answers1

0

Here is some code that more closely mirrors the asymptotic functional in Phillips et al. (IER 2011). I'll confess that I quickly reverse-engineered some of the powers of $n$ to make the critical values match those in the paper, so this code should be used with care and surely deserves some more thinking on my part.

n <- 5000
reps <- 10000

r.0 <- 0.1 r <- seq(0.005, 1, 0.005)

sup.DF.distr <- function(n, r, r.0){ u <- rnorm(n) W <- 1/sqrt(n)cumsum(u) W.r <- sapply(r, function(s) W[1:(ns)]) W_mu.r <- lapply(1:length(r), function(s) W.r[[s]] - 1/(sqrt(n)r[s])sum(W.r[[length(r)]])) numerator.sum.process <- cumsum(head(W_mu.r[[length(r)]], -1)u[2:n]) numerator.r <- numerator.sum.process[nr-1] denominator <- sapply(1:length(r), function(s) sqrt((1/nsum(W_mu.r[[s]])^2))) DFstats <- 1/sqrt(nr)numerator.r/denominator sup.DFstats.r0 <- sqrt(n)max(DFstats[(r.0*length(r)):length(r)]) }

quantile(replicate(reps, sup.DF.distr(n, r, r.0)), probs=c(.9, .95, .96, .99))