Commit Graph

152 Commits (6adf1c26392d737dc31844aa3add0441e040f4a8)

Author SHA1 Message Date
Johannes Pfeifer 582bcb7a8e Add missing Ramsey error code to dsge_likelihood.m 2016-08-24 13:32:11 +02:00
Johannes Pfeifer 75e52ed71d Make sure fast_kalman_filter is only used with diffuse_periods=0
Closes #1234
2016-08-22 19:24:35 +02:00
Johannes Pfeifer 178bf4165c Make sure Zflag for augmented state space is correctly set when measurement error is correlated 2016-08-22 19:24:35 +02:00
Johannes Pfeifer 7c96e22985 Fix bug in dsge_likelihood.m where diagonal of measurement error covariance matrix was not correctly read out
This is a prerequisite for the univariate filter that operates along a vector for H instead of along the diagonal. Because of this, the likelihood in the presence of measurement error was wrong
2016-08-22 19:24:35 +02:00
Johannes Pfeifer bffea9b426 Fix error code for inf-likelihood 2016-08-22 19:24:35 +02:00
Johannes Pfeifer 15f95cec4a Add comments to Kalman filtering routines 2016-08-22 19:24:35 +02:00
Johannes Pfeifer 39e7c39243 Filter out infinite likelihoods 2016-08-22 19:24:35 +02:00
Johannes Pfeifer 72b8c650e5 Add missing logical operator from likelihood functions introduces when removing global penalty 2016-07-18 11:11:43 +02:00
Johannes Pfeifer 0c00e28799 Remove objective_function_penalty_base 2016-06-15 00:30:28 +02:00
Johannes Pfeifer 329b91d717 Harmonize output of objective functions
Closes #1149
Mirrors 1ad8df4635
2016-06-15 00:30:28 +02:00
Marco Ratto d8fea3ff13 Correlations and measurement errors in identification:
1) Filter out measurement errors with error message that suggests to explicitly write measurement errors in model definition
2) allow identification checks with correlations, by switching to numerical derivatives
2016-05-22 23:10:01 +02:00
Houtan Bastani 25121bca4f fix copyright dates 2016-05-04 16:05:31 +02:00
Stéphane Adjemian (Lupi) fd850ca5bd Merge branch 'master' into lik_init_5_fixes
Conflicts:
	doc/dynare.texi
	tests/Makefile.am
2016-03-24 17:40:27 +01:00
Johannes Pfeifer 1c816aef24 Various interrelated bugfixes dealing with detrending 2016-03-23 10:19:40 +01:00
Johannes Pfeifer f28a7a62bb Only test non-zero measurement error covariance entries for positive definiteness
Otherwise, not having measurement error on one variable is not allowed during estimation
2015-12-15 22:37:08 +01:00
Michel Juillard c373d1e1be adding new option 'fast_kalman_filter' implementing Ed Herbst 2012 approach 2015-11-28 17:38:00 +01:00
Stéphane Adjemian (Charybdis) 5bccacaaa5 Fixed lik_init=5.
Missing initialization for the vector of state variables (a) and Zflag.
2015-11-04 22:33:15 +01:00
Stéphane Adjemian (Charybdis) fe0f19dc37 Fixed bug. Wrong size of the state vector...
When dsge_likelihood enters (because of of a detected singularity) in
univariate_kalman_filter routine with  correlated measurement errors.
2015-10-22 16:10:34 +02:00
Johannes Pfeifer a7ed27b889 Document lik_init=5 and add unit test for lik_init 2015-10-18 18:55:33 +02:00
Marco Ratto 0aa7e15d58 - Once Schur stape space transformation is done, map immediately Pinf and Pstar onto the original variablesm to avoid propagation of errors related to multiple unit and zero eigenvalues.
- ensure that smoother and filter get the same Pstar and Pinf in diffuse steps
2015-10-13 17:26:39 +02:00
Johannes Pfeifer d513d38f73 Filter out failure of k_order_pert in likelihood computation 2015-10-11 17:55:27 +02:00
Michel Juillard f7f158f078 Revert "removed global objective_function_penalty_base"
This reverts commit 5ade8d7c6f.
2015-10-09 14:23:32 +02:00
Michel Juillard 784b8d893c Revert "reducing penalty value to 0.1 when there is no ground to make it proportional"
This reverts commit a6f123fd50.
2015-10-09 14:23:32 +02:00
Michel Juillard 035adeb89e Revert "More fixing related to objective_function_penalty_base"
This reverts commit 1ad8df4635.
2015-10-09 14:23:31 +02:00
Michel Juillard 1ad8df4635 More fixing related to objective_function_penalty_base 2015-10-08 20:57:00 +02:00
Michel Juillard a6f123fd50 reducing penalty value to 0.1 when there is no ground to make it proportional 2015-10-08 20:57:00 +02:00
Michel Juillard 5ade8d7c6f removed global objective_function_penalty_base
added penalty_objective_function.m and penalty_hessian.m
2015-10-08 20:57:00 +02:00
Stéphane Adjemian (Charybdis) d125c2effc Fixed bug (wrong syntax for switch, case 5). 2015-08-27 11:37:07 +02:00
Johannes Pfeifer 0fd76e0c6f Assigning unique function for each input argument of lyapunov_symm.m
The old way of redefining input arguments to satisfy different options was too error-prone. See 69daaa0460b0ddee97292c39d40355201e316622 of tholden
2015-07-22 15:11:39 +02:00
Johannes Pfeifer 86322bcb3a Fix typo in dsge_likelihood.m
blkdiag command is not written with ck
2015-07-20 13:10:31 +02:00
Johannes Pfeifer d6bc85fdc6 Improve error message for incompatible filter/Kalman option 2015-07-20 13:06:22 +02:00
Marco Ratto e2b59630c1 diffuse_kalman_tol not properly triggered 2015-05-07 10:18:55 +02:00
Marco Ratto ca8f0ea006 Harmonize filters/likelihood with smoothers by using new option diffuse_kalman_tol 2015-04-08 15:49:12 +02:00
Marco Ratto 214dc74723 - Fixed bugs around analytic derivation.
- Fixed test routine, eliminating diffuse filter.
- Trapped incompatibility of diffuse filter with analytic derivation.
2015-04-01 09:00:51 +02:00
Johannes Pfeifer bda19832cd Integrate error from negative steady state with loglinear model into print_info.m
Prevents crashes during estimation. Instead of directly crashing, error handling is done via print_info.m so that penalizing the error during estimation is possible
2014-12-04 20:04:36 +01:00
Stéphane Adjemian (Karaba) f48566aeae Fixed prior bounds (according to the doc in master branch).
* Second  and  third  positional  arguments  after the  name  of  the
   estimated  parameter   in  the  estimated_params   block  are  only
   considered in the optimization stage (not in the MCMC)

 * Do not  store bounds  in bayestopt_, because  bounds do  not always
   reflect restrictions implied by prior shapes.

 * prior_bounds routine  returns a structure  (with fields lb  and ub)
   instead of a matrix.
2014-10-20 16:18:54 +02:00
Stéphane Adjemian (Karaba) 97b63105a0 Add a parameter to the lyapunov_symm routine (debug mode). 2014-10-13 17:42:53 +02:00
Stéphane Adjemian (Karaba) 55808060cf Removed useless input (complete commit 438a671c3873e5c4e1bb02a54080e930fbc11886). 2014-10-13 17:42:52 +02:00
Johannes Pfeifer b90f3deed2 Bugfixes and improvements related to method 3 of lyapunov_symm.m
- the function was called with the wrong input argument for this case (Q instead of R*Q*R'), crashing with incompatible matrix dimensions
- the persistent variable X was not updated when the size of it changed, leading to crashes when estimation is followed by calls to DsgeSmoother.m where the state-space is different
- Also eliminates the printed output in lyapunov_symm.m that could not be turned off and clutters estimation
2014-10-13 17:42:52 +02:00
Johannes Pfeifer 2d39fc62e2 Make sure the output arguments of dsge_likelihood.m are actually set
Before, trend_coeff and ys were sometimes returned as empty
2014-09-21 11:54:43 +02:00
Stéphane Adjemian (Scylla) 576ed55dda Merge branch optimizer_number_5. 2014-09-11 17:38:03 +02:00
Stéphane Adjemian (Charybdis) 6d42ec66d5 Account for error code 10 (Inf in Jacobian of the dynamic model) in likelihood functions. 2014-09-10 17:49:33 +02:00
Marco Ratto a6bddb2d57 Improve computation of outer product gradient for univariate Kalman algorithms, by exploiting the larger number of individual densities computed during recursions (used in optimizer number 5). 2014-07-23 16:33:39 +02:00
Stéphane Adjemian (Scylla) 0efcef8f20 Added the possibility to declare non linear prior restrictions over estimated parameters.
If a file <MOD_FILE_NAME>_prior_restrictions.m exists in current folder, the value returned by this routine is
substracted to fval (likelihood-lnprior) at the end of dsge_likelihood. The arguments of this routine are: M_,
oo_, options_, dataset_ and dataset_info. Routines for writing <MOD_FILE_NAME>_prior_restrictions.m will be
provided later.
2014-07-21 12:45:49 +02:00
Sébastien Villemot 939fb78624 Merge pull request #663 from JohannesPfeifer/master
Bugfix and cosmetic fix
2014-07-01 17:56:48 +02:00
Stéphane Adjemian (Scylla) 03395a7425 Fixed bug. Wrong test on the number of input arguments (because of the new input argument dataset_info in dsge_likelihood). 2014-06-25 14:57:20 +02:00
Stéphane Adjemian (Charybdis) efcf6bd9c0 Use dseries object in the estimation routines. 2014-06-16 17:41:59 +02:00
Johannes Pfeifer ca6803b531 Add forgotten case to likelihood functions
Code 25 was not filtered out, leading to cryptic crashes
2014-06-02 14:10:43 +02:00
Johannes Pfeifer 12026b98a5 Add info about constants to dsge_likelihood.m header 2014-03-19 19:34:34 +01:00
Johannes Pfeifer fddee8e1db Bugfixes for correlated shocks
Uses preprocessing capabilities introduced in 07137e804b

Fixes #392 and #494. Also fixes a bug in the checking for positive definiteness of covariance matrices in likelihood functions

Allows for calibrated covariances by reading them out and setting them after covariance matrix has been reconstructed from correlation and variances.

Adds unit test
2013-11-05 15:55:29 +01:00
Stéphane Adjemian (Charybdis) 06ef8fce30 Fixed typo. 2013-06-28 22:02:24 +02:00
Stéphane Adjemian (Charybdis) b281830983 Added new initialization mode ofr the Kalman filter and smoother. 2013-06-28 16:26:53 +02:00
Stéphane Adjemian (Charybdis) 268095276c Factorized code using ispd routine. 2013-06-20 12:59:01 +02:00
Sébastien Villemot 61485ab809 Fix copyright notices 2013-06-12 17:04:46 +02:00
Sébastien Villemot 8c14339a0f Merge pull request #399 from JohannesPfeifer/master
Bugfix for dsge_likelihood with univariate_kalman_filter
2013-05-31 09:24:35 -07:00
Marco Ratto 4923ba0952 Introduced new option that allows to set prior (sign) restrictions to irf's 2013-05-30 10:57:39 +02:00
Johannes Pfeifer 115b16236b Fix bug in dsge_likelihood for univariate_kalman_filter
ÿÿÿ

Lines 399-418 set the measurement covariance matrix and save it to H1.
If it is diagonal, it is not recomputed again as
correlated_errors_have_been_checked is 0. In that case, lines 654-675
are not entered and univariate_kalman_filter tries to use the old H, but
it was named H1 before, leading to a crash. Changing the name of the
matrix H in lines 654-682 to H1 assures that univariate_kalman_filter
uses the correctly updated matrix of the
~correlated_errors_have_been_checked and the previously computed H1 in
the other cases.
2013-05-17 23:54:17 +02:00
Johannes Pfeifer 7094a45f6d Revert "Make error message for prior violation more explicit by adding second argument to info()"
This reverts commit 2815d5fbd4.
2013-05-02 14:31:29 +02:00
Johannes Pfeifer 2815d5fbd4 Make error message for prior violation more explicit by adding second argument to info() 2013-04-26 20:20:23 +02:00
Sébastien Villemot e1f702f83a Various fixes to steady state computation in estimation DLL
Still not working… Valgrind detects unitialized values during the call to
hybridjs…
2013-04-18 18:28:34 +02:00
Johannes Pfeifer 40e5c61ec7 Restrict endogenous prior to stationary models and allow for measurement error 2013-03-18 23:46:15 +01:00
Johannes Pfeifer a090a7c35e Add endogenous priors
Add option and code for endogenous priors according to
Christiano/Trabandt/Walentin 2011, JEDC. Still needs to be integrated to
manual and pre-processor.
2013-03-17 22:51:23 +01:00
Michel Juillard 74c300939a making sure that dsge_likelihood.m always returns a value in fval 2012-10-24 10:02:17 +02:00
Michel Juillard dd8f16c8db Revert "reset penalty to 1.e8." Too big a penaly is not desirable.
This reverts commit fcceec896a.
2012-10-01 14:23:21 +02:00
Marco Ratto fcceec896a reset penalty to 1.e8. 2012-10-01 08:53:50 +02:00
Sébastien Villemot 421e1a39fc Merge remote-tracking branch 'ratto/master' 2012-09-27 16:36:00 +02:00
Stéphane Adjemian (Charybdis) 894b3d69f4 Added an option to decide if dsge_likelihood should call univariate filters when the covariance matrix of
the prediction error is singular (default is yes).
2012-09-27 14:48:07 +02:00
Marco Ratto 16fa6efc8d Replace NaN with numeric penalty when diffuse filter does not kill unit roots. 2012-09-26 16:00:18 +02:00
Sébastien Villemot 8d4c812671 Merge remote-tracking branch 'ratto/master' 2012-09-17 10:29:53 +02:00
Marco Ratto b756ee1819 Analytic derivatives: make them work for lik_init==2 as well
(lik_init =3 and =4 still to be worked out)
2012-09-14 17:07:38 +02:00
Marco Ratto e637319be5 bug fix. the diffuse filter should simply penalize the likelihood with the NaN without breaking the estimation (this is in line with missing_observations_kalman_filter_d.m). 2012-09-14 17:05:35 +02:00
Stéphane Adjemian (Scylla) 3658b02455 Fixed bug. If info==19 (steady state routine returns check=1) info(2) is NaN, so that it is not possible to define an endogenous penalty. In this case we just add one to objective_function_penalty_base.
(cherry picked from commit d2912b264c326b3f349984b605787045b028b992)
2012-09-14 17:05:31 +02:00
Michel Juillard d60202616a fixed problem with penalty in estimation. Created a new global scalar:
objective_function_penalty_base. It is the only simple way that I
found to keep csminwel1.m to be able to handle general functions.
2012-08-28 12:17:07 +02:00
Marco Ratto 6b91301365 Reduce memory requirements for analytic Hessian.
Tested with QUEST III (Ratto et al. 2009): 63 params and 59 state dimension.
2012-08-21 16:00:55 +02:00
Michel Juillard 2e9ae5df28 dealing with info == 8 (Nan in Jacobian) during estimation 2012-08-06 12:00:03 +02:00
Michel Juillard 6b3bd9dd0b penalty is now passed as a field of bayestopt_ (or BayesInfo) 2012-08-02 22:23:29 +02:00
Marco Ratto 47353a276b bug fix: the anlytic hessian was wrong with estimated stderr.
Manual cherry pick from Commit: 36853cb7615de41ca61ed92decf8bbe81ab40cba
2012-08-02 14:57:20 +02:00
Marco Ratto ed4d37341c Fix problem with models where steadystate files change parameter values.
1) allow to compute derivatives starting from NUMERICAL derivatives of jacobian and steady state: this has a minor cost in accuracy and allow apply without errors identification and estimation with numerical derivatives;
2) added trap in dynare_estimation_init: if steadystate changes param values, automaticly shifts to numerical derivs of jacoban and steady state +  analytic derivatives of all the rest;
3) bug fixes for 2nd order derivatives w.r.t. model parameters;
2012-07-05 10:14:10 +02:00
Stéphane Adjemian (Charybdis) 379972d715 Removed prior_penalty in dsge_likelihood.
If options_.prior_trunc is set to zero (the default is strictly positive) then prior_correction is infinite because the prior density is zero (this is not true for the uniform prior)... This does not help the optimizer. Even if we do not fall in this case (because options_.prior_trunc>0 or becuase only uniform priors are used for the bounded parameters) the meaning of this correction is unclear.
2012-07-04 13:04:49 +02:00
Stéphane Adjemian (Charybdis) abad13d020 Kill estimation if the likelihood is complex or NaN. 2012-06-14 15:32:15 +02:00
Ferhat Mihoubi 2a8436aa44 Extends the block Kalman filter to the missing observations case (not called for the moment) 2012-06-11 10:39:25 +02:00
Sébastien Villemot 129553579a Merge remote-tracking branch 'ratto/master' 2012-06-08 18:24:18 +02:00
Sébastien Villemot 1f9cea669a Update copyright notices 2012-06-08 18:22:34 +02:00
Marco Ratto 69d015a777 Asymptotic Hessian now works also for univariate stationary KF. 2012-06-08 15:26:14 +02:00
Marco Ratto 2fecf9946b 1) Extended optimizer = 5 for analytic derivatives;
2) Start adapting identification routines to allow computation of analytic asymptotic Hessian with KF routines
2012-06-08 14:23:18 +02:00
Sébastien Villemot c26a211827 analytic_derivation and loglinear are incompatible 2012-06-08 11:33:33 +02:00
Marco Ratto 7f9d2968d9 fixed bug introduced in previous commit: offset needs to be computed for analytic derivatives. 2012-06-08 08:50:07 +02:00
Stéphane Adjemian (Charybdis) 06ca265272 Complete the bug fix for the calibrated correlations in the structural and measurement covariance matrices.
Call   set_all_parameters  routine   in  dsge_likelihood.   Note  that
correlations between innovations are not allowed in dsge-var models.
2012-06-07 15:13:39 +02:00
Stéphane Adjemian (Charybdis) 3cbd702b3e Fixed bugs (initialization of the Kalman filter with the fixed point of the Riccatti equation). 2012-06-06 18:25:07 +02:00
Marco Ratto dc7c0fa74d Include prior info in penalty with Bayesian estimation.
This can improve a bit optimization routines when parameter go beyond prior bounds during line search algorithms or when numerical gradient is computed.
2012-05-31 14:44:16 +02:00
Marco Ratto da9ec0f187 Estimation with analytic scores and hessian;
This includes re-setting the list of output arguments in objective functions
Added test function
2012-04-29 21:18:33 +02:00
Marco Ratto bb02c4d6df Bug fix for univariate KF (nobs was not defined, replaced with pp) + provisions fro eliminating dsge_likelihood_hh function; 2012-04-29 21:18:33 +02:00
Ferhat eed54fb08a - Adds new algorithms to solve Lyapunov equations: Doubling algorithm and Square root solver. Their respective names are "doubling" and "square_root_solver".
- Adds the tolerance criteria for the iterative solvers (sylvester_fixed_point_tol, lyapunov_fixed_point_tol and lyapunov_doubling_tol)
- Updates the reference manual
2012-04-20 19:23:00 +02:00
Ferhat Mihoubi 8ac14f8c80 Adds fixed point solvers for Sylvester and Lyapunov equations 2012-03-06 12:03:23 +01:00
Michel Juillard 636cd1bae6 calling always multivariate Kalman filter first, even if univariate
diffuse Kalman filter was used before
2012-01-22 18:59:19 +01:00
Michel Juillard cfb5114d41 corecting logic for selecting univariate diffuse filter and dealing
with correlated measurement errors
2012-01-22 18:37:29 +01:00
Michel Juillard 111347469f adding comment explaining initialization of persistent variable
penalty in dsge_likelihood.m and dsge_likelihood_hh.m Removed misleading
initialization code. Added call to dsge_likelihood_hh in
initial_estimation_checks to initialize persistent variable in that
function as well.
2012-01-09 21:23:17 +01:00
Michel Juillard f9d2dec97f preparing dsge_loglikelihood.m for future integration of estimation DLL 2012-01-08 21:55:02 +01:00
Michel Juillard d12e1b7801 replaced BayesInfo.penalty by penalty as it is now a persistent variable 2012-01-08 17:58:22 +01:00
Stéphane Adjemian (Charybdis) bf69bac140 Fixed typo in comments. 2011-12-26 17:46:49 +01:00