Simulated method of moments using dynare

Hello,

I am running to understand about SMM DSGE_mod/Born_Pfeifer_2014 at master · JohannesPfeifer/DSGE_mod · GitHub

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.

  1. 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?

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

  3. 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?

Thanks

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

  1. 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.
  2. 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.
  3. I don’t understand the question.

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?

  1. Dynare 5 has a method_of_moments-command to do such a matching.
  2. 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.

Hi Dears,

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

Best
Sihao

No. At the current stage, the loglinear options is not supported. You need to append the logarithms of the necessary variables.

Hi Dear Pfeifer,

thanks for the confirmation. Looking forward to seeing that this option is included in near future.

Best,
Sihao

We are not currently planning on enabling this option as it would only work at order=1 and there is an easy workaround.

Get it now!

Hi Dears

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.

While I go though the sample code (which is available here: https://mutschler.eu/files/estimation/dynare-summer-school-2021/RBC_MoM.zip). I have two classification problems.

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?

@jpfeifer @wmutschl

Best,
Sihao

Hi,

  1. the data I used in the video and example files is simulated level data from the same mod file.

  2. I did not set the logdata option in the example (the option is commented out), so I am not sure what the problem is?

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).

Thanks, Willi

This is the part I feel confused.

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?

Best,
Sihao

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.

1 Like

Hi Willi,

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.

Best,
Sihao