General question:
In a generalized method of moments estimation could the covariance matrix of the moment conditions be ill-conditioned and therefore the inverse not computable?
Background on my model:
I am estimating a random coefficient logit model of demand formulated as a mathematical programm with equilibrium constraints (MPEC) (see Random Coefficients Logit using the MPEC algorithm. There the structural parameters of consumer demand are estimated using simulated GMM. Essentially, I build a model that predicts market shares for products based on the mean valuations of product characteristics (e.g. price, color, size, ...) and the individual deviations from this mean valuation. I then try to find the parameter values that minimize some metric between observed and predicted market shares. Because price is endogenous the metric is not simply the sum of least squares but rather the metric is defined by the instrumental variables and the GMM objective function.
This problem cannot be solved analytically so numerical methods are used. So finding the global minimum requires me to repeatedly solve this problem using different starting values of the parameters I want to estimate. For some values of the starting value I cannot compute the inverse of covariance matrix of moment conditions (efficient estimate of the weighting matrix for two-step GMM). For other starting values this problem does not arise.
Details on my issue:
In my specification for product demand has many indicator variables (300+). Many of these indicators are interactions between indicator variables and are therefore often zero. The matrix of independent variable X (dimension N x K with N observations and K independent variables) also contains "normal" continuous variables but only 5. Therefore the matrix of included and excluded instruments Z (N x L where L is number of instruments) also contains the same amount of zero-one indicator variables.
Now when I try to calculate the covariance-matrix of the moment conditions (to get an efficient estimate of optimal weighting matrix $\hat{W}$) i.e.
$\frac{1}{n} Z'\hat\Omega Z$ with $\hat\Omega = blkdiag(\hat{u}^2_1 ... \hat{u}^2_n )$ and $\hat{u}$ the residuals from the first stage GMM estimate
Matlab will tell me that this matrix is nearly singular and therefore the inverse might be imprecisely calculated.
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND = 3.415469e-18.
Now note, that Matlab does not tell me hat this matrix is singular. Therefore, the problem is not that I have perfect multicollinaerity due to complete indicators (dummy variable trap).
Is this to be expected with an instrument matrix that includes many indicator variables that are mostly zero for an observation? Therefore is this some kind of numerical problem? Or what else could be the problem?
Z'*Z
(i.e.rank(Z'*Z))
? What is the smallest singular value inS
if you do[U, S, V] = svd(Z'*Z)
? $\endgroup$ – Matthew Gunn May 31 '16 at 21:48sum(abs(u) < e-13)
? If the coefficients on one or more of your indicator variables are exactly identified, you won't be able to make heteroskedastic robust estimate of your initial estimator and hence can't form the weighting matrix. See my answer... $\endgroup$ – Matthew Gunn Jun 1 '16 at 20:20