Hello all,
I’m replicating Aguiar & Gopinath (2007) using Dynare’s method of moments command. Since the model has a stochastic trend but the target moments come from HP-filtered data, I’ve implemented an SMM approach by modifying the objective_function.m and get_data_moments.m files in the dynare/matlab/+mom/ folder.
My approach: After simulating the detrended model, I reconstruct non-stationary series by building up the technology level (log_Y_t = log_y_t + log_X_{t-1}), apply the one-sided HP filter, and compute the 11 moments exactly as in the data. Both model and data go through identical transformations.
The estimation runs and gives reasonable results (objective function around 0.7), but I’ve encountered a strange issue: when I change the ordering of the moments, the parameter estimates change drastically. Mathematically, the GMM criterion should be invariant to moment ordering as long as the weighting matrix is reordered consistently, which I’m doing.
I’m using two-stage GMM with identity weighting in stage 1 and the optimal HAC weighting matrix in stage 2. I’ve double-checked that both the moment vector and the weighting matrix are reordered together.
I’ve attached my mod file and the modified objective_function.m and get_data_moments.m files (only the SMM section was changed in objective_function.m). Has anyone encountered this before? Is there something about how Dynare handles moment ordering that I’m missing, or could there be an issue with my HAC variance-covariance matrix computation?
Any insights would be greatly appreciated!
objective_function.m (25.1 KB)
get_data_moments.m (7.2 KB)
mod_file.mod (5.8 KB)
Thanks!