From dd5cb335fb6d881ed5b06a16119827484a10dee5 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Sat, 21 Apr 2012 21:41:07 +0200 Subject: [PATCH] changes to stochastic perfect foresight simulation (still doesn't work correctly with ZLB) --- matlab/solve_stochastic_perfect_foresight_model.m | 2 ++ tests/ep/rbc.mod | 13 ++++++++++--- tests/ep/rbcii.mod | 5 +++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/matlab/solve_stochastic_perfect_foresight_model.m b/matlab/solve_stochastic_perfect_foresight_model.m index f3c55a22e..d2ce4e59a 100644 --- a/matlab/solve_stochastic_perfect_foresight_model.m +++ b/matlab/solve_stochastic_perfect_foresight_model.m @@ -193,6 +193,8 @@ function [flag,endo_simul,err] = solve_stochastic_perfect_foresight_model(endo_s end flag = 0;% Convergency obtained. endo_simul = reshape(Y(:,1),ny,periods+2);%Y(ny+(1:ny),1); + figure;plot(Y(16:ny:(periods+2)*ny,:)) + pause break end dy = -A\res; diff --git a/tests/ep/rbc.mod b/tests/ep/rbc.mod index 180d81f22..35edc823e 100644 --- a/tests/ep/rbc.mod +++ b/tests/ep/rbc.mod @@ -53,8 +53,15 @@ end; steady; options_.ep.verbosity = 0; -options_.ep.order = 1; -options_.ep.nnodes = 2; +options_.ep.stochastic.nodes = 2; options_.console_mode = 0; -ts = extended_path([],100); \ No newline at end of file +options_.ep.stochastic.order = 0; +ts0 = extended_path([],100); + +options_.ep.stochastic.order = 1; +ts1 = extended_path([],100); + +options_.ep.stochastic.order = 2; +ts2 = extended_path([],100); + diff --git a/tests/ep/rbcii.mod b/tests/ep/rbcii.mod index 49a0cce53..2d4046c6a 100644 --- a/tests/ep/rbcii.mod +++ b/tests/ep/rbcii.mod @@ -68,11 +68,12 @@ end; options_.maxit_ = 100; options_.ep.verbosity = 0; options_.ep.stochastic.order = 0; + options_.ep.stochastic.nodes = 2; options_.console_mode = 0; - ts = extended_path([],1000); + ts = extended_path([],100); options_.ep.stochastic.order = 1; - sts = extended_path([],1000); + sts = extended_path([],100); figure(1) plot(ts(2,:)-ts(4,:));