Transition Experiment in Stochastic Environment

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.

Transition Experiment in Stochastic Environment

Postby lm280299 » Thu Mar 12, 2015 10:18 pm

I study a transition experiment in Chapter 11 of Ljungqvist and Sargent's book. I found Dynare codes from the accompanying programs with "Practice Dynare". It is about a permanent increase in the government spending. But when I attempted to extend it to the stochastic environment, I found something weird to me. I attach my revised codes here:
----------------------------------------------------------------------------------------------------
var c k A;
varexo taui tauc tauk g epis;
parameters bet gam del alpha rho sigma;
bet=.95;
gam=2;
del=.2;
alpha=.33;
rho=0.95;
sigma=0.007;

model;
k=A*k(-1)^alpha+(1-del)*k(-1)-c-g;
c^(-gam)= bet*(c(+1)^(-gam))*((1+tauc(-1))/(1+tauc))*((1-taui)*(1-del)/(1-taui(-1))+
((1-tauk)/(1-taui(-1)))*alpha*A*k(-1)^(alpha-1));
log(A)=rho*log(A(-1))+epis;
end;

initval;
k=1.5;
c=0.6;
A=1;
g = 0.2;
tauc = 0;
taui = 0;
tauk = 0;
end;
steady;

shocks;
var epis;
stderr sigma;
var g;
periods 1:9 10:100;
values 0.2 0.4;
end;

stoch_simul(periods=100,drop=0);

k0=oo_.endo_simul(2,:);
c0=oo_.endo_simul(1,:);
figure
subplot(1,2,1)
plot(k0)
title('k')
subplot(1,2,2)
plot(c0)
title('c')

---------------------------------------------------------------------------------------------------
The idea is that instead of fixed productivity, I want to the transition path with uncertainty. I can generate a graph but it is quite different from the one in the deterministic environment (see Figure 6 in the handout "Practice Dynare"): first, the consumption even increases in the beginning and second, both variables have quite different levels compared to the deterministic case. So I wonder if I can really use Dynare to accomplish my objective. If so, then what is wrong with my codes?

Thanks a lot!
lm280299
 
Posts: 25
Joined: Thu Feb 06, 2014 5:58 pm

Re: Transition Experiment in Stochastic Environment

Postby jpfeifer » Sun Mar 15, 2015 5:52 pm

Your setup looks weird. You just look at one particular simulation path, but you did not control for the initial shock epis (or the other shocks subsequently happening). Either directly use the simult_ function or do several replications to integrate the shocks out (you will find the get_simul_replic function on my homepage).
------------
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: Transition Experiment in Stochastic Environment

Postby lm280299 » Mon Mar 16, 2015 11:38 pm

Excuse me, Johannes! I typed
[sim_array]=get_simul_replications(M_,options_)

But an error came:
??? Error using ==> get_simul_replications at 34
Cannot open Fig1131stoch_simul

Why is the identifier smaller than 3?
lm280299
 
Posts: 25
Joined: Thu Feb 06, 2014 5:58 pm

Re: Transition Experiment in Stochastic Environment

Postby jpfeifer » Tue Mar 17, 2015 8:48 am

Please provide the full file to replicate the issue.
------------
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: Transition Experiment in Stochastic Environment

Postby lm280299 » Thu Apr 23, 2015 8:28 am

Hi Johannes! In the end, I found that I should have typed "forecast" in the end. Now the qualitative property is the same as the graph in the book of Sargent and Ljungqvist. But I still have a question: why doesn't the simulation start from the steady state? I replicate the codes in the attachment.
Attachments
Fig1131stoch.mod
(717 Bytes) Downloaded 68 times
lm280299
 
Posts: 25
Joined: Thu Feb 06, 2014 5:58 pm

Re: Transition Experiment in Stochastic Environment

Postby jpfeifer » Sun Apr 26, 2015 8:10 am

You must be more precise. Which simulation of which command does not return the expected results in which sense?
------------
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: Transition Experiment in Stochastic Environment

Postby lm280299 » Mon Apr 27, 2015 8:14 am

I'm replicating Figure 6 in this file, but in the stochastic environment. I guess I should use Command "forecast". The qualitative property is exactly the same, yet the simulation doesn't start from the original steady state, which puzzles me. Thank you!
Attachments
AP_tom16.pdf
(478.51 KiB) Downloaded 51 times
lm280299
 
Posts: 25
Joined: Thu Feb 06, 2014 5:58 pm

Re: Transition Experiment in Stochastic Environment

Postby jpfeifer » Fri May 01, 2015 5:49 pm

You really need to think more about what you are trying to do. It seems you are confusing the different meaning of initval, endval, and histval in stochastic contexts. See the manual for details. In addition, you need to think about around which steady state you want to approximate your model.

Regarding your initial question: the forecast command shows response in the first period. You start at the initial steady state, but it is not shown. That initial steady state is the one you entered with your endval command!
------------
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 8 guests