How to use MC simulation to calculate Supremum ADF test critical values 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!

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:(n*s)])
  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[n*r-1]
  denominator <- sapply(1:length(r), function(s) sqrt((1/n*sum(W_mu.r[[s]])^2)))
  DFstats <- 1/sqrt(n*r)*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))

