I met some problems while i was coding in Dynare of RBC model. My goal was trying to loop over the “different steady-state value” of a variable. Not parameters. Taking the code from Professor Jpfeifer as an example:
Here, I want to loop different value of " k_hat " instead of paramters and i have already defined that k_hat_i =[0; 0.3; 0.5;0.7] in matlab .m file, but it does not run and said that something wrong with my dynare .mod codes.
var y_hat c_hat k_hat A_hat R_hat Pi_hat;
varexo eps_A;
parameters beta delta alpha rhoA phi_pi Rbar Pibar;
alpha = 0.33; // capital share
delta = 0.025; //deprecation rate
beta = 0.99; //discount factor
Pibar = 1;
Rbar = 1/beta;
phi_pi = 1.5;
rhoA = 0.97; //TFP autocorr. from linearly detrended Solow residual
model(linear);
#k_ss=((1/beta-(1-delta))/alpha)^(1/(alpha-1));
#y_ss=k_ss^alpha;
#c_ss=y_ss-delta*k_ss;
-1/c_ss*c_hat=-1/c_ss*c_hat(+1)
+beta*1/c_ss*alpha*k_ss^(alpha-1)*(A_hat(+1)+(alpha-1)*k_hat);
-c_hat=-c_hat(+1)+R_hat-Pi_hat(+1);
y_ss*y_hat=c_ss*c_hat+k_ss*k_hat-(1-delta)*k_ss*k_hat(-1);
y_hat=A_hat+alpha*k_hat(-1);
R_hat=phi_pi*Pi_hat;
A_hat=rhoA*A_hat(-1)+eps_A;
end;
steady_state_model;
**load kCurr;**
**set_param_value('k_hat_i',curr_k_hat_i);**
**// here i try to load the vector of 0, 0.3, 0.5 and 0.7 in matlab file but not work**
y_hat=0;
c_hat=0;
R_hat=0;
Pi_hat=0;
A_hat=0;
end;
shocks;
var eps_A=0.0068^2;
end;
steady;
check;
stoch_simul(order=1,irf=20,periods=250);
rplot Pi_hat;
rplot R_hat;
figure
plot(1:options_.periods,Pi_hat,'b-','LineWidth',1.5)
hold on
plot(1:options_.periods,zeros(options_.periods,1),'r--')
ylabel('Log deviation of gross inflation $\Pi_t$ from its steady state ($\hat \Pi_t$)','Interpreter','Latex')
ylim([-0.005 0.005])
print -depsc2 SimulatedTrajectory_Pi_hat
figure
plot(1:options_.periods,R_hat,'b-','LineWidth',1.5)
hold on
plot(1:options_.periods,zeros(options_.periods,1),'r--')
ylabel('Log deviation of gross quarterly interest rate $R_t$ from its steady state ($\hat R_t$)','Interpreter','Latex')
ylim([-0.005 0.005])
print -depsc2 SimulatedTrajectory_R_hat
varobs c_hat;
estimation(datafile=simulated_data_dynare_RBC_with_SS);
Please explain what you are trying to do. After all, steady state values are a function of the deep parameters. So they cannot be exogenously chosen without taking parameter dependence into account.
Thanks for replying. I will explain things and my goal in detail.
The given model is one of your replication work (JQ 2012 details see attachement) and what i want to do is comparing the IRFs with different steady-state value of e.g financial variables, like you may see from my modification of .mod file. (I set the financial variable with different steady-state value in 0.3, 0.5…by calling set_param_‘xxx’,xx). But it does not work. Not sure where the problem is.
It seems that “load xxx” and “set_param_value (‘xxx’ xxx)” only works for looping over different value of parameters, say, e.g alpha, betta… But it does not work for looping over different SS value of a certain variable, like in my task, looping over different steady-state value, xi /n/ or Z.
Again: xi_i is neither a parameter nor a variable defined in the model. As the name of the command set_param_value says, it’s for changing parameter values.
Yes, indeed. The structural parameters defined here is beta, alpha…for sure xi is not a paramter. Actually, I research for some examples about how to loop over “steady-state value” but did not find good example about how to do it. I only find some topics about looping over parameters, so i tried. Since i am a beginner of Dynare, Professor, would you mind providing me some hints or examples about how to loop such “values like xi”?
Thank you very much in advance.
I only see many good examples for your answer about how to loop over different parameter values, but it seems nothing is mentioned about looping over, lets say, “a certain ss value”.
Many thanks for your answer.
The exercise you have in mind does not make sense. You can loop over parameters that imply different steady state values. But you cannot loop over steady state values while keeping the parameters at values that would imply a different steady state.
Thank you very much for your answers.
I was wondering in this case, if i take parameter dependence into account, is it possible for me to loop over different kappa or variance and covariance of stochastic process of xi in order to obtain the different ss value of xi ?(like the authors did in sensitivity analysis part).
Would that implies we need to adopt different approach to set the “initval” is .mod file?