Looping over deep parameter

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Looping over deep parameter

Postby Daniel Bendel » Fri Apr 17, 2015 2:39 pm

Dear users,

I know the topic has already been discussed in forum, however I do not know if anyone has posted a complete solution to that topic. The issue is the following one: one wants to solve the model for different parameter values using a for loop in matlab.

The problem is when this parameter changes the steady state of the model.

Can you check if my solution is correct?

1. run dynare model.
2. write an external steady state file for the model. use the initval command to set up the steady state starting values.
3. set the parameter values to loop over say: alphaa = linspace(0.3,0.50,50); (so 50 different values for alphaa between 0.3 and 0.5)
4. use the following code:
Code: Select all

global M_ oo_ options_

for i = 1:length(alphaa)

        set_param_value('alphaa',alphaa)
       
        [oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
        [oo_.steady_state,~] = *_steadystate(oo_.steady_state,[]); % * stands for the model's name
       y_            = simult_(oo_.steady_state,oo_.dr,oo_.exo_simul,1);%first order simulation
end


I am not sure about the usage of the global command. In my case it only works if I set the globals.

Is this procedure right?
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: Looping over deep parameter

Postby jpfeifer » Mon Apr 20, 2015 9:28 pm

This is hard to tell without seeing the full example. The best post is http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4891. A relatively correct example of this http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=6727 (efficiency could still be improved)
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 4 guests