Simulating critical values using standard Brownian motion

Using R, I am replicating the Table 1 results of this paper https://www.tandfonline.com/doi/abs/10.1080/03610926.2014.985841. I wrote the following r function However, my output deviates significantly. Please see the equation below. I considered sample size n = 5 and generated from rnorm(n, 0,1). Please see my r codes below. Could you please provide a hint to me? Thanks

rm(list = ls())
cvalue = function(n, alpha) {
rep = 1000  # number of repetitions
stat = NULL
for (i in 1:rep) {
e1 = rnorm(n, 0, 1) # standard Brownian motion 1
e2 = rnorm(n, 0, 1) # standard Brownian motion 2
for(j in 1:n){
t = j ;  s = j-1 # t <= s
W1 =  cumsum(e1)[1:s] # Z(s)
W2 =  cumsum(e2)[1:t] # Z(t)
W12 = exp(-t) *  exp(-s)  # find exp(-t) * exp(-s)
}
stat = c(stat, max(W12*(W1- W2))) # line above eq (19) and get sup of that
}
critical = quantile(stat, 1 - alpha) # find the (1-alpha) quantile
return(critical)
}

cvalue(5,0.05)

• I am having difficulties ascertaining how your code implements anything in the foregoing equations. Could you supply your explanations of what you think the code is doing, line by line?
– whuber
Mar 15, 2021 at 16:56
• @whuber I have added line-by-line descriptions. Mar 15, 2021 at 17:26
• Thank you. But (1) why do you use the line preceding (19) rather than (19) itself; (2) where do you obtain the double suprema; and (3) why doesn't your computation of $Z$ agree with its formula in terms of $W$?
– whuber
Mar 15, 2021 at 18:26
• @whuber, first, I used the line preceding (19) which is easier to simulate. Second question, we always have t >=s >=0. Thus, I took the suprema only once. To answer the last question, Z(t) = W(t)/e^{-t). I thought that Z(t) is the standard Wiener process. Therefore, I simply generated from the standard normal distribution. Is that correct? Mar 15, 2021 at 19:05
• @whuber, first, I used the line preceding (19) which is easier to simulate. Also, we can write in terms of Z(t). That is , sup sup e(-t)e(-s)(Z(s) - Z(t)). Mar 15, 2021 at 19:13