dynare/tests/Makefile.am

1589 lines
78 KiB
Makefile
Raw Normal View History

2014-10-13 23:01:40 +02:00
MODFILES = \
walsh.mod \
occbin/model_irrcap_twoconstraints/dynrbc.mod \
occbin/model_irrcap_twoconstraints/dynrbc_0_std_shocks.mod \
occbin/model_borrcon/borrcon.mod \
occbin/model_borrcon/borrcon_0_std_shocks.mod \
occbin/filter/NKM.mod \
occbin/filter/NKM_0_std_shocks.mod \
optimizers/fs2000_6.mod \
moments/example1_hp_test.mod \
moments/fs2000_post_moments.mod \
moments/example1_order2_pruning.mod \
lmmcp/rbcii.mod \
lmmcp/purely_backward.mod \
lmmcp/purely_forward.mod \
lmmcp/MCP_ramsey.mod \
ep/rbc_mc.mod \
estimation/TaRB/fs2000_tarb.mod \
observation_trends_and_prefiltering/MCMC/Trend_loglin_no_prefilt_first_obs_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_loglinear_no_prefilter_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_first_obs_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.mod \
observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.mod \
dates/dseries_interact.mod \
dates/fs2000.mod \
estimation/slice/fs2000_slice.mod \
optimizers/fs2000_9.mod \
optimizers/fs2000_10.mod \
analytic_derivatives/fs2000_analytic_derivation.mod \
Added parameter derivatives of perturbation solution up to 3 order # Preliminary comments I finished the identification toolbox at orders two and three using the pruned state space system, but before I merge request this, I decided to first merge the new functionality to compute parameter derivatives of perturbation solution matrices at higher orders. So after this is approved, I merge the identification toolbox. I guess @rattoma, @sebastien, and @michel are best choices to review this. I outline the main idea first and then provide some more detailed changes I made to the functions. *** # Main idea This merge request is concerned with the *analytical*computation of the parameter derivatives of first, second and third order perturbation solution matrices, i.e. using _closed-form_ expressions to efficiently compute the derivative of $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ *with respect to model parameters* $\theta$. Note that $\theta$ contains model parameters, stderr and corr parameters of shocks. stderr and corr parameters of measurement errors are not yet supported, (they can easily be included as exogenous shocks). The availability of such derivatives is beneficial in terms of more reliable analysis of model sensitivity and parameter identifiability as well as more efficient estimation methods, in particular for models solved up to third order, as it is well-known that numerical derivatives are a tricky business, especially for large models. References for my approach are: * Iskrev (2008, 2010) and Schmitt-Grohé and Uribe (2012, Appendix) who were the first to compute the parameter derivatives analytically at first order, however, using inefficient (sparse) Kronecker products. * Mutschler (2015) who provides the expressions for a second-order, but again using inefficient (sparse) Kronecker products. * Ratto and Iskrev (2012) who show how the first-order system can be solved accurately, fast and efficiently using existing numerical algorithms for generalized Sylvester equations by taking the parameter derivative with respect to each parameter separately. * Julliard and Kamenik (2004) who provide the perturbation solution equation system in tensor notation at any order k. * Levintal (2017) who introduces permutation matrices to express the perturbation solution equation system in matrix notation up to fifth order. Note that @rattoma already implemented the parameter derivatives of $g_x$ and $g_u$ analytically (and numerically), and I rely heavily on his work in `get_first_order_solution_params_derivs.m` (previously `getH.m`). My additions are mainly to this function and thus it is renamed to `get_perturbation_params_derivs.m`. The basic idea of this merge request is to take the second- and third-order perturbation solution systems in Julliard and Kamenik (2004), unfold these into an equivalent matrix representation using permutation matrices as in Levintal (2017). Then extending Ratto and Iskrev (2012) one takes the derivative with respect to each parameter separately and gets a computational problem that is linear, albeit large, as it involves either solving generalized Sylvester equations or taking inverses of highly sparse matrices. I will now briefly summarize the perturbation solution system at third order and the system that results when taking the derivative with respect to parameters. ## Perturbation Solution The following systems arise at first, second, and third order: $(ghx): f_{x} z_{x} = f_{y_{-}^*} + f_{y_0} g_{x} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{x}= A g_{x} + f_{y_{-}^*}=0$ $(ghu): f_{z} z_{u} = f_{y_0} g_{u} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{u} + f_{u}= A g_u + f_u = 0$ $(ghxx) : A g_{xx} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{x}\right) + f_{zz} \left( z_{x} \otimes z_{x} \right) = 0$ $(ghxu) : A g_{xu} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{x} \otimes z_{u} \right) = 0$ $(ghuu) : A g_{uu} + B g_{xx} \left(g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{u} \otimes z_{u} \right) = 0$ $(ghs2) : (A+B) g_{\sigma\sigma} + \left( f_{y^{**}_{+}y^{**}_{+}} \left(g^{**}_{u} \otimes g^{**}_{u}\right) + f_{y^{**}_{+}} g^{**}_{uu}\right)vec(\Sigma) = 0$ $(ghxxx) : A g_{xxx} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{x}\right) + f_{y_{+}}g^{**}_{xx} \left(g^{*}_x \otimes g^{*}_{xx}\right)P_{x\_xx} + f_{zz} \left( z_{x} \otimes z_{xx} \right)P_{x\_xx} + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{x} \right) = 0$ $(ghxxu) : A g_{xxu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{u} \right) + f_{zz} \left( \left( z_{x} \otimes z_{xu} \right)P_{x\_xu} + \left(z_{xx} \otimes z_{u}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{x} \otimes g^{*}_{xu}\right)P_{x\_xu} + \left(g^{*}_{xx} \otimes g^{*}_{u}\right) \right) = 0$ $(ghxuu) : A g_{xuu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( \left( z_{xu} \otimes z_{u} \right)P_{xu\_u} + \left(z_{x} \otimes z_{uu}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{xu} \otimes g^{*}_{u}\right)P_{xu\_u} + \left(g^{*}_{x} \otimes g^{*}_{uu}\right) \right) = 0$ $(ghuuu) : A g_{uuu} + B g_{xxx} \left(g^{*}_{u} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{u} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( z_{u} \otimes z_{uu} \right)P_{u\_uu} + f_{y_{+}}g^{**}_{xx} \left(g^{*}_{u} \otimes g^{*}_{uu}\right)P_{u\_uu} = 0$ $(ghx\sigma\sigma) : A g_{x\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_x + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{x} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{x} \otimes z_{\sigma\sigma}\right) + F_{xu_{+}u_{+}}\left(I_{n_x} \otimes vec(\Sigma)\right) = 0$ $F_{xu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_x^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{xu_{+}} \otimes z_{u_{+}} \right)P_{xu\_u} + \left(z_{x} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{x} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ $(ghu\sigma\sigma) : A g_{u\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_{u} + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{u} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{u} \otimes z_{\sigma\sigma}\right) + F_{uu_{+}u_{+}}\left(I_{n_u} \otimes vec(\Sigma_u)\right) = 0$ $F_{uu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_u^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{uu_{+}} \otimes z_{u_{+}} \right)P_{uu\_u} + \left(z_{u} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{u} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ A and B are the common perturbation matrices: $A = f_{y_0} + \begin{pmatrix} \underbrace{0}_{n\times n_{static}} &\vdots& \underbrace{f_{y^{**}_{+}} \cdot g^{**}_{x}}_{n \times n_{spred}} &\vdots& \underbrace{0}_{n\times n_{frwd}} \end{pmatrix}$and $B = \begin{pmatrix} \underbrace{0}_{n \times n_{static}}&\vdots & \underbrace{0}_{n \times n_{pred}} & \vdots & \underbrace{f_{y^{**}_{+}}}_{n \times n_{sfwrd}} \end{pmatrix}$ and $z=(y_{-}^{\ast}; y; y_{+}^{\ast\ast}; u)$ denotes the dynamic model variables as in `M_.lead_lag_incidence`, $y^\ast$ denote state variables, $y^{\ast\ast}$ denote forward looking variables, $y_+$ denote the variables with a lead, $y_{-}$ denote variables with a lag, $y_0$ denote variables at period t, $f$ the model equations, and $f_z$ the first-order dynamic model derivatives, $f_{zz}$ the second-order dynamic derivatives, and $f_{zzz}$ the third-order dynamic model derivatives. Then: $z_{x} = \begin{pmatrix}I\\g_{x}\\g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{u} =\begin{pmatrix}0\\g_{u}\\g^{**}_{x} \cdot g^{*}_{u}\\I\end{pmatrix}$, $z_{u_{+}} =\begin{pmatrix}0\\0\\g^{**}_{u}\\0\end{pmatrix}$ $z_{xx} = \begin{pmatrix} 0\\g_{xx}\\g^{**}_{x} \left( g^{*}_x \otimes g^{*}_{x} \right) + g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{xu} =\begin{pmatrix}0\\g_{xu}\\g^{**}_{xx} \left( g^{*}_x \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{xu}\\0\end{pmatrix}$, $z_{uu} =\begin{pmatrix}0\\g_{uu}\\g^{**}_{xx} \left( g^{*}_u \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{uu}\\0\end{pmatrix}$, $z_{xu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_x \otimes I \right)\\0\end{pmatrix}$, $z_{uu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_{u} \otimes I \right)\\0\end{pmatrix}$, $z_{u_{+}u_{+}} =\begin{pmatrix}0\\0\\g^{\ast\ast}_{uu}\\0\end{pmatrix}$, $z_{\sigma\sigma} = \begin{pmatrix}0\\ g_{\sigma\sigma}\\ g^{\ast\ast}_{x}g^{\ast}_{\sigma\sigma} + g^{\ast\ast}_{\sigma\sigma}\\0 \end{pmatrix}$ $P$ are permutation matrices that can be computed using Matlab's `ipermute` function. ## Parameter derivatives of perturbation solutions First, we need the parameter derivatives of first, second, third, and fourth derivatives of the dynamic model (i.e. g1,g2,g3,g4 in dynamic files), I make use of the implicit function theorem: Let $f_{z^k}$ denote the kth derivative (wrt all dynamic variables) of the dynamic model, then let $df_{z^k}$ denote the first-derivative (wrt all model parameters) of $f_{z^k}$ evaluated at the steady state. Note that $f_{z^k}$ is a function of both the model parameters $\theta$ and of the steady state of all dynamic variables $\bar{z}$, which also depend on the parameters. Hence, implicitly $f_{z^k}=f_{z^k}(\theta,\bar{z}(\theta))$ and $df_{z^k}$ consists of two parts: 1. direct derivative wrt to all model parameters given by the preprocessor in the `_params_derivs.m` files 2. contribution of derivative of steady state of dynamic variables (wrt all model parameters): $f_{z^{k+1}} \cdot d\bar{z}$ Note that we already have functionality to compute $d\bar{z}$ analytically. Having this, the above perturbation systems are basically equations of the following types $AX +BXC = RHS$ or $AX = RHS$ Now when taking the derivative (wrt to one single parameter $\theta_j$), we get $A\mathrm{d}\{X\} + B\mathrm{d}\{X\}C = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X - \mathrm{d}\{B\}XC - BX\mathrm{d}\{C\}$ or $A\mathrm{d}\{X\} = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X$ The first one is a Sylvester type equation, the second one can be solved by taking the inverse of $A$. The only diffculty and tedious work arrises in computing (the highly sparse) derivatives of $RHS$. *** # New functions: ` ## get_perturbation_params_derivs.m`and `get_perturbation_params_derivs_numerical_objective.m` * The parameter derivatives up to third order are computed in the new function`get_perturbation_params_derivs.m` both analytically and numerically. For numerical derivatives `get_perturbation_params_derivs_numerical_objective.m` is the objective for `fjaco.m` or `hessian_sparse.m` or `hessian.m`. * `get_perturbation_params_derivs.m` is basically an extended version of the previous `get_first_order_solution_params_derivs.m` function. * * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It is used for numerical derivatives, whenever `analytic_derivation_mode=-1|-2`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. * Detailed changes: * Most important: notation of this function is now in accordance to the k_order_solver, i.e. we do not compute derivatives of Kalman transition matrices A and B, but rather the solution matrices ghx,ghu,ghxx,ghxu,ghuu,ghs2,ghxxx,ghxxu,ghxuu,ghuuu,ghxss,ghuss in accordance with notation used in `oo_.dr`. As a byproduct at first-order, focusing on ghx and ghu instead of Kalman transition matrices A and B makes the computations slightly faster for large models (e.g. for Quest the computations were faster by a couple of seconds, not much, but okay). * Removed use of `kstate`, see also Dynare/dynare#1653 and Dynare/dynare!1656 * Output arguments are stored in a structure `DERIVS`, there is also a flag `d2flag` that computes parameter hessians needed only in `dsge_likelihood.m`. * Removed `kronflag` as input. `options_.analytic_derivation_mode` is now used instead of `kronflag`. * Removed `indvar`, an index that was used to selected specific variables in the derivatives. This is not needed, as we always compute the parameter derivatives for all variables first and then select a subset of variables. The selection now takes place in other functions, like `dsge_likelihood.m`. * Introduced some checks: (i) deterministic exogenous variables are not supported, (ii) Kronecker method only compatible with first-order approximation so reset to sylvester method, (iii) for purely backward or forward models we need to be careful with the rows in `M_.lead_la g_incidence`, (iv) if `_params_derivs.m` files are missing an error is thrown. * For numerical derivatives, if mod file does not contain an `estimated_params_block`, a temporary one with the most important parameter information is created. ## `unfold_g4.m` * When evaluating g3 and g4 one needs to take into account that these do not contain symmetric elements, so one needs to use `unfold_g3.m` and the new function `unfold_g4.m`. This returns an unfolded version of the same matrix (i.e. with symmetric elements). *** # New test models `.gitignore` and `Makefile.am` are changed accordingly. Also now it is possible to run test suite on analytic_derivatives, i.e. run `make check m/analytic_derivatives` ## `analytic_derivatives/BrockMirman_PertParamsDerivs.mod` * This is the Brock Mirman model, where we know the exact policy function $g$ for capital and consumption. As this does not imply a nonzero $g_{\sigma\sigma}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ I added some artificial equations to get nonzero solution matrices with respect to $\sigma$. The true perturbation solution matrices $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ are then computed analytically with Matlab's symbolic toolbox and saved in `nBrockMirmanSYM.mat`. There is a preprocessor flag that recreates these analytical computations if changes are needed (and to check whether I made some errors here ;-) ) * Then solution matrices up to third order and their parameter Jacobians are then compared to the ones computed by Dynare's `k_order_solver` and by `get_perturbation_params_derivs` for all `analytic_derivation_mode`'s. There will be an error if the maximum absolute deviation is too large, i.e. for numerical derivatives (`analytic_derivation_mode=-1|-2`) the tolerance is choosen lower (around 1e-5); for analytical methods we are stricter: around 1e-13 for first-order, 1e-12 for second order, and 1e-11 for third-order. * As a side note, this mod file also checks Dynare's `k_order_solver` algorithm and throws an error if something is wrong. * This test model shows that the new functionality works well. And analytical derivatives perform way better and accurate than numerical ones, even for this small model. ## `analytic_derivatives/burnside_3_order_PertParamsDerivs.mod` * This builds upon `tests/k_order_perturbation/burnside_k_order.mod` and computes the true parameter derivatives analytically by hand. * This test model also shows that the new functionality works well. ## `analytic_derivatives/LindeTrabandt2019.mod` * Shows that the new functionality also works for medium-sized models, i.e. a SW type model solved at third order with 35 variables (11 states). 2 shocks and 20 parameters. * This mod file can be used to tweak the speed of the computations in the future. * Compares numerical versus analytical parameter derivatives (for first, second and third order). Note that this model clearly shows that numerical ones are quite different than analytical ones even at first order! ## `identification/LindeTrabandt2019_xfail.mod` * This model is a check for issue Dynare/dynare#1595, see fjaco.m below, and will fail. * Removed `analytic_derivatives/ls2003.mod` as this mod file is neither in the testsuite nor does it work. *** # Detailed changes in other functions ## `get_first_order_solution_params_derivs.m` * Deleted, or actually, renamed to `get_perturbation_params_derivs.m`, as this function now is able to compute the derivatives up to third order ## `identification_numerical_objective.m` * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. ## `dsge_likelihood.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `T`matrix anymore, but instead of the dynare solution matrix `ghx`. So we recreate `T` here as this amounts to adding some zeros and focusing on selected variables only. * Added some checks to make sure the first-order approximation is selected. * Removed `kron_flag` as input, as `get_perturbation_params_derivs` looks into `options_.analytic_derivation_mode` for `kron_flag`. ## `dynare_identification.m` * make sure that setting `analytic_derivation_mode` is set both in `options_ident` and `options_`. Note that at the end of the function we restore the `options_` structure, so all changes are local. In a next merge request, I will remove the global variables to make all variables local. ## `get_identification_jacobians.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `A` and `B` matrix anymore, but instead of the dynare solution matrix `ghx` and `ghu`. So we recreate these matrices here instead of in `get_perturbation_params_derivs.m`. * Added `str2func` for better function handles in `fjaco.m`. ## `fjaco.m` * make `tol`an option, which can be adjusted by changing `options_.dynatol.x`for identification and parameter derivatives purposes. * include a check and an informative error message, if numerical derivatives (two-sided finite difference method) yield errors in `resol.m` for identification and parameter derivatives purposes. This closes issue Dynare/dynare#1595. * Changed year of copyright to 2010-2017,2019 *** # Further suggestions and questions * Ones this is merged, I will merge request an improvement of the identification toolbox, which will work up to third order using the pruned state space. This will also remove some issues and bugs, and also I will remove global variables in this request. * The third-order derivatives can be further improved by taking sparsity into account and use mex versions for kronecker products etc. I leave this for further testing (and if anybody actually uses this ;-) )
2019-12-17 19:17:09 +01:00
analytic_derivatives/BrockMirman_PertParamsDerivs.mod \
analytic_derivatives/burnside_3_order_PertParamsDerivs.mod \
pruning/AnSchorfheide_pruned_state_space.mod \
pruning/AS_pruned_state_space_red_shock.mod \
measurement_errors/fs2000_corr_me_ml_mcmc/fs2000_corr_ME.mod \
TeX/fs2000_corr_ME.mod \
estimation/MH_recover/fs2000_recover_tarb.mod \
estimation/fs2000.mod \
gsa/ls2003a.mod \
optimizers/fs2000_8.mod \
optimizers/fs2000_8_with_optim.mod \
estimation/fs2000_MCMC_jumping_covariance.mod \
ms-sbvar/test_ms_variances_repeated_runs.mod \
fs2000/fs2000.mod \
ls2003/ls2003_hessian_zero.mod \
ep/rbc.mod \
exogenous-observed-variables/preprocessor.mod \
estimation/fs2000_with_weibull_prior.mod \
2013-11-06 17:07:33 +01:00
estimation/fs2000_initialize_from_calib.mod \
2019-01-16 12:54:30 +01:00
estimation/fs2000_estimated_params_init.mod \
estimation/fs2000_estimated_params_remove.mod \
estimation/fs2000_calibrated_covariance.mod \
2015-08-06 08:59:48 +02:00
estimation/fs2000_model_comparison.mod \
estimation/fs2000_fast.mod \
estimation/fs2000_init_from_previous.mod \
estimation/ls2003_endog_prior_restrict_estimation.mod \
2016-05-19 12:21:38 +02:00
estimation/independent_mh/fs2000_independent_mh.mod \
2015-04-25 19:28:58 +02:00
estimation/MH_recover/fs2000_recover.mod \
2016-03-16 19:04:03 +01:00
estimation/MH_recover/fs2000_recover_2.mod \
estimation/MH_recover/fs2000_recover_3.mod \
estimation/heteroskedastic_shocks/fs2000_het.mod \
estimation/heteroskedastic_shocks/fs2000_het_corr.mod \
estimation/heteroskedastic_shocks/fs2000_het_sample_restriction.mod \
estimation/t_proposal/fs2000_student.mod \
estimation/tune_mh_jscale/fs2000.mod \
estimation/method_of_moments/AnScho/AnScho_matched_moments.mod \
estimation/method_of_moments/AnScho/AnScho_GMM_estimParams0.mod \
estimation/method_of_moments/AnScho/AnScho_GMM_estimParams1.mod \
estimation/method_of_moments/AnScho/AnScho_GMM_estimParams2.mod \
estimation/method_of_moments/AnScho/AnScho_SMM_estimParams0.mod \
estimation/method_of_moments/AnScho/AnScho_SMM_estimParams1.mod \
estimation/method_of_moments/AnScho/AnScho_SMM_estimParams2.mod \
estimation/method_of_moments/RBC/RBC_MoM_Andreasen.mod \
estimation/method_of_moments/RBC/RBC_MoM_SMM_ME.mod \
estimation/method_of_moments/RBC/RBC_MoM_prefilter.mod \
estimation/method_of_moments/RBC/RBC_MoM_optimizer.mod \
estimation/method_of_moments/RBC/RBC_MoM_GMM_gradient_optim.mod \
estimation/method_of_moments/AFVRR/AFVRR_M0.mod \
estimation/method_of_moments/AFVRR/AFVRR_MFB.mod \
estimation/method_of_moments/AFVRR/AFVRR_MFB_RRA.mod \
estimation/system_prior_restriction/Gali_2015.mod \
estimation/no_init_estimation_check_first_obs/fs2000_init_check.mod \
estimation/univariate/nls/staticmodel.mod \
estimation/univariate/nls/dynamicmodel1.mod \
estimation/univariate/nls/dynamicmodel2.mod \
moments/example1_var_decomp.mod \
moments/example1_bp_test.mod \
moments/test_AR1_spectral_density.mod \
2015-10-13 20:20:33 +02:00
moments/example1_one_sided_hp_test.mod \
2012-10-05 12:58:34 +02:00
gsa/ls2003.mod \
2015-06-05 20:50:29 +02:00
gsa/cod_ML_morris/cod_ML_morris.mod \
gsa/morris/nk_est.mod \
ramst.mod \
ramst_a.mod \
ramst_static_tag.mod \
ramst_static_tag_block.mod \
2020-11-26 15:48:57 +01:00
ramst_mshocks.mod \
ramst_model_edit.mod \
on-the-fly/ex1.mod \
on-the-fly/ex2.mod \
on-the-fly/ex3.mod \
on-the-fly/ex4.mod \
on-the-fly/ex5.mod \
on-the-fly/ex6.mod \
example1.mod \
example2.mod \
example1_use_dll.mod \
example1_with_tags.mod \
2011-07-07 16:05:18 +02:00
example1_irf_shocks.mod \
2011-08-18 09:41:26 +02:00
example1_abs_sign.mod \
example1_mlv.mod \
example1long.mod \
example2long.mod \
example2long_use_dll.mod \
t_sgu_ex1.mod \
macro_processor/test_ifndef.mod \
macro_processor/example1_macro.mod \
2014-09-22 10:35:54 +02:00
irfs/example1_unit_std.mod \
optimal_policy/OSR/osr_example.mod \
optimal_policy/OSR/osr_example_objective_correctness.mod \
optimal_policy/OSR/osr_example_obj_corr_non_stat_vars.mod \
optimal_policy/OSR/osr_example_param_bounds.mod \
optimal_policy/OSR/osr_obj_corr_algo_1.mod \
optimal_policy/OSR/osr_obj_corr_algo_3.mod \
optimal_policy/OSR/osr_obj_corr_algo_4.mod \
optimal_policy/OSR/osr_obj_corr_algo_7.mod \
optimal_policy/OSR/osr_obj_corr_algo_8.mod \
optimal_policy/OSR/osr_obj_corr_algo_9.mod \
optimal_policy/ramsey_.mod \
optimal_policy/nk_ramsey.mod \
2014-03-09 09:52:44 +01:00
optimal_policy/nk_ramsey_model.mod \
optimal_policy/nk_ramsey_det.mod \
optimal_policy/nk_ramsey_expectation.mod \
optimal_policy/nk_ramsey_expectation_a.mod \
optimal_policy/mult_elimination_test.mod \
2021-02-15 17:21:43 +01:00
optimal_policy/neo_growth.mod \
optimal_policy/neo_growth_ramsey.mod \
optimal_policy/neo_growth_k_order.mod \
optimal_policy/neo_growth_ramsey_k_order.mod \
optimal_policy/Ramsey/ramsey_ex_initval.mod \
optimal_policy/Ramsey/ramsey_ex.mod \
optimal_policy/Ramsey/ramsey_ex_initval_AR2.mod \
optimal_policy/Ramsey/ramsey_ex_aux.mod \
optimal_policy/Ramsey/ramsey_histval.mod \
optimal_policy/Ramsey/Gali_commitment.mod \
optimal_policy/RamseyConstraints/test1.mod \
optimal_policy/Ramsey/Ramsey_Example_estimation.mod \
discretionary_policy/dennis_1.mod \
discretionary_policy/dennis_1_estim.mod \
discretionary_policy/Gali_discretion.mod \
discretionary_policy/Gali_2015_chapter_3.mod \
discretionary_policy/Gali_2015_chapter_3_nonlinear.mod \
histval_initval_file/ramst_initval_file.mod \
histval_initval_file/ramst_initval_file_with_dseries.mod \
histval_initval_file/ramst_data_generate.mod \
histval_initval_file/ramst_datafile.mod \
histval_initval_file/sim_exo_lead_lag.mod \
histval_initval_file/sim_exo_lead_lag_initvalf.mod \
ramst_normcdf_and_friends_mfile.mod \
ramst_normcdf_and_friends_use_dll.mod \
ramst_normcdf_and_friends_bytecode.mod \
2011-10-13 22:06:07 +02:00
ramst_vec.mod \
2020-12-07 22:24:05 +01:00
ramst_mshocks_vec.mod \
example1_varexo_det.mod \
predetermined_variables.mod \
fs2000_ssfile.mod \
comments.mod \
histval_sto.mod \
histval_det.mod \
histval_predetermined.mod \
auxiliary_variables/test1.mod \
expectations/expectation.mod \
expectations/expectation_ss.mod \
expectations/expectation_ss_old.mod \
expectations/expectation_nested.mod \
steady_state/walsh1_initval.mod \
steady_state/walsh1_old_ss.mod \
steady_state/walsh1_ssm.mod \
steady_state/walsh1_ssm_block.mod \
2011-10-19 14:19:35 +02:00
steady_state/multi_leads.mod \
steady_state/example1_trust_region.mod \
steady_state/example1_block_trust_region.mod \
steady_state/Gali_2015_chapter_6_4.mod \
steady_state_operator/standard.mod \
steady_state_operator/use_dll.mod \
steady_state_operator/block.mod \
steady_state_operator/bytecode_test.mod \
block_bytecode/ireland.mod \
block_bytecode/lola_solve_one_boundary.mod \
block_bytecode/lola_solve_one_boundary_mfs1.mod \
block_bytecode/lola_solve_one_boundary_mfs2.mod \
block_bytecode/lola_solve_one_boundary_mfs3.mod \
block_bytecode/lola_stochastic.mod \
block_bytecode/lola_stochastic_block.mod \
k_order_perturbation/fs2000k2a.mod \
k_order_perturbation/fs2000k2_use_dll.mod \
k_order_perturbation/fs2000k_1_use_dll.mod \
k_order_perturbation/fs2000k3_use_dll.mod \
k_order_perturbation/fs2000k2_m.mod \
k_order_perturbation/fs2000k_1_m.mod \
k_order_perturbation/fs2000k3_m.mod \
2012-07-31 21:50:28 +02:00
k_order_perturbation/fs2000k3_p.mod \
k_order_perturbation/fs2000k4.mod \
k_order_perturbation/burnside_k_order.mod \
2021-10-09 12:07:23 +02:00
k_order_perturbation/fs2000_k_order_simul.mod \
partial_information/PItest3aHc0PCLsimModPiYrVarobsAll.mod \
partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR.mod \
arima/mod1.mod \
arima/mod1a.mod \
arima/mod1b.mod \
arima/mod1c.mod \
arima/mod2.mod \
arima/mod2a.mod \
arima/mod2b.mod \
arima/mod2c.mod \
data/mod1a.mod \
fs2000/fs2000a.mod \
fs2000/fs2000c.mod \
2012-05-31 08:22:31 +02:00
fs2000/fs2000_calib.mod \
2014-06-19 18:12:02 +02:00
fs2000/fs2000_calib_dseries.mod \
fs2000/fs2000_missing_data.mod \
2012-10-16 11:12:12 +02:00
fs2000/fs2000_sd.mod \
fs2000/fs2000_dseries_a.mod \
fs2000/fs2000_dseries_b.mod \
homotopy/homotopy1_test.mod \
homotopy/homotopy2_test.mod \
homotopy/homotopy3_test.mod \
bvar_a_la_sims/bvar_standalone.mod \
bvar_a_la_sims/bvar_and_dsge.mod \
AIM/fs2000x10L9_L.mod \
AIM/fs2000x10L9_L_AIM.mod \
AIM/fs2000x10_L9_L.mod \
AIM/fs2000x10_L9_L_AIM.mod \
AIM/fs2000_b1L1L.mod \
AIM/fs2000_b1L1L_AIM.mod \
AIM/ls2003_2L0L.mod \
AIM/ls2003_2L0L_AIM.mod \
AIM/ls2003_2L2L.mod \
AIM/ls2003_2L2L_AIM.mod \
conditional_variance_decomposition/example1.mod \
dsge-var/simul_hybrid.mod \
dsge-var/dsgevar_forward_calibrated_lambda.mod \
dsge-var/dsgevar_forward_estimated_lambda.mod \
external_function/benchmark.mod \
external_function/first_deriv_given.mod \
external_function/first_deriv_given_dll.mod \
external_function/first_and_2nd_deriv_given.mod \
external_function/first_and_2nd_deriv_given_namespace.mod \
external_function/first_and_2nd_deriv_given_dll.mod \
external_function/first_and_2nd_deriv_given_dll_namespace.mod \
external_function/no_deriv_given.mod \
external_function/no_deriv_given_dll.mod \
external_function/extfun_in_mlv.mod \
seeds.mod \
minimal_state_space_system/as2007_minimal.mod \
minimal_state_space_system/sw_minimal.mod \
identification/kim/kim2.mod \
identification/as2007/as2007.mod \
Improvement of Identification Toolbox # Improvements * heavily commented (also auxiliary functions) and changed notation to make all the functions (hopefully) more readable and understandable, and hence, easier to debug * added identification criteria of Komunjer and Ng (2011, Econometrica) and Qu and Tkachenko (2012, Quantitative Economics) * tests can be turned of, i.e. nostrength disables identification strenght, noreducedform disables reduced form criteria, nomoments disables moment criteria, nospectrum disables spectrum criteria, nominimal disables minimal system criteria * all kronflags (analytic_derivation_mode) actually work in all functions * added functionality when there is correlation in Sigma_e and when one wants to consider corr parameters of exogenous shocks. Previously, (1) corr parameters were not allowed when calling identification and (2) when Sigma_e was not diagonal then the toolbox relied on numerical derviatives only (kronflag=-1). Now it is possible to handle both identification of corr parameters as well as correct analytical derivatives when Sigma_e is not diagonal with all possible kronflag values (-1|-2|0|1) * all plots and results are stored in the same folder named identification (previously there was another one with a capital I (Identification)) # Needed changes to preprocessor * add as field to options_ident: - tex (same as in options_) - nostrength (to turn off identification strength) - noreducedform (to turn off reduced form criteria) - nomoments (to turn off Iskrev's moment criteria) - nominimal (to turn off Komunjer and Ng's minimal system criteria) - nospectrum (to turn off Qu and Tkachenko's spectrum criteria) * add to options_ident: - normalize_jacobians (whether to normalize Jacobians or not) - grid_nbr (integer used to discretize the interval [-pi;pi] - tol_rank (tolerance level to compute ranks) - tol_deriv (tolerance level to select nonzero columns in derivatives) - tol_sv (tolerance level to select nonzero singular values) - ChecksViaSubsets (for debugging purposes, uses different function to find problematic parameter sets) - max_dim_subsets_groups (for debugging purposes, used for ChecksViaSubsets) # Further Suggestions * Rename getH.m into getParamsDerivReducedForm.m to make the purpose of this function evident * Rename getJJ.m into getIdentificationJacobians.m to make the purpose of this function evident * Rename thet2tau.m into IdentificationNumericalObjectiveFunction.m to make the purpose of this function evident * dYss, d2Yss, dg1 should also include derivatives wrt to stderr and corr parameters (even though these are just 0), as in other functions (getJJ, dynare_estimation) we always add these manually * I am pretty sure the current handling in getH.m of dYss and d2Yss is not correct in the case of nonstationary variables (if g2static is nonempty), I added a warning message, as I am not sure whether this is ever used * It would be straigthforward to also include stderr and corr parameters of measurement errors (these is not possible right now). Should I do this? * Computations of d2A and d2Om need to be checked, as the differences between computing these with analytically (kronflag=0|1) or numerically kronflag=-1|-2 is really large for the example model of AnSchorfheide. * I am not sure how to best normalize Qu and Tkachenko's G matrix. It looks (and in the Gaussian case actually is) very similar to the Ahess matrix. So I used the same normalization rule as for the Ahess matrix. See comments in identification_checks.m. Anyone has a better idea? Please also check the models in test/identification/cgg for differences. * parts that are unclear to me are marked by a [@wmutschl] tag * the run time of tests/identification/as2007.mod increases from 0h01m27s to 0h03m46s (as Qu and Tkachenko's G matrix takes a little while to compute). One could decrease prior_mc=250 to prior_mc=150. # New functions * commutation: Returns Magnus and Neudecker's commutation matrix that solves k*vec(X)=vec(X') * DerivABCD: Derivative of X(p)=A(p)*B(p)*C(p)*D(p) w.r.t to p as in Magnus and Neudecker (1999), p. 175 * DeriveMinimalState: Derives minimal state space system by checking observability and controllability of all possible combinations of variables * duplication: Duplication Matrix (and its Moore Penrose Inverse) as defined by Magnus and Neudecker (2002), p.49, Dp*vec(X) = X * identification_checks_via_subsets: finds problematic parameters in a bruteforce fashion: It computes the rank of the Jacobians for all possible parameter combinations, if the rank condition is not fullfilled, these parameter sets are flagged as non-identifiable. For debugging purposes only, as the current identification_checks.m (based on nullspace and multicorrelation coefficients) is much faster # Detailed changes in getH.m * functionality improvements - heavily commented (also auxiliary functions) and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - added functionality when Sigma_e is not diagonal and/or when one wants to consider corr parameters of exogenous shocks independent of the value of kronflag - fixed function for all values of kronflag, i.e. kronflag=-2|-1|0|1. Previosuly, only kronflag=-2|0 were working, all other kronflags ran into errors (-1 was actually never called , but was dealt with in getJJ.m). I assume kronflag=-1|1 was used only for debugging issues, but still was not working. I fixed this now, the function now works out-of-the-box for all kronflag values. - I also outlined and documented what each kronflag does and point to the corresponding equations in Ratto and Iskrev (2012) or Iskrev (2010,Appendix A) - the function additionally outputs the Jacobians of B and Sig, which are needed for Qu and Tkachenko (2012) and Komunjer and Ng (2011)'s criteria - Moved computation of Jacobian of tau=[ys;vec(A);vech(B * M_.Sigma_e * B')] into getJJ.m to have all Jacobians which are needed for identification in one place. That is, getH.m computes first and second parameter derivatives of (1) reduced-form solution, (2) steady state and (3) Jacobian of dynamic model, whereas getJJ computes and sets up all Jacobians which are used for identification purposes. Therefore, getH might be useful more generally for other purposes than identification. For instance, when doing a GMM estimation, we could use this function to compute analytically the gradient of the moments and provide this to the optimizer used in a GMM context. * output arguments - renamed `H` (Jacobian wrt parameters of tau=[ys;vec(A);vech(B * M_.Sigma_e * B')] into dTAU, (as H is very confusing, e.g. in other functions it is a Hessian, or Hss and H2ss is also just the steady state. Morevoer, tau is used in Iskrev(2010) for the steady state and reduced-form solution) - renamed `Hss` (Jacobian of steady state wrt model parameters only) into `dYss` (as H is very confusing here, see above) - renamed `H2ss` (Hessian wrt model parameters only of ys) into d2Yss (as H is very confusing, see above) - renamed `gp` into `dg1`, where g1 corresponds to the same variable as in dynamic model files. Note that in params_deriv files gp lacks the contribution of Jacobian wrt steady state and dg1 includes this using the implicit function theorem as outlined in Ratto and Iskrev (2012). Hence, dg1 denotes Jacobian wrt to parameters. It is useful and important to distinguish gp and dg1. - added `dB` (Jacobian wrt parameters of solution matrix B) needed for Qu and Tkachenko (2012) as well as Komunjer and Ng (2011) - added `dSig` (Jacobian wrt parameters of M_.Sigma_e) needed for Qu and Tkachenko (2012) as well as Komunjer and Ng (2011) * input arguments - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - renamed `iv` (index of variables to consider) into `indvar` - Renamed `M_` to `M`, `estim_params_` to `estim_params`, `options_` to `options` , `oo_` to `oo` to visualize that these are local and not global variables - included `indpcorr` a matrix of indices for corr parameters to be checked * misc - distinguished clearly between variables in DR or in declaration order without overwriting this in between - added which functions call getH.m - updated copyright to 2010-2019 # Detailed changes in getJJ.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - added functionality when Sigma_e is not diagonal and/or when one wants to consider corr parameters of exogenous shocks independent of the value of kronflag - tidied the function up, such that it sets up all Jacobians which are needed for identification, i.e. Iskrev's J matrix, Qu and Tkachenko (2012)'s G matrix, Komunjer and Ng (2011)'s D matrix, reduced-form solution (dTAU), linear rational expectation (i.e. Jacobian of steady state and dynamic model equations dLRE). - dTAU is now constructed in getJJ instead of in getH (see comment above in getH.m) - works for all kronflags, i.e. for numerical derivatives (-1 and -2) as well as for analytical derivatives based on kronecker products (1) or Sylvester Equations (0) - added functionality for stderr and corr parameters independent of the value of kronflag (previously this was only possible with numerical derivatives, now it works for all kronflags) - finds minimal state vector needed for Komunjer and Ng (2011)'s criteria (function `DeriveMinimalState.m`) - moved computations from kronflag=-1 (which were used in case of corr in shock block) into getH.m, so that getJJ now only sets up the Jacobians for LRE, Iskrev's J, Qu and Tkachenko's G and Komunjer and Ng's D, whereas getH computes the Jacobians (wrt parameters) of A, B, Sigma_e, Om, Yss and g1. This should simplify debugging as everything is now in one place and not in two * output arguments - renamed `JJ` into `J` - renamed `H` into `dTAU` (as H is very confusing, e.g. in other functions it is a Hessian, or Hss and H2ss is also just the steady state. Morevoer, tau is used in Iskrev(2010) for the steady state and reduced-form solution) - renamed `gp` into `dLRE`, as this corresponds to Jacobian of LRE=[Yss;vec(g1)] where g1 is the Jacobian of the dynamic model equations. - renamed `gam` into `MOMENTS` - added `G` for Qu and Tkachenko's Jacobian matrix G - added `D` for Komunjer and Ng's Jacobian matrix D - reordered output arguments * input arguments - added `options_ident` as input argument; hence, `kronflag`, `nlags` and `useautocorr` are removed from input arguments as these are available in options_ident - Renamed `M_` to `M`, `estim_params_` to `estim_params`, `options_` to `options` , `oo_` to `oo` to visualize that these are local and not global variables - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - added `indpcorr` (index of corr parameters) - renamed `mf` (index of VAROBS variables) into `indvobs` * misc - updated copyright to 2010-2019 - provided some comments on several ways to compute the spectral density matrix - added which functions call getJJ.m # Detailed changes in thet2tau.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - Added output option to compute spectral density matrix - Reorded and added some output option. - Instead of Om, `outputflag=0` computes B and Sigma_e, which are needed for Qu and Tkachenko as well as Komunjer and Ng. The Jacobian of Om is then computed in getJJ or getH from Jacobian of B and Sigma_e. Due to some testing with An and Schorfheide model this seems to be more accurate when I compare these with the analytical derivatives. The old behavior (computing Om directly) can be restored by setting `outputflag=-2`. - In total this function can now be used to compute numerically Jacobians of Yss, A, B, Sigma_e, Om, g1, autocovariogram and spectral density - Clearly distinguished (and commented) on the different outputs of this function. - Works for all types of parameters, ie. model, stderr and corr. - This function can now also be used when there is no estimated_params block. Previously, there was an error when there was no estimated_params block when calling `set_all_parameters` as this requires some information in `estim_params`. I fixed this by providing a temporary local estim_parms structure with the necessary information on model, stderr and corr parameters. In this way, this can be easily extended to also include stderr and corr parameters of measurement errors. * output arguments - renamed `tau` into `out`, as this function computes *very* different things (and not only tau) depending on an input flag * input arguments - renamed `flagmoments` into `outputflag` as this function does not only compute moments but many other things (see above) - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - added `indpcorr` (index of corr parameters) - merged `mf` (index of observable variables) and `iv` (index of variables to consider) into a single index `indvar` as there is no need to distinguish between these two indices (they were never used in combination) - added `grid_nbr` (number of grid points to compute spectral density) - reordered input arguments * misc - added which functions call thet2tau - updated copyright to 2010-2019 # Detailed changes in identification_analysis.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - renamed `dg1` to `dLRE`, renamed `vecg1` to `lre`, renamed `H` to `dTAU` (see comments above) - added option `numzerotolderiv` with default `1.e-8` used for non-zero derivatives - added option `numzerotolrank` with default `1.e-10` used for rank computations - added theoretical identification analysis based on Komunjer and Ng (2011)'s method, i.e. steady state and observational equivalent spectral densities within a minimal system - added theoretical identification analysis based on Qu and Tkachenko (2012)'s method, i.e. steady state and spectral density - restructured the code slightly to combined chunks of code that belong together on the one hand, and on the other hand to differentiate between the different criteria - added call to new function `identification_checks_via_subsets.m` (see above for the definition of the functionality) to perform identification checks differently as find it more intuitive and (most likely) more precise. * input arguments - removed `bounds` and `dataset_` as input argument, because these are not needed - moved `name_tex` and `tittxt` into `options_ident` as these two inputs are only used in `ident_bruteforce.m` and already set in `dynare_identification.m` * output arguments - added `ide_spectrum` structure for Qu and Tkachenko's criteria based on the spectral density - added `ide_minimal` structure for Komunjer and Ng's criteria based on the minimal state space system - reordered output arguments * misc - added which functions call identification_analysis - updated copyright to 2010-2019 # Detailed changes in dynare_identification.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - included more options (and default values) which can be set by the user, i.e. nostrength, nomoments, nominimal, nospectrum, tex, tol_rank, tol_deriv, tol_sv, grid_nbr, ChecksViaSubsets, max_dim_subsets_group - instead of turning warnings globally off, I specified the relevant warnings for matlab and octave, respectively, off - improved the warning messages slightly - restructured chunks of code with respect to different criteria * output arguments - renamed arguments: TAU to STO_TAU, GAM to STO_MOMENTS, LRE to STO_LRE, gp to STO_si_dLRE, H to STO_si_dTAU, JJ to STO_si_J - added arguments: STO_G and STO_D for the two new criteria * misc - added which functions call dynare_identification - updated copyright to 2010-2019 # Detailed changes in identification_checks.m * functionality improvements - added checks for Komunjer and Ng's D matrix. Note that the Jacobian D=[D_par D_rest], where D_par depends on the parameters and D_rest does not. So this is taken into account. - added checks for Qu and Tkachenko's G matrix. Note that the Jacobian G is a Gram matrix with dimension nparam x nparam, similar to Ahess. So this is taken into account. I am, however, not sure whether this is correct regarding the multicorrelation and pairwise correlation coefficients. Please double check. - the rank is now actually computed at the prespecified tolerance level (and not Matlab's default level), so this is in accordance to the further analysis of problematic parameter sets * output arguments - added the rank to output arguments which is later also displayed - replaced the J or JJ part in the variable names with X as this function is used for all sorts of Jacobians, not only Iskrev's J * input arguments - renamed hess_flag to output_flag (and clearly outlined what each value does) - added tol_rank and tol_sv as input arguments, such that the tolerance levels can be changed by the user and not preimplemented in this function - added param_nbr which is needed for Komunjer and Ng's D matrix * misc - updated copyright to 2010-2019 # Detailed changes in ident_bruteforce.m * functionality improvements - the output directory was set with a capital I, i.e. Identification, whereas in all other functions we rely on lower case i, i.e. identification. I changed this to lower-cases, so everything is now saved in the same folder. - changed displayed strings to be more precise with the corresponding papers and notation * input arguments - renamed `n` to `max_dim_cova_group` to name options the same across functions - renamed `pnames_TeX` to `name_tex` to name options the same across functions - added `tol_deriv` as tolerance level which can be changed by the user * misc - Added some comments - updated copyright to 2010-2019 # Detailed changes in disp_identification.m * functionality improvements - this function displays the same output for different Jacobians, hence I put the common code into a for loop. This should simplify changing the output that is printed to the console. Previously the code was simply repeated for the different criteria and only the strings changed. - some settings relevant for the computation are now printed as a summary to the console - the tolerance level, rank and required rank are always displayed on the command line to see how many problematic sets there are and which tolerance level was used - the function is also able to display problematic parameters computed by the new function `identification_checks_via_subsets.m` which is only used for debugging. * input arguments - added `idespectrum` structure for analysis based on Qu and Tkachenko - added `ideminimal` structure for analysis based on Komunjer and Ng - added `options_ident` to have all necessary settings in a structure * misc - Added some comments - Removed uncommented code that was not used as this was redundant and probably an artifact of the original programming?! - updated copyright to 2010-2019 # Detailed changes in dsge_likelihood.m * misc - adjusted call of getH due to changes of input and output arguments - updated copyright to 2010-2019 # Detailed changes in cosn.m * misc - commented functionality, input and output arguments of this function - updated copyright to 2010-2019
2019-03-20 16:44:54 +01:00
identification/as2007/as2007_kronflags.mod \
identification/as2007/as2007_QT.mod \
identification/as2007/as2007_QT_equal_autocorr.mod \
identification/as2007/as2007_order_1_2_3.mod \
identification/as2007/as2007_order3_no_stoch_simul.mod \
Improvement of Identification Toolbox # Improvements * heavily commented (also auxiliary functions) and changed notation to make all the functions (hopefully) more readable and understandable, and hence, easier to debug * added identification criteria of Komunjer and Ng (2011, Econometrica) and Qu and Tkachenko (2012, Quantitative Economics) * tests can be turned of, i.e. nostrength disables identification strenght, noreducedform disables reduced form criteria, nomoments disables moment criteria, nospectrum disables spectrum criteria, nominimal disables minimal system criteria * all kronflags (analytic_derivation_mode) actually work in all functions * added functionality when there is correlation in Sigma_e and when one wants to consider corr parameters of exogenous shocks. Previously, (1) corr parameters were not allowed when calling identification and (2) when Sigma_e was not diagonal then the toolbox relied on numerical derviatives only (kronflag=-1). Now it is possible to handle both identification of corr parameters as well as correct analytical derivatives when Sigma_e is not diagonal with all possible kronflag values (-1|-2|0|1) * all plots and results are stored in the same folder named identification (previously there was another one with a capital I (Identification)) # Needed changes to preprocessor * add as field to options_ident: - tex (same as in options_) - nostrength (to turn off identification strength) - noreducedform (to turn off reduced form criteria) - nomoments (to turn off Iskrev's moment criteria) - nominimal (to turn off Komunjer and Ng's minimal system criteria) - nospectrum (to turn off Qu and Tkachenko's spectrum criteria) * add to options_ident: - normalize_jacobians (whether to normalize Jacobians or not) - grid_nbr (integer used to discretize the interval [-pi;pi] - tol_rank (tolerance level to compute ranks) - tol_deriv (tolerance level to select nonzero columns in derivatives) - tol_sv (tolerance level to select nonzero singular values) - ChecksViaSubsets (for debugging purposes, uses different function to find problematic parameter sets) - max_dim_subsets_groups (for debugging purposes, used for ChecksViaSubsets) # Further Suggestions * Rename getH.m into getParamsDerivReducedForm.m to make the purpose of this function evident * Rename getJJ.m into getIdentificationJacobians.m to make the purpose of this function evident * Rename thet2tau.m into IdentificationNumericalObjectiveFunction.m to make the purpose of this function evident * dYss, d2Yss, dg1 should also include derivatives wrt to stderr and corr parameters (even though these are just 0), as in other functions (getJJ, dynare_estimation) we always add these manually * I am pretty sure the current handling in getH.m of dYss and d2Yss is not correct in the case of nonstationary variables (if g2static is nonempty), I added a warning message, as I am not sure whether this is ever used * It would be straigthforward to also include stderr and corr parameters of measurement errors (these is not possible right now). Should I do this? * Computations of d2A and d2Om need to be checked, as the differences between computing these with analytically (kronflag=0|1) or numerically kronflag=-1|-2 is really large for the example model of AnSchorfheide. * I am not sure how to best normalize Qu and Tkachenko's G matrix. It looks (and in the Gaussian case actually is) very similar to the Ahess matrix. So I used the same normalization rule as for the Ahess matrix. See comments in identification_checks.m. Anyone has a better idea? Please also check the models in test/identification/cgg for differences. * parts that are unclear to me are marked by a [@wmutschl] tag * the run time of tests/identification/as2007.mod increases from 0h01m27s to 0h03m46s (as Qu and Tkachenko's G matrix takes a little while to compute). One could decrease prior_mc=250 to prior_mc=150. # New functions * commutation: Returns Magnus and Neudecker's commutation matrix that solves k*vec(X)=vec(X') * DerivABCD: Derivative of X(p)=A(p)*B(p)*C(p)*D(p) w.r.t to p as in Magnus and Neudecker (1999), p. 175 * DeriveMinimalState: Derives minimal state space system by checking observability and controllability of all possible combinations of variables * duplication: Duplication Matrix (and its Moore Penrose Inverse) as defined by Magnus and Neudecker (2002), p.49, Dp*vec(X) = X * identification_checks_via_subsets: finds problematic parameters in a bruteforce fashion: It computes the rank of the Jacobians for all possible parameter combinations, if the rank condition is not fullfilled, these parameter sets are flagged as non-identifiable. For debugging purposes only, as the current identification_checks.m (based on nullspace and multicorrelation coefficients) is much faster # Detailed changes in getH.m * functionality improvements - heavily commented (also auxiliary functions) and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - added functionality when Sigma_e is not diagonal and/or when one wants to consider corr parameters of exogenous shocks independent of the value of kronflag - fixed function for all values of kronflag, i.e. kronflag=-2|-1|0|1. Previosuly, only kronflag=-2|0 were working, all other kronflags ran into errors (-1 was actually never called , but was dealt with in getJJ.m). I assume kronflag=-1|1 was used only for debugging issues, but still was not working. I fixed this now, the function now works out-of-the-box for all kronflag values. - I also outlined and documented what each kronflag does and point to the corresponding equations in Ratto and Iskrev (2012) or Iskrev (2010,Appendix A) - the function additionally outputs the Jacobians of B and Sig, which are needed for Qu and Tkachenko (2012) and Komunjer and Ng (2011)'s criteria - Moved computation of Jacobian of tau=[ys;vec(A);vech(B * M_.Sigma_e * B')] into getJJ.m to have all Jacobians which are needed for identification in one place. That is, getH.m computes first and second parameter derivatives of (1) reduced-form solution, (2) steady state and (3) Jacobian of dynamic model, whereas getJJ computes and sets up all Jacobians which are used for identification purposes. Therefore, getH might be useful more generally for other purposes than identification. For instance, when doing a GMM estimation, we could use this function to compute analytically the gradient of the moments and provide this to the optimizer used in a GMM context. * output arguments - renamed `H` (Jacobian wrt parameters of tau=[ys;vec(A);vech(B * M_.Sigma_e * B')] into dTAU, (as H is very confusing, e.g. in other functions it is a Hessian, or Hss and H2ss is also just the steady state. Morevoer, tau is used in Iskrev(2010) for the steady state and reduced-form solution) - renamed `Hss` (Jacobian of steady state wrt model parameters only) into `dYss` (as H is very confusing here, see above) - renamed `H2ss` (Hessian wrt model parameters only of ys) into d2Yss (as H is very confusing, see above) - renamed `gp` into `dg1`, where g1 corresponds to the same variable as in dynamic model files. Note that in params_deriv files gp lacks the contribution of Jacobian wrt steady state and dg1 includes this using the implicit function theorem as outlined in Ratto and Iskrev (2012). Hence, dg1 denotes Jacobian wrt to parameters. It is useful and important to distinguish gp and dg1. - added `dB` (Jacobian wrt parameters of solution matrix B) needed for Qu and Tkachenko (2012) as well as Komunjer and Ng (2011) - added `dSig` (Jacobian wrt parameters of M_.Sigma_e) needed for Qu and Tkachenko (2012) as well as Komunjer and Ng (2011) * input arguments - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - renamed `iv` (index of variables to consider) into `indvar` - Renamed `M_` to `M`, `estim_params_` to `estim_params`, `options_` to `options` , `oo_` to `oo` to visualize that these are local and not global variables - included `indpcorr` a matrix of indices for corr parameters to be checked * misc - distinguished clearly between variables in DR or in declaration order without overwriting this in between - added which functions call getH.m - updated copyright to 2010-2019 # Detailed changes in getJJ.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - added functionality when Sigma_e is not diagonal and/or when one wants to consider corr parameters of exogenous shocks independent of the value of kronflag - tidied the function up, such that it sets up all Jacobians which are needed for identification, i.e. Iskrev's J matrix, Qu and Tkachenko (2012)'s G matrix, Komunjer and Ng (2011)'s D matrix, reduced-form solution (dTAU), linear rational expectation (i.e. Jacobian of steady state and dynamic model equations dLRE). - dTAU is now constructed in getJJ instead of in getH (see comment above in getH.m) - works for all kronflags, i.e. for numerical derivatives (-1 and -2) as well as for analytical derivatives based on kronecker products (1) or Sylvester Equations (0) - added functionality for stderr and corr parameters independent of the value of kronflag (previously this was only possible with numerical derivatives, now it works for all kronflags) - finds minimal state vector needed for Komunjer and Ng (2011)'s criteria (function `DeriveMinimalState.m`) - moved computations from kronflag=-1 (which were used in case of corr in shock block) into getH.m, so that getJJ now only sets up the Jacobians for LRE, Iskrev's J, Qu and Tkachenko's G and Komunjer and Ng's D, whereas getH computes the Jacobians (wrt parameters) of A, B, Sigma_e, Om, Yss and g1. This should simplify debugging as everything is now in one place and not in two * output arguments - renamed `JJ` into `J` - renamed `H` into `dTAU` (as H is very confusing, e.g. in other functions it is a Hessian, or Hss and H2ss is also just the steady state. Morevoer, tau is used in Iskrev(2010) for the steady state and reduced-form solution) - renamed `gp` into `dLRE`, as this corresponds to Jacobian of LRE=[Yss;vec(g1)] where g1 is the Jacobian of the dynamic model equations. - renamed `gam` into `MOMENTS` - added `G` for Qu and Tkachenko's Jacobian matrix G - added `D` for Komunjer and Ng's Jacobian matrix D - reordered output arguments * input arguments - added `options_ident` as input argument; hence, `kronflag`, `nlags` and `useautocorr` are removed from input arguments as these are available in options_ident - Renamed `M_` to `M`, `estim_params_` to `estim_params`, `options_` to `options` , `oo_` to `oo` to visualize that these are local and not global variables - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - added `indpcorr` (index of corr parameters) - renamed `mf` (index of VAROBS variables) into `indvobs` * misc - updated copyright to 2010-2019 - provided some comments on several ways to compute the spectral density matrix - added which functions call getJJ.m # Detailed changes in thet2tau.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - Added output option to compute spectral density matrix - Reorded and added some output option. - Instead of Om, `outputflag=0` computes B and Sigma_e, which are needed for Qu and Tkachenko as well as Komunjer and Ng. The Jacobian of Om is then computed in getJJ or getH from Jacobian of B and Sigma_e. Due to some testing with An and Schorfheide model this seems to be more accurate when I compare these with the analytical derivatives. The old behavior (computing Om directly) can be restored by setting `outputflag=-2`. - In total this function can now be used to compute numerically Jacobians of Yss, A, B, Sigma_e, Om, g1, autocovariogram and spectral density - Clearly distinguished (and commented) on the different outputs of this function. - Works for all types of parameters, ie. model, stderr and corr. - This function can now also be used when there is no estimated_params block. Previously, there was an error when there was no estimated_params block when calling `set_all_parameters` as this requires some information in `estim_params`. I fixed this by providing a temporary local estim_parms structure with the necessary information on model, stderr and corr parameters. In this way, this can be easily extended to also include stderr and corr parameters of measurement errors. * output arguments - renamed `tau` into `out`, as this function computes *very* different things (and not only tau) depending on an input flag * input arguments - renamed `flagmoments` into `outputflag` as this function does not only compute moments but many other things (see above) - renamed `indx` (index of model parameters to be checked) into `indpmodel`, the p makes it more clear that this is a parameter index - renamed `indexo` (index of stderr parameters) into `indpstderr`, the p makes it more clear that this is a parameter index - added `indpcorr` (index of corr parameters) - merged `mf` (index of observable variables) and `iv` (index of variables to consider) into a single index `indvar` as there is no need to distinguish between these two indices (they were never used in combination) - added `grid_nbr` (number of grid points to compute spectral density) - reordered input arguments * misc - added which functions call thet2tau - updated copyright to 2010-2019 # Detailed changes in identification_analysis.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - renamed `dg1` to `dLRE`, renamed `vecg1` to `lre`, renamed `H` to `dTAU` (see comments above) - added option `numzerotolderiv` with default `1.e-8` used for non-zero derivatives - added option `numzerotolrank` with default `1.e-10` used for rank computations - added theoretical identification analysis based on Komunjer and Ng (2011)'s method, i.e. steady state and observational equivalent spectral densities within a minimal system - added theoretical identification analysis based on Qu and Tkachenko (2012)'s method, i.e. steady state and spectral density - restructured the code slightly to combined chunks of code that belong together on the one hand, and on the other hand to differentiate between the different criteria - added call to new function `identification_checks_via_subsets.m` (see above for the definition of the functionality) to perform identification checks differently as find it more intuitive and (most likely) more precise. * input arguments - removed `bounds` and `dataset_` as input argument, because these are not needed - moved `name_tex` and `tittxt` into `options_ident` as these two inputs are only used in `ident_bruteforce.m` and already set in `dynare_identification.m` * output arguments - added `ide_spectrum` structure for Qu and Tkachenko's criteria based on the spectral density - added `ide_minimal` structure for Komunjer and Ng's criteria based on the minimal state space system - reordered output arguments * misc - added which functions call identification_analysis - updated copyright to 2010-2019 # Detailed changes in dynare_identification.m * functionality improvements - heavily commented and changed notation of several variables to make this function (hopefully) more readable and understandable, and hence, easier to debug - included more options (and default values) which can be set by the user, i.e. nostrength, nomoments, nominimal, nospectrum, tex, tol_rank, tol_deriv, tol_sv, grid_nbr, ChecksViaSubsets, max_dim_subsets_group - instead of turning warnings globally off, I specified the relevant warnings for matlab and octave, respectively, off - improved the warning messages slightly - restructured chunks of code with respect to different criteria * output arguments - renamed arguments: TAU to STO_TAU, GAM to STO_MOMENTS, LRE to STO_LRE, gp to STO_si_dLRE, H to STO_si_dTAU, JJ to STO_si_J - added arguments: STO_G and STO_D for the two new criteria * misc - added which functions call dynare_identification - updated copyright to 2010-2019 # Detailed changes in identification_checks.m * functionality improvements - added checks for Komunjer and Ng's D matrix. Note that the Jacobian D=[D_par D_rest], where D_par depends on the parameters and D_rest does not. So this is taken into account. - added checks for Qu and Tkachenko's G matrix. Note that the Jacobian G is a Gram matrix with dimension nparam x nparam, similar to Ahess. So this is taken into account. I am, however, not sure whether this is correct regarding the multicorrelation and pairwise correlation coefficients. Please double check. - the rank is now actually computed at the prespecified tolerance level (and not Matlab's default level), so this is in accordance to the further analysis of problematic parameter sets * output arguments - added the rank to output arguments which is later also displayed - replaced the J or JJ part in the variable names with X as this function is used for all sorts of Jacobians, not only Iskrev's J * input arguments - renamed hess_flag to output_flag (and clearly outlined what each value does) - added tol_rank and tol_sv as input arguments, such that the tolerance levels can be changed by the user and not preimplemented in this function - added param_nbr which is needed for Komunjer and Ng's D matrix * misc - updated copyright to 2010-2019 # Detailed changes in ident_bruteforce.m * functionality improvements - the output directory was set with a capital I, i.e. Identification, whereas in all other functions we rely on lower case i, i.e. identification. I changed this to lower-cases, so everything is now saved in the same folder. - changed displayed strings to be more precise with the corresponding papers and notation * input arguments - renamed `n` to `max_dim_cova_group` to name options the same across functions - renamed `pnames_TeX` to `name_tex` to name options the same across functions - added `tol_deriv` as tolerance level which can be changed by the user * misc - Added some comments - updated copyright to 2010-2019 # Detailed changes in disp_identification.m * functionality improvements - this function displays the same output for different Jacobians, hence I put the common code into a for loop. This should simplify changing the output that is printed to the console. Previously the code was simply repeated for the different criteria and only the strings changed. - some settings relevant for the computation are now printed as a summary to the console - the tolerance level, rank and required rank are always displayed on the command line to see how many problematic sets there are and which tolerance level was used - the function is also able to display problematic parameters computed by the new function `identification_checks_via_subsets.m` which is only used for debugging. * input arguments - added `idespectrum` structure for analysis based on Qu and Tkachenko - added `ideminimal` structure for analysis based on Komunjer and Ng - added `options_ident` to have all necessary settings in a structure * misc - Added some comments - Removed uncommented code that was not used as this was redundant and probably an artifact of the original programming?! - updated copyright to 2010-2019 # Detailed changes in dsge_likelihood.m * misc - adjusted call of getH due to changes of input and output arguments - updated copyright to 2010-2019 # Detailed changes in cosn.m * misc - commented functionality, input and output arguments of this function - updated copyright to 2010-2019
2019-03-20 16:44:54 +01:00
identification/BrockMirman/BrockMirman.mod \
identification/cgg/cgg_criteria_differ.mod \
identification/ident_unit_root/ident_unit_root.mod \
identification/rbc_ident/rbc_ident_std_as_structural_par.mod \
identification/rbc_ident/rbc_ident_varexo_only.mod \
identification/correlated_errors/fs2000_corr.mod \
identification/forward_looking/forward_looking.mod \
2011-08-02 11:58:09 +02:00
simul/example1.mod \
simul/Solow_no_varexo.mod \
simul/simul_ZLB_purely_forward.mod \
simul/simul_ZLB_purely_forward_no_solution.mod \
simul/Irreversible_investment.mod \
simul/linear_state_space_arma.mod \
2018-09-27 18:56:41 +02:00
conditional_forecasts/1/fs2000_cal.mod \
conditional_forecasts/2/fs2000_est.mod \
conditional_forecasts/3/fs2000_conditional_forecast_initval.mod \
conditional_forecasts/4/fs2000_conditional_forecast_histval.mod \
conditional_forecasts/5/fs2000_cal.mod \
2018-09-27 18:56:41 +02:00
conditional_forecasts/6/fs2000_cal.mod \
2011-10-21 22:13:56 +02:00
recursive/ls2003.mod \
recursive/ls2003_bayesian.mod \
recursive/ls2003_bayesian_xls.mod \
2015-10-07 12:19:52 +02:00
recursive/ls2003_bayesian_csv.mod \
2011-08-02 11:58:09 +02:00
ms-sbvar/test_exclusions.mod \
ms-sbvar/test_exclusions_nc.mod \
ms-sbvar/test_lower_cholesky.mod \
ms-sbvar/test_lower_cholesky_a.mod \
ms-sbvar/test_lower_cholesky_nc.mod \
ms-sbvar/test_upper_cholesky.mod \
ms-sbvar/test_upper_cholesky_nc.mod \
ms-sbvar/test_ms_variances.mod \
2012-01-23 17:37:59 +01:00
ms-dsge/test_ms_dsge.mod \
kalman/lyapunov/fs2000_lyap.mod \
kalman/lik_init/fs2000_ns_lik_init_2.mod \
kalman/lik_init/fs2000_ns_lik_init_3.mod \
kalman/lik_init/fs2000_ns_lik_init_5.mod \
kalman/lik_init/fs2000_lik_init_1.mod \
kalman/lik_init/fs2000_lik_init_2.mod \
kalman/lik_init/fs2000_lik_init_3.mod \
kalman/lik_init/fs2000_lik_init_4.mod \
kalman/lik_init/fs2000_lik_init_5.mod \
kalman/block/fs2000.mod \
kalman/block/fs2000_missing_data.mod \
kalman_initial_state/fs2000_smoother_only_initial_state.mod \
kalman_initial_state/fs2000_ns_smoother_only_initial_state.mod \
kalman_initial_state/fs2000_kalman_initial.mod \
kalman_initial_state/fs2000_kalman_initial_2_lag.mod \
2011-11-03 11:14:37 +01:00
kalman_filter_smoother/gen_data.mod \
2011-11-02 21:16:49 +01:00
kalman_filter_smoother/algo1.mod \
kalman_filter_smoother/algo2.mod \
kalman_filter_smoother/algo3.mod \
kalman_filter_smoother/algo4.mod \
kalman_filter_smoother/algo4a.mod \
kalman_filter_smoother/algo4b.mod \
kalman_filter_smoother/algoH1.mod \
kalman_filter_smoother/algoH2.mod \
kalman_filter_smoother/algoH3.mod \
kalman_filter_smoother/fs2000.mod \
kalman_filter_smoother/fs2000_1.mod \
kalman_filter_smoother/fs2000_2.mod \
2011-12-01 22:04:37 +01:00
kalman_filter_smoother/fs2000a.mod \
kalman_filter_smoother/fs2000_smoother_only.mod \
kalman_filter_smoother/fs2000_smoother_only_ns.mod \
kalman_filter_smoother/fs2000_smoother_redux.mod \
kalman_filter_smoother/test_compute_Pinf_Pstar_data.mod \
kalman_filter_smoother/test_compute_Pinf_Pstar.mod \
kalman_filter_smoother/SOE.mod \
kalman_filter_smoother/check_variable_dimensions/fs2000.mod \
kalman_filter_smoother/check_variable_dimensions/fs2000_ML.mod \
kalman/likelihood_from_dynare/fs2000_corr_ME.mod \
kalman/likelihood_from_dynare/fs2000_corr_ME_missing.mod \
kalman/likelihood_from_dynare/fs2000_uncorr_ME.mod \
kalman/likelihood_from_dynare/fs2000_uncorr_ME_missing.mod \
2016-06-16 18:57:35 +02:00
kalman/likelihood_from_dynare/fs2000ns_corr_ME.mod \
kalman/likelihood_from_dynare/fs2000ns_corr_ME_missing.mod \
kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.mod \
kalman/likelihood_from_dynare/fs2000ns_uncorr_ME_missing.mod \
2011-12-01 22:04:37 +01:00
second_order/burnside_1.mod \
kalman_filter_smoother/compare_results_simulation/fs2000_ML.mod \
kalman_filter_smoother/compare_results_simulation/fs2000_ML_loglinear.mod \
kalman_filter_smoother/compare_results_simulation/fs2000.mod \
kalman_filter_smoother/compare_results_simulation/fs2000_loglinear.mod \
second_order/burnside_1.mod \
2011-12-01 22:04:37 +01:00
second_order/ds1.mod \
2011-12-12 10:43:38 +01:00
second_order/ds2.mod \
2012-06-08 17:36:32 +02:00
ep/rbc2.mod \
ep/rbcii.mod \
ep/linearmodel0.mod \
ep/linearmodel1.mod \
ep/rbc_bytecode.mod \
2021-05-26 12:35:27 +02:00
ep/rbcii_MCP.mod \
2020-03-08 09:01:00 +01:00
stochastic_simulations/example1_noprint.mod \
stochastic-backward-models/solow_cd.mod \
stochastic-backward-models/solow_ces.mod \
stochastic-backward-models/solow_cd_with_steadystate.mod \
deterministic_simulations/purely_forward/ar1.mod \
deterministic_simulations/purely_forward/nk.mod \
deterministic_simulations/purely_backward/ar1.mod \
deterministic_simulations/purely_static/toto.mod \
deterministic_simulations/rbc_det1.mod \
deterministic_simulations/rbc_det2.mod \
deterministic_simulations/rbc_det3.mod \
deterministic_simulations/rbc_det4.mod \
deterministic_simulations/rbc_det5.mod \
deterministic_simulations/rbc_det6.mod \
deterministic_simulations/homotopy.mod \
deterministic_simulations/homotopy_histval.mod \
deterministic_simulations/rbc_det_exo_lag_2a.mod \
deterministic_simulations/rbc_det_exo_lag_2b.mod \
deterministic_simulations/rbc_det_exo_lag_2c.mod \
deterministic_simulations/multiple_lead_lags/sim_base.mod \
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag_aux_vars.mod \
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag.mod \
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag_aux_vars.mod \
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag.mod \
deterministic_simulations/multiple_lead_lags/sim_lead_lag_aux_vars.mod \
deterministic_simulations/multiple_lead_lags/sim_lead_lag.mod \
deterministic_simulations/ramst_block_mfs1.mod \
deterministic_simulations/linear_approximation/sw.mod \
deterministic_simulations/multiple_lead_lags/AR2.mod \
deterministic_simulations/multiple_lead_lags/AR2_forward.mod \
deterministic_simulations/multiple_lead_lags/ramst_augmented_histval.mod \
deterministic_simulations/rbc_det.mod \
deterministic_simulations/rbc_det_stack_solve_algo_7.mod \
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lag.mod \
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lead.mod \
deterministic_simulations/pfwee.mod \
deterministic_simulations/pfwee_constant_sim_length.mod \
deterministic_simulations/pfwee_learnt_in.mod \
lmmcp/rbc.mod \
lmmcp/sw_lmmcp.mod \
lmmcp/sw_newton.mod \
trend_var/fs2000_nonstationary.mod \
2013-04-25 12:24:29 +02:00
trend_var/fs2000_log_nonstationary.mod \
decision_rules/third_order/FV2011.mod \
2015-07-31 22:55:15 +02:00
decision_rules/example1.mod \
2016-11-04 12:10:10 +01:00
decision_rules/ar_qz_test.mod \
shock_decomposition/example1_calib_shock_decomp.mod \
shock_decomposition/fs2000_est.mod \
shock_decomposition/fs2000_est_varlist.mod \
shock_decomposition/fs2000_cal_groups.mod \
shock_decomposition/ls2003_plot.mod \
shock_decomposition/shock_decomp_backward.mod \
2013-08-12 21:52:32 +02:00
stochastic_purely_forward/stochastic_purely_forward.mod \
stochastic_purely_forward/stochastic_purely_forward_with_static.mod \
forecast/Hansen_exo_det_forecast.mod \
forecast/linear_exo_det_forecast.mod \
forecast/ls2003_rolling_window_forecast.mod \
gradient/fs2000_numgrad_13.mod \
gradient/fs2000_numgrad_15.mod \
gradient/fs2000_numgrad_2.mod \
gradient/fs2000_numgrad_3.mod \
2013-12-12 11:26:03 +01:00
gradient/fs2000_numgrad_5.mod \
filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod \
2014-01-29 20:43:23 +01:00
filter_step_ahead/fs2000_filter_step_ahead_ML.mod \
filter_step_ahead/trend_cycle_decomposition.mod \
loglinear/example4_exp.mod \
loglinear/example4_loglinear.mod \
loglinear/example4_loglinear_lagged_exogenous.mod \
loglinear/example4_loglinear_lagged_exogenous_a.mod \
loglinear/example4_exp_histval.mod \
loglinear/example4_loglinear_histval.mod \
smoother2histval/fs2000_simul.mod \
smoother2histval/fs2000_smooth.mod \
2014-06-11 12:32:00 +02:00
smoother2histval/fs2000_smooth_stoch_simul.mod \
smoother2histval/fs2000_smooth_ML.mod \
optimizers/fs2000_1.mod \
optimizers/fs2000_2.mod \
optimizers/fs2000_3.mod \
optimizers/fs2000_4.mod \
optimizers/fs2000_4_with_optim.mod \
optimizers/fs2000_5.mod \
optimizers/fs2000_7.mod \
optimizers/fs2000_101.mod \
optimizers/fs2000_102.mod \
optimizers/fs2000_w.mod \
epilogue/example1.mod \
differentiate_forward_vars/RBC_differentiate_forward.mod \
partitioning/partitions.mod \
2016-03-31 19:55:17 +02:00
prior_posterior_function/fs2000_prior_posterior_function.mod \
observation_trends_and_prefiltering/MCMC/Trend_loglinear_prefilter_MC.mod \
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter.mod \
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter_first_obs.mod \
observation_trends_and_prefiltering/ML/Trend_loglinear_prefilter.mod \
observation_trends_and_prefiltering/ML/Trend_loglinear_prefilter_first_obs.mod \
observation_trends_and_prefiltering/ML/Trend_no_prefilter.mod \
observation_trends_and_prefiltering/ML/Trend_no_prefilter_first_obs.mod \
observation_trends_and_prefiltering/ML/Trend_prefilter.mod \
observation_trends_and_prefiltering/ML/Trend_prefilter_first_obs.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_calib_smoother.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilt_first_obs_cal_smooth.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_calib_smoother.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_prefilt_first_obs_cal_smooth.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_loglin_calib_smoother.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefil_f_obs_loglin_cal_smoother.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_loglin_calib_smoother.mod \
observation_trends_and_prefiltering/calib_smoother/Tr_prefil_f_obs_loglin_cal_smoother.mod \
observation_trends_and_prefiltering/ML/Trend_no_prefilter_selected_var.mod \
bgp/solow-1/solow.mod \
bgp/nk-1/nk.mod \
bgp/ramsey-1/ramsey.mod \
dynare-command-options/ramst.mod \
log_transform/example1.mod \
log_transform/ramst.mod \
log_transform/fs2000_nonstationary.mod \
log_transform/nk_ramsey.mod
ECB_MODFILES = \
var-expectations/1/example1.mod \
var-expectations/1-with-time-shift-a/example1.mod \
var-expectations/2/example1.mod \
var-expectations/2-with-time-shift/example1.mod \
var-expectations/3/example1.mod \
var-expectations/3-with-time-shift/example1.mod \
var-expectations/4/example1.mod \
var-expectations/4-with-time-shift/example1.mod \
var-expectations/5/example1.mod \
var-expectations/5-with-time-shift/example1.mod \
var-expectations/6/example1.mod \
2019-01-16 12:54:30 +01:00
var-expectations/6/substitution.mod \
var-expectations/6-with-time-shift/example1.mod \
var-expectations/6-with-time-shift/substitution.mod \
var-expectations/7/example1.mod \
2019-01-16 12:54:30 +01:00
var-expectations/7/substitution.mod \
var-expectations/8/example1.mod \
2019-01-16 12:54:30 +01:00
var-expectations/8/substitution.mod \
var-expectations/9/example1.mod \
var-expectations/10/example1.mod \
var-expectations/11/example1.mod \
var-expectations/12/example1.mod \
2018-09-12 18:56:03 +02:00
trend-component-and-var-models/vm1.mod \
trend-component-and-var-models/vm2.mod \
trend-component-and-var-models/vm3.mod \
trend-component-and-var-models/vm4.mod \
2019-03-15 14:22:50 +01:00
trend-component-and-var-models/vm5.mod \
2018-09-12 18:56:03 +02:00
trend-component-and-var-models/tcm1.mod \
trend-component-and-var-models/tcm2.mod \
trend-component-and-var-models/tcm3.mod \
trend-component-and-var-models/tcm4.mod \
trend-component-and-var-models/tcm5.mod \
trend-component-and-var-models/tcm6.mod \
trend-component-and-var-models/tcm7.mod \
2019-01-16 12:54:30 +01:00
trend-component-and-var-models/tcm8.mod \
trend-component-and-var-models/tcm9.mod \
trend-component-and-var-models/tcm10.mod \
trend-component-and-var-models/tcm11.mod \
trend-component-and-var-models/tcm12.mod \
trend-component-and-var-models/legacy/vm1.mod \
trend-component-and-var-models/legacy/vm2.mod \
trend-component-and-var-models/legacy/vm3.mod \
trend-component-and-var-models/legacy/tcm1.mod \
trend-component-and-var-models/legacy/tcm2.mod \
trend-component-and-var-models/legacy/tcm3.mod \
trend-component-and-var-models/legacy/tcm4.mod \
trend-component-and-var-models/legacy/tcm5.mod \
pac/var-1/example1.mod \
pac/var-2/example1.mod \
pac/var-3/example1.mod \
pac/var-4/example1.mod \
pac/var-5/example1.mod \
2019-01-16 12:54:30 +01:00
pac/var-5/substitution.mod \
pac/var-6/example1.mod \
pac/var-6/substitution.mod \
pac/var-7/example1.mod \
pac/var-7/substitution.mod \
pac/var-8/example1.mod \
pac/var-8/substitution.mod \
pac/var-8e/example1.mod \
pac/var-9/example1.mod \
pac/var-9/substitution.mod \
pac/var-9e/example1.mod \
pac/var-10e/example1.mod \
pac/var-10e/example2.mod \
pac/var-11e/example1.mod \
pac/var-12/example1.mod \
pac/var-12/example2.mod \
2022-01-19 09:20:22 +01:00
pac/var-12/example3.mod \
pac/var-12/example4.mod \
pac/var-12/example5.mod \
pac/var-12/example11.mod \
pac/var-12/example12.mod \
pac/trend-component-1/example1.mod \
pac/trend-component-2/example1.mod \
pac/trend-component-3/example1.mod \
pac/trend-component-4/example1.mod \
pac/trend-component-5/example1.mod \
pac/trend-component-6/example1.mod \
pac/trend-component-7/example1.mod \
pac/trend-component-9/example1.mod \
pac/trend-component-10/example1.mod \
pac/trend-component-11/example1.mod \
pac/trend-component-12/example1.mod \
pac/trend-component-13a/example1.mod \
pac/trend-component-13b/example1.mod \
pac/trend-component-14/example1.mod \
2019-01-16 12:54:30 +01:00
pac/trend-component-14/substitution.mod \
pac/trend-component-15/example1.mod \
pac/trend-component-16/example1.mod \
pac/trend-component-17/example1.mod \
pac/trend-component-18/example1.mod \
2019-01-30 16:29:21 +01:00
pac/trend-component-19/example1.mod \
pac/trend-component-19/example2.mod \
pac/trend-component-19/example3.mod \
pac/trend-component-19-growth-lin-comb/example1.mod \
2019-03-08 11:16:26 +01:00
pac/trend-component-1-mce/example_det.mod \
pac/trend-component-1-mce/example_sto.mod \
pac/trend-component-2-mce/example_det.mod \
pac/trend-component-2-mce/example_sto.mod \
pac/trend-component-20-1/example1.mod \
pac/trend-component-20-2/example1.mod \
pac/trend-component-20-3/example1.mod \
pac/trend-component-20-4/example1.mod \
pac/trend-component-21/example1.mod \
pac/trend-component-22/example1.mod \
pac/trend-component-23/example1.mod \
pac/trend-component-24/example1.mod \
pac/trend-component-25/example1.mod \
pac/trend-component-26/example1.mod \
pac/trend-component-27/example1.mod \
pac/trend-component-28/example1.mod \
pac/trend-component-28/example2.mod \
pac/trend-component-28/example3.mod \
pac/trend-component-28/example4.mod \
pac/trend-component-28/example5.mod \
pac/trend-component-28/example6.mod \
2021-01-15 15:31:57 +01:00
pac/trend-component-29/example1.mod \
2019-04-02 22:57:23 +02:00
pac/trend-component-29/example2.mod \
pac/trend-component-30/example1.mod \
2019-03-08 11:16:26 +01:00
write/example1.mod \
ecb/backward-models/irf/solow_1.mod \
ecb/backward-models/irf/solow_2.mod \
ecb/cherrypick/test1.mod \
2019-04-29 23:38:47 +02:00
ecb/cherrypick/test2.mod \
2019-05-14 22:12:27 +02:00
ecb/contribution-plots/contrib1.mod \
ecb/contribution-plots/contrib2.mod
OLS_MODFILES = \
2019-01-16 12:54:30 +01:00
estimation/univariate/bayesian.mod \
estimation/univariate/bayesian_param_names.mod \
2019-03-04 11:15:45 +01:00
ecb/SURGibbs/fulton_fish.mod \
2019-01-16 12:54:30 +01:00
estimation/univariate/ols/ols_wc_1.mod \
estimation/univariate/ols/ols_wc_2.mod \
estimation/univariate/ols/ols_wc_3.mod \
2019-03-26 15:02:26 +01:00
estimation/univariate/ols/ols_date_range.mod \
estimation/univariate/ols/ols_param_names.mod \
estimation/univariate/ols/ols_base.mod \
2019-03-06 17:01:59 +01:00
ecb/SUR/sur_noniterative.mod \
2019-03-07 18:06:39 +01:00
ecb/SUR/sur_params_noniterative.mod \
2019-03-04 11:15:45 +01:00
ecb/SUR/panel_var_diff_NB_simulation_test.mod \
ecb/SUR/panel_var_diff_NB_simulation_zero_eq.mod \
ecb/pooled_ols/panel_var_diff_NB_simulation_test.mod \
ecb/pooled_ols/test_param_names.mod \
ecb/pooled_fgls/panel_var_diff_NB_simulation_test.mod \
ecb/pooled_fgls/test_param_names.mod
2019-03-04 11:15:45 +01:00
ECB_MODFILES += $(OLS_MODFILES)
MODFILES += $(ECB_MODFILES)
PARTICLEFILES = \
particle/dsge_base2.mod \
2021-01-16 17:42:17 +01:00
particle/first_spec.mod \
2021-01-18 10:07:23 +01:00
particle/first_spec_MCMC.mod \
particle/local_state_space_iteration_k_test.mod
2012-10-05 12:58:34 +02:00
XFAIL_MODFILES = ramst_xfail.mod \
estim_param_in_shock_value_xfail.mod \
optimal_policy/Ramsey/ramsey_ex_wrong_ss_file_xfail.mod \
estimation/fs2000_mixed_ML_xfail.mod \
estimation/fs2000_stochastic_singularity_xfail.mod \
estimation/heteroskedastic_shocks/fs2000_het_XFAIL.mod \
estimation/heteroskedastic_shocks/fs2000_het_XFAIL2.mod \
identification/ident_unit_root/ident_unit_root_xfail.mod \
Added parameter derivatives of perturbation solution up to 3 order # Preliminary comments I finished the identification toolbox at orders two and three using the pruned state space system, but before I merge request this, I decided to first merge the new functionality to compute parameter derivatives of perturbation solution matrices at higher orders. So after this is approved, I merge the identification toolbox. I guess @rattoma, @sebastien, and @michel are best choices to review this. I outline the main idea first and then provide some more detailed changes I made to the functions. *** # Main idea This merge request is concerned with the *analytical*computation of the parameter derivatives of first, second and third order perturbation solution matrices, i.e. using _closed-form_ expressions to efficiently compute the derivative of $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ *with respect to model parameters* $\theta$. Note that $\theta$ contains model parameters, stderr and corr parameters of shocks. stderr and corr parameters of measurement errors are not yet supported, (they can easily be included as exogenous shocks). The availability of such derivatives is beneficial in terms of more reliable analysis of model sensitivity and parameter identifiability as well as more efficient estimation methods, in particular for models solved up to third order, as it is well-known that numerical derivatives are a tricky business, especially for large models. References for my approach are: * Iskrev (2008, 2010) and Schmitt-Grohé and Uribe (2012, Appendix) who were the first to compute the parameter derivatives analytically at first order, however, using inefficient (sparse) Kronecker products. * Mutschler (2015) who provides the expressions for a second-order, but again using inefficient (sparse) Kronecker products. * Ratto and Iskrev (2012) who show how the first-order system can be solved accurately, fast and efficiently using existing numerical algorithms for generalized Sylvester equations by taking the parameter derivative with respect to each parameter separately. * Julliard and Kamenik (2004) who provide the perturbation solution equation system in tensor notation at any order k. * Levintal (2017) who introduces permutation matrices to express the perturbation solution equation system in matrix notation up to fifth order. Note that @rattoma already implemented the parameter derivatives of $g_x$ and $g_u$ analytically (and numerically), and I rely heavily on his work in `get_first_order_solution_params_derivs.m` (previously `getH.m`). My additions are mainly to this function and thus it is renamed to `get_perturbation_params_derivs.m`. The basic idea of this merge request is to take the second- and third-order perturbation solution systems in Julliard and Kamenik (2004), unfold these into an equivalent matrix representation using permutation matrices as in Levintal (2017). Then extending Ratto and Iskrev (2012) one takes the derivative with respect to each parameter separately and gets a computational problem that is linear, albeit large, as it involves either solving generalized Sylvester equations or taking inverses of highly sparse matrices. I will now briefly summarize the perturbation solution system at third order and the system that results when taking the derivative with respect to parameters. ## Perturbation Solution The following systems arise at first, second, and third order: $(ghx): f_{x} z_{x} = f_{y_{-}^*} + f_{y_0} g_{x} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{x}= A g_{x} + f_{y_{-}^*}=0$ $(ghu): f_{z} z_{u} = f_{y_0} g_{u} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{u} + f_{u}= A g_u + f_u = 0$ $(ghxx) : A g_{xx} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{x}\right) + f_{zz} \left( z_{x} \otimes z_{x} \right) = 0$ $(ghxu) : A g_{xu} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{x} \otimes z_{u} \right) = 0$ $(ghuu) : A g_{uu} + B g_{xx} \left(g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{u} \otimes z_{u} \right) = 0$ $(ghs2) : (A+B) g_{\sigma\sigma} + \left( f_{y^{**}_{+}y^{**}_{+}} \left(g^{**}_{u} \otimes g^{**}_{u}\right) + f_{y^{**}_{+}} g^{**}_{uu}\right)vec(\Sigma) = 0$ $(ghxxx) : A g_{xxx} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{x}\right) + f_{y_{+}}g^{**}_{xx} \left(g^{*}_x \otimes g^{*}_{xx}\right)P_{x\_xx} + f_{zz} \left( z_{x} \otimes z_{xx} \right)P_{x\_xx} + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{x} \right) = 0$ $(ghxxu) : A g_{xxu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{u} \right) + f_{zz} \left( \left( z_{x} \otimes z_{xu} \right)P_{x\_xu} + \left(z_{xx} \otimes z_{u}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{x} \otimes g^{*}_{xu}\right)P_{x\_xu} + \left(g^{*}_{xx} \otimes g^{*}_{u}\right) \right) = 0$ $(ghxuu) : A g_{xuu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( \left( z_{xu} \otimes z_{u} \right)P_{xu\_u} + \left(z_{x} \otimes z_{uu}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{xu} \otimes g^{*}_{u}\right)P_{xu\_u} + \left(g^{*}_{x} \otimes g^{*}_{uu}\right) \right) = 0$ $(ghuuu) : A g_{uuu} + B g_{xxx} \left(g^{*}_{u} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{u} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( z_{u} \otimes z_{uu} \right)P_{u\_uu} + f_{y_{+}}g^{**}_{xx} \left(g^{*}_{u} \otimes g^{*}_{uu}\right)P_{u\_uu} = 0$ $(ghx\sigma\sigma) : A g_{x\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_x + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{x} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{x} \otimes z_{\sigma\sigma}\right) + F_{xu_{+}u_{+}}\left(I_{n_x} \otimes vec(\Sigma)\right) = 0$ $F_{xu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_x^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{xu_{+}} \otimes z_{u_{+}} \right)P_{xu\_u} + \left(z_{x} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{x} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ $(ghu\sigma\sigma) : A g_{u\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_{u} + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{u} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{u} \otimes z_{\sigma\sigma}\right) + F_{uu_{+}u_{+}}\left(I_{n_u} \otimes vec(\Sigma_u)\right) = 0$ $F_{uu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_u^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{uu_{+}} \otimes z_{u_{+}} \right)P_{uu\_u} + \left(z_{u} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{u} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ A and B are the common perturbation matrices: $A = f_{y_0} + \begin{pmatrix} \underbrace{0}_{n\times n_{static}} &\vdots& \underbrace{f_{y^{**}_{+}} \cdot g^{**}_{x}}_{n \times n_{spred}} &\vdots& \underbrace{0}_{n\times n_{frwd}} \end{pmatrix}$and $B = \begin{pmatrix} \underbrace{0}_{n \times n_{static}}&\vdots & \underbrace{0}_{n \times n_{pred}} & \vdots & \underbrace{f_{y^{**}_{+}}}_{n \times n_{sfwrd}} \end{pmatrix}$ and $z=(y_{-}^{\ast}; y; y_{+}^{\ast\ast}; u)$ denotes the dynamic model variables as in `M_.lead_lag_incidence`, $y^\ast$ denote state variables, $y^{\ast\ast}$ denote forward looking variables, $y_+$ denote the variables with a lead, $y_{-}$ denote variables with a lag, $y_0$ denote variables at period t, $f$ the model equations, and $f_z$ the first-order dynamic model derivatives, $f_{zz}$ the second-order dynamic derivatives, and $f_{zzz}$ the third-order dynamic model derivatives. Then: $z_{x} = \begin{pmatrix}I\\g_{x}\\g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{u} =\begin{pmatrix}0\\g_{u}\\g^{**}_{x} \cdot g^{*}_{u}\\I\end{pmatrix}$, $z_{u_{+}} =\begin{pmatrix}0\\0\\g^{**}_{u}\\0\end{pmatrix}$ $z_{xx} = \begin{pmatrix} 0\\g_{xx}\\g^{**}_{x} \left( g^{*}_x \otimes g^{*}_{x} \right) + g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{xu} =\begin{pmatrix}0\\g_{xu}\\g^{**}_{xx} \left( g^{*}_x \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{xu}\\0\end{pmatrix}$, $z_{uu} =\begin{pmatrix}0\\g_{uu}\\g^{**}_{xx} \left( g^{*}_u \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{uu}\\0\end{pmatrix}$, $z_{xu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_x \otimes I \right)\\0\end{pmatrix}$, $z_{uu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_{u} \otimes I \right)\\0\end{pmatrix}$, $z_{u_{+}u_{+}} =\begin{pmatrix}0\\0\\g^{\ast\ast}_{uu}\\0\end{pmatrix}$, $z_{\sigma\sigma} = \begin{pmatrix}0\\ g_{\sigma\sigma}\\ g^{\ast\ast}_{x}g^{\ast}_{\sigma\sigma} + g^{\ast\ast}_{\sigma\sigma}\\0 \end{pmatrix}$ $P$ are permutation matrices that can be computed using Matlab's `ipermute` function. ## Parameter derivatives of perturbation solutions First, we need the parameter derivatives of first, second, third, and fourth derivatives of the dynamic model (i.e. g1,g2,g3,g4 in dynamic files), I make use of the implicit function theorem: Let $f_{z^k}$ denote the kth derivative (wrt all dynamic variables) of the dynamic model, then let $df_{z^k}$ denote the first-derivative (wrt all model parameters) of $f_{z^k}$ evaluated at the steady state. Note that $f_{z^k}$ is a function of both the model parameters $\theta$ and of the steady state of all dynamic variables $\bar{z}$, which also depend on the parameters. Hence, implicitly $f_{z^k}=f_{z^k}(\theta,\bar{z}(\theta))$ and $df_{z^k}$ consists of two parts: 1. direct derivative wrt to all model parameters given by the preprocessor in the `_params_derivs.m` files 2. contribution of derivative of steady state of dynamic variables (wrt all model parameters): $f_{z^{k+1}} \cdot d\bar{z}$ Note that we already have functionality to compute $d\bar{z}$ analytically. Having this, the above perturbation systems are basically equations of the following types $AX +BXC = RHS$ or $AX = RHS$ Now when taking the derivative (wrt to one single parameter $\theta_j$), we get $A\mathrm{d}\{X\} + B\mathrm{d}\{X\}C = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X - \mathrm{d}\{B\}XC - BX\mathrm{d}\{C\}$ or $A\mathrm{d}\{X\} = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X$ The first one is a Sylvester type equation, the second one can be solved by taking the inverse of $A$. The only diffculty and tedious work arrises in computing (the highly sparse) derivatives of $RHS$. *** # New functions: ` ## get_perturbation_params_derivs.m`and `get_perturbation_params_derivs_numerical_objective.m` * The parameter derivatives up to third order are computed in the new function`get_perturbation_params_derivs.m` both analytically and numerically. For numerical derivatives `get_perturbation_params_derivs_numerical_objective.m` is the objective for `fjaco.m` or `hessian_sparse.m` or `hessian.m`. * `get_perturbation_params_derivs.m` is basically an extended version of the previous `get_first_order_solution_params_derivs.m` function. * * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It is used for numerical derivatives, whenever `analytic_derivation_mode=-1|-2`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. * Detailed changes: * Most important: notation of this function is now in accordance to the k_order_solver, i.e. we do not compute derivatives of Kalman transition matrices A and B, but rather the solution matrices ghx,ghu,ghxx,ghxu,ghuu,ghs2,ghxxx,ghxxu,ghxuu,ghuuu,ghxss,ghuss in accordance with notation used in `oo_.dr`. As a byproduct at first-order, focusing on ghx and ghu instead of Kalman transition matrices A and B makes the computations slightly faster for large models (e.g. for Quest the computations were faster by a couple of seconds, not much, but okay). * Removed use of `kstate`, see also Dynare/dynare#1653 and Dynare/dynare!1656 * Output arguments are stored in a structure `DERIVS`, there is also a flag `d2flag` that computes parameter hessians needed only in `dsge_likelihood.m`. * Removed `kronflag` as input. `options_.analytic_derivation_mode` is now used instead of `kronflag`. * Removed `indvar`, an index that was used to selected specific variables in the derivatives. This is not needed, as we always compute the parameter derivatives for all variables first and then select a subset of variables. The selection now takes place in other functions, like `dsge_likelihood.m`. * Introduced some checks: (i) deterministic exogenous variables are not supported, (ii) Kronecker method only compatible with first-order approximation so reset to sylvester method, (iii) for purely backward or forward models we need to be careful with the rows in `M_.lead_la g_incidence`, (iv) if `_params_derivs.m` files are missing an error is thrown. * For numerical derivatives, if mod file does not contain an `estimated_params_block`, a temporary one with the most important parameter information is created. ## `unfold_g4.m` * When evaluating g3 and g4 one needs to take into account that these do not contain symmetric elements, so one needs to use `unfold_g3.m` and the new function `unfold_g4.m`. This returns an unfolded version of the same matrix (i.e. with symmetric elements). *** # New test models `.gitignore` and `Makefile.am` are changed accordingly. Also now it is possible to run test suite on analytic_derivatives, i.e. run `make check m/analytic_derivatives` ## `analytic_derivatives/BrockMirman_PertParamsDerivs.mod` * This is the Brock Mirman model, where we know the exact policy function $g$ for capital and consumption. As this does not imply a nonzero $g_{\sigma\sigma}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ I added some artificial equations to get nonzero solution matrices with respect to $\sigma$. The true perturbation solution matrices $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ are then computed analytically with Matlab's symbolic toolbox and saved in `nBrockMirmanSYM.mat`. There is a preprocessor flag that recreates these analytical computations if changes are needed (and to check whether I made some errors here ;-) ) * Then solution matrices up to third order and their parameter Jacobians are then compared to the ones computed by Dynare's `k_order_solver` and by `get_perturbation_params_derivs` for all `analytic_derivation_mode`'s. There will be an error if the maximum absolute deviation is too large, i.e. for numerical derivatives (`analytic_derivation_mode=-1|-2`) the tolerance is choosen lower (around 1e-5); for analytical methods we are stricter: around 1e-13 for first-order, 1e-12 for second order, and 1e-11 for third-order. * As a side note, this mod file also checks Dynare's `k_order_solver` algorithm and throws an error if something is wrong. * This test model shows that the new functionality works well. And analytical derivatives perform way better and accurate than numerical ones, even for this small model. ## `analytic_derivatives/burnside_3_order_PertParamsDerivs.mod` * This builds upon `tests/k_order_perturbation/burnside_k_order.mod` and computes the true parameter derivatives analytically by hand. * This test model also shows that the new functionality works well. ## `analytic_derivatives/LindeTrabandt2019.mod` * Shows that the new functionality also works for medium-sized models, i.e. a SW type model solved at third order with 35 variables (11 states). 2 shocks and 20 parameters. * This mod file can be used to tweak the speed of the computations in the future. * Compares numerical versus analytical parameter derivatives (for first, second and third order). Note that this model clearly shows that numerical ones are quite different than analytical ones even at first order! ## `identification/LindeTrabandt2019_xfail.mod` * This model is a check for issue Dynare/dynare#1595, see fjaco.m below, and will fail. * Removed `analytic_derivatives/ls2003.mod` as this mod file is neither in the testsuite nor does it work. *** # Detailed changes in other functions ## `get_first_order_solution_params_derivs.m` * Deleted, or actually, renamed to `get_perturbation_params_derivs.m`, as this function now is able to compute the derivatives up to third order ## `identification_numerical_objective.m` * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. ## `dsge_likelihood.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `T`matrix anymore, but instead of the dynare solution matrix `ghx`. So we recreate `T` here as this amounts to adding some zeros and focusing on selected variables only. * Added some checks to make sure the first-order approximation is selected. * Removed `kron_flag` as input, as `get_perturbation_params_derivs` looks into `options_.analytic_derivation_mode` for `kron_flag`. ## `dynare_identification.m` * make sure that setting `analytic_derivation_mode` is set both in `options_ident` and `options_`. Note that at the end of the function we restore the `options_` structure, so all changes are local. In a next merge request, I will remove the global variables to make all variables local. ## `get_identification_jacobians.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `A` and `B` matrix anymore, but instead of the dynare solution matrix `ghx` and `ghu`. So we recreate these matrices here instead of in `get_perturbation_params_derivs.m`. * Added `str2func` for better function handles in `fjaco.m`. ## `fjaco.m` * make `tol`an option, which can be adjusted by changing `options_.dynatol.x`for identification and parameter derivatives purposes. * include a check and an informative error message, if numerical derivatives (two-sided finite difference method) yield errors in `resol.m` for identification and parameter derivatives purposes. This closes issue Dynare/dynare#1595. * Changed year of copyright to 2010-2017,2019 *** # Further suggestions and questions * Ones this is merged, I will merge request an improvement of the identification toolbox, which will work up to third order using the pruned state space. This will also remove some issues and bugs, and also I will remove global variables in this request. * The third-order derivatives can be further improved by taking sparsity into account and use mex versions for kronecker products etc. I leave this for further testing (and if anybody actually uses this ;-) )
2019-12-17 19:17:09 +01:00
identification/LindeTrabandt/LindeTrabandt2019_xfail.mod \
steady_state/Linear_steady_state_xfail.mod \
optimal_policy/Ramsey/ramsey_histval_xfail.mod \
occbin/model_irrcap_twoconstraints/dynrbc_token_xfail.mod \
particle/first_spec_xfail_0.mod \
particle/first_spec_xfail_1.mod \
kalman_initial_state/fs2000_kalman_initial_xfail.mod \
example1_extra_exo_xfail.mod \
estimation/tune_mh_jscale/fs2000_1_xfail.mod \
estimation/tune_mh_jscale/fs2000_2_xfail.mod \
estimation/no_init_estimation_check_first_obs/fs2000_init_check_XFAIL.mod \
estimation/no_init_estimation_check_first_obs/fs2000_init_check_XFAIL2.mod \
var-expectations/1-with-time-shift-b/example1.mod \
estimation/univariate/nls/staticmodelx.mod
2012-11-07 12:02:35 +01:00
MFILES = histval_initval_file/ramst_initval_file_data.m
2012-10-05 12:58:34 +02:00
# Dependencies
2021-02-15 17:21:43 +01:00
optimal_policy/neo_growth_ramsey.m.trs: optimal_policy/neo_growth.m.trs
optimal_policy/neo_growth_ramsey.o.trs: optimal_policy/neo_growth.o.trs
optimal_policy/neo_growth_ramsey_foresight.m.trs: optimal_policy/neo_growth_foresight.m.trs
optimal_policy/neo_growth_ramsey_foresight.o.trs: optimal_policy/neo_growth_foresight.o.trs
optimal_policy/neo_growth_ramsey_k_order.m.trs: optimal_policy/neo_growth_k_order.m.trs
optimal_policy/neo_growth_ramsey_k_order.o.trs: optimal_policy/neo_growth_k_order.o.trs
occbin/model_irrcap_twoconstraints/dynrbc_0_std_shocks.m.trs: occbin/model_irrcap_twoconstraints/dynrbc.m.trs
occbin/model_irrcap_twoconstraints/dynrbc_0_std_shocks.o.trs: occbin/model_irrcap_twoconstraints/dynrbc.o.trs
occbin/model_borrcon/borrcon_0_std_shocks.m.trs: occbin/model_borrcon/borrcon.m.trs
occbin/model_borrcon/borrcon_0_std_shocks.o.trs: occbin/model_borrcon/borrcon.o.trs
2012-10-05 12:58:34 +02:00
example1_use_dll.m.trs: example1.m.trs
example1_use_dll.o.trs: example1.o.trs
example2long_use_dll.m.trs: example1long.m.trs
example2long_use_dll.o.trs: example1long.o.trs
example2long.m.trs: example1long.m.trs
example2long.o.trs: example1long.o.trs
estimation/MH_recover/fs2000_recover_tarb.m.trs: estimation/MH_recover/fs2000_recover.m.trs
estimation/MH_recover/fs2000_recover_tarb.o.trs: estimation/MH_recover/fs2000_recover.o.trs
2012-10-05 12:58:34 +02:00
k_order_perturbation/fs2000k_1_m.m.trs: k_order_perturbation/fs2000k2_m.m.trs
k_order_perturbation/fs2000k2_m.m.trs k_order_perturbation/fs2000k3_m.m.trs k_order_perturbation/fs2000k2_use_dll.m.trs k_order_perturbation/fs2000k3_use_dll.m.trs: k_order_perturbation/fs2000k2a.m.trs
k_order_perturbation/fs2000k_1_use_dll.m.trs: k_order_perturbation/fs2000k2_use_dll.m.trs
k_order_perturbation/fs2000k4.m.trs: k_order_perturbation/fs2000k++.mat
2012-10-05 12:58:34 +02:00
k_order_perturbation/fs2000k_1_m.o.trs: k_order_perturbation/fs2000k2_m.o.trs
k_order_perturbation/fs2000k2_m.o.trs k_order_perturbation/fs2000k3_m.o.trs k_order_perturbation/fs2000k2_use_dll.o.trs k_order_perturbation/fs2000k3_use_dll.o.trs: k_order_perturbation/fs2000k2a.o.trs
k_order_perturbation/fs2000k_1_use_dll.o.trs: k_order_perturbation/fs2000k2_use_dll.o.trs
k_order_perturbation/fs2000k4.o.trs: k_order_perturbation/fs2000k++.mat
k_order_perturbation/fs2000k++.mat: k_order_perturbation/fs2000k++.mod ../dynare++/src/dynare++$(EXEEXT)
cd k_order_perturbation && ../../dynare++/src/dynare++ --order 3 --no-centralize fs2000k++.mod
2012-10-05 12:58:34 +02:00
kalman_filter_smoother/algo1.m.trs kalman_filter_smoother/algo3.m.trs kalman_filter_smoother/algo4a.m.trs kalman_filter_smoother/algo4b.m.trs kalman_filter_smoother/algoH1.m.trs kalman_filter_smoother/algoH3.m.trs kalman_filter_smoother/fs2000.m.trs kalman_filter_smoother/fs2000_1.m.trs kalman_filter_smoother/fs2000_2.m.trs kalman_filter_smoother/fs2000a.m.trs: kalman_filter_smoother/gen_data.m.trs
kalman_filter_smoother/algo1.o.trs kalman_filter_smoother/algo3.o.trs kalman_filter_smoother/algo4a.o.trs kalman_filter_smoother/algo4b.o.trs kalman_filter_smoother/algoH1.o.trs kalman_filter_smoother/algoH3.o.trs kalman_filter_smoother/fs2000.o.trs kalman_filter_smoother/fs2000_1.o.trs kalman_filter_smoother/fs2000_2.o.trs kalman_filter_smoother/fs2000a.o.trs: kalman_filter_smoother/gen_data.o.trs
kalman_filter_smoother/algo2.m.trs: kalman_filter_smoother/algo1.m.trs
kalman_filter_smoother/algo2.o.trs: kalman_filter_smoother/algo1.o.trs
kalman_filter_smoother/algoH2.m.trs: kalman_filter_smoother/algoH1.m.trs
kalman_filter_smoother/algoH2.o.trs: kalman_filter_smoother/algoH1.o.trs
kalman_filter_smoother/algo4.m.trs: kalman_filter_smoother/algo3.m.trs
kalman_filter_smoother/algo4.o.trs: kalman_filter_smoother/algo3.o.trs
2016-11-24 10:00:34 +01:00
kalman_filter_smoother/test_compute_Pinf_Pstar.m.trs: kalman_filter_smoother/test_compute_Pinf_Pstar_data.m.trs
kalman_filter_smoother/test_compute_Pinf_Pstar.o.trs: kalman_filter_smoother/test_compute_Pinf_Pstar_data.o.trs
2021-09-11 11:26:55 +02:00
optimal_policy/Ramsey/ramsey_ex.m.trs: optimal_policy/Ramsey/ramsey_ex_initval.m.trs
optimal_policy/Ramsey/ramsey_ex.o.trs: optimal_policy/Ramsey/ramsey_ex_initval.o.trs
2012-10-05 12:58:34 +02:00
optimal_policy/nk_ramsey_expectation_a.m.trs: optimal_policy/nk_ramsey_expectation.m.trs
optimal_policy/nk_ramsey_expectation_a.o.trs: optimal_policy/nk_ramsey_expectation.o.trs
second_order/ds2.m.trs: second_order/ds1.m.trs
second_order/ds2.o.trs: second_order/ds1.o.trs
AIM/fs2000_b1L1L_AIM.m.trs: AIM/fs2000_b1L1L.m.trs
AIM/fs2000x10L9_L_AIM.m.trs: AIM/fs2000x10L9_L.m.trs
AIM/fs2000x10_L9_L_AIM.m.trs: AIM/fs2000x10_L9_L.m.trs
AIM/ls2003_2L0L_AIM.m.trs: AIM/ls2003_2L0L.m.trs
AIM/ls2003_2L2L_AIM.m.trs: AIM/ls2003_2L2L.m.trs
AIM/fs2000_b1L1L_AIM.o.trs: AIM/fs2000_b1L1L.o.trs
AIM/fs2000x10L9_L_AIM.o.trs: AIM/fs2000x10L9_L.o.trs
AIM/fs2000x10_L9_L_AIM.o.trs: AIM/fs2000x10_L9_L.o.trs
AIM/ls2003_2L0L_AIM.o.trs: AIM/ls2003_2L0L.o.trs
AIM/ls2003_2L2L_AIM.o.trs: AIM/ls2003_2L2L.o.trs
2015-08-06 08:59:48 +02:00
estimation/fs2000_model_comparison.m.trs: estimation/fs2000.m.trs estimation/fs2000_initialize_from_calib.m.trs estimation/fs2000_calibrated_covariance.m.trs
estimation/fs2000_model_comparison.o.trs: estimation/fs2000.o.trs estimation/fs2000_initialize_from_calib.o.trs estimation/fs2000_calibrated_covariance.o.trs
estimation/fs2000_init_from_previous.m.trs: estimation/fs2000.m.trs
estimation/fs2000_init_from_previous.o.trs: estimation/fs2000.o.trs
2015-08-06 08:59:48 +02:00
2015-06-01 18:21:30 +02:00
optimizers/fs2000_102.m.trs: estimation/fs2000.m.trs
optimizers/fs2000_102.o.trs: estimation/fs2000.o.trs
2012-10-16 11:10:13 +02:00
arima/mod1a.m.trs: arima/mod1.m.trs
arima/mod1b.m.trs: arima/mod1.m.trs
arima/mod1c.m.trs: arima/mod1.m.trs
arima/mod1a.o.trs: arima/mod1.o.trs
arima/mod1b.o.trs: arima/mod1.o.trs
arima/mod1c.o.trs: arima/mod1.o.trs
arima/mod2a.m.trs: arima/mod2.m.trs
arima/mod2b.m.trs: arima/mod2.m.trs
arima/mod2c.m.trs: arima/mod2.m.trs
arima/mod2a.o.trs: arima/mod2.o.trs
arima/mod2b.o.trs: arima/mod2.o.trs
arima/mod2c.o.trs: arima/mod2.o.trs
dsge-var/dsgevar_forward_calibrated_lambda.m.trs: dsge-var/simul_hybrid.m.trs
dsge-var/dsgevar_forward_estimated_lambda.m.trs: dsge-var/simul_hybrid.m.trs
dsge-var/dsgevar_forward_calibrated_lambda.o.trs: dsge-var/simul_hybrid.o.trs
dsge-var/dsgevar_forward_estimated_lambda.o.trs: dsge-var/simul_hybrid.o.trs
external_function/first_deriv_given.m.trs: external_function/benchmark.m.trs
external_function/first_deriv_given.o.trs: external_function/benchmark.o.trs
external_function/first_deriv_given_dll.m.trs: external_function/benchmark.m.trs
external_function/first_deriv_given_dll.o.trs: external_function/benchmark.o.trs
external_function/first_and_2nd_deriv_given.m.trs: external_function/benchmark.m.trs
external_function/first_and_2nd_deriv_given.o.trs: external_function/benchmark.o.trs
external_function/first_and_2nd_deriv_given_dll.m.trs: external_function/benchmark.m.trs
external_function/first_and_2nd_deriv_given_dll.o.trs: external_function/benchmark.o.trs
external_function/first_and_2nd_deriv_given_namespace.m.trs: external_function/benchmark.m.trs
external_function/first_and_2nd_deriv_given_namespace.o.trs: external_function/benchmark.o.trs
external_function/first_and_2nd_deriv_given_dll_namespace.m.trs: external_function/benchmark.m.trs
external_function/first_and_2nd_deriv_given_dll_namespace.o.trs: external_function/benchmark.o.trs
external_function/no_deriv_given.m.trs: external_function/benchmark.m.trs
external_function/no_deriv_given.o.trs: external_function/benchmark.o.trs
external_function/no_deriv_given_dll.m.trs: external_function/benchmark.m.trs
external_function/no_deriv_given_dll.o.trs: external_function/benchmark.o.trs
external_function/extfun_in_mlv.m.trs: external_function/benchmark.m.trs
external_function/extfun_in_mlv.o.trs: external_function/benchmark.o.trs
smoother2histval/fs2000_simul.m.trs: smoother2histval/fs2000_smooth.m.trs
smoother2histval/fs2000_simul.o.trs: smoother2histval/fs2000_smooth.o.trs
deterministic_simulations/rbc_det_exo_lag_2b.m.trs: deterministic_simulations/rbc_det_exo_lag_2a.m.trs
deterministic_simulations/rbc_det_exo_lag_2c.m.trs: deterministic_simulations/rbc_det_exo_lag_2a.m.trs
deterministic_simulations/rbc_det_exo_lag_2b.o.trs: deterministic_simulations/rbc_det_exo_lag_2a.o.trs
deterministic_simulations/rbc_det_exo_lag_2c.o.trs: deterministic_simulations/rbc_det_exo_lag_2a.o.trs
deterministic_simulations/rbc_det_stack_solve_algo_7.m.trs: deterministic_simulations/rbc_det.m.trs
deterministic_simulations/rbc_det_stack_solve_algo_7.o.trs: deterministic_simulations/rbc_det.o.trs
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lead.m.trs: deterministic_simulations/rbc_det.m.trs
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lead.o.trs: deterministic_simulations/rbc_det.o.trs
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lag.m.trs: deterministic_simulations/rbc_det.m.trs
deterministic_simulations/rbc_det_stack_solve_algo_7_exo_lag.o.trs: deterministic_simulations/rbc_det.o.trs
block_bytecode/lola_solve_one_boundary_mfs1.m.trs: block_bytecode/lola_solve_one_boundary.m.trs
block_bytecode/lola_solve_one_boundary_mfs1.o.trs: block_bytecode/lola_solve_one_boundary.o.trs
block_bytecode/lola_solve_one_boundary_mfs2.m.trs: block_bytecode/lola_solve_one_boundary.m.trs
block_bytecode/lola_solve_one_boundary_mfs2.o.trs: block_bytecode/lola_solve_one_boundary.o.trs
block_bytecode/lola_solve_one_boundary_mfs3.m.trs: block_bytecode/lola_solve_one_boundary.m.trs
block_bytecode/lola_solve_one_boundary_mfs3.o.trs: block_bytecode/lola_solve_one_boundary.o.trs
block_bytecode/lola_stochastic_block.m.trs: block_bytecode/lola_stochastic.m.trs
block_bytecode/lola_stochastic_block.o.trs: block_bytecode/lola_stochastic.o.trs
histval_initval_file/ramst_initval_file.m.trs: histval_initval_file/ramst_initval_file_data.m.tls histval_initval_file/ramst_data_generate.m.trs
histval_initval_file/ramst_initval_file.o.trs: histval_initval_file/ramst_initval_file_data.o.tls histval_initval_file/ramst_data_generate.o.trs
histval_initval_file/ramst_datafile.m.trs: histval_initval_file/ramst_initval_file_data.m.tls
histval_initval_file/ramst_datafile.o.trs: histval_initval_file/ramst_initval_file_data.o.tls
histval_initval_file/sim_exo_lead_lag_initvalf.m.trs: histval_initval_file/sim_exo_lead_lag.m.trs
histval_initval_file/sim_exo_lead_lag_initvalf.o.trs: histval_initval_file/sim_exo_lead_lag.o.trs
histval_initval_file_unit_tests.m.trs: histval_initval_file/ramst_data_generate.m.trs
histval_initval_file_unit_tests.o.trs: histval_initval_file/ramst_data_generate.o.trs
identification/rbc_ident/rbc_ident_varexo_only.m.trs: identification/rbc_ident/rbc_ident_std_as_structural_par.m.trs
identification/rbc_ident/rbc_ident_varexo_only.o.trs: identification/rbc_ident/rbc_ident_std_as_structural_par.o.trs
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag_aux_vars.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag_aux_vars.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag_aux_vars.m.trs
deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs deterministic_simulations/multiple_lead_lags/sim_exo_lead_lag_aux_vars.o.trs
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag_aux_vars.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag_aux_vars.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag_aux_vars.m.trs
deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs deterministic_simulations/multiple_lead_lags/sim_endo_lead_lag_aux_vars.o.trs
deterministic_simulations/multiple_lead_lags/sim_lead_lag_aux_vars.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs
deterministic_simulations/multiple_lead_lags/sim_lead_lag_aux_vars.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs
deterministic_simulations/multiple_lead_lags/sim_lead_lag.m.trs: deterministic_simulations/multiple_lead_lags/sim_base.m.trs deterministic_simulations/multiple_lead_lags/sim_lead_lag_aux_vars.m.trs
deterministic_simulations/multiple_lead_lags/sim_lead_lag.o.trs: deterministic_simulations/multiple_lead_lags/sim_base.o.trs deterministic_simulations/multiple_lead_lags/sim_lead_lag_aux_vars.o.trs
deterministic_simulations/multiple_lead_lags/ramst_augmented_histval.m.trs: ramst.m.trs
deterministic_simulations/multiple_lead_lags/ramst_augmented_histval.o.trs: ramst.o.trs
loglinear/example4_loglinear.m.trs: loglinear/example4_exp.m.trs
loglinear/example4_loglinear.o.trs: loglinear/example4_exp.o.trs
loglinear/example4_loglinear_lagged_exogenous_a.m.trs: loglinear/example4_loglinear_lagged_exogenous.m.trs
loglinear/example4_loglinear_lagged_exogenous_a.o.trs: loglinear/example4_loglinear_lagged_exogenous.o.trs
loglinear/example4_loglinear_histval.m.trs: loglinear/example4_exp_histval.m.trs
loglinear/example4_loglinear_histval.o.trs: loglinear/example4_exp_histval.o.trs
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter_first_obs.m.trs: observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter.m.trs
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter_first_obs.o.trs: observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter.o.trs
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter.m.trs: observation_trends_and_prefiltering/ML/Trend_no_prefilter.m.trs
observation_trends_and_prefiltering/ML/Trend_loglinear_no_prefilter.o.trs: observation_trends_and_prefiltering/ML/Trend_no_prefilter.o.trs
2016-06-16 18:57:35 +02:00
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_first_obs_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_loglinear_no_prefilter_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_first_obs_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_loglinear_no_prefilter_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_first_obs_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_first_obs_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_loglinear_prefilter_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_loglinear_prefilter_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_no_prefilter_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_loglinear_prefilter_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_loglinear_prefilter_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.o.trs
observation_trends_and_prefiltering/MCMC/Trend_loglin_no_prefilt_first_obs_MC.m.trs: observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.m.trs
observation_trends_and_prefiltering/MCMC/Trend_loglin_no_prefilt_first_obs_MC.o.trs: observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefil_f_obs_loglin_cal_smoother.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_calib_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefil_f_obs_loglin_cal_smoother.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_calib_smoother.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_loglin_calib_smoother.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefil_f_obs_loglin_cal_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_loglin_calib_smoother.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefil_f_obs_loglin_cal_smoother.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilt_first_obs_cal_smooth.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_loglin_calib_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilt_first_obs_cal_smooth.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilter_loglin_calib_smoother.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefil_f_obs_loglin_cal_smoother.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilt_first_obs_cal_smooth.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefil_f_obs_loglin_cal_smoother.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_no_prefilt_first_obs_cal_smooth.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_calib_smoother.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefil_f_obs_loglin_cal_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_calib_smoother.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefil_f_obs_loglin_cal_smoother.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_loglin_calib_smoother.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_calib_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_loglin_calib_smoother.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_calib_smoother.o.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilt_first_obs_cal_smooth.m.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_loglin_calib_smoother.m.trs
observation_trends_and_prefiltering/calib_smoother/Tr_prefilt_first_obs_cal_smooth.o.trs: observation_trends_and_prefiltering/calib_smoother/Tr_prefilter_loglin_calib_smoother.o.trs
2016-06-16 18:55:23 +02:00
kalman/likelihood_from_dynare/fs2000_corr_ME.m.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000_corr_ME.o.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.o.trs
kalman/likelihood_from_dynare/fs2000_uncorr_ME_missing.m.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000_uncorr_ME_missing.o.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.o.trs
kalman/likelihood_from_dynare/fs2000_corr_ME_missing.m.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000_corr_ME_missing.o.trs: kalman/likelihood_from_dynare/fs2000_uncorr_ME.o.trs
2016-06-16 18:57:35 +02:00
kalman/likelihood_from_dynare/fs2000ns_corr_ME.m.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000ns_corr_ME.o.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.o.trs
kalman/likelihood_from_dynare/fs2000ns_uncorr_ME_missing.m.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000ns_uncorr_ME_missing.o.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.o.trs
kalman/likelihood_from_dynare/fs2000ns_corr_ME_missing.m.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.m.trs
kalman/likelihood_from_dynare/fs2000ns_corr_ME_missing.o.trs: kalman/likelihood_from_dynare/fs2000ns_uncorr_ME.o.trs
var-expectations/6/substitution.m.trs: var-expectations/6/example1.m.trs
var-expectations/6/substitution.o.trs: var-expectations/6/example1.o.trs
var-expectations/6-with-time-shift/substitution.m.trs: var-expectations/6-with-time-shift/example1.m.trs
var-expectations/6-with-time-shift/substitution.o.trs: var-expectations/6-with-time-shift/example1.o.trs
var-expectations/7/substitution.m.trs: var-expectations/7/example1.m.trs
var-expectations/7/substitution.o.trs: var-expectations/7/example1.o.trs
var-expectations/8/substitution.m.trs: var-expectations/8/example1.m.trs
var-expectations/8/substitution.o.trs: var-expectations/8/example1.o.trs
pac/var-5/substitution.m.trs: pac/var-5/example1.m.trs
pac/var-5/substitution.o.trs: pac/var-5/example1.o.trs
pac/var-6/substitution.m.trs: pac/var-6/example1.m.trs
pac/var-6/substitution.o.trs: pac/var-6/example1.o.trs
pac/var-7/substitution.m.trs: pac/var-7/example1.m.trs
pac/var-7/substitution.o.trs: pac/var-7/example1.o.trs
pac/var-8/substitution.m.trs: pac/var-8/example1.m.trs
pac/var-8/substitution.o.trs: pac/var-8/example1.o.trs
pac/var-9/substitution.m.trs: pac/var-9/example1.m.trs
pac/var-9/substitution.o.trs: pac/var-9/example1.o.trs
pac/var-10e/example2.m.trs: pac/var-10e/example1.m.trs
pac/var-10e/example2.o.trs: pac/var-10e/example1.o.trs
pac/trend-component-14/substitution.m.trs: pac/trend-component-14/example1.m.trs
pac/trend-component-14/substitution.o.trs: pac/trend-component-14/example1.o.trs
lmmcp/sw_newton.m.trs: lmmcp/sw_lmmcp.m.trs
lmmcp/sw_newton.o.trs: lmmcp/sw_lmmcp.o.trs
var-expectations/4/example1.m.trs: var-expectations/3/example1.m.trs
var-expectations/4/example1.o.trs: var-expectations/3/example1.o.trs
var-expectations/4-with-time-shift/example1.m.trs: var-expectations/3-with-time-shift/example1.m.trs
var-expectations/4-with-time-shift/example1.o.trs: var-expectations/3-with-time-shift/example1.o.trs
trend-component-and-var-models/tcm7.m.trs: trend-component-and-var-models/tcm6.m.trs
trend-component-and-var-models/tcm7.o.trs: trend-component-and-var-models/tcm6.o.trs
trend-component-and-var-models/tcm8.m.trs: trend-component-and-var-models/tcm6.m.trs
trend-component-and-var-models/tcm8.o.trs: trend-component-and-var-models/tcm6.o.trs
discretionary_policy/dennis_1_estim.m.trs: discretionary_policy/dennis_1.m.trs
discretionary_policy/dennis_1_estim.o.trs: discretionary_policy/dennis_1.o.trs
discretionary_policy/Gali_2015_chapter_3_nonlinear.m.trs: discretionary_policy/Gali_2015_chapter_3.m.trs
discretionary_policy/Gali_2015_chapter_3_nonlinear.o.trs: discretionary_policy/Gali_2015_chapter_3.o.trs
particle/local_state_space_iteration_k_test.m.trs: particle/first_spec.m.trs
particle/local_state_space_iteration_k_test.o.trs: particle/first_spec.o.trs
particle/local_it_k_test_parallel.m.trs: particle/first_spec.m.trs
particle/local_it_k_test_parallel.o.trs: particle/first_spec.o.trs
pruning/AS_pruned_state_space_red_shock.m.trs: pruning/AnSchorfheide_pruned_state_space.m.trs
pruning/AS_pruned_state_space_red_shock.o.trs: pruning/AnSchorfheide_pruned_state_space.o.trs
ramst_model_edit.m.trs: ramst.m.trs
ramst_model_edit.o.trs: ramst.o.trs
log_transform/ramst.m.trs: ramst.m.trs
log_transform/ramst.o.trs: ramst.o.trs
observation_trends_and_prefiltering/MCMC: m/observation_trends_and_prefiltering/MCMC o/observation_trends_and_prefiltering/MCMC
m/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
o/observation_trends_and_prefiltering/MCMC: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/MCMC/%.mod, $(MODFILES)))
observation_trends_and_prefiltering/ML: m/observation_trends_and_prefiltering/ML o/observation_trends_and_prefiltering/ML
m/observation_trends_and_prefiltering/ML: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/ML/%.mod, $(MODFILES)))
o/observation_trends_and_prefiltering/ML: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/ML/%.mod, $(MODFILES)))
observation_trends_and_prefiltering/calib_smoother: m/observation_trends_and_prefiltering/calib_smoother o/observation_trends_and_prefiltering/calib_smoother
m/observation_trends_and_prefiltering/calib_smoother: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/calib_smoother/%.mod, $(MODFILES)))
o/observation_trends_and_prefiltering/calib_smoother: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/calib_smoother/%.mod, $(MODFILES)))
observation_trends_and_prefiltering: m/observation_trends_and_prefiltering o/observation_trends_and_prefiltering
m/observation_trends_and_prefiltering: $(patsubst %.mod, %.m.trs, $(filter observation_trends_and_prefiltering/%.mod, $(MODFILES)))
o/observation_trends_and_prefiltering: $(patsubst %.mod, %.o.trs, $(filter observation_trends_and_prefiltering/%.mod, $(MODFILES)))
stochastic-backward-models: m/stochastic-backward-models o/stochastic-backward-models
m/stochastic-backward-models: $(patsubst %.mod, %.m.trs, $(filter stochastic-backward-models/%.mod, $(MODFILES)))
o/stochastic-backward-models: $(patsubst %.mod, %.o.trs, $(filter stochastic-backward-models/%.mod, $(MODFILES)))
arima: m/arima o/arima
m/arima: $(patsubst %.mod, %.m.trs, $(filter arima/%.mod, $(MODFILES)))
o/arima: $(patsubst %.mod, %.o.trs, $(filter arima/%.mod, $(MODFILES)))
homotopy: m/homotopy o/homotopy
m/homotopy: $(patsubst %.mod, %.m.trs, $(filter homotopy/%.mod, $(MODFILES)))
o/homotopy: $(patsubst %.mod, %.o.trs, $(filter homotopy/%.mod, $(MODFILES)))
expectations: m/expectations o/expectations
m/expectations: $(patsubst %.mod, %.m.trs, $(filter expectations/%.mod, $(MODFILES)))
o/expectations: $(patsubst %.mod, %.o.trs, $(filter expectations/%.mod, $(MODFILES)))
external_function: m/external_function o/external_function
m/external_function: $(patsubst %.mod, %.m.trs, $(filter external_function/%.mod, $(MODFILES)))
o/external_function: $(patsubst %.mod, %.o.trs, $(filter external_function/%.mod, $(MODFILES)))
on-the-fly: m/on-the-fly o/on-the-fly
m/on-the-fly: $(patsubst %.mod, %.m.trs, $(filter on-the-fly/%.mod, $(MODFILES)))
o/on-the-fly: $(patsubst %.mod, %.o.trs, $(filter on-the-fly/%.mod, $(MODFILES)))
trend_var: m/trend_var o/trend_var
m/trend_var: $(patsubst %.mod, %.m.trs, $(filter trend_var/%.mod, $(MODFILES)))
o/trend_var: $(patsubst %.mod, %.o.trs, $(filter trend_var/%.mod, $(MODFILES)))
moments: m/moments o/moments
m/moments: $(patsubst %.mod, %.m.trs, $(filter moments/%.mod, $(MODFILES)))
o/moments: $(patsubst %.mod, %.o.trs, $(filter moments/%.mod, $(MODFILES)))
AIM: m/AIM o/AIM
m/AIM: $(patsubst %.mod, %.m.trs, $(filter AIM/%.mod, $(MODFILES)))
o/AIM: $(patsubst %.mod, %.o.trs, $(filter AIM/%.mod, $(MODFILES)))
second_order: m/second_order o/second_order
m/second_order: $(patsubst %.mod, %.m.trs, $(filter second_order/%.mod, $(MODFILES)))
o/second_order: $(patsubst %.mod, %.o.trs, $(filter second_order/%.mod, $(MODFILES)))
decision_rules: m/decision_rules o/decision_rules
m/decision_rules: $(patsubst %.mod, %.m.trs, $(filter decision_rules/%.mod, $(MODFILES)))
o/decision_rules: $(patsubst %.mod, %.o.trs, $(filter decision_rules/%.mod, $(MODFILES)))
k_order_perturbation: m/k_order_perturbation o/k_order_perturbation
m/k_order_perturbation: $(patsubst %.mod, %.m.trs, $(filter k_order_perturbation/%.mod, $(MODFILES)))
o/k_order_perturbation: $(patsubst %.mod, %.o.trs, $(filter k_order_perturbation/%.mod, $(MODFILES)))
optimal_policy/OSR: m/optimal_policy/OSR o/optimal_policy/OSR
m/optimal_policy/OSR: $(patsubst %.mod, %.m.trs, $(filter optimal_policy/OSR/%.mod, $(MODFILES)))
o/optimal_policy/OSR: $(patsubst %.mod, %.o.trs, $(filter optimal_policy/OSR/%.mod, $(MODFILES)))
optimal_policy/Ramsey: m/optimal_policy/Ramsey o/optimal_policy/Ramsey
m/optimal_policy/Ramsey: $(patsubst %.mod, %.m.trs, $(filter optimal_policy/Ramsey/%.mod, $(MODFILES)))
o/optimal_policy/Ramsey: $(patsubst %.mod, %.o.trs, $(filter optimal_policy/Ramsey/%.mod, $(MODFILES)))
optimal_policy: m/optimal_policy o/optimal_policy
m/optimal_policy: $(patsubst %.mod, %.m.trs, $(filter optimal_policy/%.mod, $(MODFILES)))
o/optimal_policy: $(patsubst %.mod, %.o.trs, $(filter optimal_policy/%.mod, $(MODFILES)))
discretionary_policy: m/discretionary_policy o/discretionary_policy
m/discretionary_policy: $(patsubst %.mod, %.m.trs, $(filter discretionary_policy/%.mod, $(MODFILES)))
o/discretionary_policy: $(patsubst %.mod, %.o.trs, $(filter discretionary_policy/%.mod, $(MODFILES)))
steady_state: m/steady_state o/steady_state
m/steady_state: $(patsubst %.mod, %.m.trs, $(filter steady_state/%.mod, $(MODFILES)))
o/steady_state: $(patsubst %.mod, %.o.trs, $(filter steady_state/%.mod, $(MODFILES)))
steady_state_operator: m/steady_state_operator o/steady_state_operator
m/steady_state_operator: $(patsubst %.mod, %.m.trs, $(filter steady_state_operator/%.mod, $(MODFILES)))
o/steady_state_operator: $(patsubst %.mod, %.o.trs, $(filter steady_state_operator/%.mod, $(MODFILES)))
deterministic_simulations/multiple_lead_lags: m/deterministic_simulations/multiple_lead_lags o/deterministic_simulations/multiple_lead_lags
m/deterministic_simulations/multiple_lead_lags: $(patsubst %.mod, %.m.trs, $(filter deterministic_simulations/multiple_lead_lags/%.mod, $(MODFILES)))
o/deterministic_simulations/multiple_lead_lags: $(patsubst %.mod, %.o.trs, $(filter deterministic_simulations/multiple_lead_lags/%.mod, $(MODFILES)))
deterministic_simulations: m/deterministic_simulations o/deterministic_simulations
m/deterministic_simulations: $(patsubst %.mod, %.m.trs, $(filter deterministic_simulations/%.mod, $(MODFILES)))
o/deterministic_simulations: $(patsubst %.mod, %.o.trs, $(filter deterministic_simulations/%.mod, $(MODFILES)))
simul: m/simul o/simul
m/simul: $(patsubst %.mod, %.m.trs, $(filter simul/%.mod, $(MODFILES)))
o/simul: $(patsubst %.mod, %.o.trs, $(filter simul/%.mod, $(MODFILES)))
ep: m/ep o/ep
m/ep: $(patsubst %.mod, %.m.trs, $(filter ep/%.mod, $(MODFILES)))
o/ep: $(patsubst %.mod, %.o.trs, $(filter ep/%.mod, $(MODFILES)))
ms-sbvar: m/ms-sbvar o/ms-sbvar
m/ms-sbvar: $(patsubst %.mod, %.m.trs, $(filter ms-sbvar/%.mod, $(MODFILES)))
o/ms-sbvar: $(patsubst %.mod, %.o.trs, $(filter ms-sbvar/%.mod, $(MODFILES)))
lmmcp: m/lmmcp o/lmmcp
m/lmmcp: $(patsubst %.mod, %.m.trs, $(filter lmmcp/%.mod, $(MODFILES)))
o/lmmcp: $(patsubst %.mod, %.o.trs, $(filter lmmcp/%.mod, $(MODFILES)))
loglinear: m/loglinear o/loglinear
m/loglinear: $(patsubst %.mod, %.m.trs, $(filter loglinear/%.mod, $(MODFILES)))
o/loglinear: $(patsubst %.mod, %.o.trs, $(filter loglinear/%.mod, $(MODFILES)))
gsa: m/gsa o/gsa
m/gsa: $(patsubst %.mod, %.m.trs, $(filter gsa/%.mod, $(MODFILES)))
o/gsa: $(patsubst %.mod, %.o.trs, $(filter gsa/%.mod, $(MODFILES)))
identification: m/identification o/identification
m/identification: $(patsubst %.mod, %.m.trs, $(filter identification/%.mod, $(MODFILES)))
o/identification: $(patsubst %.mod, %.o.trs, $(filter identification/%.mod, $(MODFILES)))
Added parameter derivatives of perturbation solution up to 3 order # Preliminary comments I finished the identification toolbox at orders two and three using the pruned state space system, but before I merge request this, I decided to first merge the new functionality to compute parameter derivatives of perturbation solution matrices at higher orders. So after this is approved, I merge the identification toolbox. I guess @rattoma, @sebastien, and @michel are best choices to review this. I outline the main idea first and then provide some more detailed changes I made to the functions. *** # Main idea This merge request is concerned with the *analytical*computation of the parameter derivatives of first, second and third order perturbation solution matrices, i.e. using _closed-form_ expressions to efficiently compute the derivative of $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ *with respect to model parameters* $\theta$. Note that $\theta$ contains model parameters, stderr and corr parameters of shocks. stderr and corr parameters of measurement errors are not yet supported, (they can easily be included as exogenous shocks). The availability of such derivatives is beneficial in terms of more reliable analysis of model sensitivity and parameter identifiability as well as more efficient estimation methods, in particular for models solved up to third order, as it is well-known that numerical derivatives are a tricky business, especially for large models. References for my approach are: * Iskrev (2008, 2010) and Schmitt-Grohé and Uribe (2012, Appendix) who were the first to compute the parameter derivatives analytically at first order, however, using inefficient (sparse) Kronecker products. * Mutschler (2015) who provides the expressions for a second-order, but again using inefficient (sparse) Kronecker products. * Ratto and Iskrev (2012) who show how the first-order system can be solved accurately, fast and efficiently using existing numerical algorithms for generalized Sylvester equations by taking the parameter derivative with respect to each parameter separately. * Julliard and Kamenik (2004) who provide the perturbation solution equation system in tensor notation at any order k. * Levintal (2017) who introduces permutation matrices to express the perturbation solution equation system in matrix notation up to fifth order. Note that @rattoma already implemented the parameter derivatives of $g_x$ and $g_u$ analytically (and numerically), and I rely heavily on his work in `get_first_order_solution_params_derivs.m` (previously `getH.m`). My additions are mainly to this function and thus it is renamed to `get_perturbation_params_derivs.m`. The basic idea of this merge request is to take the second- and third-order perturbation solution systems in Julliard and Kamenik (2004), unfold these into an equivalent matrix representation using permutation matrices as in Levintal (2017). Then extending Ratto and Iskrev (2012) one takes the derivative with respect to each parameter separately and gets a computational problem that is linear, albeit large, as it involves either solving generalized Sylvester equations or taking inverses of highly sparse matrices. I will now briefly summarize the perturbation solution system at third order and the system that results when taking the derivative with respect to parameters. ## Perturbation Solution The following systems arise at first, second, and third order: $(ghx): f_{x} z_{x} = f_{y_{-}^*} + f_{y_0} g_{x} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{x}= A g_{x} + f_{y_{-}^*}=0$ $(ghu): f_{z} z_{u} = f_{y_0} g_{u} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{u} + f_{u}= A g_u + f_u = 0$ $(ghxx) : A g_{xx} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{x}\right) + f_{zz} \left( z_{x} \otimes z_{x} \right) = 0$ $(ghxu) : A g_{xu} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{x} \otimes z_{u} \right) = 0$ $(ghuu) : A g_{uu} + B g_{xx} \left(g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{u} \otimes z_{u} \right) = 0$ $(ghs2) : (A+B) g_{\sigma\sigma} + \left( f_{y^{**}_{+}y^{**}_{+}} \left(g^{**}_{u} \otimes g^{**}_{u}\right) + f_{y^{**}_{+}} g^{**}_{uu}\right)vec(\Sigma) = 0$ $(ghxxx) : A g_{xxx} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{x}\right) + f_{y_{+}}g^{**}_{xx} \left(g^{*}_x \otimes g^{*}_{xx}\right)P_{x\_xx} + f_{zz} \left( z_{x} \otimes z_{xx} \right)P_{x\_xx} + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{x} \right) = 0$ $(ghxxu) : A g_{xxu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{u} \right) + f_{zz} \left( \left( z_{x} \otimes z_{xu} \right)P_{x\_xu} + \left(z_{xx} \otimes z_{u}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{x} \otimes g^{*}_{xu}\right)P_{x\_xu} + \left(g^{*}_{xx} \otimes g^{*}_{u}\right) \right) = 0$ $(ghxuu) : A g_{xuu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( \left( z_{xu} \otimes z_{u} \right)P_{xu\_u} + \left(z_{x} \otimes z_{uu}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{xu} \otimes g^{*}_{u}\right)P_{xu\_u} + \left(g^{*}_{x} \otimes g^{*}_{uu}\right) \right) = 0$ $(ghuuu) : A g_{uuu} + B g_{xxx} \left(g^{*}_{u} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{u} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( z_{u} \otimes z_{uu} \right)P_{u\_uu} + f_{y_{+}}g^{**}_{xx} \left(g^{*}_{u} \otimes g^{*}_{uu}\right)P_{u\_uu} = 0$ $(ghx\sigma\sigma) : A g_{x\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_x + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{x} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{x} \otimes z_{\sigma\sigma}\right) + F_{xu_{+}u_{+}}\left(I_{n_x} \otimes vec(\Sigma)\right) = 0$ $F_{xu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_x^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{xu_{+}} \otimes z_{u_{+}} \right)P_{xu\_u} + \left(z_{x} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{x} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ $(ghu\sigma\sigma) : A g_{u\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_{u} + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{u} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{u} \otimes z_{\sigma\sigma}\right) + F_{uu_{+}u_{+}}\left(I_{n_u} \otimes vec(\Sigma_u)\right) = 0$ $F_{uu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_u^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{uu_{+}} \otimes z_{u_{+}} \right)P_{uu\_u} + \left(z_{u} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{u} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ A and B are the common perturbation matrices: $A = f_{y_0} + \begin{pmatrix} \underbrace{0}_{n\times n_{static}} &\vdots& \underbrace{f_{y^{**}_{+}} \cdot g^{**}_{x}}_{n \times n_{spred}} &\vdots& \underbrace{0}_{n\times n_{frwd}} \end{pmatrix}$and $B = \begin{pmatrix} \underbrace{0}_{n \times n_{static}}&\vdots & \underbrace{0}_{n \times n_{pred}} & \vdots & \underbrace{f_{y^{**}_{+}}}_{n \times n_{sfwrd}} \end{pmatrix}$ and $z=(y_{-}^{\ast}; y; y_{+}^{\ast\ast}; u)$ denotes the dynamic model variables as in `M_.lead_lag_incidence`, $y^\ast$ denote state variables, $y^{\ast\ast}$ denote forward looking variables, $y_+$ denote the variables with a lead, $y_{-}$ denote variables with a lag, $y_0$ denote variables at period t, $f$ the model equations, and $f_z$ the first-order dynamic model derivatives, $f_{zz}$ the second-order dynamic derivatives, and $f_{zzz}$ the third-order dynamic model derivatives. Then: $z_{x} = \begin{pmatrix}I\\g_{x}\\g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{u} =\begin{pmatrix}0\\g_{u}\\g^{**}_{x} \cdot g^{*}_{u}\\I\end{pmatrix}$, $z_{u_{+}} =\begin{pmatrix}0\\0\\g^{**}_{u}\\0\end{pmatrix}$ $z_{xx} = \begin{pmatrix} 0\\g_{xx}\\g^{**}_{x} \left( g^{*}_x \otimes g^{*}_{x} \right) + g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{xu} =\begin{pmatrix}0\\g_{xu}\\g^{**}_{xx} \left( g^{*}_x \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{xu}\\0\end{pmatrix}$, $z_{uu} =\begin{pmatrix}0\\g_{uu}\\g^{**}_{xx} \left( g^{*}_u \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{uu}\\0\end{pmatrix}$, $z_{xu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_x \otimes I \right)\\0\end{pmatrix}$, $z_{uu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_{u} \otimes I \right)\\0\end{pmatrix}$, $z_{u_{+}u_{+}} =\begin{pmatrix}0\\0\\g^{\ast\ast}_{uu}\\0\end{pmatrix}$, $z_{\sigma\sigma} = \begin{pmatrix}0\\ g_{\sigma\sigma}\\ g^{\ast\ast}_{x}g^{\ast}_{\sigma\sigma} + g^{\ast\ast}_{\sigma\sigma}\\0 \end{pmatrix}$ $P$ are permutation matrices that can be computed using Matlab's `ipermute` function. ## Parameter derivatives of perturbation solutions First, we need the parameter derivatives of first, second, third, and fourth derivatives of the dynamic model (i.e. g1,g2,g3,g4 in dynamic files), I make use of the implicit function theorem: Let $f_{z^k}$ denote the kth derivative (wrt all dynamic variables) of the dynamic model, then let $df_{z^k}$ denote the first-derivative (wrt all model parameters) of $f_{z^k}$ evaluated at the steady state. Note that $f_{z^k}$ is a function of both the model parameters $\theta$ and of the steady state of all dynamic variables $\bar{z}$, which also depend on the parameters. Hence, implicitly $f_{z^k}=f_{z^k}(\theta,\bar{z}(\theta))$ and $df_{z^k}$ consists of two parts: 1. direct derivative wrt to all model parameters given by the preprocessor in the `_params_derivs.m` files 2. contribution of derivative of steady state of dynamic variables (wrt all model parameters): $f_{z^{k+1}} \cdot d\bar{z}$ Note that we already have functionality to compute $d\bar{z}$ analytically. Having this, the above perturbation systems are basically equations of the following types $AX +BXC = RHS$ or $AX = RHS$ Now when taking the derivative (wrt to one single parameter $\theta_j$), we get $A\mathrm{d}\{X\} + B\mathrm{d}\{X\}C = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X - \mathrm{d}\{B\}XC - BX\mathrm{d}\{C\}$ or $A\mathrm{d}\{X\} = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X$ The first one is a Sylvester type equation, the second one can be solved by taking the inverse of $A$. The only diffculty and tedious work arrises in computing (the highly sparse) derivatives of $RHS$. *** # New functions: ` ## get_perturbation_params_derivs.m`and `get_perturbation_params_derivs_numerical_objective.m` * The parameter derivatives up to third order are computed in the new function`get_perturbation_params_derivs.m` both analytically and numerically. For numerical derivatives `get_perturbation_params_derivs_numerical_objective.m` is the objective for `fjaco.m` or `hessian_sparse.m` or `hessian.m`. * `get_perturbation_params_derivs.m` is basically an extended version of the previous `get_first_order_solution_params_derivs.m` function. * * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It is used for numerical derivatives, whenever `analytic_derivation_mode=-1|-2`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. * Detailed changes: * Most important: notation of this function is now in accordance to the k_order_solver, i.e. we do not compute derivatives of Kalman transition matrices A and B, but rather the solution matrices ghx,ghu,ghxx,ghxu,ghuu,ghs2,ghxxx,ghxxu,ghxuu,ghuuu,ghxss,ghuss in accordance with notation used in `oo_.dr`. As a byproduct at first-order, focusing on ghx and ghu instead of Kalman transition matrices A and B makes the computations slightly faster for large models (e.g. for Quest the computations were faster by a couple of seconds, not much, but okay). * Removed use of `kstate`, see also Dynare/dynare#1653 and Dynare/dynare!1656 * Output arguments are stored in a structure `DERIVS`, there is also a flag `d2flag` that computes parameter hessians needed only in `dsge_likelihood.m`. * Removed `kronflag` as input. `options_.analytic_derivation_mode` is now used instead of `kronflag`. * Removed `indvar`, an index that was used to selected specific variables in the derivatives. This is not needed, as we always compute the parameter derivatives for all variables first and then select a subset of variables. The selection now takes place in other functions, like `dsge_likelihood.m`. * Introduced some checks: (i) deterministic exogenous variables are not supported, (ii) Kronecker method only compatible with first-order approximation so reset to sylvester method, (iii) for purely backward or forward models we need to be careful with the rows in `M_.lead_la g_incidence`, (iv) if `_params_derivs.m` files are missing an error is thrown. * For numerical derivatives, if mod file does not contain an `estimated_params_block`, a temporary one with the most important parameter information is created. ## `unfold_g4.m` * When evaluating g3 and g4 one needs to take into account that these do not contain symmetric elements, so one needs to use `unfold_g3.m` and the new function `unfold_g4.m`. This returns an unfolded version of the same matrix (i.e. with symmetric elements). *** # New test models `.gitignore` and `Makefile.am` are changed accordingly. Also now it is possible to run test suite on analytic_derivatives, i.e. run `make check m/analytic_derivatives` ## `analytic_derivatives/BrockMirman_PertParamsDerivs.mod` * This is the Brock Mirman model, where we know the exact policy function $g$ for capital and consumption. As this does not imply a nonzero $g_{\sigma\sigma}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ I added some artificial equations to get nonzero solution matrices with respect to $\sigma$. The true perturbation solution matrices $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ are then computed analytically with Matlab's symbolic toolbox and saved in `nBrockMirmanSYM.mat`. There is a preprocessor flag that recreates these analytical computations if changes are needed (and to check whether I made some errors here ;-) ) * Then solution matrices up to third order and their parameter Jacobians are then compared to the ones computed by Dynare's `k_order_solver` and by `get_perturbation_params_derivs` for all `analytic_derivation_mode`'s. There will be an error if the maximum absolute deviation is too large, i.e. for numerical derivatives (`analytic_derivation_mode=-1|-2`) the tolerance is choosen lower (around 1e-5); for analytical methods we are stricter: around 1e-13 for first-order, 1e-12 for second order, and 1e-11 for third-order. * As a side note, this mod file also checks Dynare's `k_order_solver` algorithm and throws an error if something is wrong. * This test model shows that the new functionality works well. And analytical derivatives perform way better and accurate than numerical ones, even for this small model. ## `analytic_derivatives/burnside_3_order_PertParamsDerivs.mod` * This builds upon `tests/k_order_perturbation/burnside_k_order.mod` and computes the true parameter derivatives analytically by hand. * This test model also shows that the new functionality works well. ## `analytic_derivatives/LindeTrabandt2019.mod` * Shows that the new functionality also works for medium-sized models, i.e. a SW type model solved at third order with 35 variables (11 states). 2 shocks and 20 parameters. * This mod file can be used to tweak the speed of the computations in the future. * Compares numerical versus analytical parameter derivatives (for first, second and third order). Note that this model clearly shows that numerical ones are quite different than analytical ones even at first order! ## `identification/LindeTrabandt2019_xfail.mod` * This model is a check for issue Dynare/dynare#1595, see fjaco.m below, and will fail. * Removed `analytic_derivatives/ls2003.mod` as this mod file is neither in the testsuite nor does it work. *** # Detailed changes in other functions ## `get_first_order_solution_params_derivs.m` * Deleted, or actually, renamed to `get_perturbation_params_derivs.m`, as this function now is able to compute the derivatives up to third order ## `identification_numerical_objective.m` * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. ## `dsge_likelihood.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `T`matrix anymore, but instead of the dynare solution matrix `ghx`. So we recreate `T` here as this amounts to adding some zeros and focusing on selected variables only. * Added some checks to make sure the first-order approximation is selected. * Removed `kron_flag` as input, as `get_perturbation_params_derivs` looks into `options_.analytic_derivation_mode` for `kron_flag`. ## `dynare_identification.m` * make sure that setting `analytic_derivation_mode` is set both in `options_ident` and `options_`. Note that at the end of the function we restore the `options_` structure, so all changes are local. In a next merge request, I will remove the global variables to make all variables local. ## `get_identification_jacobians.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `A` and `B` matrix anymore, but instead of the dynare solution matrix `ghx` and `ghu`. So we recreate these matrices here instead of in `get_perturbation_params_derivs.m`. * Added `str2func` for better function handles in `fjaco.m`. ## `fjaco.m` * make `tol`an option, which can be adjusted by changing `options_.dynatol.x`for identification and parameter derivatives purposes. * include a check and an informative error message, if numerical derivatives (two-sided finite difference method) yield errors in `resol.m` for identification and parameter derivatives purposes. This closes issue Dynare/dynare#1595. * Changed year of copyright to 2010-2017,2019 *** # Further suggestions and questions * Ones this is merged, I will merge request an improvement of the identification toolbox, which will work up to third order using the pruned state space. This will also remove some issues and bugs, and also I will remove global variables in this request. * The third-order derivatives can be further improved by taking sparsity into account and use mex versions for kronecker products etc. I leave this for further testing (and if anybody actually uses this ;-) )
2019-12-17 19:17:09 +01:00
analytic_derivatives: m/analytic_derivatives o/analytic_derivatives
m/analytic_derivatives: $(patsubst %.mod, %.m.trs, $(filter analytic_derivatives/%.mod, $(MODFILES)))
o/analytic_derivatives: $(patsubst %.mod, %.o.trs, $(filter analytic_derivatives/%.mod, $(MODFILES)))
pruning: m/pruning o/pruning
m/pruning: $(patsubst %.mod, %.m.trs, $(filter pruning/%.mod, $(MODFILES)))
o/pruning: $(patsubst %.mod, %.o.trs, $(filter pruning/%.mod, $(MODFILES)))
fs2000: m/fs2000 o/fs2000
m/fs2000: $(patsubst %.mod, %.m.trs, $(filter fs2000/%.mod, $(MODFILES)))
o/fs2000: $(patsubst %.mod, %.o.trs, $(filter fs2000/%.mod, $(MODFILES)))
estimation/MH_recover: m/estimation/MH_recover o/estimation/MH_recover
m/estimation/MH_recover: $(patsubst %.mod, %.m.trs, $(filter estimation/MH_recover/%.mod, $(MODFILES)))
o/estimation/MH_recover: $(patsubst %.mod, %.o.trs, $(filter estimation/MH_recover/%.mod, $(MODFILES)))
estimation: m/estimation o/estimation
m/estimation: $(patsubst %.mod, %.m.trs, $(filter estimation/%.mod, $(MODFILES)))
o/estimation: $(patsubst %.mod, %.o.trs, $(filter estimation/%.mod, $(MODFILES)))
kalman/likelihood_from_dynare: m/kalman/likelihood_from_dynare o/kalman/likelihood_from_dynare
m/kalman/likelihood_from_dynare: $(patsubst %.mod, %.m.trs, $(filter kalman/likelihood_from_dynare/%.mod, $(MODFILES)))
o/kalman/likelihood_from_dynare: $(patsubst %.mod, %.o.trs, $(filter kalman/likelihood_from_dynare/%.mod, $(MODFILES)))
kalman/lik_init: m/kalman/lik_init o/kalman/lik_init
m/kalman/lik_init: $(patsubst %.mod, %.m.trs, $(filter kalman/lik_init/%.mod, $(MODFILES)))
o/kalman/lik_init: $(patsubst %.mod, %.o.trs, $(filter kalman/lik_init/%.mod, $(MODFILES)))
kalman: m/kalman o/kalman
m/kalman: $(patsubst %.mod, %.m.trs, $(filter kalman/%.mod, $(MODFILES)))
o/kalman: $(patsubst %.mod, %.o.trs, $(filter kalman/%.mod, $(MODFILES)))
dsge-var: m/dsge-var o/dsge-var
m/dsge-var: $(patsubst %.mod, %.m.trs, $(filter dsge-var/%.mod, $(MODFILES)))
o/dsge-var: $(patsubst %.mod, %.o.trs, $(filter dsge-var/%.mod, $(MODFILES)))
kalman_filter_smoother: m/kalman_filter_smoother o/kalman_filter_smoother
m/kalman_filter_smoother: $(patsubst %.mod, %.m.trs, $(filter kalman_filter_smoother/%.mod, $(MODFILES)))
o/kalman_filter_smoother: $(patsubst %.mod, %.o.trs, $(filter kalman_filter_smoother/%.mod, $(MODFILES)))
shock_decomposition: m/shock_decomposition o/shock_decomposition
m/shock_decomposition: $(patsubst %.mod, %.m.trs, $(filter shock_decomposition/%.mod, $(MODFILES)))
o/shock_decomposition: $(patsubst %.mod, %.o.trs, $(filter shock_decomposition/%.mod, $(MODFILES)))
conditional_forecasts: m/conditional_forecasts o/conditional_forecasts
m/conditional_forecasts: $(patsubst %.mod, %.m.trs, $(filter conditional_forecasts/%.mod, $(MODFILES)))
o/conditional_forecasts: $(patsubst %.mod, %.o.trs, $(filter conditional_forecasts/%.mod, $(MODFILES)))
optimizers: m/optimizers o/optimizers
m/optimizers: $(patsubst %.mod, %.m.trs, $(filter optimizers/%.mod, $(MODFILES)))
o/optimizers: $(patsubst %.mod, %.o.trs, $(filter optimizers/%.mod, $(MODFILES)))
gradient: m/gradient o/gradient
m/gradient: $(patsubst %.mod, %.m.trs, $(filter gradient/%.mod, $(MODFILES)))
o/gradient: $(patsubst %.mod, %.o.trs, $(filter gradient/%.mod, $(MODFILES)))
var-expectations: m/var-expectations o/var-expectations
m/var-expectations: $(patsubst %.mod, %.m.trs, $(filter var-expectations/%.mod, $(MODFILES)))
o/var-expectations: $(patsubst %.mod, %.o.trs, $(filter var-expectations/%.mod, $(MODFILES)))
estimation/univariate/ols: m/estimation/univariate/ols o/estimation/univariate/ols
m/estimation/univariate/ols: $(patsubst %.mod, %.m.trs, $(filter estimation/univariate/ols/%.mod, $(MODFILES)))
o/estimation/univariate/ols: $(patsubst %.mod, %.o.trs, $(filter estimation/univariate/ols/%.mod, $(MODFILES)))
trend-component-and-var-models: m/trend-component-and-var-models o/trend-component-and-var-models
m/trend-component-and-var-models: $(patsubst %.mod, %.m.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
o/trend-component-and-var-models: $(patsubst %.mod, %.o.trs, $(filter trend-component-and-var-models/%.mod, $(MODFILES)))
2018-09-06 23:42:30 +02:00
pac: m/pac o/pac
m/pac: $(patsubst %.mod, %.m.trs, $(filter pac/%.mod, $(MODFILES)))
o/pac: $(patsubst %.mod, %.o.trs, $(filter pac/%.mod, $(MODFILES)))
particle: m/particle o/particle
m/particle: $(patsubst %.mod, %.m.trs, $(PARTICLEFILES))
o/particle: $(patsubst %.mod, %.o.trs, $(PARTICLEFILES))
method_of_moments: m/method_of_moments o/method_of_moments
m/method_of_moments: $(patsubst %.mod, %.m.trs, $(filter estimation/method_of_moments/%.mod, $(MODFILES)))
o/method_of_moments: $(patsubst %.mod, %.o.trs, $(filter estimation/method_of_moments/%.mod, $(MODFILES)))
ecb: m/ecb o/ecb
m/ecb: $(patsubst %.mod, %.m.trs, $(filter ecb/%.mod, $(MODFILES)))
o/ecb: $(patsubst %.mod, %.o.trs, $(filter ecb/%.mod, $(MODFILES)))
estimation/univariate: m/estimation/univariate o/estimation/univariate
m/estimation/univariate: $(patsubst %.mod, %.m.trs, $(filter estimation/univariate/%.mod, $(MODFILES)))
o/estimation/univariate: $(patsubst %.mod, %.o.trs, $(filter estimation/univariate/%.mod, $(MODFILES)))
# ECB files
M_ECB_TRS_FILES = $(patsubst %.mod, %.m.trs, $(ECB_MODFILES))
# Just OLS files
M_OLS_TRS_FILES = $(patsubst %.mod, %.m.trs, $(OLS_MODFILES))
2012-10-05 12:58:34 +02:00
# Matlab TRS Files
2012-11-07 12:02:35 +01:00
M_TRS_FILES = $(patsubst %.mod, %.m.trs, $(MODFILES))
2021-01-16 17:42:17 +01:00
M_TRS_FILES += $(patsubst %.mod, %.m.trs, $(PARTICLEFILES))
M_TRS_FILES += run_block_byte_tests_matlab.m.trs \
run_reporting_test_matlab.m.trs \
run_all_unitary_tests.m.trs \
histval_initval_file_unit_tests.m.trs \
test_aggregate_routine_1_2.m.trs \
test_aggregate_routine_1_2_3.m.trs \
run_kronecker_tests.m.trs \
nonlinearsolvers.m.trs
2012-11-07 12:02:35 +01:00
M_XFAIL_TRS_FILES = $(patsubst %.mod, %.m.trs, $(XFAIL_MODFILES))
2012-10-05 12:58:34 +02:00
# Octave TRS Files
2012-11-07 12:02:35 +01:00
O_TRS_FILES = $(patsubst %.mod, %.o.trs, $(MODFILES))
2021-01-16 17:42:17 +01:00
O_TRS_FILES += $(patsubst %.mod, %.o.trs, $(PARTICLEFILES))
O_TRS_FILES += run_block_byte_tests_octave.o.trs \
run_reporting_test_octave.o.trs \
run_all_unitary_tests.o.trs \
histval_initval_file_unit_tests.o.trs \
run_kronecker_tests.o.trs \
nonlinearsolvers.o.trs
2012-11-07 12:02:35 +01:00
O_XFAIL_TRS_FILES = $(patsubst %.mod, %.o.trs, $(XFAIL_MODFILES))
2012-10-05 12:58:34 +02:00
# Matlab TLS Files
M_TLS_FILES = $(patsubst %.m, %.m.tls, $(MFILES))
# Octave TLS Files
O_TLS_FILES = $(patsubst %.m, %.o.tls, $(MFILES))
EXTRA_DIST = \
2012-10-05 12:58:34 +02:00
read_trs_files.sh \
run_test_matlab.m \
run_test_octave.m \
run_m_script.m \
load_octave_packages.m \
$(MODFILES) \
$(PARTICLEFILES) \
2012-11-07 12:02:35 +01:00
$(XFAIL_MODFILES) \
$(MFILES) \
2012-10-05 12:58:34 +02:00
run_block_byte_tests_matlab.m \
run_block_byte_tests_octave.m \
2013-06-24 15:19:56 +02:00
run_reporting_test_matlab.m \
run_reporting_test_octave.m \
run_all_unitary_tests.m \
+matlab/+namespace/y_k.m \
2013-06-25 16:37:18 +02:00
reporting/AnnualTable.m \
reporting/CommResidTablePage.m \
reporting/CountryGraphPage.m \
reporting/CountryTablePage.m \
reporting/ResidTablePage.m \
reporting/db_a.csv \
reporting/db_q.csv \
reporting/dc_a.csv \
reporting/dc_q.csv \
reporting/runDynareReport.m \
homotopy/common.mod \
block_bytecode/ls2003.mod \
fs2000_ssfile_aux.m \
utils/printMakeCheckMatlabErrMsg.m \
utils/printMakeCheckOctaveErrMsg.m \
utils/fataltest.m \
AIM/data_ca1.m \
AIM/fsdat.m \
block_bytecode/run_ls2003.m \
block_bytecode/lola_data.mat \
block_bytecode/lola_common.inc \
bvar_a_la_sims/bvar_sample.m \
dates/fsdat_simul.m \
dates/data_uav.xlsx \
external_function/extFunDeriv.m \
external_function/extFunNoDerivs.m \
external_function/extFunWithFirstAndSecondDerivs.m \
external_function/+matlab/+namespace/extFunNoDerivsNamespace.m \
external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m \
expectations/expectation_ss_old_steadystate.m \
filter_step_ahead/trend_cycle_decomposition_data.m \
steady_state/walsh1_old_ss_steadystate.m \
data/test.xlsx \
gsa/morris/nk_est_data.m \
gsa/data_ca1.m \
gsa/data_ca1.mat \
analytic_derivatives/fsdat_simul.m \
Added parameter derivatives of perturbation solution up to 3 order # Preliminary comments I finished the identification toolbox at orders two and three using the pruned state space system, but before I merge request this, I decided to first merge the new functionality to compute parameter derivatives of perturbation solution matrices at higher orders. So after this is approved, I merge the identification toolbox. I guess @rattoma, @sebastien, and @michel are best choices to review this. I outline the main idea first and then provide some more detailed changes I made to the functions. *** # Main idea This merge request is concerned with the *analytical*computation of the parameter derivatives of first, second and third order perturbation solution matrices, i.e. using _closed-form_ expressions to efficiently compute the derivative of $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ *with respect to model parameters* $\theta$. Note that $\theta$ contains model parameters, stderr and corr parameters of shocks. stderr and corr parameters of measurement errors are not yet supported, (they can easily be included as exogenous shocks). The availability of such derivatives is beneficial in terms of more reliable analysis of model sensitivity and parameter identifiability as well as more efficient estimation methods, in particular for models solved up to third order, as it is well-known that numerical derivatives are a tricky business, especially for large models. References for my approach are: * Iskrev (2008, 2010) and Schmitt-Grohé and Uribe (2012, Appendix) who were the first to compute the parameter derivatives analytically at first order, however, using inefficient (sparse) Kronecker products. * Mutschler (2015) who provides the expressions for a second-order, but again using inefficient (sparse) Kronecker products. * Ratto and Iskrev (2012) who show how the first-order system can be solved accurately, fast and efficiently using existing numerical algorithms for generalized Sylvester equations by taking the parameter derivative with respect to each parameter separately. * Julliard and Kamenik (2004) who provide the perturbation solution equation system in tensor notation at any order k. * Levintal (2017) who introduces permutation matrices to express the perturbation solution equation system in matrix notation up to fifth order. Note that @rattoma already implemented the parameter derivatives of $g_x$ and $g_u$ analytically (and numerically), and I rely heavily on his work in `get_first_order_solution_params_derivs.m` (previously `getH.m`). My additions are mainly to this function and thus it is renamed to `get_perturbation_params_derivs.m`. The basic idea of this merge request is to take the second- and third-order perturbation solution systems in Julliard and Kamenik (2004), unfold these into an equivalent matrix representation using permutation matrices as in Levintal (2017). Then extending Ratto and Iskrev (2012) one takes the derivative with respect to each parameter separately and gets a computational problem that is linear, albeit large, as it involves either solving generalized Sylvester equations or taking inverses of highly sparse matrices. I will now briefly summarize the perturbation solution system at third order and the system that results when taking the derivative with respect to parameters. ## Perturbation Solution The following systems arise at first, second, and third order: $(ghx): f_{x} z_{x} = f_{y_{-}^*} + f_{y_0} g_{x} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{x}= A g_{x} + f_{y_{-}^*}=0$ $(ghu): f_{z} z_{u} = f_{y_0} g_{u} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{u} + f_{u}= A g_u + f_u = 0$ $(ghxx) : A g_{xx} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{x}\right) + f_{zz} \left( z_{x} \otimes z_{x} \right) = 0$ $(ghxu) : A g_{xu} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{x} \otimes z_{u} \right) = 0$ $(ghuu) : A g_{uu} + B g_{xx} \left(g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{u} \otimes z_{u} \right) = 0$ $(ghs2) : (A+B) g_{\sigma\sigma} + \left( f_{y^{**}_{+}y^{**}_{+}} \left(g^{**}_{u} \otimes g^{**}_{u}\right) + f_{y^{**}_{+}} g^{**}_{uu}\right)vec(\Sigma) = 0$ $(ghxxx) : A g_{xxx} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{x}\right) + f_{y_{+}}g^{**}_{xx} \left(g^{*}_x \otimes g^{*}_{xx}\right)P_{x\_xx} + f_{zz} \left( z_{x} \otimes z_{xx} \right)P_{x\_xx} + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{x} \right) = 0$ $(ghxxu) : A g_{xxu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{u} \right) + f_{zz} \left( \left( z_{x} \otimes z_{xu} \right)P_{x\_xu} + \left(z_{xx} \otimes z_{u}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{x} \otimes g^{*}_{xu}\right)P_{x\_xu} + \left(g^{*}_{xx} \otimes g^{*}_{u}\right) \right) = 0$ $(ghxuu) : A g_{xuu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( \left( z_{xu} \otimes z_{u} \right)P_{xu\_u} + \left(z_{x} \otimes z_{uu}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{xu} \otimes g^{*}_{u}\right)P_{xu\_u} + \left(g^{*}_{x} \otimes g^{*}_{uu}\right) \right) = 0$ $(ghuuu) : A g_{uuu} + B g_{xxx} \left(g^{*}_{u} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{u} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( z_{u} \otimes z_{uu} \right)P_{u\_uu} + f_{y_{+}}g^{**}_{xx} \left(g^{*}_{u} \otimes g^{*}_{uu}\right)P_{u\_uu} = 0$ $(ghx\sigma\sigma) : A g_{x\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_x + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{x} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{x} \otimes z_{\sigma\sigma}\right) + F_{xu_{+}u_{+}}\left(I_{n_x} \otimes vec(\Sigma)\right) = 0$ $F_{xu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_x^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{xu_{+}} \otimes z_{u_{+}} \right)P_{xu\_u} + \left(z_{x} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{x} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ $(ghu\sigma\sigma) : A g_{u\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_{u} + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{u} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{u} \otimes z_{\sigma\sigma}\right) + F_{uu_{+}u_{+}}\left(I_{n_u} \otimes vec(\Sigma_u)\right) = 0$ $F_{uu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_u^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{uu_{+}} \otimes z_{u_{+}} \right)P_{uu\_u} + \left(z_{u} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{u} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ A and B are the common perturbation matrices: $A = f_{y_0} + \begin{pmatrix} \underbrace{0}_{n\times n_{static}} &\vdots& \underbrace{f_{y^{**}_{+}} \cdot g^{**}_{x}}_{n \times n_{spred}} &\vdots& \underbrace{0}_{n\times n_{frwd}} \end{pmatrix}$and $B = \begin{pmatrix} \underbrace{0}_{n \times n_{static}}&\vdots & \underbrace{0}_{n \times n_{pred}} & \vdots & \underbrace{f_{y^{**}_{+}}}_{n \times n_{sfwrd}} \end{pmatrix}$ and $z=(y_{-}^{\ast}; y; y_{+}^{\ast\ast}; u)$ denotes the dynamic model variables as in `M_.lead_lag_incidence`, $y^\ast$ denote state variables, $y^{\ast\ast}$ denote forward looking variables, $y_+$ denote the variables with a lead, $y_{-}$ denote variables with a lag, $y_0$ denote variables at period t, $f$ the model equations, and $f_z$ the first-order dynamic model derivatives, $f_{zz}$ the second-order dynamic derivatives, and $f_{zzz}$ the third-order dynamic model derivatives. Then: $z_{x} = \begin{pmatrix}I\\g_{x}\\g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{u} =\begin{pmatrix}0\\g_{u}\\g^{**}_{x} \cdot g^{*}_{u}\\I\end{pmatrix}$, $z_{u_{+}} =\begin{pmatrix}0\\0\\g^{**}_{u}\\0\end{pmatrix}$ $z_{xx} = \begin{pmatrix} 0\\g_{xx}\\g^{**}_{x} \left( g^{*}_x \otimes g^{*}_{x} \right) + g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{xu} =\begin{pmatrix}0\\g_{xu}\\g^{**}_{xx} \left( g^{*}_x \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{xu}\\0\end{pmatrix}$, $z_{uu} =\begin{pmatrix}0\\g_{uu}\\g^{**}_{xx} \left( g^{*}_u \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{uu}\\0\end{pmatrix}$, $z_{xu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_x \otimes I \right)\\0\end{pmatrix}$, $z_{uu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_{u} \otimes I \right)\\0\end{pmatrix}$, $z_{u_{+}u_{+}} =\begin{pmatrix}0\\0\\g^{\ast\ast}_{uu}\\0\end{pmatrix}$, $z_{\sigma\sigma} = \begin{pmatrix}0\\ g_{\sigma\sigma}\\ g^{\ast\ast}_{x}g^{\ast}_{\sigma\sigma} + g^{\ast\ast}_{\sigma\sigma}\\0 \end{pmatrix}$ $P$ are permutation matrices that can be computed using Matlab's `ipermute` function. ## Parameter derivatives of perturbation solutions First, we need the parameter derivatives of first, second, third, and fourth derivatives of the dynamic model (i.e. g1,g2,g3,g4 in dynamic files), I make use of the implicit function theorem: Let $f_{z^k}$ denote the kth derivative (wrt all dynamic variables) of the dynamic model, then let $df_{z^k}$ denote the first-derivative (wrt all model parameters) of $f_{z^k}$ evaluated at the steady state. Note that $f_{z^k}$ is a function of both the model parameters $\theta$ and of the steady state of all dynamic variables $\bar{z}$, which also depend on the parameters. Hence, implicitly $f_{z^k}=f_{z^k}(\theta,\bar{z}(\theta))$ and $df_{z^k}$ consists of two parts: 1. direct derivative wrt to all model parameters given by the preprocessor in the `_params_derivs.m` files 2. contribution of derivative of steady state of dynamic variables (wrt all model parameters): $f_{z^{k+1}} \cdot d\bar{z}$ Note that we already have functionality to compute $d\bar{z}$ analytically. Having this, the above perturbation systems are basically equations of the following types $AX +BXC = RHS$ or $AX = RHS$ Now when taking the derivative (wrt to one single parameter $\theta_j$), we get $A\mathrm{d}\{X\} + B\mathrm{d}\{X\}C = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X - \mathrm{d}\{B\}XC - BX\mathrm{d}\{C\}$ or $A\mathrm{d}\{X\} = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X$ The first one is a Sylvester type equation, the second one can be solved by taking the inverse of $A$. The only diffculty and tedious work arrises in computing (the highly sparse) derivatives of $RHS$. *** # New functions: ` ## get_perturbation_params_derivs.m`and `get_perturbation_params_derivs_numerical_objective.m` * The parameter derivatives up to third order are computed in the new function`get_perturbation_params_derivs.m` both analytically and numerically. For numerical derivatives `get_perturbation_params_derivs_numerical_objective.m` is the objective for `fjaco.m` or `hessian_sparse.m` or `hessian.m`. * `get_perturbation_params_derivs.m` is basically an extended version of the previous `get_first_order_solution_params_derivs.m` function. * * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It is used for numerical derivatives, whenever `analytic_derivation_mode=-1|-2`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. * Detailed changes: * Most important: notation of this function is now in accordance to the k_order_solver, i.e. we do not compute derivatives of Kalman transition matrices A and B, but rather the solution matrices ghx,ghu,ghxx,ghxu,ghuu,ghs2,ghxxx,ghxxu,ghxuu,ghuuu,ghxss,ghuss in accordance with notation used in `oo_.dr`. As a byproduct at first-order, focusing on ghx and ghu instead of Kalman transition matrices A and B makes the computations slightly faster for large models (e.g. for Quest the computations were faster by a couple of seconds, not much, but okay). * Removed use of `kstate`, see also Dynare/dynare#1653 and Dynare/dynare!1656 * Output arguments are stored in a structure `DERIVS`, there is also a flag `d2flag` that computes parameter hessians needed only in `dsge_likelihood.m`. * Removed `kronflag` as input. `options_.analytic_derivation_mode` is now used instead of `kronflag`. * Removed `indvar`, an index that was used to selected specific variables in the derivatives. This is not needed, as we always compute the parameter derivatives for all variables first and then select a subset of variables. The selection now takes place in other functions, like `dsge_likelihood.m`. * Introduced some checks: (i) deterministic exogenous variables are not supported, (ii) Kronecker method only compatible with first-order approximation so reset to sylvester method, (iii) for purely backward or forward models we need to be careful with the rows in `M_.lead_la g_incidence`, (iv) if `_params_derivs.m` files are missing an error is thrown. * For numerical derivatives, if mod file does not contain an `estimated_params_block`, a temporary one with the most important parameter information is created. ## `unfold_g4.m` * When evaluating g3 and g4 one needs to take into account that these do not contain symmetric elements, so one needs to use `unfold_g3.m` and the new function `unfold_g4.m`. This returns an unfolded version of the same matrix (i.e. with symmetric elements). *** # New test models `.gitignore` and `Makefile.am` are changed accordingly. Also now it is possible to run test suite on analytic_derivatives, i.e. run `make check m/analytic_derivatives` ## `analytic_derivatives/BrockMirman_PertParamsDerivs.mod` * This is the Brock Mirman model, where we know the exact policy function $g$ for capital and consumption. As this does not imply a nonzero $g_{\sigma\sigma}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ I added some artificial equations to get nonzero solution matrices with respect to $\sigma$. The true perturbation solution matrices $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ are then computed analytically with Matlab's symbolic toolbox and saved in `nBrockMirmanSYM.mat`. There is a preprocessor flag that recreates these analytical computations if changes are needed (and to check whether I made some errors here ;-) ) * Then solution matrices up to third order and their parameter Jacobians are then compared to the ones computed by Dynare's `k_order_solver` and by `get_perturbation_params_derivs` for all `analytic_derivation_mode`'s. There will be an error if the maximum absolute deviation is too large, i.e. for numerical derivatives (`analytic_derivation_mode=-1|-2`) the tolerance is choosen lower (around 1e-5); for analytical methods we are stricter: around 1e-13 for first-order, 1e-12 for second order, and 1e-11 for third-order. * As a side note, this mod file also checks Dynare's `k_order_solver` algorithm and throws an error if something is wrong. * This test model shows that the new functionality works well. And analytical derivatives perform way better and accurate than numerical ones, even for this small model. ## `analytic_derivatives/burnside_3_order_PertParamsDerivs.mod` * This builds upon `tests/k_order_perturbation/burnside_k_order.mod` and computes the true parameter derivatives analytically by hand. * This test model also shows that the new functionality works well. ## `analytic_derivatives/LindeTrabandt2019.mod` * Shows that the new functionality also works for medium-sized models, i.e. a SW type model solved at third order with 35 variables (11 states). 2 shocks and 20 parameters. * This mod file can be used to tweak the speed of the computations in the future. * Compares numerical versus analytical parameter derivatives (for first, second and third order). Note that this model clearly shows that numerical ones are quite different than analytical ones even at first order! ## `identification/LindeTrabandt2019_xfail.mod` * This model is a check for issue Dynare/dynare#1595, see fjaco.m below, and will fail. * Removed `analytic_derivatives/ls2003.mod` as this mod file is neither in the testsuite nor does it work. *** # Detailed changes in other functions ## `get_first_order_solution_params_derivs.m` * Deleted, or actually, renamed to `get_perturbation_params_derivs.m`, as this function now is able to compute the derivatives up to third order ## `identification_numerical_objective.m` * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. ## `dsge_likelihood.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `T`matrix anymore, but instead of the dynare solution matrix `ghx`. So we recreate `T` here as this amounts to adding some zeros and focusing on selected variables only. * Added some checks to make sure the first-order approximation is selected. * Removed `kron_flag` as input, as `get_perturbation_params_derivs` looks into `options_.analytic_derivation_mode` for `kron_flag`. ## `dynare_identification.m` * make sure that setting `analytic_derivation_mode` is set both in `options_ident` and `options_`. Note that at the end of the function we restore the `options_` structure, so all changes are local. In a next merge request, I will remove the global variables to make all variables local. ## `get_identification_jacobians.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `A` and `B` matrix anymore, but instead of the dynare solution matrix `ghx` and `ghu`. So we recreate these matrices here instead of in `get_perturbation_params_derivs.m`. * Added `str2func` for better function handles in `fjaco.m`. ## `fjaco.m` * make `tol`an option, which can be adjusted by changing `options_.dynatol.x`for identification and parameter derivatives purposes. * include a check and an informative error message, if numerical derivatives (two-sided finite difference method) yield errors in `resol.m` for identification and parameter derivatives purposes. This closes issue Dynare/dynare#1595. * Changed year of copyright to 2010-2017,2019 *** # Further suggestions and questions * Ones this is merged, I will merge request an improvement of the identification toolbox, which will work up to third order using the pruned state space. This will also remove some issues and bugs, and also I will remove global variables in this request. * The third-order derivatives can be further improved by taking sparsity into account and use mex versions for kronecker products etc. I leave this for further testing (and if anybody actually uses this ;-) )
2019-12-17 19:17:09 +01:00
analytic_derivatives/nBrockMirmanSYM.mat \
pruning/Andreasen_et_al_2018_Dynare44Pruning_v2.mat \
fs2000/fsdat_simul.m \
fs2000/fsdat_simul_dseries.m \
fs2000/fsdat_simul_missing_obs.m \
ls2003/data_ca1.m \
measurement_errors/data_ca1.m \
measurement_errors/fs2000_corr_me_ml_mcmc/fsdat_simul.m \
missing/simulate_data_with_missing_observations.m \
2011-08-02 11:58:09 +02:00
objectives/sgu_ex1.mat \
conditional_forecasts/2/fsdat_simul.m \
ms-sbvar/msdata.m \
2011-10-07 11:21:02 +02:00
ms-sbvar/archive-files/ftd_2s_caseall_upperchol3v.m \
2011-10-09 10:15:58 +02:00
ms-sbvar/archive-files/ftd_2s_caseall_upperchol4v.m \
2011-10-07 11:21:02 +02:00
ms-sbvar/archive-files/ftd_2s_caseall_upperchol6v.m \
ms-sbvar/archive-files/ftd_2s_caseall_upperchol7v.m \
ms-sbvar/archive-files/ftd_RSvensson_4v.m \
ms-sbvar/archive-files/ftd_cholesky.m \
ms-sbvar/archive-files/ftd_non_rec_5v.m \
ms-sbvar/archive-files/ftd_simszha5v.m \
ms-sbvar/archive-files/ftd_upperchol3v.m \
ms-sbvar/archive-files/ftd_upperchol4v.m \
ms-sbvar/archive-files/ftd_upperchol5v.m \
ms-sbvar/archive-files/ftd_upperchol6v.m \
ms-sbvar/archive-files/ftd_upperchol7v.m \
ms-sbvar/archive-files/specification_2v.dat \
2011-10-25 18:31:17 +02:00
ms-sbvar/archive-files/specification_2v2c.dat \
2011-11-02 20:54:58 +01:00
recursive/data_ca1.m \
recursive/data_ca1_csv.csv \
recursive/data_ca1_xls.xlsx \
2011-11-04 09:11:25 +01:00
kalman_filter_smoother/fsdat_simul.m \
kalman/lik_init/fs2000_common.inc \
kalman/lik_init/fs2000_ns_common.inc \
kalman_initial_state/fs2000_common.inc \
kalman_filter_smoother/compare_results_simulation/fsdat_simul_logged.m \
kalman_filter_smoother/SOE_data_file.m \
2016-06-16 18:55:23 +02:00
kalman/likelihood_from_dynare/fs2000_model.inc \
kalman/likelihood_from_dynare/fs2000_estimation_check.inc \
2016-06-16 18:57:35 +02:00
kalman/likelihood_from_dynare/fs2000ns_model.inc \
kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc \
Added parameter derivatives of perturbation solution up to 3 order # Preliminary comments I finished the identification toolbox at orders two and three using the pruned state space system, but before I merge request this, I decided to first merge the new functionality to compute parameter derivatives of perturbation solution matrices at higher orders. So after this is approved, I merge the identification toolbox. I guess @rattoma, @sebastien, and @michel are best choices to review this. I outline the main idea first and then provide some more detailed changes I made to the functions. *** # Main idea This merge request is concerned with the *analytical*computation of the parameter derivatives of first, second and third order perturbation solution matrices, i.e. using _closed-form_ expressions to efficiently compute the derivative of $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ *with respect to model parameters* $\theta$. Note that $\theta$ contains model parameters, stderr and corr parameters of shocks. stderr and corr parameters of measurement errors are not yet supported, (they can easily be included as exogenous shocks). The availability of such derivatives is beneficial in terms of more reliable analysis of model sensitivity and parameter identifiability as well as more efficient estimation methods, in particular for models solved up to third order, as it is well-known that numerical derivatives are a tricky business, especially for large models. References for my approach are: * Iskrev (2008, 2010) and Schmitt-Grohé and Uribe (2012, Appendix) who were the first to compute the parameter derivatives analytically at first order, however, using inefficient (sparse) Kronecker products. * Mutschler (2015) who provides the expressions for a second-order, but again using inefficient (sparse) Kronecker products. * Ratto and Iskrev (2012) who show how the first-order system can be solved accurately, fast and efficiently using existing numerical algorithms for generalized Sylvester equations by taking the parameter derivative with respect to each parameter separately. * Julliard and Kamenik (2004) who provide the perturbation solution equation system in tensor notation at any order k. * Levintal (2017) who introduces permutation matrices to express the perturbation solution equation system in matrix notation up to fifth order. Note that @rattoma already implemented the parameter derivatives of $g_x$ and $g_u$ analytically (and numerically), and I rely heavily on his work in `get_first_order_solution_params_derivs.m` (previously `getH.m`). My additions are mainly to this function and thus it is renamed to `get_perturbation_params_derivs.m`. The basic idea of this merge request is to take the second- and third-order perturbation solution systems in Julliard and Kamenik (2004), unfold these into an equivalent matrix representation using permutation matrices as in Levintal (2017). Then extending Ratto and Iskrev (2012) one takes the derivative with respect to each parameter separately and gets a computational problem that is linear, albeit large, as it involves either solving generalized Sylvester equations or taking inverses of highly sparse matrices. I will now briefly summarize the perturbation solution system at third order and the system that results when taking the derivative with respect to parameters. ## Perturbation Solution The following systems arise at first, second, and third order: $(ghx): f_{x} z_{x} = f_{y_{-}^*} + f_{y_0} g_{x} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{x}= A g_{x} + f_{y_{-}^*}=0$ $(ghu): f_{z} z_{u} = f_{y_0} g_{u} + f_{y_{+}^{**}} g^{**}_{x} g^{*}_{u} + f_{u}= A g_u + f_u = 0$ $(ghxx) : A g_{xx} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{x}\right) + f_{zz} \left( z_{x} \otimes z_{x} \right) = 0$ $(ghxu) : A g_{xu} + B g_{xx} \left(g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{x} \otimes z_{u} \right) = 0$ $(ghuu) : A g_{uu} + B g_{xx} \left(g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zz} \left( z_{u} \otimes z_{u} \right) = 0$ $(ghs2) : (A+B) g_{\sigma\sigma} + \left( f_{y^{**}_{+}y^{**}_{+}} \left(g^{**}_{u} \otimes g^{**}_{u}\right) + f_{y^{**}_{+}} g^{**}_{uu}\right)vec(\Sigma) = 0$ $(ghxxx) : A g_{xxx} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{x}\right) + f_{y_{+}}g^{**}_{xx} \left(g^{*}_x \otimes g^{*}_{xx}\right)P_{x\_xx} + f_{zz} \left( z_{x} \otimes z_{xx} \right)P_{x\_xx} + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{x} \right) = 0$ $(ghxxu) : A g_{xxu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{x} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{x} \otimes z_{u} \right) + f_{zz} \left( \left( z_{x} \otimes z_{xu} \right)P_{x\_xu} + \left(z_{xx} \otimes z_{u}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{x} \otimes g^{*}_{xu}\right)P_{x\_xu} + \left(g^{*}_{xx} \otimes g^{*}_{u}\right) \right) = 0$ $(ghxuu) : A g_{xuu} + B g_{xxx} \left(g^{*}_{x} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{x} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( \left( z_{xu} \otimes z_{u} \right)P_{xu\_u} + \left(z_{x} \otimes z_{uu}\right) \right) + f_{y_{+}}g^{**}_{xx} \left( \left(g^{*}_{xu} \otimes g^{*}_{u}\right)P_{xu\_u} + \left(g^{*}_{x} \otimes g^{*}_{uu}\right) \right) = 0$ $(ghuuu) : A g_{uuu} + B g_{xxx} \left(g^{*}_{u} \otimes g^{*}_{u} \otimes g^{*}_{u}\right) + f_{zzz} \left( z_{u} \otimes z_{u} \otimes z_{u} \right)+ f_{zz} \left( z_{u} \otimes z_{uu} \right)P_{u\_uu} + f_{y_{+}}g^{**}_{xx} \left(g^{*}_{u} \otimes g^{*}_{uu}\right)P_{u\_uu} = 0$ $(ghx\sigma\sigma) : A g_{x\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_x + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{x} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{x} \otimes z_{\sigma\sigma}\right) + F_{xu_{+}u_{+}}\left(I_{n_x} \otimes vec(\Sigma)\right) = 0$ $F_{xu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_x^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{xu_{+}} \otimes z_{u_{+}} \right)P_{xu\_u} + \left(z_{x} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{x} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ $(ghu\sigma\sigma) : A g_{u\sigma\sigma} + B g_{x\sigma\sigma} g^{*}_{u} + f_{y_{+}} g^{**}_{xx}\left(g^{*}_{u} \otimes g^{*}_{\sigma\sigma}\right) + f_{zz} \left(z_{u} \otimes z_{\sigma\sigma}\right) + F_{uu_{+}u_{+}}\left(I_{n_u} \otimes vec(\Sigma_u)\right) = 0$ $F_{uu_{+}u_{+}} = f_{y_{+}^{\ast\ast}} g_{xuu}^{\ast\ast} (g_u^{\ast} \otimes I_{n_u^2}) + f_{zz} \left( \left( z_{uu_{+}} \otimes z_{u_{+}} \right)P_{uu\_u} + \left(z_{u} \otimes z_{u_{+}u_{+}}\right) \right) + f_{zzz}\left(z_{u} \otimes z_{u_{+}} \otimes z_{u_{+}}\right)$ A and B are the common perturbation matrices: $A = f_{y_0} + \begin{pmatrix} \underbrace{0}_{n\times n_{static}} &\vdots& \underbrace{f_{y^{**}_{+}} \cdot g^{**}_{x}}_{n \times n_{spred}} &\vdots& \underbrace{0}_{n\times n_{frwd}} \end{pmatrix}$and $B = \begin{pmatrix} \underbrace{0}_{n \times n_{static}}&\vdots & \underbrace{0}_{n \times n_{pred}} & \vdots & \underbrace{f_{y^{**}_{+}}}_{n \times n_{sfwrd}} \end{pmatrix}$ and $z=(y_{-}^{\ast}; y; y_{+}^{\ast\ast}; u)$ denotes the dynamic model variables as in `M_.lead_lag_incidence`, $y^\ast$ denote state variables, $y^{\ast\ast}$ denote forward looking variables, $y_+$ denote the variables with a lead, $y_{-}$ denote variables with a lag, $y_0$ denote variables at period t, $f$ the model equations, and $f_z$ the first-order dynamic model derivatives, $f_{zz}$ the second-order dynamic derivatives, and $f_{zzz}$ the third-order dynamic model derivatives. Then: $z_{x} = \begin{pmatrix}I\\g_{x}\\g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{u} =\begin{pmatrix}0\\g_{u}\\g^{**}_{x} \cdot g^{*}_{u}\\I\end{pmatrix}$, $z_{u_{+}} =\begin{pmatrix}0\\0\\g^{**}_{u}\\0\end{pmatrix}$ $z_{xx} = \begin{pmatrix} 0\\g_{xx}\\g^{**}_{x} \left( g^{*}_x \otimes g^{*}_{x} \right) + g^{**}_{x} g^{*}_{x}\\0\end{pmatrix}$, $z_{xu} =\begin{pmatrix}0\\g_{xu}\\g^{**}_{xx} \left( g^{*}_x \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{xu}\\0\end{pmatrix}$, $z_{uu} =\begin{pmatrix}0\\g_{uu}\\g^{**}_{xx} \left( g^{*}_u \otimes g^{*}_{u} \right) + g^{**}_{x} g^{*}_{uu}\\0\end{pmatrix}$, $z_{xu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_x \otimes I \right)\\0\end{pmatrix}$, $z_{uu_{+}} =\begin{pmatrix}0\\0\\g^{**}_{xu} \left( g^{*}_{u} \otimes I \right)\\0\end{pmatrix}$, $z_{u_{+}u_{+}} =\begin{pmatrix}0\\0\\g^{\ast\ast}_{uu}\\0\end{pmatrix}$, $z_{\sigma\sigma} = \begin{pmatrix}0\\ g_{\sigma\sigma}\\ g^{\ast\ast}_{x}g^{\ast}_{\sigma\sigma} + g^{\ast\ast}_{\sigma\sigma}\\0 \end{pmatrix}$ $P$ are permutation matrices that can be computed using Matlab's `ipermute` function. ## Parameter derivatives of perturbation solutions First, we need the parameter derivatives of first, second, third, and fourth derivatives of the dynamic model (i.e. g1,g2,g3,g4 in dynamic files), I make use of the implicit function theorem: Let $f_{z^k}$ denote the kth derivative (wrt all dynamic variables) of the dynamic model, then let $df_{z^k}$ denote the first-derivative (wrt all model parameters) of $f_{z^k}$ evaluated at the steady state. Note that $f_{z^k}$ is a function of both the model parameters $\theta$ and of the steady state of all dynamic variables $\bar{z}$, which also depend on the parameters. Hence, implicitly $f_{z^k}=f_{z^k}(\theta,\bar{z}(\theta))$ and $df_{z^k}$ consists of two parts: 1. direct derivative wrt to all model parameters given by the preprocessor in the `_params_derivs.m` files 2. contribution of derivative of steady state of dynamic variables (wrt all model parameters): $f_{z^{k+1}} \cdot d\bar{z}$ Note that we already have functionality to compute $d\bar{z}$ analytically. Having this, the above perturbation systems are basically equations of the following types $AX +BXC = RHS$ or $AX = RHS$ Now when taking the derivative (wrt to one single parameter $\theta_j$), we get $A\mathrm{d}\{X\} + B\mathrm{d}\{X\}C = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X - \mathrm{d}\{B\}XC - BX\mathrm{d}\{C\}$ or $A\mathrm{d}\{X\} = \mathrm{d}\{RHS\} - \mathrm{d}\{A\}X$ The first one is a Sylvester type equation, the second one can be solved by taking the inverse of $A$. The only diffculty and tedious work arrises in computing (the highly sparse) derivatives of $RHS$. *** # New functions: ` ## get_perturbation_params_derivs.m`and `get_perturbation_params_derivs_numerical_objective.m` * The parameter derivatives up to third order are computed in the new function`get_perturbation_params_derivs.m` both analytically and numerically. For numerical derivatives `get_perturbation_params_derivs_numerical_objective.m` is the objective for `fjaco.m` or `hessian_sparse.m` or `hessian.m`. * `get_perturbation_params_derivs.m` is basically an extended version of the previous `get_first_order_solution_params_derivs.m` function. * * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It is used for numerical derivatives, whenever `analytic_derivation_mode=-1|-2`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. * Detailed changes: * Most important: notation of this function is now in accordance to the k_order_solver, i.e. we do not compute derivatives of Kalman transition matrices A and B, but rather the solution matrices ghx,ghu,ghxx,ghxu,ghuu,ghs2,ghxxx,ghxxu,ghxuu,ghuuu,ghxss,ghuss in accordance with notation used in `oo_.dr`. As a byproduct at first-order, focusing on ghx and ghu instead of Kalman transition matrices A and B makes the computations slightly faster for large models (e.g. for Quest the computations were faster by a couple of seconds, not much, but okay). * Removed use of `kstate`, see also Dynare/dynare#1653 and Dynare/dynare!1656 * Output arguments are stored in a structure `DERIVS`, there is also a flag `d2flag` that computes parameter hessians needed only in `dsge_likelihood.m`. * Removed `kronflag` as input. `options_.analytic_derivation_mode` is now used instead of `kronflag`. * Removed `indvar`, an index that was used to selected specific variables in the derivatives. This is not needed, as we always compute the parameter derivatives for all variables first and then select a subset of variables. The selection now takes place in other functions, like `dsge_likelihood.m`. * Introduced some checks: (i) deterministic exogenous variables are not supported, (ii) Kronecker method only compatible with first-order approximation so reset to sylvester method, (iii) for purely backward or forward models we need to be careful with the rows in `M_.lead_la g_incidence`, (iv) if `_params_derivs.m` files are missing an error is thrown. * For numerical derivatives, if mod file does not contain an `estimated_params_block`, a temporary one with the most important parameter information is created. ## `unfold_g4.m` * When evaluating g3 and g4 one needs to take into account that these do not contain symmetric elements, so one needs to use `unfold_g3.m` and the new function `unfold_g4.m`. This returns an unfolded version of the same matrix (i.e. with symmetric elements). *** # New test models `.gitignore` and `Makefile.am` are changed accordingly. Also now it is possible to run test suite on analytic_derivatives, i.e. run `make check m/analytic_derivatives` ## `analytic_derivatives/BrockMirman_PertParamsDerivs.mod` * This is the Brock Mirman model, where we know the exact policy function $g$ for capital and consumption. As this does not imply a nonzero $g_{\sigma\sigma}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ I added some artificial equations to get nonzero solution matrices with respect to $\sigma$. The true perturbation solution matrices $g_x$ , $g_u$, $g_{xx}$, $g_{xu}$, $g_{uu}$, $g_{\sigma\sigma}$, $g_{xxx}$, $g_{xxu}$, $g_{xuu}$, $g_{uuu}$, $g_{x\sigma\sigma}$, $g_{u\sigma\sigma}$ are then computed analytically with Matlab's symbolic toolbox and saved in `nBrockMirmanSYM.mat`. There is a preprocessor flag that recreates these analytical computations if changes are needed (and to check whether I made some errors here ;-) ) * Then solution matrices up to third order and their parameter Jacobians are then compared to the ones computed by Dynare's `k_order_solver` and by `get_perturbation_params_derivs` for all `analytic_derivation_mode`'s. There will be an error if the maximum absolute deviation is too large, i.e. for numerical derivatives (`analytic_derivation_mode=-1|-2`) the tolerance is choosen lower (around 1e-5); for analytical methods we are stricter: around 1e-13 for first-order, 1e-12 for second order, and 1e-11 for third-order. * As a side note, this mod file also checks Dynare's `k_order_solver` algorithm and throws an error if something is wrong. * This test model shows that the new functionality works well. And analytical derivatives perform way better and accurate than numerical ones, even for this small model. ## `analytic_derivatives/burnside_3_order_PertParamsDerivs.mod` * This builds upon `tests/k_order_perturbation/burnside_k_order.mod` and computes the true parameter derivatives analytically by hand. * This test model also shows that the new functionality works well. ## `analytic_derivatives/LindeTrabandt2019.mod` * Shows that the new functionality also works for medium-sized models, i.e. a SW type model solved at third order with 35 variables (11 states). 2 shocks and 20 parameters. * This mod file can be used to tweak the speed of the computations in the future. * Compares numerical versus analytical parameter derivatives (for first, second and third order). Note that this model clearly shows that numerical ones are quite different than analytical ones even at first order! ## `identification/LindeTrabandt2019_xfail.mod` * This model is a check for issue Dynare/dynare#1595, see fjaco.m below, and will fail. * Removed `analytic_derivatives/ls2003.mod` as this mod file is neither in the testsuite nor does it work. *** # Detailed changes in other functions ## `get_first_order_solution_params_derivs.m` * Deleted, or actually, renamed to `get_perturbation_params_derivs.m`, as this function now is able to compute the derivatives up to third order ## `identification_numerical_objective.m` * `get_perturbation_params_derivs_numerical_objective.m`builds upon `identification_numerical_objective.m`. It takes from `identification_numerical_objective.m` the parts that compute numerical parameter Jacobians of steady state, dynamic model equations, and perturbation solution matrices. Hence, these parts are removed in `identification_numerical_objective.m` and it only computes numerical parameter Jacobian of moments and spectrum which are needed for identification analysis in `get_identification_jacobians.m`, when `analytic_derivation_mode=-1` only. ## `dsge_likelihood.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `T`matrix anymore, but instead of the dynare solution matrix `ghx`. So we recreate `T` here as this amounts to adding some zeros and focusing on selected variables only. * Added some checks to make sure the first-order approximation is selected. * Removed `kron_flag` as input, as `get_perturbation_params_derivs` looks into `options_.analytic_derivation_mode` for `kron_flag`. ## `dynare_identification.m` * make sure that setting `analytic_derivation_mode` is set both in `options_ident` and `options_`. Note that at the end of the function we restore the `options_` structure, so all changes are local. In a next merge request, I will remove the global variables to make all variables local. ## `get_identification_jacobians.m` * As `get_first_order_solution_params_derivs.m`is renamed to `get_perturbation_params_derivs.m`, the call is adapted. That is,`get_perturbation_params_derivs` does not compute the derivatives of the Kalman transition `A` and `B` matrix anymore, but instead of the dynare solution matrix `ghx` and `ghu`. So we recreate these matrices here instead of in `get_perturbation_params_derivs.m`. * Added `str2func` for better function handles in `fjaco.m`. ## `fjaco.m` * make `tol`an option, which can be adjusted by changing `options_.dynatol.x`for identification and parameter derivatives purposes. * include a check and an informative error message, if numerical derivatives (two-sided finite difference method) yield errors in `resol.m` for identification and parameter derivatives purposes. This closes issue Dynare/dynare#1595. * Changed year of copyright to 2010-2017,2019 *** # Further suggestions and questions * Ones this is merged, I will merge request an improvement of the identification toolbox, which will work up to third order using the pruned state space. This will also remove some issues and bugs, and also I will remove global variables in this request. * The third-order derivatives can be further improved by taking sparsity into account and use mex versions for kronecker products etc. I leave this for further testing (and if anybody actually uses this ;-) )
2019-12-17 19:17:09 +01:00
identification/as2007/G_QT.mat \
estimation/fsdat_simul.m \
estimation/heteroskedastic_shocks/fs2000_het_model.inc \
estimation/heteroskedastic_shocks/fs2000_het_check.inc \
estimation/system_prior_restriction/Gali_2015_PC_slope.m \
estimation/system_prior_restriction/Gali_2015_prior_restrictions.m \
2013-04-25 12:24:29 +02:00
ep/mean_preserving_spread.m \
ep/rbcii_steadystate.m \
decision_rules/example1_results_dyn_432.mat \
decision_rules/third_order/comparison_policy_functions_dynare_mathematica.m \
decision_rules/third_order/FV_2011_policyfunctions.mat \
shock_decomposition/example1_calib_shock_decomp_data.mat \
shock_decomposition/fsdat_simul.m \
smoother2histval/fsdat_simul.m \
particle/first_spec_common.inc \
particle/risky.m \
particle/dsgebase2data.mat \
optimal_policy/Ramsey/find_c.m \
observation_trends_and_prefiltering/generate_trend_stationary_AR1.m \
observation_trends_and_prefiltering/Trend_diagnostics_MCMC_common.inc \
observation_trends_and_prefiltering/Trend_diagnostics_calib_common.inc \
observation_trends_and_prefiltering/Trend_diagnostics_ML_common.inc \
observation_trends_and_prefiltering/Trend_exp_model_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_exp_model_no_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_model_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_model_no_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_exp_model_calib_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_exp_model_calib_no_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_model_calib_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_model_calib_no_prefilter_common.inc \
observation_trends_and_prefiltering/Trend_load_data_common.inc \
observation_trends_and_prefiltering/Trend_no_prefilter_conditional_forecast.inc \
occbin/model_borrcon/borrcon_common.inc \
occbin/model_irrcap_twoconstraints/dynrbc_common.inc \
occbin/filter/dataobsfile.mat \
occbin/filter/NKM_mh_mode_saved.mat \
optimal_policy/neo_growth_common.inc \
optimal_policy/neo_growth_ramsey_common.inc \
optimizers/optimizer_function_wrapper.m \
optimizers/fs2000.common.inc \
2016-03-16 19:04:03 +01:00
estimation/MH_recover/fs2000.common.inc \
prior_posterior_function/posterior_function_demo.m \
k_order_perturbation/fs2000k++.mod \
lmmcp/sw-common-header.inc \
lmmcp/sw-common-footer.inc \
estimation/tune_mh_jscale/fs2000.inc \
estimation/method_of_moments/AnScho/AnScho_MoM_common.inc \
estimation/method_of_moments/AnScho/AnScho_MoM_data_2.mat \
estimation/method_of_moments/RBC/RBC_MoM_common.inc \
estimation/method_of_moments/RBC/RBC_MoM_steady_helper.m \
estimation/method_of_moments/RBC/RBC_Andreasen_Data_2.mat \
estimation/method_of_moments/AFVRR/AFVRR_common.inc \
estimation/method_of_moments/AFVRR/AFVRR_steady_helper.m \
estimation/method_of_moments/AFVRR/AFVRR_data.mat \
2019-01-16 12:54:30 +01:00
estimation/univariate/data.csv \
estimation/univariate/ols/mc-ols.inc \
estimation/no_init_estimation_check_first_obs/fsdat_simul.m \
estimation/no_init_estimation_check_first_obs/fsdat_mat.m \
estimation/no_init_estimation_check_first_obs/fsdat_mat_XFAIL.m \
ecb/SURGibbs/fishdata.csv \
test_aggregate_routine_1_2.m \
test_aggregate_routine_1_2_3.m \
ecb/aggregate/1/endogenous.inc \
ecb/aggregate/1/exogenous.inc \
ecb/aggregate/1/parameters.inc \
ecb/aggregate/1/parameter-values.inc \
ecb/aggregate/1/model.inc \
ecb/aggregate/2/endogenous.inc \
ecb/aggregate/2/exogenous.inc \
ecb/aggregate/2/parameters.inc \
ecb/aggregate/2/parameter-values.inc \
ecb/aggregate/2/model.inc \
ecb/aggregate/3/endogenous.inc \
ecb/aggregate/3/exogenous.inc \
ecb/aggregate/3/parameters.inc \
ecb/aggregate/3/parameter-values.inc \
ecb/aggregate/3/model.inc \
histval_initval_file_unit_tests.m \
histval_initval_file/my_assert.m \
histval_initval_file/ramst_data.xls \
histval_initval_file/ramst_data.xlsx \
histval_initval_file/ramst_initval_file_data.m \
run_kronecker_tests.m \
kronecker/test_kron.m \
kronecker/nash_matrices.mat \
deterministic_simulations/pfwee.csv \
solver-test-functions/brown.m \
solver-test-functions/broydenbanded.m \
solver-test-functions/broydentridiagonal.m \
solver-test-functions/chebyquad.m \
solver-test-functions/discreteboundaryvalue.m \
solver-test-functions/discreteintegralequation.m \
solver-test-functions/helicalvalley.m \
solver-test-functions/powell1.m \
solver-test-functions/powell2.m \
solver-test-functions/rosenbrock.m \
solver-test-functions/trigonometric.m \
solver-test-functions/variablydimensioned.m \
solver-test-functions/watson.m \
solver-test-functions/wood.m \
ramst_normcdf_and_friends.inc
if ENABLE_MATLAB
check-local: check-matlab
endif
if ENABLE_OCTAVE
check-local: check-octave
endif
2012-11-07 12:02:35 +01:00
check-matlab: $(M_XFAIL_TRS_FILES) $(M_TRS_FILES)
@./read_trs_files.sh "$(M_TRS_FILES)" "$(M_XFAIL_TRS_FILES)"
2012-10-05 12:58:34 +02:00
2012-11-07 12:02:35 +01:00
check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
@./read_trs_files.sh "$(O_TRS_FILES)" "$(O_XFAIL_TRS_FILES)"
check-matlab-ecb: $(M_ECB_TRS_FILES)
@./read_trs_files.sh "$(M_ECB_TRS_FILES)"
check-matlab-ols: $(M_OLS_TRS_FILES)
@./read_trs_files.sh "$(M_OLS_TRS_FILES)"
2012-10-05 12:58:34 +02:00
%.m.trs %.m.log: %.mod
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
# The while loop is a workaround for this glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 (should be fixed in glibc 2.34, likely included in Debian “bookworm” 12)
@while ! [ -f $*.m.trs ] || head -1 $*.m.log | egrep -q '^Inconsistency detected by ld.so'; \
do \
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) run_test_matlab > $*.m.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.m.trs; \
done
@if test -z "$(filter $*.m.trs,$(M_XFAIL_TRS_FILES))"; then pass_color=2; fail_color=1; else pass_color=1; fail_color=2; fi; \
if grep -q ":test-result: PASS" $*.m.trs; then \
echo "`tput bold``tput setaf $${pass_color}`MATLAB: $(CURDIR)/$* PASSED!`tput sgr0`" ; \
else \
echo "`tput bold``tput setaf $${fail_color}`MATLAB: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi
2012-10-05 12:58:34 +02:00
%.m.drs %.m.log: %.m.trs
@cat $*.m.log
2012-10-05 12:58:34 +02:00
%.m.trs %.m.log : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
# The while loop is a workaround for this glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 (should be fixed in glibc 2.34, likely included in Debian “bookworm” 12)
@while ! [ -f $*.m.trs ] || head -1 $*.m.log | egrep -q '^Inconsistency detected by ld.so'; \
do \
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) $* > $*.m.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.m.trs; \
done
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$* Done!`tput sgr0`"
2012-10-05 12:58:34 +02:00
%.o.trs %.o.log: %.mod
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.o.trs
@if test -z "$(filter $*.o.trs,$(O_XFAIL_TRS_FILES))"; then pass_color=2; fail_color=1; else pass_color=1; fail_color=2; fi; \
if grep -q ":test-result: PASS" $*.o.trs; then \
echo "`tput bold``tput setaf $${pass_color}`OCTAVE: $(CURDIR)/$* PASSED!`tput sgr0`" ; \
else \
echo "`tput bold``tput setaf $${fail_color}`OCTAVE: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi
2012-10-05 12:58:34 +02:00
%.o.drs %.o.log: %.mod %.o.trs
@cat $*.o.log
2012-10-05 12:58:34 +02:00
%.o.trs %.o.log : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.m\n:elapsed-time: 0.0\n" > $*.o.trs
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
%.m.tls : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab $(MATLAB_BATCH_OPTIONS) run_m_script >/dev/null 2>&1
@touch $*.m.tls
@echo "`tput bold`MATLAB`tput setaf 8`: $(CURDIR)/$* Done!`tput sgr0`"
%.o.tls : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
xvfb-run -a $(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1
@touch $*.o.tls
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
clean-local:
2018-09-13 17:28:12 +02:00
rm -f $(M_TRS_FILES)
rm -f $(M_OLS_TRS_FILES)
2018-09-13 17:28:12 +02:00
rm -f $(M_TLS_FILES)
rm -f $(M_XFAIL_TRS_FILES)
rm -f $(O_TRS_FILES)
rm -f $(O_TLS_FILES)
rm -f $(O_XFAIL_TRS_FILES)
rm -f $(patsubst %.trs, %.log, $(M_TRS_FILES))
rm -f $(patsubst %.trs, %.log, $(M_OLS_TRS_FILES))
2018-09-13 17:28:12 +02:00
rm -f $(patsubst %.trs, %.log, $(M_XFAIL_TRS_FILES))
rm -f $(patsubst %.trs, %.log, $(O_TRS_FILES))
rm -f $(patsubst %.trs, %.log, $(O_XFAIL_TRS_FILES))
rm -f $(patsubst %.trs, %.json, $(M_TRS_FILES))
rm -f $(patsubst %.trs, %.json, $(M_OLS_TRS_FILES))
2018-09-13 17:28:12 +02:00
rm -f $(patsubst %.trs, %.json, $(M_XFAIL_TRS_FILES))
rm -f $(patsubst %.trs, %.json, $(O_TRS_FILES))
rm -f $(patsubst %.trs, %.json, $(O_XFAIL_TRS_FILES))
rm -f $(patsubst %.mod, %.log, $(MODFILES))
2011-11-30 14:18:05 +01:00
rm -rf $(patsubst %.mod, %, $(MODFILES))
rm -rf $(foreach mod, $(MODFILES), $(dir $(mod))+$(basename $(notdir $(mod))))
2018-09-13 17:28:12 +02:00
rm -f $(patsubst %.mod, %*.pdf, $(MODFILES))
rm -f $(patsubst %.mod, %*.eps, $(MODFILES))
rm -f $(patsubst %.mod, %*.fig, $(MODFILES))
2018-09-13 17:28:12 +02:00
rm -f $(shell find -name g1.mat)
rm -f $(shell find -name g2.mat)
rm -f $(shell find -name g3.mat)
rm -f $(shell find -name H.dat)
rm -f arima/data1.m arima/data2.m \
k_order_perturbation/*.jnl \
k_order_perturbation/*.mat \
kalman_filter_smoother/data_algo.mat \
kalman_filter_smoother/data_Pinf_Pstar.mat
rm -f data_ca1_csv.csv
rm -f estimation/MH_recover/*.mat \
estimation/MH_recover/*.dat
rm -rf ramsey_objective
rm -f ep/*.c
rm -f fs2000_ssfile_steadystate.m
rm -f $(shell find -name '*~')
2011-02-07 12:49:03 +01:00
rm -f dsge-var/datarabanal_hybrid.m
rm -rf partial_information/PItest3aHc0PCLsimModPiYrVarobsAll_PCL* partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR_PCL*
rm -rf block_bytecode/ls2003_tmp*
2013-06-26 09:10:58 +02:00
rm -f reporting/report.*
2013-06-24 15:19:56 +02:00
rm -f $(shell find -name wsOct) \
$(shell find -name wsMat.mat)
2011-08-19 18:10:18 +02:00
rm -f run_test_matlab_output.txt run_test_octave_output.txt
2012-10-04 11:40:38 +02:00
rm -rf ms-sbvar/init_* \
ms-sbvar/*.out \
ms-sbvar/*.mat \
ms-sbvar/*.prn \
ms-sbvar/*.dat \
ms-sbvar/tmv_rr_sr \
ms-sbvar/tmv_rr_tr
rm -f estimation/test_matrix.mat
rm -f histval_initval_file/ramst_initval_file_data_col_vec_mat.mat histval_initval_file/ramst_initval_file_data_row_vec_mat.mat histval_initval_file/ramst_initval_file_excel.xls
rm -f loglinear/results_exp_histval.mat loglinear/results_exp.mat
rm -f k_order_perturbation/fs2000k++.mat k_order_perturbation/fs2000k++.dump \
k_order_perturbation/fs2000k++.jnl k_order_perturbation/fs2000k++_f.m \
k_order_perturbation/fs2000k++_ff.m
rm -rf ecb/cherrypick/simulation-files1 ecb/cherrypick/simulation-files2 toto.mod
rm -f discretionary_policy/dennis_simul.m
rm -f kalman/likelihood_from_dynare/fsdat_simul_corr_ME.m \
kalman/likelihood_from_dynare/fsdat_simul_corr_ME_missing.m \
kalman/likelihood_from_dynare/fsdat_simul_uncorr_ME.m \
kalman/likelihood_from_dynare/fsdat_simul_uncorr_ME_missing.m \
kalman/likelihood_from_dynare/fs_ns_dat_simul_corr_ME.m \
kalman/likelihood_from_dynare/fs_ns_dat_simul_corr_ME_missing.m \
kalman/likelihood_from_dynare/fs_ns_dat_simul_uncorr_ME.m \
kalman/likelihood_from_dynare/fs_ns_dat_simul_uncorr_ME_missing.m
rm -f occbin/filter/dataobsfile2.mat
2021-09-11 11:26:55 +02:00
rm -f optimal_policy/Ramsey/oo_ramsey_policy_initval.mat
rm -rf tests/pac/var-12/toto
find . -name "*.tex" -type f -delete
find . -name "*.aux" -type f -delete
find . -name "*.log" -type f -delete
find . -name "*.eps" -type f -delete