Commit 4cf9f7d1 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

stoch_simul.m: reports second moments based on pruned state space at order=2...

stoch_simul.m: reports second moments based on pruned state space at order=2 when pruning is specified

Related to Dynare/dynare!1744
parent 84566ada
......@@ -3819,7 +3819,7 @@ Computing the stochastic solution
:mvar:`oo_.conditional_variance_decomposition_ME`). The
variance decomposition is only conducted, if theoretical
moments are requested, *i.e.* using the ``periods=0``-option.
Only available at ``order<3``. In case of ``order=2``,
Only available at ``order<3`` and without ``pruning''. In case of ``order=2``,
Dynare provides a second-order accurate
approximation to the true second moments based on the linear
terms of the second-order solution (see *Kim, Kim,
......@@ -3836,7 +3836,11 @@ Computing the stochastic solution
algorithm of *Kim, Kim, Schaumburg and Sims (2008)*, while at
third order its generalization by *Andreasen,
Fernández-Villaverde and Rubio-Ramírez (2018)* is used.
Not available above third order.
Not available above third order. When specified, theoretical moments
are based on the pruned state space, i.e. the computation of second moments
uses all terms as in *Andreasen, Fernández-Villaverde and Rubio-Ramírez (2018), page 10*
as opposed to simply providing a second-order accurate result based on the
linear solution as in *Kim, Kim, Schaumburg and Sims (2008)*.
.. option:: partial_information
......
......@@ -189,11 +189,11 @@ if ~options_.nomoments
if PI_PCL_solver
PCL_Part_info_moments(0, PCL_varobs, oo_.dr, i_var);
elseif options_.periods == 0
if options_.order <= 2
if options_.order == 1 || (options_.order == 2 && ~options_.pruning)
oo_=disp_th_moments(oo_.dr,var_list,M_,options_,oo_);
elseif options_.order == 3 && options_.pruning
elseif (ismember(options_.order,[2,3])) && options_.pruning
% There is no code for theoretical moments at 3rd order without pruning
oo_=disp_th_moments_order3(oo_.dr,M_,options_,i_var,oo_);
oo_=disp_th_moments_pruned_state_space(oo_.dr,M_,options_,i_var,oo_);
end
else
oo_=disp_moments(oo_.endo_simul,var_list,M_,options_,oo_);
......
......@@ -3,6 +3,7 @@ MODFILES = \
optimizers/fs2000_6.mod \
moments/example1_hp_test.mod \
moments/fs2000_post_moments.mod \
moments/example1_order2_pruning.mod \
lmmcp/rbcii.mod \
lmmcp/purely_backward.mod \
lmmcp/purely_forward.mod \
......
// Example 1 from Collard's guide to Dynare
// tests moments at order=2 with pruning
var y, k, a, h, b;
varexo e, u;
parameters beta, rho, alpha, delta, theta, psi, tau;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
model;
[endogenous='c',name='law of motion of capital']
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
a = 0;
b = 0;
e = 0;
u = 0;
end;
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
stoch_simul(order=2,pruning);
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment