Plotting Policy Functions

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.

Plotting Policy Functions

Postby nbt » Sun Oct 13, 2013 12:46 pm

Hi,

Im working on the following simple optimal growth model:
Image
with the first-order conditions:
Image
The Dynare code is:
Code: Select all
%
%%%PREAMBLE%%%
%
var y invest k c z;                       
predetermined_variables k;                 
varexo eps;                                     
parameters cbeta calpha crho ceta;             

cbeta = .99;                                     
calpha = .33;
crho = 0.9;
csigma = 0.035;
%
%%%MODELBLOCK%%%
%
model;                                         
1/c = cbeta * 1/c(+1) * calpha * exp(z(+1)) * k(+1)^(calpha-1); 
k(+1) = exp(z) * k^calpha - c;
z = crho*z(-1) + eps;
y = exp(z) * k^calpha;
invest = y - c;
end;
%
%%%INITIAL VALUE BLOCK%%%
%
initval;                                     
k = 0.2;
c = 0.4;
z = 0;
end;
steady;                                   
%
%%%SHOCKS%%%
%
shocks;                                       
var eps = csigma^2;                                       
end;

stoch_simul(periods = 2000,order=2, irf=40);

state_range=0:0.1:10;
state_name='k';
plot_var_name='c';
plot_policy_fun(state_name,state_range,plot_var_name);

For plotting the policy function I used the m-file by jpfeifer » Sat Mar 16, 2013 (attached)
My goal is to show the differences that occur between the policy functions using first and second order approximation due to certainty equivalence.
Yet I got really strange results. For the 2nd order approximation my policy function looks like
Image
and for my 1st order approx the policy function looks like
Image

Im very thankful for any help!
Best regards,
nbt
Attachments
plot_policy_fun.m
(3.39 KiB) Downloaded 87 times
nbt
 
Posts: 7
Joined: Sun Oct 13, 2013 12:12 pm

Re: Plotting Policy Functions

Postby jpfeifer » Mon Oct 14, 2013 9:48 am

Look at
STEADY-STATE RESULTS:

y 0.576369
invest 0.1883
k 0.1883
c 0.388069
z 0

You are plotting the policy function in an area where the approximation is poor, e.g. 100 times the steady state value of capital.
for first order, the policy function is linear and upward sloping. For second order, around the steady state, it is still upward sloping, but also concave. For k -> Infinity, the concavity starts to dominate.
------------
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: Plotting Policy Functions

Postby nbt » Mon Oct 14, 2013 2:02 pm

Hi,
thanks very much, worked out well now!
nbt
 
Posts: 7
Joined: Sun Oct 13, 2013 12:12 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests