Page 1 of 1

Deterministic Simulation - Steady State function

PostPosted: Mon Nov 10, 2014 3:31 am
by Jeff
Dear All,

I need your help. I need to compute the perfect-foresight transition path (deterministic simulation) between an initial steady state and a final one.
I was wondering whether it is possible to use the steady state function to load into dynare both steady states. I know I could use the initval and endval command right after the model block, but my model is complicated that I want to avoid doing that.

Here is the sketch (in a much simpler model) of the steady state function that I currently use to load the initial steady state.

function [ys,check1] = rbc_steadystate(junk,ys);

global M_
%LOAD PARAMETERS AND INITIAL STEADY STATE VALUES
load PARAM.mat
load SSrbc_INIT.mat

M_.params = [ BETA ; DELTA; GAMMA; NU;
PSI; RHOZ; SIGMAU ;];

check1 = 0 ;

xxx = [Crbc; Irbc; lambdarbc; Nrbc; Krbc; Yrbc; Wrbc;1];

ys = xxx;


Thanks in advance, any help is appreciated.

Re: Deterministic Simulation - Steady State function

PostPosted: Tue Nov 11, 2014 9:10 pm
by jpfeifer
Unfortunately, this is not easily possible. Your best option is to trick Dynare. If I see it correctly, Dynare 4.4.3 will write the initval contents to
Code: Select all
ys0_= oo_.steady_state;
ex0_ = oo_.exo_steady_state;

and the endval-contents to oo_.steady_state.
Try defining almost empty initval and endval-block and then use the verbatim-block to call the steady state file and then assign the steady states to ys0_ and oo_.steady_state.
If it works or not, please provide feedback.

Re: Deterministic Simulation - Steady State function

PostPosted: Wed Nov 12, 2014 1:49 am
by Jeff
Hi jpfeifer,

First of all let me thank you for your reply and help.

Your proposed solution works. Following your advice I load initial and final values with the following syntax.

Following the model block,

initval;
c = 1;
end;

verbatim; %Note that ysINIT is a vector that contains the initial steady state values
oo_.steady_state = ysINIT;
end;

endval;
c = 1;
end;

verbatim;%Note that ysFIN is a vector that contains the final steady state values
oo_.steady_state = ysFIN;
end;

the standard syntax for the deterministic simulation follows.


Thanks a lot for your help,

Re: Deterministic Simulation - Steady State function

PostPosted: Wed Nov 12, 2014 6:12 am
by jpfeifer
I am confused by your solution. Shouldn't the first part be
Code: Select all
verbatim; %Note that ysINIT is a vector that contains the initial steady state values
ys0_ = ysINIT;
end;

Re: Deterministic Simulation - Steady State function

PostPosted: Wed Nov 12, 2014 8:16 pm
by Jeff
Unless I include oo_.steady_state = ysINIT; in the first block the code does not converge properly.

I verified that all equations at each point in time hold, so it seems that what dynare finds is the correct deterministic simulation from one steady state to the other.

Re: Deterministic Simulation - Steady State function

PostPosted: Wed Nov 12, 2014 8:26 pm
by jpfeifer
I was only worried that your simulation starts from the wrong point. But if you say it worked as expected that is fine with me.

Re: Deterministic Simulation - Steady State function

PostPosted: Tue Nov 18, 2014 4:11 pm
by Jeff
Hi jpfeifer,

would it be possible to use the same "trick" you suggested before when the deterministic simulation is performed under histval?
I was trying to find where dynare stores the initial states from where to start the simulation, but with no success.

Could you please tell me where to look to find what is the name of the vector of the states I need to fill to perform the simulation with histval.

Thanks in advance for your time.

Re: Deterministic Simulation - Steady State function

PostPosted: Sat Nov 22, 2014 8:58 am
by jpfeifer
In Dynare 4.4.3, you need to set M_.endo_histval