Add code to time the evaluation of the likelihood.

master
Stéphane Adjemian (Argos) 2023-10-14 16:56:14 +02:00
parent a3be87e805
commit 01b23938c2
Signed by: stepan
GPG Key ID: A6D44CB9C64CE77B
1 changed files with 20 additions and 4 deletions

24
Q3.mod
View File

@ -11,6 +11,9 @@
@#define USE_RICATTI_FIXED_POINT = false
@#endif
@#ifndef ESTIMATION
@#define ESTIMATION=true
@#endif
var
E_BGYN E_BWRY E_CLCSN E_DBGYN E_LER E_ETA E_GC E_GCL E_GCLC E_GCNLC E_GE E_GEX E_GEXL E_GG E_GGL E_GI E_GIG E_GIL E_GIM E_GIML E_GK E_GKG E_GL E_GSN E_GTAX E_GTFP E_GTFPUCAP E_GTR E_GUC E_GUCAP E_GWRY E_GY E_GYL E_GYPOT E_GYW E_INOM E_INOMW E_LL E_LL0 E_LBGYN E_LCSN E_LCLCSN E_LCNLCSN E_LEXYN E_LGSN E_LIGSN E_LIMYN E_LIK E_LIKG E_LISN E_LOL E_LPCP E_LPMP E_LPXP E_LTRYN E_LUCYN E_LUCLCYN E_LYGAP E_LYKPPI E_LYWR E_LYWY E_MRY E_PHI E_PHIC E_PHIPI E_PHIM E_PHIML E_PHIW E_PHIX E_PHIXL E_Q E_R E_TAXYN E_TBYN E_TRTAXYN E_TRW E_TRYN E_TW E_UCAP E_UCAP0 E_VL E_VLLC E_WPHI E_WRPHI E_WS E_WSW E_ZEPS_C E_ZEPS_ETA E_ZEPS_ETAM E_ZEPS_ETAX E_ZEPS_EX E_ZEPS_G E_ZEPS_IG E_ZEPS_L E_ZEPS_M E_ZEPS_PPI E_ZEPS_RPREME E_ZEPS_RPREMK E_ZEPS_TR E_ZEPS_W E_ZPHIT E_LCY E_LGY E_LWS interest inflation inflationq outputgap;
@ -750,9 +753,22 @@ end;
// Set observed variables
varobs E_LCY E_LER E_LGY E_LIGSN E_LISN E_LL E_GY E_LYWR E_INOM E_PHI E_LPMP E_LPXP E_TRW E_INOMW E_PHIW E_LYWY E_PHIPI;
// Run estimation
@#if USE_RICATTI_FIXED_POINT
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=5, mh_replic=0, plot_priors=0, lik_init=4, mode_check);
@#if ESTIMATION
// Run estimation
@#if USE_RICATTI_FIXED_POINT
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=5, mh_replic=0, plot_priors=0, lik_init=4, mode_check);
@#else
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=5, mh_replic=0, plot_priors=0, mode_check);
@#endif
@#else
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=5, mh_replic=0, plot_priors=0, mode_check);
// Evaluation of the likelihood on a point (calibration)
@#if USE_RICATTI_FIXED_POINT
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=0, mode_file=modewithoutricattifixedpoint, mh_replic=0, plot_priors=0, lik_init=4);
tic, for i=1:1000, [llik] = evaluate_likelihood('posterior mode', M_, estim_params_, oo_,options_, bayestopt_); end, toc
@#else
// Using the fixed point of the state equations is 21% longer than using the fixed point of the Ricatti equation as for the initial condition.
estimation(datafile=Q3_data, first_obs=2, presample=11, nobs=116, mode_compute=0, mode_file=modewithoutricattifixedpoint, mh_replic=0, plot_priors=0);
tic, for i=1:1000, [llik] = evaluate_likelihood('posterior mode', M_, estim_params_, oo_, options_, bayestopt_); end, toc
@#endif
@#endif