Feed Different High-Dimensional Parameters to Dynare for SMM


I need some help with estimating my model parameters using SMM. My model has a high-dimensional parameter space (around 15-20), and I have an optimization program ready with an interface that looks like this:

Distance = smm_optimization_cal(mfile, parameters)

As long as I have an mfile that calculates the distance between theoretical moments and empirical moments for each set of parameters, the program can find the global minimum. However, I need to feed in parameters to the mfile each time.

My question is: Is there a way to call Dynare only once and then feed different high-dimensional parameters to calculate the simulated moments?

Currently, I am calling Dynare every time for each parameter, and I wonder if there is anything to improve it. I am attaching the mfile for reference.

mfile.m (793 Bytes)

I am aware that Dynare 5 has a method_of_moments command, but I’m not sure if it allows for general moments calculation like correlation or regression coefficients. Any advice or suggestions would be greatly appreciated!

Thank you in advance.

You should be able to follow the outline of

Thank you! It seems from the link that the function IRF_matching_objective calculates the distance, and function csminwel does the search in the parameter space.

And in this case, you just call dynare once by doing:

Dynare modfile


However, given the parameter space of my problem is quite large, I am not sure if I can do this. Also, my search program is kind of a commercial black box from a third party :frowning:

If possible, I want to be able to separate the mod file from the estimation file, and perhaps stop in the middle to examine the search problem. Is it possible to call dynare once and then simulate the solution for different parameters in a separate mfile?


The whole last part of the mod-file is actually Matlab code. You can move it to an m-file where you call dynare on the mod-file once.

Thank you for your reply. Based on your suggestion, it seems that I can employ ‘set_param_value’ to run simulations and compute moments for various parameter values, which all rely on the solution of a single dynare mod file run in the beginning.

Although I have tried this approach, I have observed a slight numerical discrepancy in the initial dynare mod file.

In an ideal scenario, the decision rule should be independent of parameter values if we aim to conduct estimation. Nevertheless, I have noticed that there are minor differences in the moments from the simulation when I use different initial parameter values (that is, the mod file which provide the decision rules).

Can you please advise on the potential cause of this issue? Also, would SMM conduct this way based on the initial parameter values of the mod file? Thank you!

What you describe sounds strange. Can you share the files?

You cannot set parameters used in the shocks-block this way. Rewrite your process to

uh_basic = exp(std_u*uh + mean_u );
uf_basic = exp(std_u*uf + mean_u );

var uh; stderr 1;
var uf; stderr 1;

I cannot run the file to the end, because files are missing. I get an error about simu_wealth_income.

I still get the same error message.

sorry, this one should work, would you please take a look? thanks!
simpleSMMhelpmfile.m (12.4 KB)
simpleSMM.mod (16.1 KB)

You forgot to recompute the decision rules after changing the parameter. You need a call to

    [~, info, M_, oo_] = resol(0, M_, options_, oo_);
1 Like

Yes, now they are consistent, thank you!

just trying to understand, why don’t we need this resol command in the estimation here?

Or did I miss something?

That function calls stoch_simul, which in turn calls resol to compute the decision rules.

1 Like