Merge remote-tracking branch community/master into enterprise

time-shift
Stéphane Adjemian (Charybdis) 2020-04-03 11:31:55 +02:00
commit 046960c4a8
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
9 changed files with 135 additions and 3 deletions

View File

@ -5448,6 +5448,8 @@ block decomposition of the model (see :opt:`block`).
Available options are:
.. _prop_distrib:
``'proposal_distribution'``
Specifies the statistical distribution used for the
@ -5546,6 +5548,11 @@ block decomposition of the model (see :opt:`block`).
``'tailored_random_block_metropolis_hastings'``
``'proposal_distribution'``
Specifies the statistical distribution used for the
proposal density. See :ref:`proposal_distribution <prop_distrib>`.
``new_block_probability = DOUBLE``
Specifies the probability of the next parameter

View File

@ -297,7 +297,7 @@ if d %diffuse periods
+ L_1'*N(:,:,t+1)*L_1; % DK (2012), eq. 5.29
end
else
r0(:,t) = Z(di,:)'*iFstar(di,di,t)*v(di,t)-Lstar(:,di,t)'*r0(:,t+1); % DK (2003), eq. (14)
r0(:,t) = Z(di,:)'*iFstar(di,di,t)*v(di,t)-Lstar(:,:,t)'*r0(:,t+1); % DK (2003), eq. (14)
r1(:,t) = T'*r1(:,t+1); % DK (2003), eq. (14)
if state_uncertainty_flag
N(:,:,t)=Z(di,:)'*iFstar(di,di,t)*Z(di,:)...

View File

@ -185,6 +185,7 @@ end
if ~isreal(oo_.endo_simul(:)) % cannot happen with bytecode or the perfect_foresight_problem DLL
ny = size(oo_.endo_simul, 1)
if M_.maximum_lag > 0
y0 = real(oo_.endo_simul(:, M_.maximum_lag));
else

View File

@ -118,7 +118,7 @@ switch posterior_sampling_method
if strcmpi(sampler_options.proposal_distribution,'rand_multivariate_normal')
n = nxopt;
elseif strcmpi(sampler_options.proposal_distribution,'rand_multivariate_student')
n = options_.student_degrees_of_freedom;
n = sampler_options.student_degrees_of_freedom;
end
proposed_par = feval(sampler_options.proposal_distribution, xopt_current_block', proposal_covariance_Cholesky_decomposition_upper, n);

@ -1 +1 @@
Subproject commit 9263a02a9b881d971325fc6c58a036ce5e84ece1
Subproject commit fb72472ee0ca34ade2f401043fedc19dc64b8621

View File

@ -258,6 +258,7 @@ MODFILES = \
kalman_filter_smoother/fs2000_smoother_only_ns.mod \
kalman_filter_smoother/test_compute_Pinf_Pstar_data.mod \
kalman_filter_smoother/test_compute_Pinf_Pstar.mod \
kalman_filter_smoother/SOE.mod \
kalman_filter_smoother/check_variable_dimensions/fs2000.mod \
kalman_filter_smoother/check_variable_dimensions/fs2000_ML.mod \
kalman/likelihood_from_dynare/fs2000_corr_ME.mod \
@ -1059,6 +1060,7 @@ EXTRA_DIST = \
kalman/lik_init/fs2000_common.inc \
kalman/lik_init/fs2000_ns_common.inc \
kalman_filter_smoother/compare_results_simulation/fsdat_simul_logged.m \
kalman_filter_smoother/SOE_data_file.m \
kalman/likelihood_from_dynare/fs2000_model.inc \
kalman/likelihood_from_dynare/fs2000_estimation_check.inc \
kalman/likelihood_from_dynare/fs2000ns_model.inc \

View File

@ -116,3 +116,7 @@ varobs gp_obs gy_obs;
estimation(order=1, datafile='../fsdat_simul',nobs=192, loglinear, mh_replic=2002, mh_nblocks=2, mh_jscale=0.8,mode_compute=4,
posterior_sampler_options=('proposal_distribution','rand_multivariate_student','student_degrees_of_freedom',5,'save_tmp_file',0));
estimation(order=1, datafile='../fsdat_simul',nobs=192, loglinear, mh_replic=30, mh_nblocks=1, mh_jscale=0.8,mode_compute=4,
posterior_sampling_method='tailored_random_block_metropolis_hastings',
posterior_sampler_options=('proposal_distribution','rand_multivariate_student','student_degrees_of_freedom',5,'save_tmp_file',0));

View File

@ -0,0 +1,112 @@
var pi_h y_hat i r_nat a y_star nu s y y_nat z z_star z_e dY_o dY_star_o dP_o I_o p_h e i_star de_o;
varexo eps_a eps_nu eps_star eps_z eps_z_star eps_z_e;
parameters alpha varphi beta theta gamma sigma eta rho_nu rho_a rho_star phi_pi phi_y sig_a sig_nu sig_star sig_z sig_z_e gY gY_star sig_z_star gP gi ge;
gY = 0.3783;
gY_star = 0.3783;
gP = 0.3845;
gi = 2.5197;
ge = 0;
beta = 0.99;
alpha = 0.53;
sigma = 0.7;
gamma = 1.6;
eta = 1.5;
varphi = 5;
theta = 3/4;
rho_nu = 0.5;
rho_a = 0.9;
rho_star = 0.5;
phi_pi = 1.5;
phi_y = 0.5/4;
sig_a = 0.0405;
sig_nu = 0.0031;
sig_star = 0.1;
sig_z = 0.0109;
sig_z_star = 0.0109;
sig_z_e = 0.0109;
model(linear);
#omega = sigma*gamma + (1-alpha)*(sigma*eta-1);
#lambda = (1-beta*theta)*(1-theta)/theta;
#sigma_alpha = sigma/(1+alpha*(omega-1));
#Theta = omega-1;
#Gamma_a = (1+varphi)/(sigma_alpha+varphi);
#Gamma_star = -alpha*Theta*sigma_alpha/(sigma_alpha+varphi);
#kappa_alpha = lambda*(sigma_alpha*varphi);
pi_h = beta*pi_h(+1) + kappa_alpha*y_hat; //NKPC
y_hat = y_hat(+1) - 1/sigma_alpha*(i-pi_h(+1)-r_nat); //DIS
r_nat = -sigma_alpha*Gamma_a*(1-rho_a)*a+alpha*Theta*sigma_alpha*varphi/(sigma_alpha+varphi)*(y_star(+1)-y_star); //Natural interest rate
a = rho_a*a(-1)+eps_a; //Technology
i = phi_pi*pi_h + phi_y*y_hat + nu; //Taylor rule
nu = rho_nu*nu(-1) + eps_nu; //Monetary shock
s = sigma_alpha*(y-y_star); //Equation 29
y_hat = y - y_nat; //Output gap
y_nat = Gamma_a*a + Gamma_star*y_star; //Natural output
y_star = rho_star*y_star(-1)+eps_star; //Foreign GDP growth
e = s + p_h; //PPP
//e-e(-1) = s - s(-1) + pi_h; //PPP Modified
pi_h = p_h - 0.9999999*p_h(-1); //Definition of inflation. If coef = 1, problem of singularity and estimation doesn't work
i = i_star + e(+1) - e; //UIP
//Observables
dY_o = gY + 100*(y - y(-1) + z) ;
z = eps_z;
dY_star_o = gY_star + 100*(y_star - y_star(-1) + z_star) ;
z_star = eps_z_star;
dP_o = gP + 100*pi_h ;
I_o = gi + 400*i ;
de_o = ge + 100*(e - e(-1) + z_e);
z_e = eps_z_e;
end;
shocks;
var eps_a=sig_a^2;
var eps_nu=sig_nu^2;
var eps_star=sig_star^2;
var eps_z = sig_z^2;
var eps_z_star = sig_z_star^2;
var eps_z_e = sig_z_e^2;
end;
steady;
varobs dY_o dY_star_o dP_o I_o de_o;
estimated_params;
gY, normal_pdf, 0.3783, 0.10 ;
gY_star, normal_pdf, 0.3783, 0.10 ;
gP, normal_pdf, 0.3845, 0.10;
gi, normal_pdf, 2.5197, 0.50;
ge, normal_pdf, 0, 0.1;
sigma, normal_pdf, 0.7, 0.1 ;
gamma, normal_pdf, 1.6, 0.3 ;
eta, normal_pdf, 1.5, 0.3;
varphi, normal_pdf, 2.05, 0.6;
theta, beta_pdf, 3/4, 0.05;
rho_nu, beta_pdf, 0.5, 0.1;
rho_a, beta_pdf, 0.7, 0.1;
rho_star, beta_pdf, 0.5, 0.1;
phi_pi, normal_pdf, 1.5, 0.1;
phi_y, normal_pdf, 0.125, 0.05;
stderr eps_a, uniform_pdf, , , 0, 0.1;
stderr eps_z, uniform_pdf, , , 0, 0.2;
stderr eps_nu, uniform_pdf, , , 0, 0.1;
stderr eps_star, uniform_pdf, , , 0, 0.1;
stderr eps_z_star, uniform_pdf, , , 0, 0.1;
stderr eps_z_e, uniform_pdf, , , 0, 0.1;
end;
options_.diffuse_filter=1;
stoch_simul(nograph);
calib_smoother(datafile=SOE_data_file,smoothed_state_uncertainty) dY_o dY_star_o dP_o I_o de_o;

View File

@ -0,0 +1,6 @@
temp=[0.804083980284887 0.640321343874284 0.125654718543444 1.05406666666667 0.0416753496342404;0.452069591352533 1.06780341353616 0.331797292329661 1.17171666666667 0.124921940043210;2.09564579562436 1.30569154871605 0.0811413623781121 2.07657333333333 -0.124921940043210;0.903569415068972 1.07554312318854 0.0934158105243554 2.25624666666667 0.457286184513411;0.567130960002160 0.928289388473402 -0.0727273782397120 3.12846666666667 -2.75430004126581;1.00858549953617 0.531158158784884 0.413538033715888 3.44140333333333 -1.26570390756272;0.776177139337975 0.808960486620869 0.157535974405576 3.48471666666667 -1.83011643824044;0.00148806435333881 0.854344265771978 0.532138185120523 3.43019000000000 1.15860952850420;0.325509946952351 0.0970245401630265 0.133974516205093 3.20579000000000 -0.326548673761906;0.0417555604375508 0.0855813865062061 0.368519744556561 3.07092000000000 -1.47174540065699;-0.221229695625347 0.178588650547873 -0.0762631510369261 2.05350000000000 -2.19248155850365;0.269987484672818 0.174133085937633 0.353499328214202 1.70946333333333 -0.0452488695503184;0.0613620124472192 0.476057317172085 0.305282804448570 1.36737666666667 -0.544589501146275;-0.0296237166521607 0.401099943173833 0.127786005612140 0.877030000000000 -0.0682826929910563;-0.362743749805539 0.101716801521690 0.245070644806944 0.722533333333333 0.181983671698593;-0.439645949107081 -0.200917269796186 0.0487159283119709 0.522753333333333 -0.0454648791646028;0.0798225091564575 0.0564410715847785 0.160584123601293 0.289016666666667 3.39773408302895;0.862501016733042 0.534754524602654 0.0744681267574876 0.266573333333333 1.82931930473253;1.18244365994133 0.718012811491775 0.128282076830022 0.253700000000000 0.602411460338109;0.763444988641027 0.581901043509348 0.0279309581315168 0.249163333333333 0.939374969160545;0.393239538919765 0.531556100363950 0.311832032598058 0.316956666666667 -1.95264223503554;0.332663024678048 0.324747248526158 0.168837994607962 0.570696666666667 -0.151794456122545;0.281605030911791 0.350773308012364 0.288963757632832 0.734716666666667 -0.152025222025842;1.10442704745264 0.199757953705237 0.187648495843806 0.748576666666667 0.973296317488581;0.919907523832286 0.636003397154106 -0.0845742397373783 0.756430000000000 -0.344976625007476;1.01695217053859 0.751904930760361 -0.109037121685240 0.756933333333333 0.645858003941197;1.03930406142876 0.611018155456478 0.153396772590675 0.928826666666667 -0.387014028530935;1.15523890909977 0.921602713873782 0.244453752663443 1.10270333333333 0.729773575757670;0.792564994904943 1.03446192498318 0.107188593363272 1.38924333333333 0.341588718140712;0.865882967534049 0.636139493603238 0.0771330016340777 1.62582666666667 0.827766585778189;1.33691221757193 1.07043894651238 0.135420027208522 1.92088000000000 1.00947229470102;0.896858295685554 0.758085927887997 -0.0751433791491785 2.20656333333333 1.47473853533706;1.21409128608363 0.623724405575921 0.356974316755032 2.42533333333333 1.85890349142213;0.937178119179905 0.456999334895158 0.262940869901751 2.77853000000000 0.0404694461209221;0.524684558289579 0.534646452901733 0.294446522384106 2.77076000000000 0.705576962057808;0.857258187670418 0.492062346988575 0.432312054661477 2.75664000000000 -3.66206410692919;0.673025944932526 -0.338974454413332 0.447117550660181 2.82209333333333 0.726671940518286;0.135265772208903 -0.546261843713936 0.446806140812761 2.77106666666667 0;-1.61571683114179 -1.76143702714651 0.333200600295758 1.95938333333333 -5.50675835538065;-1.42053058872058 -3.01389092534645 0.0760869316740909 0.503450000000000 -1.83086618512879;-0.279003747472650 -0.222865406132655 0.192418510382364 0.399330000000000 1.10694068071699;0.803392003822445 0.297797040627579 0.0904642387836496 0.338946666666667 0.373585754793765;0.264139633292793 0.514297545280407 0.177779043980397 0.259836666666667 -0.704383277748277;1.20143590076029 0.438317888073847 -0.0217359023458208 0.249293333333333 -3.02747642465923;0.843183892335375 0.980220828735412 -0.0607942251805937 0.178450000000000 -3.73463324692990;0.440726642895761 0.412284823255327 -0.188298115773744 0.156783333333333 -5.63940418732490;0.814168308860097 0.568903114354313 0.251801427344489 0.170563333333333 -0.677458368175526;0.296369045977940 0.786308022985338 0.188346264445016 0.172520000000000 -2.78256624987818;0.635594809422457 -0.00339921274417065 -0.136626583954147 0.179580000000000 -2.67592041959449;-0.125019256867809 0.0311537513555393 -0.205045348182065 0.0806066666666667 -7.19219109928313;0.675277348843650 -0.355716173030629 -0.686372408929170 0.0449766666666667 5.28634895570676;-0.151488711476766 -0.178174091263905 -0.113915690017485 0.0805866666666667 -1.80480698717028;0.276567787341087 -0.331600288104461 -0.174698687622588 0.105156666666667 -0.553404843464134];
dY_o=temp(:,1);
dY_star_o=temp(:,1);
dP_o=temp(:,1);
I_o=temp(:,1);
de_o=temp(:,1);