First you run the code by setting recalibration and estimation to 0 then change to 1 to find values for sigma_x, phipar, D_bar, and Phi.

In Born_Pfeifer_RM_Comment.mod, the values for sigma_x, phipar, D_bar, and Phi are written already which is the same as values from running smm_diff_function. What is smm_diff_function doing if we know values already in original mod file?

simulated_moments have three values while moments_emp have 8 values, should they be equal when simulating?

In simult_FGRU.m, they talk about exogenous states sigma_r, sigma_tb, eps_r, eps_tb, X. Are they playing any role to find values for sigma_x, phipar, D_bar, and Phi?

The code you are looking at is a replication file for an article.

Minimizing the smm_diff_function requires some starting values. We provided the values we found as starting values, but you should get the same with other reasonable starting values.

No, the 8 empirical moments are the ones used for the paper, but only four of them are matched. The moments at the optimum should be reasonably close to the empirical ones. There are four targets targeted with four parameters. If this were a linear equation system, you could typically find an exact solution. For practical applications, the fit will not be perfect.

Thank you for your reply and explanation.
Lines 115-119 in simult_FGRU.m were mentioning about sigma_r, sigma_tb, eps_r, eps_tb, X. I thought sigma_x, phipar, D_bar, and Phi would be used in lines 115-119 since they are the parameter values to find?

I want to match theoretical moments from dynare to empirical data. Is working with SMM the right approach to find parameters that match theoretical moments to data?

Dynare 5 has a method_of_moments-command to do such a matching.

The mentioning of the shock is necessary for the simulation of the model. It’s specific to the replication of the original paper. Usually, you can use generic Dynare codes for that.

It is great to know that Dynare 5 has the method_of_moments command. I read the dynare manual and want to figure out it is possible to include the loglinear option, like the stoch_simul and estimation block. @jpfeifer@wmutschl

Thanks again for developing a toolbox for method of moments in Dynare. I learn a lot from the tutorial in Youtube as well as the corresponding sections in Dynare manual.

First, the data used are RBC_Data_2.mat (21.8 KB) . We can see that both c, n and iv have negative values. What is the treatment behind this data? Demeaned or hp filtered? The data is already measured in the percentage?

Second, in the option of method_of_moments , the Dynare manual says that the default is not set logdata. It implies that Dynare will applies the 𝑙𝑜𝑔 transformation to the provided data? Which make no sense since both c, n and iv have negative value in the data. So I’m wondering what is the role of logdata in the method_of_moments block, and when should we choose to set logdata=1?

Dynare applies the 𝑙𝑜𝑔 transformation to the provided data if a log-linearization of the model is requested (loglinear option) unless logdata option is used. This option is necessary if the user provides data already in logs, otherwise the 𝑙𝑜𝑔 transformation will be applied twice (this may result in complex data).

First of all, in the method of moment block, no loglinear option will be available.
And, in your shared example code, you did not set the logdata option. With this specification, will the dynare applies the 𝑙𝑜𝑔 transformation to the provided data? I guess the answer is no, right? The provided data is a level data for variable c, iv and n.
And if the answer is no, under what condition will the logdata command be used, provided that no loglinear option will be available?

The logdata option in the method_of_moments command is only relevant IF you use the loglinear option.

The loglinear option needs to be provided to the model block. Then dynare internally does a log transformation on ALL variables in the model, which is sometimes useful, but mostly doesn’t work as we often have variables where it is not a good idea to do a log transform. So in general, don’t use the loglinear option (unless you have a very specific usecase and model) and rather define auxiliary variables and equations for those variables for which you want to look at the log of.

So in my example: 1) no loglinear option was used in the model block and 2) no logdata option was used in the method_of_moments block. So dynare doesn’t do any transformation for you.

Many thanks for your prompt response. It clarifies my concerns. I almost forgot that it is possible to specify a loglinear model using model(linear) in the model block.