SMM loop stuck at initial values

Dear All,

I have a related question to the previous ones. I would like to estimate my model by SMM and I looked at Johannes’s replication codes and tried to re-write it myself. Nevertheless I got a problem, which you can help me with. As I was always getting that the initial value was the local minimum, I started digging into what could cause the issue, so i just try to simulate the model changing the parameters and see what moment it gives for a specific variable (say “r”).

I do the following:
1)run mod file.
2)change param value with set_param_value(‘paraname’,paravalue);
3)[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); %run model solution in Dynare
4) simulate with simult_
5) get the the simulated moment of interest

what i get is the following: a) even using the same parameter value (beta=0.994) as in the mod. file, the moment (in my case the mean of r) i get from 5) is different to that printed by dynare, when i run the mod in 1).
b) regardless of the parameter value, the moment doesn’t change, moreover if I set the parameter equal to that in the mod.

I’m attaching the mod file and the m. file, so maybe it’s clearer and easier to spot the issue. Thank you very much in advance for your help.
simulation_changing_para.m (548 Bytes)
Basu_basic_EZ.mod (5.91 KB)

Your mod-file does not correctly handle parameter dependence. That way, beta is changed, but beta does not enter the mod-file and all parameters depending on beta are not changed. Either use model-local variables (# operator) or a steady state file