Moments Based Estimation

In this section we document how to calculate standard errors of a GMM or MSM estimator. We use the notation and formulations provided in section 13.25 of [Han19]

Bruce E. Hansen - Econometrics, (https://www.ssc.wisc.edu/~bhansen/econometrics)

The distribution of the estimator is shaped by the moment conditions, which are functions of the estimated parameter \(\beta\) to the real numbers. We denote the vector of all moment condition values for observation \(i\) by \(\textbf{g}_i\). With this on hand the calculation of the covariance matrix can be formalized:

\[V = n^{-1}(Q^{T}WQ)^{-1} (Q^{T}W\Omega WQ) (Q^{T}WQ)^{-1}\]

where \(W\) is some weighting matrix chosen by the econometrican, \(\Omega\) the covariance matrix of the moment conditions, given by

\[\Omega = n^{-1} \sum_{i=1}^n (\mathbf{g}_i(\beta) - \mathbf{\bar{g}}) (\mathbf{g}_i(\beta) - \mathbf{\bar{g}})^T\]

where \(\mathbf{\bar{g}}\) is the mean of all \(\mathbf{g}_i(\beta)\). The auxiliary matrix \(Q\) is calculated by

\[Q = n^{-1} \sum_{i=1}^n \frac{\partial}{\partial\beta^T} \mathbf{g}_i(\beta)\]

The corresponding function to this calculations is

estimagic.inference.moment_covs.gmm_cov(mom_cond, mom_cond_jacob, weighting_matrix)[source]
Parameters
  • mom_cond (np.array) – 2d array matrix of the moment conditions of dimension (nobs, nmoms).

  • mom_cond_jacob (np.array) – 3d array of the moment condition derivatives w.r.t. the parameters of dimension (nobs, nmoms, nparams).

  • weighting_matrix (np.array) – 2d array weighting matrix for the moments of dimension (nmoms, nmoms)

Returns

2d array variance-covariance matrix of the GMM estimator of dimension (nparams, nparams)

Return type

sandwich (np.array)

After the estimation of \(\beta\), the moment condition functions have to be evaluated at \(\beta\) for each observation to get the first input of the function above. The second input can be obtained by calling for each observation the jacobian function in the differentiation module of estimagic. This function provides the partial derivatives at the estimated parameter value. The third input is the weighting matrix, which was chosen before the estimation.

Han19

Bruce E. Hansen. Econometrics. Unpublished, https://www.ssc.wisc.edu/ bhansen/econometrics/, 2019.