diff --git a/matlab/disp_moments.m b/matlab/disp_moments.m index 00f23da8456c510cbb7aab16f11ca02d833c2cd2..e6c9d2fa815a0a7f88788825627e26c24cb7f8db 100644 --- a/matlab/disp_moments.m +++ b/matlab/disp_moments.m @@ -189,7 +189,7 @@ elseif ~options_.hp_filter && options_.one_sided_hp_filter && ~options_.bandpass [hptrend,y] = one_sided_hp_filter(y,options_.one_sided_hp_filter); elseif ~options_.hp_filter && ~options_.one_sided_hp_filter && options_.bandpass.indicator data_temp=dseries(y,'0q1'); - data_temp=baxter_king_filter(data_temp,options_.bandpass.passband(1),options_.bandpass.passband(2),12); + data_temp=baxter_king_filter(data_temp,options_.bandpass.passband(1),options_.bandpass.passband(2),options_.bandpass.K); y=data_temp.data; elseif ~options_.hp_filter && ~options_.one_sided_hp_filter && ~options_.bandpass.indicator y = bsxfun(@minus, y, m); diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 188952cb2eb3b6a624a5160bb5f67f1c92ea8a26..ea73413ac6d711a846628f82783dc0ff64274f0c 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -169,6 +169,7 @@ options_.nofunctions = false; options_.bandpass.indicator = 0; options_.bandpass.passband = [6; 32]; +options_.bandpass.K=12; % Extended path options % diff --git a/tests/moments/example1_bp_test.mod b/tests/moments/example1_bp_test.mod index 5dfca644609dae96676e488274c0c528eea415bb..43c2c8747b390aae520492769ce5062dfeb31587 100644 --- a/tests/moments/example1_bp_test.mod +++ b/tests/moments/example1_bp_test.mod @@ -29,9 +29,9 @@ varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; -rho = 0.95; +rho = 0.5; tau = 0.025; -beta = 0.99; +beta = 0.98; delta = 0.025; psi = 0; theta = 2.95; @@ -84,7 +84,7 @@ stoch_simul(order=1,nofunctions,irf=0,periods=0); oo_filtered_one_shock_theoretical=oo_; -stoch_simul(order=1,nofunctions,periods=5000000); +stoch_simul(order=1,nofunctions,periods=1000000); oo_filtered_one_shock_simulated=oo_; @@ -92,11 +92,11 @@ if max(abs((1-diag(oo_filtered_one_shock_simulated.var)./(diag(oo_filtered_all_s error('Variance Decomposition wrong') end -if max(max(abs(oo_filtered_all_shocks_simulated.var-oo_filtered_all_shocks_theoretical.var)))>2e-4; +if max(max(abs(oo_filtered_all_shocks_simulated.var-oo_filtered_all_shocks_theoretical.var)))>5e-4; error('Covariance wrong') end -if max(max(abs(oo_filtered_one_shock_simulated.var-oo_filtered_one_shock_theoretical.var)))>1e-4; +if max(max(abs(oo_filtered_one_shock_simulated.var-oo_filtered_one_shock_theoretical.var)))>5e-4; error('Covariance wrong') end @@ -107,10 +107,10 @@ for ii=1:options_.ar autocorr_model_one_shock_theoretical(:,ii)=diag(oo_filtered_one_shock_theoretical.autocorr{ii}); end -if max(max(abs(autocorr_model_all_shocks_simulated-autocorr_model_all_shocks_theoretical)))>2e-2; +if max(max(abs(autocorr_model_all_shocks_simulated-autocorr_model_all_shocks_theoretical)))>0.05; error('Correlation wrong') end -if max(max(abs(autocorr_model_one_shock_simulated-autocorr_model_one_shock_theoretical)))>2e-2; +if max(max(abs(autocorr_model_one_shock_simulated-autocorr_model_one_shock_theoretical)))>0.05; error('Correlation wrong') end diff --git a/tests/moments/example1_hp_test.mod b/tests/moments/example1_hp_test.mod index 718db44177ed24fc9a77a72b47cd02648c3c9e8f..d2ae7a4ebff3290cd8955ad6006060673519c65c 100644 --- a/tests/moments/example1_hp_test.mod +++ b/tests/moments/example1_hp_test.mod @@ -66,16 +66,13 @@ var e, u = phi*0.009*0.009; end; steady(solve_algo=4,maxit=1000); -options_.hp_ngrid=2048*4; -options_.bandpass.indicator=0; -options_.bandpass.passband=[6 32]; -stoch_simul(order=1,nofunctions,hp_filter=1600,irf=0); +stoch_simul(order=1,nofunctions,hp_filter=1600,irf=0,hp_ngrid=8192); total_var_filtered=diag(oo_.var); oo_filtered_all_shocks=oo_; -stoch_simul(order=1,nofunctions,hp_filter=0,periods=5000000,nomoments); +stoch_simul(order=1,nofunctions,hp_filter=0,periods=2500000,nomoments); options_.nomoments=0; oo_unfiltered_all_shocks=oo_; @@ -87,8 +84,8 @@ oo_unfiltered_all_shocks=oo_; [junk, b_filtered]=sample_hp_filter(b,1600); verbatim; -total_std_all_shocks_filtered_sim=std([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]) -cov_filtered_all_shocks=cov([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]) +total_std_all_shocks_filtered_sim=std([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]); +cov_filtered_all_shocks=cov([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]); acf = zeros(6); [junk, acf(:,1)] = sample_autocovariance([y_filtered ],5); [junk, acf(:,2)] = sample_autocovariance([c_filtered ],5); @@ -110,7 +107,7 @@ stoch_simul(order=1,nofunctions,hp_filter=1600,irf=0,periods=0); total_var_filtered_one_shock=diag(oo_.var); oo_filtered_one_shock=oo_; -stoch_simul(order=1,nofunctions,hp_filter=0,periods=5000000,nomoments); +stoch_simul(order=1,nofunctions,hp_filter=0,periods=2500000,nomoments); oo_unfiltered_one_shock=oo_; [junk, y_filtered]=sample_hp_filter(y,1600); @@ -121,8 +118,8 @@ oo_unfiltered_one_shock=oo_; [junk, b_filtered]=sample_hp_filter(b,1600); verbatim; -total_std_one_shock_filtered_sim=std([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]) -cov_filtered_one_shock=cov([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]) +total_std_one_shock_filtered_sim=std([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]); +cov_filtered_one_shock=cov([y_filtered c_filtered k_filtered a_filtered h_filtered b_filtered]); acf = zeros(6); [junk, acf(:,1)] = sample_autocovariance([y_filtered ],5); [junk, acf(:,2)] = sample_autocovariance([c_filtered ],5);