Merge pull request #1152 from JohannesPfeifer/headers

Cosmetic changes to various function headers
time-shift
Stéphane Adjemian 2016-04-08 23:29:16 +02:00
commit 056548ba76
10 changed files with 161 additions and 19 deletions

View File

@ -6329,8 +6329,11 @@ Posterior probability of the respective model
@descriptionhead
This command computes and displays shock decomposition according to
the model for a given sample.
This command computes the historical shock decomposition for a given sample based on
the Kalman smoother, i.e. it decomposes the historical deviations of the endogenous
variables from their respective steady state values into the contribution coming
from the various shocks. The @code{variable_names} provided govern for which
variables the decomposition is plotted.
Note that this command must come after either @code{estimation} (in case
of an estimated model) or @code{stoch_simul} (in case of a calibrated
@ -6356,12 +6359,13 @@ calibrated model.
@vindex oo_.shock_decomposition
The results are stored in the field @code{oo_.shock_decomposition}, which is a three
dimensional array. The first dimension contains the endogenous variables for
which the shock decomposition has been requested. The second dimension stores
dimensional array. The first dimension contains the @code{M_.endo_nbr} endogenous variables.
The second dimension stores
in the first @code{M_.exo_nbr} columns the contribution of the respective shocks.
Column @code{M_.exo_nbr+1} stores the contribution of the initial conditions,
while column @code{M_.exo_nbr+2} stores the smoothed value of the respective
endogenous variable. The third dimension stores the time periods. Both the variables
endogenous variable in deviations from their steady state, i.e. the mean and trends are
subtracted. The third dimension stores the time periods. Both the variables
and shocks are stored in the order of declaration, i.e. @code{M_.endo_names} and
@code{M_.exo_names}, respectively.

View File

@ -1,6 +1,6 @@
/*
* This file implements the Baseline New Keynesian DSGE model described in
* much detail in Jesús Fernández-Villaverde (2006): "A Baseline DSGE
* much detail in Jesús Fernández-Villaverde and Juan F. Rubio-Ramírez (2006): "A Baseline DSGE
* Model", available at http://economics.sas.upenn.edu/~jesusfv/benchmark_DSGE.pdf
*
* The parametrization is based on the estimated version of this model in

View File

@ -1,6 +1,6 @@
function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_, bounds] = dynare_estimation_init(var_list_, dname, gsa_flag, M_, options_, oo_, estim_params_, bayestopt_)
% function dynare_estimation_init(var_list_, gsa_flag)
% function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_, bounds] = dynare_estimation_init(var_list_, dname, gsa_flag, M_, options_, oo_, estim_params_, bayestopt_)
% performs initialization tasks before estimation or
% global sensitivity analysis
%
@ -14,7 +14,6 @@ function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,
% estim_params_: structure storing information about estimated
% parameters
% bayestopt_: structure storing information about priors
% optim: structure storing optimization bounds
% OUTPUTS
% dataset_: the dataset after required transformation
@ -28,6 +27,7 @@ function [dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,
% estim_params_: structure storing information about estimated
% parameters
% bayestopt_: structure storing information about priors
% bounds: structure containing prior bounds
%
% SPECIAL REQUIREMENTS
% none

View File

@ -1,7 +1,7 @@
function [residuals,check1,jacob] = evaluate_static_model(ys,exo_ss,params,M,options)
% function [ys,info] = evaluate_steady_state(M,options,oo)
% Computes the steady state
% function [residuals,check1,jacob] = evaluate_static_model(ys,exo_ss,params,M,options)
% Evaluates the static model
%
% INPUTS
% ys vector initial values used to compute the steady
@ -20,7 +20,7 @@ function [residuals,check1,jacob] = evaluate_static_model(ys,exo_ss,params,M,opt
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2012 Dynare Team
% Copyright (C) 2001-2016 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,8 +1,38 @@
function [H, dA, dOm, Hss, gp, d2A, d2Om, H2ss] = getH(A, B, M_,oo_,options_,kronflag,indx,indexo,iv)
% function [H, dA, dOm, Hss, gp, d2A, d2Om, H2ss] = getH(A, B, M_,oo_,options_,kronflag,indx,indexo,iv)
% computes derivative of reduced form linear model w.r.t. deep params
%
% Copyright (C) 2010-2012 Dynare Team
% Inputs:
% A: Transition matrix of lagged states from Kalman filter
% B: Matrix in state transition equation mapping shocks today to
% states today
% M_: structure storing the model information
% oo_: structure storing the results
% options_: structure storing the options
% kronflag: Indicator whether to rely on Kronecker products (1) or
% not (-1 or -2)
% indx: Index of estimated parameters in M_.params
% indexo: Index of estimated standard deviations in M_.exo_names
% iv: Index of considered variables
%
% Outputs:
% H: dTAU/dTHETA: Jacobian of TAU, vectorized form of
% linearized reduced form state space model, given ys [steady state],
% A [transition matrix], B [matrix of shocks], Sigma [covariance of shocks]
% TAU = [ys; vec(A); dyn_vech(B*Sigma*B')].
% dA: [endo_nbr by endo_nbr by (indx+indexo)] Jacobian of transition matrix A
% dOm: [endo_nbr by endo_nbr by (indx+indexo)] Jacobian of Omega = (B*Sigma*B')
% Hss: [endo_nbr by (indx)] Jacobian of steady state with respect to estimated
% structural parameters only (indx)
% gp: Jacobian of linear rational expectation matrices [i.e.
% Jacobian of dynamic model] with respect to estimated
% structural parameters only (indx)
% d2A: Hessian of transition matrix A
% d2Om: Hessian of Omega
% H2s: Hessian of steady state with respect to estimated
% structural parameters only (indx)
% Copyright (C) 2010-2016 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,43 @@
function [JJ, H, gam, gp, dA, dOm, dYss] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% function [JJ, H, gam, gp, dA, dOm, dYss] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% computes derivatives of 1st and 2nd order moments of observables with
% respect to estimated parameters
%
% Inputs:
% A: Transition matrix of lagged states from Kalman filter
% B: Matrix in state transition equation mapping shocks today to
% states today
% M_: structure storing the model information
% oo_: structure storing the results
% options_: structure storing the options
% kronflag: Indicator whether to rely on Kronecker products (1) or
% not (-1 or -2)
% indx: Index of estimated parameters in M_.params
% indexo: Index of estimated standard deviations in M_.exo_names
% mf: Index of observed variables
% nlags: Number of lags to consider for covariances and
% correlations
% useautocorr: Indicator on whether to use correlations (1) instead of
% covariances (0)
%
% Outputs:
% JJ: Jacobian of 1st and 2nd order moments of observables, i.e. dgam/dTHETA
% (see below for definition of gam)
% H: dTAU/dTHETA: Jacobian of TAU, vectorized form of
% linearized reduced form state space model, given ys [steady state],
% A [transition matrix], B [matrix of shocks], Sigma [covariance of shocks]
% TAU = [ys; vec(A); dyn_vech(B*Sigma*B')].
% gam: vector of theoretical moments of observed variables mf [JJ is the Jacobian of gam].
% gam = [ys(mf); dyn_vech(GAM{1}); vec(GAM{j+1})]; for j=1:ar and where
% GAM is the first output of th_autocovariances
% gp: Jacobian of linear rational expectation matrices [i.e.
% Jacobian of dynamic model] with respect to estimated
% structural parameters only (indx)
% dA: [endo_nbr by endo_nbr by (indx+indexo)] Jacobian of transition matrix A
% dOm: Jacobian of Omega = (B*Sigma*B')
% dYss Jacobian of steady state with respect to estimated structural parameters only (indx)
% Copyright (C) 2010-2012 Dynare Team
% Copyright (C) 2010-2016 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -7,11 +7,12 @@ function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info] = i
% o indx [array] index of estimated parameters
% o indexo [array] index of estimated shocks
% o options_ident [structure] identification options
% o data_info [structure] data info for Kalman Filter
% o dataset_ [structure] the dataset after required transformation
% o dataset_info [structure] Various informations about the dataset (descriptive statistics and missing observations) info for Kalman Filter
% o prior_exist [integer]
% =1 when prior exists and indentification is checked only for estimated params and shocks
% =0 when prior is not defined and indentification is checked for all params and shocks
% o nem_tex [char] list of tex names
% o name_tex [char] list of tex names
% o init [integer] flag for initialization of persistent vars
%
% OUTPUTS
@ -25,7 +26,7 @@ function [ide_hess, ide_moments, ide_model, ide_lre, derivatives_info, info] = i
% SPECIAL REQUIREMENTS
% None
% Copyright (C) 2008-2013 Dynare Team
% Copyright (C) 2008-2016 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,5 +1,5 @@
function DynareResults = initial_estimation_checks(objective_function,xparam1,DynareDataset,DatasetInfo,Model,EstimatedParameters,DynareOptions,BayesInfo,BoundsInfo,DynareResults)
% function initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations)
% function DynareResults = initial_estimation_checks(objective_function,xparam1,DynareDataset,DatasetInfo,Model,EstimatedParameters,DynareOptions,BayesInfo,BoundsInfo,DynareResults)
% Checks data (complex values, ML evaluation, initial values, BK conditions,..)
%
% INPUTS
@ -11,6 +11,7 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy
% EstimatedParameters [structure] characterizing parameters to be estimated
% DynareOptions [structure] describing the options
% BayesInfo [structure] describing the priors
% BoundsInfo [structure] containing prior bounds
% DynareResults [structure] storing the results
%
% OUTPUTS

View File

@ -1536,6 +1536,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
<< "% in M_.lead_lag_incidence; see the Manual" << endl
<< "% x [nperiods by M_.exo_nbr] double matrix of exogenous variables (in declaration order)" << endl
<< "% for all simulation periods" << endl
<< "% steady_state [M_.endo_nbr by 1] double vector of steady state values" << endl
<< "% params [M_.param_nbr by 1] double vector of parameter values in declaration order" << endl
<< "% it_ scalar double time period for exogenous variables for which to evaluate the model" << endl
<< "%" << endl
@ -3980,6 +3981,46 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
if (!julia)
paramsDerivsFile << "function [rp, gp, rpp, gpp, hp] = " << basename << "_params_derivs(y, x, params, steady_state, it_, ss_param_deriv, ss_param_2nd_deriv)" << endl
<< "%" << endl
<< "% Compute the derivatives of the dynamic model with respect to the parameters" << endl
<< "% Inputs :" << endl
<< "% y [#dynamic variables by 1] double vector of endogenous variables in the order stored" << endl
<< "% in M_.lead_lag_incidence; see the Manual" << endl
<< "% x [nperiods by M_.exo_nbr] double matrix of exogenous variables (in declaration order)" << endl
<< "% for all simulation periods" << endl
<< "% params [M_.param_nbr by 1] double vector of parameter values in declaration order" << endl
<< "% steady_state [M_.endo_nbr by 1] double vector of steady state values" << endl
<< "% it_ scalar double time period for exogenous variables for which to evaluate the model" << endl
<< "% ss_param_deriv [M_.eq_nbr by #params] Jacobian matrix of the steady states values with respect to the parameters" << endl
<< "% ss_param_2nd_deriv [M_.eq_nbr by #params by #params] Hessian matrix of the steady states values with respect to the parameters" << endl
<< "%" << endl
<< "% Outputs:" << endl
<< "% rp [M_.eq_nbr by #params] double Jacobian matrix of dynamic model equations with respect to parameters " << endl
<< "% Dynare may prepend or append auxiliary equations, see M_.aux_vars" << endl
<< "% gp [M_.endo_nbr by #dynamic variables by #params] double Derivative of the Jacobian matrix of the dynamic model equations with respect to the parameters" << endl
<< "% rows: equations in order of declaration" << endl
<< "% columns: variables in order stored in M_.lead_lag_incidence" << endl
<< "% rpp [#second_order_residual_terms by 4] double Hessian matrix of second derivatives of residuals with respect to parameters;" << endl
<< "% rows: respective derivative term" << endl
<< "% 1st column: equation number of the term appearing" << endl
<< "% 2nd column: number of the first parameter in derivative" << endl
<< "% 3rd column: number of the second parameter in derivative" << endl
<< "% 4th column: value of the Hessian term" << endl
<< "% gpp [#second_order_Jacobian_terms by 5] double Hessian matrix of second derivatives of the Jacobian with respect to the parameters;" << endl
<< "% rows: respective derivative term" << endl
<< "% 1st column: equation number of the term appearing" << endl
<< "% 2nd column: column number of variable in Jacobian of the dynamic model" << endl
<< "% 3rd column: number of the first parameter in derivative" << endl
<< "% 4th column: number of the second parameter in derivative" << endl
<< "% 5th column: value of the Hessian term" << endl
<< "% hp [#first_order_Hessian_terms by 5] double Jacobian matrix of derivatives of the dynamic Hessian with respect to the parameters;" << endl
<< "% rows: respective derivative term" << endl
<< "% 1st column: equation number of the term appearing" << endl
<< "% 2nd column: column number of first variable in Hessian of the dynamic model" << endl
<< "% 3rd column: column number of second variable in Hessian of the dynamic model" << endl
<< "% 4th column: number of the parameter in derivative" << endl
<< "% 5th column: value of the Hessian term" << endl
<< "%" << endl
<< "%" << endl
<< "% Warning : this file is generated automatically by Dynare" << endl
<< "% from model file (.mod)" << endl << endl;
else

View File

@ -1179,7 +1179,7 @@ StaticModel::writeStaticMFile(const string &func_name) const
<< "% Outputs:" << endl
<< "% residual [M_.endo_nbr by 1] double vector of residuals of the static model equations " << endl
<< "% in order of declaration of the equations." << endl
<< "% Dynare may prepend auxiliary equations, see M_.aux_vars" << endl
<< "% Dynare may prepend or append auxiliary equations, see M_.aux_vars" << endl
<< "% g1 [M_.endo_nbr by M_.endo_nbr] double Jacobian matrix of the static model equations;" << endl
<< "% columns: variables in declaration order" << endl
<< "% rows: equations in order of declaration" << endl
@ -2166,6 +2166,34 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
if (!julia)
paramsDerivsFile << "function [rp, gp, rpp, gpp, hp] = " << basename << "_static_params_derivs(y, x, params)" << endl
<< "%" << endl
<< "% Status : Computes derivatives of the static model with respect to the parameters" << endl
<< "%" << endl
<< "% Inputs : " << endl
<< "% y [M_.endo_nbr by 1] double vector of endogenous variables in declaration order" << endl
<< "% x [M_.exo_nbr by 1] double vector of exogenous variables in declaration order" << endl
<< "% params [M_.param_nbr by 1] double vector of parameter values in declaration order" << endl
<< "%" << endl
<< "% Outputs:" << endl
<< "% rp [M_.eq_nbr by #params] double Jacobian matrix of static model equations with respect to parameters " << endl
<< "% Dynare may prepend or append auxiliary equations, see M_.aux_vars" << endl
<< "% gp [M_.endo_nbr by M_.endo_nbr by #params] double Derivative of the Jacobian matrix of the static model equations with respect to the parameters" << endl
<< "% rows: variables in declaration order" << endl
<< "% rows: equations in order of declaration" << endl
<< "% rpp [#second_order_residual_terms by 4] double Hessian matrix of second derivatives of residuals with respect to parameters;" << endl
<< "% rows: respective derivative term" << endl
<< "% 1st column: equation number of the term appearing" << endl
<< "% 2nd column: number of the first parameter in derivative" << endl
<< "% 3rd column: number of the second parameter in derivative" << endl
<< "% 4th column: value of the Hessian term" << endl
<< "% gpp [#second_order_Jacobian_terms by 5] double Hessian matrix of second derivatives of the Jacobian with respect to the parameters;" << endl
<< "% rows: respective derivative term" << endl
<< "% 1st column: equation number of the term appearing" << endl
<< "% 2nd column: column number of variable in Jacobian of the static model" << endl
<< "% 3rd column: number of the first parameter in derivative" << endl
<< "% 4th column: number of the second parameter in derivative" << endl
<< "% 5th column: value of the Hessian term" << endl
<< "%" << endl
<< "%" << endl
<< "% Warning : this file is generated automatically by Dynare" << endl
<< "% from model file (.mod)" << endl << endl;
else