Merge branch 'pruned_moments' of git.dynare.org:JohannesPfeifer/dynare

time-shift
Sébastien Villemot 2020-12-17 16:47:02 +01:00
commit b8d396e388
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
5 changed files with 56 additions and 5 deletions

View File

@ -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

View File

@ -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_);

View File

@ -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 \

View File

@ -0,0 +1,46 @@
// 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);