How to use set_param_value

Hi guys, I met some problem when trying to loop over a parameter by command ‘set_param_value’.
I want to set the param ‘Phi_Pi_star = 1.2’, and here’s how I did:

set_param_value(‘Phi_Pi_star’,1.2);
dynare baseline noclearall;

But I found the value of Phi_Pi_star would be covered by calibrate mod file. Then I deleted the ‘Phi_Pi = x;’ from the calibrate mod file and did it again, but this time the steady state got NaN (I used a log-linearize model, and pretty sure the problem is not from the model).

I check the “Looping over Parameters”, but still have no idea what I done wrong.

I use the set_param_value function within the dynare mod file, and it works fine. I don’t think we can use that function outside the mod file as you have. Dynare would simply overwrite it: somebody please correct me if I am wrong.

Cheers
Reuben

@punnoosejacob Is correct. set_param_value will rely on a global variable that will not yet exists before calling Dynare the first time. Also you may overwrite the contents.

Thanks a lot, it helps!

I have tried another way by using ‘set_param_value’ inside the mod file, it works well!
Moreover I wondering if I can use stoch_simul in a matlab file after calling dynare once? (I have seen your comments in another discussion, but I still couldn’t figure out the routine).
And I do know Dynare can compute the SpectralDensity, if it is possible way to compute the cross-spectral density?

An example is at Parameter loop in Dynare 5.x - #3 by jpfeifer
And no, the cross-spectra are not computed by Dynare.

Thanks!
If there’s any precedents on calculating cross-spectral density or maybe some advice?
And if there’s possible way to get the coefficient matrix of the linear equation system like Sims(2002)/Klein/B&K suggest to?
I am trying to replicate the method of Sargent and Surico (2011, AER) and Kliem et al(2016,EER) by Dynare.
Great thanks for answering so many question!

As for
"
And if there’s possible way to get the coefficient matrix of the linear equation system like Sims(2002)/Klein/B&K suggest to?
"
It that the “oo_.dr.ghx”?

Which linear equation system do you mean? The state space representation?

Yes

Have a look at DSGE_mod/ABCD_test.m at master · JohannesPfeifer/DSGE_mod · GitHub

Many thanks in advance!

Is control toolbox means the control system toolbox?

problem solved, thanks a lot