I am trying to implement the MDE method for GARCH given by Baillie and Chung '01 (Estimation of GARCH Models from the Autocorrelations of the Squares of a Process, Jrl. of Time Series Analysis) but I can't understand it enough to implement the algorithm.
For a squared process $X \sim GARCH(\theta)$ with size $n$, MDE criterion is
$$\arg\min_\theta \left(R C^{-1}_{NW}R'\right)\tag1$$
where R equals to $\hat\rho - \rho(\theta) $ with $\hat\rho$ as sample autocorrelations and $\rho(\theta)$ as parametric autocorrelation function for GARCH process. And the $C_{NW}$ is the Newey-West Covariance matrix:
$$C_{NW} = \gamma_0^{-2} S\tag2$$
Here
$$S=\Omega_0 + \sum_{i=1}^m \left(1- \frac{i}{1+m}\right) \left(\Omega_i+\Omega_i'\right)\tag3$$
with $$\Omega_i= \frac{\sum_{t=i+1}^n Z_t Z_{t-i}'}{n}\tag4$$
And for $D=x-\bar{x}$
$$ Z_t = \begin{bmatrix} D_t \, D_{t-1} - \rho_1(\theta)\,D_t^2\\ \vdots\\ D_t \, D_{t-k} - \rho_k(\theta)\,D_t^2 \end{bmatrix}\tag5$$
The value $m$ is the number of positive autocorrelations and for simplicity lets say $k=5$. $Z_t$ and $\rho$ are $k\times 1$ vectors, $\Omega$ and $S$ are $k\times k$ matrices.
I implemented the Eq.5 as follows
#--------------------------------------------------------
# for Eq. 5
# as a (k x k) Z matrix containing Z_1 to Z_k
z = np.zeros((k, k), np.float64)
t=0
while t<k:
i = t+1
z[t] = D[t]*D[i:k+i]-rho[:k]*D[t]**2
t = i
#----------------------------------------------------
I am not sure if this is correct way to build $Z$ (mathematically it is correct for $Z_t$, but what about $Z_{t-i}$?), and since $k$, $m$ and $n$ are not equal, I am confused about Eq. 3 and 4. So can someone help me and clearify things?