| 1 |
// ------------------------------------------------------------------------ |
| 2 |
//.......................... MODEL CODE ................................... |
| 3 |
// ------------------------------------------------------------------------ |
| 4 |
var q r rlag ${r^{lag}}$ rnot ${r^{not}}$ u; |
| 5 |
|
| 6 |
varexo epsu ${\varepsilon_u}$ |
| 7 |
epsr ${\varepsilon_r}$ |
| 8 |
; |
| 9 |
parameters betap ${\beta_p}$ phip ${\phi_p}$ rhop ${\rho_p}$ rhor ${\rho_r}$ rhou ${\rho_u}$ rlb $\bar u$ shock_scale_zlb sigmap ${\sigma_p}$; |
| 10 |
betap = 0.99; |
| 11 |
phip = 0.2; |
| 12 |
rhop = 0.5; |
| 13 |
rhor = 0.8; |
| 14 |
rhou = 0; |
| 15 |
rlb = -(1/betap-1); |
| 16 |
shock_scale_zlb =1; |
| 17 |
sigmap = 5; |
| 18 |
|
| 19 |
model; |
| 20 |
[name = 'Asset price'] |
| 21 |
q = betap*(1-rhop)*q(1)+rhop*q(-1)-sigmap*r+u; |
| 22 |
|
| 23 |
[name = 'Shock process u'] |
| 24 |
u = rhou*u(-1)+epsu; |
| 25 |
|
| 26 |
[name = 'Notional rate'] |
| 27 |
rnot = (1-rhor)*phip*q+rhor*rlag(-1); |
| 28 |
|
| 29 |
[name = 'Observed interest rate',relax='zlb'] |
| 30 |
r = rnot + epsr; |
| 31 |
|
| 32 |
[name = 'Observed interest rate',bind='zlb'] |
| 33 |
r = rlb + shock_scale_zlb*epsr; |
| 34 |
|
| 35 |
[name = 'Lag term TR',bind='zlb'] |
| 36 |
rlag = rnot; |
| 37 |
|
| 38 |
[name = 'Lag term TR',relax='zlb'] |
| 39 |
rlag = r; |
| 40 |
end; |
| 41 |
steady; |
| 42 |
|
| 43 |
shocks; |
| 44 |
var epsr; |
| 45 |
stderr 0.001; |
| 46 |
var epsu; |
| 47 |
stderr 0.15; |
| 48 |
end; |
| 49 |
|
| 50 |
occbin_constraints; |
| 51 |
name 'zlb'; bind rnot<=rlb; |
| 52 |
end; |
| 53 |
|
| 54 |
write_latex_dynamic_model; |
| 55 |
write_latex_original_model; |
| 56 |
write_latex_parameter_table; |
| 57 |
// ------------------------------------------------------------------------ |
| 58 |
//.......................... COMPUTATIONS ................................. |
| 59 |
// ------------------------------------------------------------------------ |
| 60 |
options_.occbin.smoother.max_number_of_iterations=20; |
| 61 |
options_.occbin.smoother.first_period_occbin_update=1; |
| 62 |
options_.occbin.likelihood.first_period_occbin_update=1; |
| 63 |
options_.occbin.likelihood.check_ahead_periods=60; |
| 64 |
options_.occbin.likelihood.max_check_ahead_periods=60; |
| 65 |
options_.occbin.simul.check_ahead_periods=60; |
| 66 |
options_.occbin.simul.max_check_ahead_periods=60; |
| 67 |
options_.occbin.smoother.check_ahead_periods=60; |
| 68 |
options_.occbin.smoother.max_check_ahead_periods=60; |
| 69 |
// Prepare data and observations |
| 70 |
// ---------------------------- |
| 71 |
varobs q r; |
| 72 |
// Priors |
| 73 |
// ----------------------------- |
| 74 |
estimated_params; |
| 75 |
phip, 0.2, 0.01, 2, NORMAL_PDF, 0.2, 0.05; |
| 76 |
rhop, 0.5, 0.01000, 0.9999, BETA_PDF, 0.5, 0.2; |
| 77 |
rhor, 0.8, 0.01000, 0.9999, BETA_PDF, 0.8, 0.1; |
| 78 |
stderr epsu, GAMMA_PDF, 0.15, 0.015, 0, inf; |
| 79 |
stderr epsr, GAMMA_PDF, 0.001, 0.0003, 0, inf; |
| 80 |
end; |
| 81 |
|
| 82 |
//occbin options |
| 83 |
options_.occbin.likelihood.max_number_of_iterations = 30; |
| 84 |
options_.occbin.simul.periodic_solution=true; |
| 85 |
options_.occbin.smoother.periodic_solution=true; |
| 86 |
options_.occbin.likelihood.periodic_solution=true; |
| 87 |
options_.occbin.filter.init_periods_using_particles=true; |
| 88 |
options_.occbin.filter.state_covariance=true; |
| 89 |
// end occbin options |
| 90 |
|
| 91 |
steady; |
| 92 |
check; |
| 93 |
// Estimation |
| 94 |
// ----------------------------- |
| 95 |
options_.TeX=true; |
| 96 |
estimation(datafile='datafile', |
| 97 |
order=1, |
| 98 |
use_univariate_filters_if_singularity_is_detected=0, |
| 99 |
mh_replic=2, |
| 100 |
load_mh_file, |
| 101 |
mode_compute=0, |
| 102 |
posterior_sampling_method='slice', |
| 103 |
posterior_sampler_options = ('save_iter_info_file', 0, |
| 104 |
'draw_init_state_from_smoother',0, |
| 105 |
'draw_init_state_with_rotated_slice',0, |
| 106 |
'fast_likelihood_evaluation_for_rejection',1), |
| 107 |
mh_nblocks=4, |
| 108 |
mh_drop=0.25, |
| 109 |
sub_draws = 300, |
| 110 |
//bayesian_irf, |
| 111 |
filter_covariance, smoothed_state_uncertainty, |
| 112 |
filtered_vars, smoother, consider_all_endogenous,forecast=8); |