Debian Codegraph @

tests/estimation/slice/bf.mod

raw
1 // test slice sampler with conditional likelihood initial state estimation of OccBin
2 var q r rlag rnot u;
3
4 varexo epsu
5 epsr
6 ;
7 parameters betap phip rhop rhor rhou rlb shock_scale_zlb sigmap;
8 betap = 0.99;
9 phip = 0.2;
10 qinit = 0;
11 rinit = 0;
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 model;
19 [name = 'Asset price']
20 q = betap*(1-rhop)*q(1)+rhop*q(-1)-sigmap*r+u;
21
22 [name = 'Shock process u']
23 u = rhou*u(-1)+epsu;
24
25 [name = 'Notional rate']
26 rnot = (1-rhor)*phip*q+rhor*rlag(-1);
27
28 [name = 'Observed interest rate',relax='zlb']
29 r = rnot + epsr;
30
31 [name = 'Observed interest rate',bind='zlb']
32 r = rlb + shock_scale_zlb*epsr;
33
34 [name = 'Lag term TR',bind='zlb']
35 rlag = rnot;
36
37 [name = 'Lag term TR',relax='zlb']
38 rlag = r;
39 end;
40 steady;
41
42 shocks;
43 var epsr;
44 stderr 0.001;
45 var epsu;
46 stderr 0.15;
47 end;
48
49 occbin_constraints;
50 name 'zlb'; bind rnot<=rlb;
51 end;
52 // ------------------------------------------------------------------------
53 //.......................... COMPUTATIONS .................................
54 // ------------------------------------------------------------------------
55 // Prepare data and observations
56 // ----------------------------
57 varobs q r;
58 // Priors
59 // -----------------------------
60 estimated_params;
61 phip, 0.2, 0.01, 2, NORMAL_PDF, 0.2, 0.05;
62 rhop, 0.5, 0.01000, 0.9999, BETA_PDF, 0.5, 0.2;
63 rhor, 0.8, 0.01000, 0.9999, BETA_PDF, 0.8, 0.1;
64 stderr epsu, GAMMA_PDF, 0.15, 0.015, 0, inf;
65 stderr epsr, GAMMA_PDF, 0.001, 0.0003, 0, inf;
66 end;
67
68 //occbin options
69 options_.occbin.likelihood.max_number_of_iterations = 30;
70 options_.occbin.simul.periodic_solution=true;
71 options_.occbin.smoother.periodic_solution=true;
72 options_.occbin.likelihood.periodic_solution=true;
73 // end occbin options
74
75 steady;
76 check;
77 // Estimation
78 // -----------------------------
79
80 if ~isoctave % test takes too much time under Octave,
81 estimation(estimate_initial_states_endogenous_prior,
82 datafile='datafile',
83 order=1,
84 use_univariate_filters_if_singularity_is_detected=0,
85 mh_replic=20,
86 mode_compute=0,
87 posterior_sampling_method='slice',
88 posterior_sampler_options = ('save_iter_info_file', 0,
89 'draw_init_state_from_smoother',1,
90 'draw_init_state_with_rotated_slice',0,
91 'fast_likelihood_evaluation_for_rejection',1),
92 mh_nblocks=1,
93 mh_drop=0.5,
94 sub_draws = 10,
95 //bayesian_irf,
96 filter_covariance, smoothed_state_uncertainty,
97 filtered_vars, smoother,consider_all_endogenous);
98
99 end
100