Steady State Calculations for Large Scale Models

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.

Steady State Calculations for Large Scale Models

Postby ssingleton » Thu Aug 04, 2016 7:07 pm

I have a question related to a number of previous posts, i.e. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=8373.

I just started a new job and inherited code from another colleague. I am responsible for adding and subtracting variables from the code. And, it seems that the code ("workhorsemodel") fails to run due to workhorsemodel_steadystate.m. I have adapted the code to a neoclassical growth model ("ncgm1") with fixed labor (as in Eric Sims' notes), for which I get a string of errors when running, including:

Code: Select all
Error using print_info (line 72)
The steadystate file did not compute the steady state

Error in resid (line 112)
    print_info(info,options_.noprint, options_)

Error in steady (line 90)
        resid;

Error in ncgm1 (line 122)
steady;

Error in dynare (line 180)
evalin('base',fname) ;

Error in run_ncgm1 (line 17)
dynare ncgm1 noclearall nolog


I think the problem may be found in these five lines, but I am not sure why:
Code: Select all
for ii = 1:NumberOfEndogenousVariables
    varname = deblank(M_.endo_names(ii,:));
    eval(['ys(' int2str(ii) ') = ' varname ';']);
end
ysold = ys;


Please tell me if you have any suggestions for why this code is not running and what I can do to remedy this problem. Also, any suggestions on easily modify, altering, adding to or subtracting from inherited code would be much (much!) appreciated.

Cheers!
Attachments
run_ncgm1.m
this file runs the code and sets the parameters
(244 Bytes) Downloaded 72 times
ncgm1_steadystate.m
steady state file (problem file?)
(1.46 KiB) Downloaded 77 times
ncgm1.mod
mod file
(3.28 KiB) Downloaded 96 times
ssingleton
 
Posts: 2
Joined: Thu Aug 04, 2016 6:36 pm

Re: Steady State Calculations for Large Scale Models

Postby jpfeifer » Fri Aug 05, 2016 7:18 am

A clean steady state file would be
Code: Select all
function [ys,check] = ncgm1_steadystate(ys,exe);

global M_ options_ oo_

NumberOfParameters = M_.param_nbr;

for ii = 1:NumberOfParameters
    paramname = deblank(M_.param_names(ii,:));
    eval([ paramname ' = M_.params(' int2str(ii) ');']);
end

k = (alphaa/(1/betta - (1 - delta)))^(1/(1 - alphaa));
y = k^(alphaa);
Inv = delta*k;
c = y - Inv;
a = 1;
w = (1-alphaa)*k^(alphaa);
R = alphaa*k^(alphaa-1);
r = (1/betta) - 1;

y=log(y);
Inv=log(Inv);
k=log(k);
a= log(a);
c= log(c);
w= log(w);
R= log(R);

check = 0;

%%-------------------------------------------------------------------------
%
NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
    paramname = deblank(M_.param_names(ii,:));
    eval(['M_.params(' int2str(ii) ')=' paramname ';']);
end
check = 0;

NumberOfEndogenousVariables = M_.endo_nbr;
ys = zeros(NumberOfEndogenousVariables,1);

for ii = 1:NumberOfEndogenousVariables
    varname = deblank(M_.endo_names(ii,:));
    eval(['ys(' int2str(ii) ') = ' varname ';']);
end
ysold = ys;

Your problem is that you did an exp()-substitution, i.e. your variables are the log-levels, but your steady state file computed the levels. Therefore, you need to log them first.
------------
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

Re: Steady State Calculations for Large Scale Models

Postby ssingleton » Fri Aug 05, 2016 1:31 pm

Thank you very much!
ssingleton
 
Posts: 2
Joined: Thu Aug 04, 2016 6:36 pm


Return to Dynare help

Who is online

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