currently I am trying to estimate a simple linear regression: \begin{equation} y_t = X \beta + \varepsilon_t, \end{equation} where I try to find 4 coefficients and one specific predictor is an autoregressive predictor: $y_{t-1}$. OLS will yield biased results so I am attempting to use GMM with the following moment conditions: \begin{equation} E(y_{t-2}\varepsilon_t) = 0 \\ E(y_{t-3}\varepsilon_t) = 0 \\ E(y_{t-4}\varepsilon_t) = 0 \\ E(y_{t-5}\varepsilon_t) = 0 \\ E(y_{t-6}\varepsilon_t) = 0 \\ \end{equation}
After implementing GMM in MATLAB, I get the following warning: "Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.080661e-21.". Moreover, this warning is quite correct as my estimated GMM coefficients are of the magnitude e+150...
I know that the optimal weighting matrix $W$ is the following: \begin{equation} W = S^{-1} = (E(g(x_t, \beta)g(x_t, \beta)'))^ {-1}, \end{equation} where $g$ are my moment conditions.
Why is my Weighting matrix singular? and how do I prevent it? What advice can you give me to solve the endogeneity problem for estimating my regression?