I'm looking for an R package (or a combination of packages) that would allow me to perform MCMC estimation of a GMM model, with a user-specified moments function.

I've looked at the CRAN Bayesian task-view, but I can't seem to find what I'm looking for, packages being either too general (eg. mcmc) or too specific (MCMCpack)... Ideally I would like to be able to implement Stochastic GMM or to use package R-INLA to do iterative nested Laplace approximation, again with a user-specified moments function.

Any help greatly appreciated!


I've implemented Bayesian GMM estimators in STAN before and it is pretty straight-forward. The way STAN works is that one simply defines how to calculate he log-likelihood and then a very efficient sampler (NUTS) based on Hybrid Monte Carlo is created automatically, and for the GMM likelihood one just creates the $U_i$ and $\Sigma$ by hand (which will depend on $\beta$) and increment the log-likelihood by doing something like

lp__ <- lp__ - 0.5 * U[i]' * Sigma * U[i]

(make sure to double check that this is correct though). It may even be possible to trick JAGS/BUGS into doing it with the "zeros trick" but STAN seems like a fantastic option for this (although I suppose it may also depend on the amount of data you have). I'm taking for granted that your pseudo-likelihood defines a valid posterior, of course!

EDIT: should definitely be a Sigma inverse rather than Sigma in the formula above!


In Bayesian generalized method of moment we estimate the pseudo-likelihood and then multiply the specified priors of model parameters and then use the usual MCMC procedure to estimate the model parameters.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.