I'm working in the implementation of a cointegration test with multiple trend breaks. I'm stuck in the critical values computation provided that the asymptotic distributions are given by brownian bridges' integrals and I have scarce kwonledge of stochastic calculus. I have found a paper ("A new set of critical values for systems cointegration tests with a prior adjustment for deterministic terms" (Trenkler 2003)) that uses random walks in order to aproximate those integrals. I understand how to aproximate a brownian motion using random walks, but when I try to reproduce the paper results I can't. The details are:
I have to aproximate: $$\int_{0}^{1} B_*\, dB_*$$ where $B_*=B_{(n-r)}(s)-sB_{(n-r)}(1)$ is an $(n-r)$-dimensional brownian bridge.
The paper says that I can use: $$T^{-1}[W_{n-r}^{T-1}-\bar{W}_{n-r}^{T}T_{-1}][(W_{n-r}^{T}-W_{n-r}^{T-1})-\bar{W}_{n-r}^{T}]'$$
where $W_{n-r}^T=(W_{n-r}^1, W_{n-r}^2,...;W_{n-r}^T)$, being $W_{n-r}^t=\sum_{i=1}^t \epsilon_i$, and each $\epsilon_i$ is $(n-r)$ dimensional normal standard. Then, each $W_{n-r}^t$ is an $(n-r)$- dimensional random walk, and $W_{n-r}^T$ is a colection of random walks that can be used to simulate an $(n-r)$ dimensional standard brownian motion. Also, $W_{n-r}^{T-1}$ are the first $T-1$ observations of $W_{n-r}^T$, $T_1$ is a row vector representing a linear trend running from $1$ to $T-1$, and $\bar{W}_{n-r}^{T}=W_{n-r}^T/T$.
When I try to implement the simulation, first I generate $T=1000$, $n-r$-dimensional standard normal $\epsilon$, then I obtain the $(n-r)\times T$ matrix $W_{n-r}^{T}$ but when I try to build $$T^{-1}[W_{n-r}^{T-1}-\bar{W}_{n-r}^{T}T_{-1}]$$ I obtain non-comformable matricial operations. I think that $W_{n-r}^{T-1}$ is $(n-r)\times (T-1)$, $\bar{W}_{n-r}^{T}$ is $(n-r)\times T$ , and $T_{-1}$ is $1\times (T-1)$.
Probably, I didn't understand how to build $\bar{W}_{n-r}^{T}$...I'm so confused!
I would greatly appreciate if someone can help me to discover what I'm doing wrong because I've invested a lot of time searching for some guideline but i only have found how to simulate integrals of brownian motions but not brownian bridges.