I'm trying to estimate a nonlinear GMM model with a large parameter space and a large data set. The numerical computation takes a extremely long time and I have been using small subsamples (which also take a long time) to calibrate the model. I'm getting to a point of including a large number of dummies, many of which are removed to reduce multicollinearity, yet I'm starting to get numerically singular matrix error
Error in solve.default(w, gbar) : system is computationally singular: reciprocal condition number = 1.20741e-27
solve.default(w, gbar) inputs suggest that the error is occurring during the computation of the covariance matrix. With a small subsample, the model could be overfitted, but the error persists even if I raise the number of observations a few hundreds above the number of parameters. The
gmm function is set up as below:
res<-gmm(g,x,init,type="twoStep", wmatrix="optimal", optfct="nlminb", prewhite = 0, lower = lb, upper = ub, control = list(eval.max = 1000, iter.max = 1000, abs.tol = tols, rel.tol = tols), tol=tols)
where various tolerances are set to
tols=1e-15, and I don't think any smaller number would help in this situation.
I understand that most of the CPU time is spent on numerically approximating the gradient matrix and the computing time can be drastically reduced, with accuracy increased, if $\nabla G/\nabla \Theta_0$ is provided. Unfortunately, the partials of the moment conditions are not analytically tractable. As a result, running the full dataset every time really is not a feasible strategy given the computational complexity of the model.
I'm wondering if there's a way to configure
gmm such that it returns the some estimation results even if it cannot calculate the covariance matrix. Perhaps using
nlminb can give me at least the parameters, but more would be better.
Thanks in advance.