Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • 4.6
  • 5.x
  • 6.x
  • asm
  • aux_func
  • benchmark-ec
  • clang+openmp
  • covariance-quadratic-approximation
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dprior
  • dragonfly
  • dynamic-striated
  • dynare_minreal
  • eigen
  • ep-sparse
  • error_msg_undeclared_model_vars
  • estim_params
  • exceptions
  • exo_steady_state
  • filter_initial_state
  • gpm-optimal-policy
  • julia
  • kalman_mex
  • master
  • mex-GetPowerDeriv
  • mr#2134
  • new-samplers
  • newton-quadratic-equation-solver
  • nlf-fixes
  • nlf-fixes-r
  • nls-fixes
  • nonlinear-filter-fixes
  • occbin
  • pac-mce-with-composite-target
  • parfor
  • penalty
  • rebase-1
  • remove-persistent-variables
  • remove-priordens
  • reset-seed-in-unit-tests
  • rmExtraExo
  • sep
  • sep-fixes
  • separateM_
  • silicon
  • silicon-new-samplers
  • slice
  • sphinx-doc-experimental
  • static_aux_vars
  • time-varying-information-set
  • use-dprior
  • various_fixes
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
111 results

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • ebenetce/dynare
  • chskcau/dynare-doc-fixes
28 results
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • 4.6
  • 5.x
  • 6.x
  • asm
  • aux_func
  • clang+openmp
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dragonfly
  • dynare_minreal
  • eigen
  • error_msg_undeclared_model_vars
  • estim_params
  • exo_steady_state
  • gpm-optimal-policy
  • julia
  • madysson
  • master
  • mex-GetPowerDeriv
  • penalty
  • separateM_
  • slice
  • sphinx-doc-experimental
  • static_aux_vars
  • time-varying-information-set
  • various_fixes
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
  • 6-beta1
  • 6-beta2
  • 6.0
  • 6.1
  • 6.2
  • 6.3
  • 6.4
91 results
Show changes
Showing
with 735 additions and 832 deletions
SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests
EXTRA_DIST = dynare_simul
install-exec-local:
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/dynare++
cp -r dynare_simul/* $(DESTDIR)$(pkglibdir)/dynare++
uninstall-local:
rm -rf $(DESTDIR)$(pkglibdir)/dynare++
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
\author{Ondra Kamen\'\i k} \author{Ondra Kamen\'\i k}
\date{February 2011, updated August 2016} \date{First version: February 2011 \\ This version: September 2020}
\maketitle \maketitle
\tableofcontents \tableofcontents
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
\section{Setup} \section{Setup}
The Dynare++ setup procedure is pretty straightforward as Dynare++ is included in the Dynare installation The Dynare++ setup procedure is pretty straightforward as Dynare++ is included in the Dynare installation
packages which can be downloaded from \url{http://www.dynare.org}. Take the following steps: packages which can be downloaded from \url{https://www.dynare.org}. Take the following steps:
\begin{enumerate} \begin{enumerate}
\item Add the {\tt dynare++} subdirectory of the root Dynare installation directory to the your \item Add the {\tt dynare++} subdirectory of the root Dynare installation directory to the your
operating system path. This ensures that your OS will find the {\tt dynare++} executable. operating system path. This ensures that your OS will find the {\tt dynare++} executable.
...@@ -159,10 +159,7 @@ file {\tt example1.jnl} and a MATLAB MAT-4 {\tt example1.mat}. The ...@@ -159,10 +159,7 @@ file {\tt example1.jnl} and a MATLAB MAT-4 {\tt example1.mat}. The
journal file contains information about time, memory and processor journal file contains information about time, memory and processor
resources needed for all steps of solution. The output file is more resources needed for all steps of solution. The output file is more
interesting. It contains various simulation results. It can be loaded interesting. It contains various simulation results. It can be loaded
into MATLAB or Scilab and examined.% into MATLAB or Octave and examined.
\footnote{For MATLAB {\tt load example1.mat}, for Scilab {\tt
mtlb\_load example1.mat}} The following examples are done in MATLAB,
everything would be very similar in Scilab.
Let us first examine the contents of the MAT file: Let us first examine the contents of the MAT file:
{\small {\small
...@@ -431,7 +428,7 @@ vcov = [ ...@@ -431,7 +428,7 @@ vcov = [
} }
After this model file has been run, we can load the resulting MAT-file After this model file has been run, we can load the resulting MAT-file
into the MATLAB (or Scilab) and examine its contents: into the MATLAB and examine its contents:
{\small {\small
\begin{verbatim} \begin{verbatim}
>> load kp1980_2.mat >> load kp1980_2.mat
...@@ -628,7 +625,11 @@ reported. They might be useful for confidence interval calculations. ...@@ -628,7 +625,11 @@ reported. They might be useful for confidence interval calculations.
For each shock, Dynare++ calculates IRF for two impulses, positive and For each shock, Dynare++ calculates IRF for two impulses, positive and
negative. Size of an impulse is one standard error of a respective negative. Size of an impulse is one standard error of a respective
shock. shock.\footnote{Note that if the exogenous shocks are correlated, Dynare++ will
ignore the correlation when computing the IRFs, and simulate the impulse on
each shock independently of the others. Note that Dynare behaves differently
in this case, and computes IRFs after performing an orthogonalization of the
shocks (via a Cholesky decomposition of the variance-covariance matrix).}
The rest of this subsection is divided to three parts giving account The rest of this subsection is divided to three parts giving account
on real-time simulations, conditional simulations, and on the way how on real-time simulations, conditional simulations, and on the way how
...@@ -924,7 +925,7 @@ This section deals with Dynare++ input. The first subsection ...@@ -924,7 +925,7 @@ This section deals with Dynare++ input. The first subsection
\ref{dynpp_opts} provides a list of command line options, next \ref{dynpp_opts} provides a list of command line options, next
subsection \ref{dynpp_mod} deals with a format of Dynare++ model file, subsection \ref{dynpp_mod} deals with a format of Dynare++ model file,
and the last subsection discusses incompatibilities between Dynare and the last subsection discusses incompatibilities between Dynare
MATLAB and Dynare++. and Dynare++.
\subsection{Command Line Options} \subsection{Command Line Options}
\label{dynpp_opts} \label{dynpp_opts}
...@@ -1143,7 +1144,7 @@ $t+1$. The realization of $u_t$ is included in the information set of ...@@ -1143,7 +1144,7 @@ $t+1$. The realization of $u_t$ is included in the information set of
$E_t$. See an explanation of Dynare++ timing on page \pageref{timing}. $E_t$. See an explanation of Dynare++ timing on page \pageref{timing}.
\end{itemize} \end{itemize}
The model equations are formulated in the same way as in MATLAB The model equations are formulated in the same way as in
Dynare. The time indexes different from $t$ are put to round Dynare. The time indexes different from $t$ are put to round
parenthesis in this way: {\tt C(-1)}, {\tt C}, {\tt C(+1)}. parenthesis in this way: {\tt C(-1)}, {\tt C}, {\tt C(+1)}.
...@@ -1181,16 +1182,16 @@ Y-Y_SS = rho*(Y(-1)-Y_SS)+EPS; ...@@ -1181,16 +1182,16 @@ Y-Y_SS = rho*(Y(-1)-Y_SS)+EPS;
\end{verbatim} \end{verbatim}
} }
\subsection{Incompatibilities with MATLAB Dynare} \subsection{Incompatibilities with Dynare}
This section provides a list of incompatibilities between a model file This section provides a list of incompatibilities between a model file
for Dy\-na\-re++ and MATLAB Dynare. These must be considered when a model for Dy\-na\-re++ and for Dynare. These must be considered when a model
file for MATLAB Dynare is being migrated to Dynare++. The list is the file for Dynare is being migrated to Dynare++. The list is the
following: following:
\begin{itemize} \begin{itemize}
\item There is no {\tt periods} keyword. \item There is no {\tt periods} keyword.
\item The parameters cannot be lagged or leaded, I think that Dynare \item The parameters cannot be lagged or leaded; Dynare
MATLAB allows it, but the semantics is the same (parameter is a allows it, though the semantics is the same (parameter is a
constant). constant).
\item There are no commands like {\tt steady}, {\tt check}, {\tt \item There are no commands like {\tt steady}, {\tt check}, {\tt
simul}, {\tt stoch\_simul}, etc. simul}, {\tt stoch\_simul}, etc.
......
%
% SYNOPSIS
%
% r = dynare_simul(name, shocks)
% r = dynare_simul(name, prefix, shocks)
% r = dynare_simul(name, shocks, start)
% r = dynare_simul(name, prefix, shocks, start)
%
% name name of MAT-file produced by dynare++
% prefix prefix of variables in the MAT-file
% shocks matrix of shocks
% start zero period value
%
% Note that this file requires the dynare_simul_ DLL to be in the path.
% This DLL is distributed with Dynare, under the mex/matlab or mex/octave
% subdirectory.
%
% SEMANTICS
%
% The command reads a decision rule from the MAT-file having the given
% prefix. Then it starts simulating the decision rule with zero time value
% equal to the given start. It uses the given shocks for the simulation. If
% the start is not given, the state about which the decision rule is
% centralized is taken (called fix point, or stochastic steady state, take
% your pick).
%
% prefix Use the prefix with which you called dynare++, the default
% prefix in dynare++ is 'dyn'.
% shocks Number of rows must be a number of exogenous shocks,
% number of columns gives the number of simulated
% periods. NaNs and Infs in the matrix are substitued by
% draws from the normal distribution using the covariance
% matrix given in the model file.
% start Vector of endogenous variables in the ordering given by
% <prefix>_vars.
%
% Seed for random generator is derived from calling rand(1,1). Therefore,
% seeding can be controlled with rand('state') and rand('state',some_seed).
%
% EXAMPLES
%
% All examples suppose that the prefix is 'dyn' and that your_model.mat
% has been loaded into Matlab.
%
% 1. response to permanent negative shock to the third exo var EPS3 for
% 100 periods
%
% shocks = zeros(4,100); % 4 exogenous variables in the model
% shocks(dyn_i_EPS3,:) = -0.1; % the permanent shock to EPS3
% r = dynare_simul('your_model.mat',shocks);
%
% 2. one stochastic simulation for 100 periods
%
% shocks = zeros(4,100)./0; % put NaNs everywhere
% r = dynare_simul('your_model.mat',shocks);
%
% 3. one stochastic simulation starting at 75% undercapitalized economy
%
% shocks = zeros(4,100)./0; % put NaNs everywhere
% ystart = dyn_ss; % get copy of DR fix point
% ystart(dyn_i_K) = 0.75*dyn_ss(dyn_i_K); % scale down the capital
% r = dynare_simul('your_model.mat',shocks,ystart);
%
%
% SEE ALSO
%
% "DSGE Models with Dynare++. A Tutorial.", Ondra Kamenik, 2005
% Copyright (C) 2005-2011, Ondra Kamenik
% Copyright (C) 2020, Dynare Team
function r = dynare_simul(varargin)
if ~exist('dynare_simul_','file')
error('Can''t find dynare_simul_ DLL in the path. The simplest way to add it is to run Dynare once in this session.')
end
% get the file name and load data
fname = varargin{1};
load(fname);
% set prefix, shocks, ystart
if ischar(varargin{2})
prefix = varargin{2};
if length(varargin) == 3
shocks = varargin{3};
ystart = NaN;
elseif length(varargin) == 4
shocks = varargin{3};
ystart = varargin{4};
else
error('Wrong number of parameters.');
end
else
prefix = 'dyn';
if length(varargin) == 2
shocks = varargin{2};
ystart = NaN;
elseif length(varargin) == 3
shocks = varargin{2};
ystart = varargin{3};
else
error('Wrong number of parameters.');
end
end
% load all needed variables but prefix_g_*
if exist([prefix '_nstat'],'var')
nstat = eval([prefix '_nstat']);
else
error(['Could not find variable ' prefix '_nstat in workspace']);
end
if exist([prefix '_npred'],'var')
npred = eval([prefix '_npred']);
else
error(['Could not find variable ' prefix '_npred in workspace']);
end
if exist([prefix '_nboth'],'var')
nboth = eval([prefix '_nboth']);
else
error(['Could not find variable ' prefix '_nboth in workspace']);
end
if exist([prefix '_nforw'],'var')
nforw = eval([prefix '_nforw']);
else
error(['Could not find variable ' prefix '_nforw in workspace']);
end
if exist([prefix '_ss'],'var')
ss = eval([prefix '_ss']);
else
error(['Could not find variable ' prefix '_ss in workspace']);
end
if exist([prefix '_vcov_exo'],'var')
vcov_exo = eval([prefix '_vcov_exo']);
else
error(['Could not find variable ' prefix '_vcov_exo in workspace']);
end
nexog = size(vcov_exo,1);
if isnan(ystart)
ystart = ss;
end
% newer version of dynare++ doesn't return prefix_g_0, we make it here if
% it does not exist in workspace
g_zero = [prefix '_g_0'];
if ~exist(g_zero,'var')
dr.g_0=zeros(nstat+npred+nboth+nforw,1);
else
dr.g_0=eval(g_zero);
end
% make derstr a string of comma seperated existing prefix_g_*
order = 1;
cont = 1;
while cont == 1
g_ord = [prefix '_g_' num2str(order)];
if exist(g_ord,'var')
dr.(['g_' num2str(order)])=eval(g_ord);
order = order + 1;
else
cont = 0;
end
end
% set seed
seed = ceil(10000*rand(1,1));
% call dynare_simul_
[err,r]=dynare_simul_(order-1,nstat,npred,nboth,nforw,...
nexog,ystart,shocks,vcov_exo,seed,ss,dr);
if err
error('Simulation failed')
end
\ No newline at end of file
/* /*
* Copyright © 2004-2011 Ondra Kamenik * Copyright © 2004-2011 Ondra Kamenik
* Copyright © 2019 Dynare Team * Copyright © 2019-2020 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -203,8 +203,8 @@ Journal::printHeader() ...@@ -203,8 +203,8 @@ Journal::printHeader()
*this << "Dynare++ v. " << VERSION << '\n' *this << "Dynare++ v. " << VERSION << '\n'
<< '\n' << '\n'
<< u8"Copyright © 2004-2011 Ondra Kamenik\n" << u8"Copyright © 2004-2011 Ondra Kamenik\n"
<< u8"Copyright © 2019 Dynare Team\n" << u8"Copyright © 2019-2020 Dynare Team\n"
<< "Dynare++ comes with ABSOLUTELY NO WARRANTY and is distributed under the GNU GPL," << "Dynare++ comes with ABSOLUTELY NO WARRANTY and is distributed under the GNU GPL,\n"
<< "version 3 or later (see https://www.gnu.org/licenses/gpl.html)\n" << "version 3 or later (see https://www.gnu.org/licenses/gpl.html)\n"
<< "\n\n" << "\n\n"
<< "System info: "; << "System info: ";
...@@ -219,7 +219,15 @@ Journal::printHeader() ...@@ -219,7 +219,15 @@ Journal::printHeader()
*this << ", processors online: " << std::thread::hardware_concurrency() *this << ", processors online: " << std::thread::hardware_concurrency()
<< "\n\nStart time: "; << "\n\nStart time: ";
std::time_t t = std::time(nullptr); std::time_t t = std::time(nullptr);
*this << std::put_time(std::localtime(&t), "%c %Z") // NB: in the date/time string, we avoid using locale-specific strings (#1751)
*this << std::put_time(std::localtime(&t),
#ifndef _WIN32
"%F %T %z"
#else
// Specifiers introduced in C++11 don’t work under Windows…
"%Y-%m-%d %H:%M:%S"
#endif
)
<< "\n\n" << "\n\n"
<< u8" ┌────╼ elapsed time (seconds) \n" << u8" ┌────╼ elapsed time (seconds) \n"
<< u8" │ ┌────╼ record unique identifier \n" << u8" │ ┌────╼ record unique identifier \n"
......
/* /*
* Copyright © 2004-2011 Ondra Kamenik * Copyright © 2004-2011 Ondra Kamenik
* Copyright © 2019 Dynare Team * Copyright © 2019-2020 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -47,7 +47,7 @@ main(int argc, char **argv) ...@@ -47,7 +47,7 @@ main(int argc, char **argv)
std::cout << "Dynare++ v. " << VERSION << '\n' std::cout << "Dynare++ v. " << VERSION << '\n'
<< '\n' << '\n'
<< u8"Copyright © 2004-2011 Ondra Kamenik\n" << u8"Copyright © 2004-2011 Ondra Kamenik\n"
<< u8"Copyright © 2019 Dynare Team\n" << u8"Copyright © 2019-2020 Dynare Team\n"
<< "Dynare++ comes with ABSOLUTELY NO WARRANTY and is distributed under the GNU GPL,\n" << "Dynare++ comes with ABSOLUTELY NO WARRANTY and is distributed under the GNU GPL,\n"
<< "version 3 or later (see https://www.gnu.org/licenses/gpl.html)\n"; << "version 3 or later (see https://www.gnu.org/licenses/gpl.html)\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
......
/* /*
* This file implements the Baseline New Keynesian DSGE model described in * This file implements the Baseline New Keynesian DSGE model described in
* much detail in Jesús Fernández-Villaverde and Juan F. Rubio-Ramírez (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 * Model, available at http://economics.sas.upenn.edu/~jesusfv/benchmark_DSGE.pdf
* *
* The parametrization is based on the estimated version of this model in * The parametrization is based on the estimated version of this model in
* Jesús Fernández-Villaverde (2010): "The econometrics of DSGE models", * Jesús Fernández-Villaverde (2010): The econometrics of DSGE models,
* SERIEs, Vol. 1, pp. 3-49, DOI 10.1007/s13209-009-0014-7 * SERIEs, Vol. 1, pp. 3-49, DOI 10.1007/s13209-009-0014-7
* *
* This implementation was written by Benjamin Born and Johannes Pfeifer. In * This implementation was written by Benjamin Born and Johannes Pfeifer. In
...@@ -24,16 +24,15 @@ ...@@ -24,16 +24,15 @@
* example3.mod * example3.mod
* *
* The model is written in the beginning of period stock notation. To make the model * The model is written in the beginning of period stock notation. To make the model
* conform with Dynare's end of period stock notation, we use the * conform with Dynares end of period stock notation, we use the
* predetermined_variables-command. * predetermined_variables-command.
* *
* Please note that the following copyright notice only applies to this Dynare * Please note that the following copyright notice only applies to this Dynare
* implementation of the model. * implementation of the model.
*/ */
/* /*
* Copyright (C) 2013-2016 Dynare Team * Copyright (C) 2013-2020 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -51,72 +50,78 @@ ...@@ -51,72 +50,78 @@
* along with Dynare. If not, see <http://www.gnu.org/licenses/>. * along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/ */
var d //preference shock var d (long_name='preference shock')
c //consumption c (long_name='consumption')
mu_z //trend growth rate of the economy (from neutral and investment specific technology) mu_z (long_name='trend growth rate of the economy (from neutral and investment specific technology)')
mu_I //growth rate of investment-specific technology growth mu_I (long_name='growth rate of investment-specific technology growth')
mu_A //growth rate of neutral technology mu_A (long_name='growth rate of neutral technology')
lambda //Lagrange multiplier lambda (long_name='Lagrange multiplier')
R //Nominal Interest rate R (long_name='Nominal Interest rate')
PI //Inflation PI (long_name='Inflation')
r //rental rate of capital r (long_name='rental rate of capital')
x //investment x (long_name='investment')
u //capacity utilization u (long_name='capacity utilization')
q //Tobin's marginal q q (long_name='Tobin marginal q')
f //variable for recursive formulation of wage setting f (long_name='variable for recursive formulation of wage setting')
ld //aggregate labor demand ld (long_name='aggregate labor demand')
w //real wage w (long_name='real wage')
wstar //optimal real wage wstar (long_name='optimal real wage')
PIstarw //optimal wage inflation PIstarw (long_name='optimal wage inflation')
PIstar //optimal price inflation PIstar (long_name='optimal price inflation')
g1 //variable 1 for recursive formulation of price setting g1 (long_name='variable 1 for recursive formulation of price setting')
g2 //variable 2 for recursive formulation of price setting g2 (long_name='variable 2 for recursive formulation of price setting')
yd //aggregate output yd (long_name='aggregate output')
mc //marginal costs mc (long_name='marginal costs')
k //capital k (long_name='capital')
vp //price dispersion term vp (long_name='price dispersion term')
vw //wage dispersion term vw (long_name='wage dispersion term')
l //aggregate labor bundle l (long_name='aggregate labor bundle')
phi //labor disutility shock phi (long_name='labor disutility shock')
F; //firm profits F (long_name='firm profits')
;
varexo epsd epsphi epsmu_I epsA epsm;
predetermined_variables k; varexo epsd (long_name='Innovation preference shock')
epsphi (long_name='Innovation labor disutility shock')
epsmu_I (long_name='Innovation investment-specific technology')
epsA (long_name='Innovation neutral technology')
epsm (long_name='Innovation monetary policy shock')
;
parameters h //consumption habits predetermined_variables k;
betta //discount factor
gammma1 //capital utilization, linear term
gammma2 //capital utilization, quadratic term
delta //depreciation rate
kappa //capital adjustment costs parameter
eta //elasticity of substitution between labor varieties
epsilon //elasticity of substitution between goods varieties
varpsi //labor disutility parameter
gammma //inverse Frisch elasticity
chiw //wage indexation parameter
chi //price indexation
thetap //Calvo parameter prices
thetaw //Calvo parameter wages
alppha //capital share
Rbar //steady state interest rate
PIbar //steady state inflation
gammmaR //interest smoothing coefficient Taylor rule
gammmaPI //feedback coefficient to inflation monetary policy rule
gammmay //feedback coefficient to output growth deviation in monetary policy rule
Phi //firms fixed costs
rhod //autocorrelation preference shock
rhophi //autocorrelation labor disutility shock
Lambdamu //steady state growth rate of investmentment-specific technology
LambdaA //steady state neutral technology growth
Lambdax //steady state growth rate of investment
LambdaYd //steady state growth rate of output
sigma_d //standard deviation preference shock
sigma_phi //standard deviation labor disutility shock
sigma_mu //standard deviation investment-specific technology
sigma_A //standard deviation neutral technology
sigma_m; //standard deviation preference shock
parameters h (long_name='consumption habits')
betta (long_name='discount factor')
gammma1 (long_name='capital utilization, linear term')
gammma2 (long_name='capital utilization, quadratic term')
delta (long_name='depreciation rate')
kappa (long_name='capital adjustment costs parameter')
eta (long_name='elasticity of substitution between labor varieties')
epsilon (long_name='elasticity of substitution between goods varieties')
varpsi (long_name='labor disutility parameter')
gammma (long_name='inverse Frisch elasticity')
chiw (long_name='wage indexation parameter')
chi (long_name='price indexation')
thetap (long_name='Calvo parameter prices')
thetaw (long_name='Calvo parameter wages')
alppha (long_name='capital share')
Rbar (long_name='steady state interest rate')
PIbar (long_name='steady state inflation')
gammmaR (long_name='interest smoothing coefficient Taylor rule')
gammmaPI (long_name='feedback coefficient to inflation monetary policy rule')
gammmay (long_name='feedback coefficient to output growth deviation in monetary policy rule')
Phi (long_name='firms fixed costs')
rhod (long_name='autocorrelation preference shock')
rhophi (long_name='autocorrelation labor disutility shock')
Lambdamu (long_name='steady state growth rate of investmentment-specific technology')
LambdaA (long_name='steady state neutral technology growth')
Lambdax (long_name='steady state growth rate of investment')
LambdaYd (long_name='steady state growth rate of output')
sigma_d (long_name='standard deviation preference shock')
sigma_phi (long_name='standard deviation labor disutility shock')
sigma_mu (long_name='standard deviation investment-specific technology')
sigma_A (long_name='standard deviation neutral technology')
sigma_m (long_name='standard deviation monetary policy shock')
;
//Note that the parameter naming in FV(2010) differs from FV(2006) //Note that the parameter naming in FV(2010) differs from FV(2006)
//Fixed parameters, taken from FV(2010), Table 2, p. 37 //Fixed parameters, taken from FV(2010), Table 2, p. 37
...@@ -177,60 +182,67 @@ FV(2006), p. 20, section 3.2. ...@@ -177,60 +182,67 @@ FV(2006), p. 20, section 3.2.
*/ */
model; model;
//1. FOC consumption [name='FOC consumption']
d*(c-h*c(-1)*mu_z^(-1))^(-1)-h*betta*d(+1)*(c(+1)*mu_z(+1)-h*c)^(-1)=lambda; d*(c-h*c(-1)*mu_z^(-1))^(-1)-h*betta*d(+1)*(c(+1)*mu_z(+1)-h*c)^(-1)=lambda;
//2. Euler equation [name='Euler equation']
lambda=betta*lambda(+1)*mu_z(+1)^(-1)/PI(+1)*R; lambda=betta*lambda(+1)*mu_z(+1)^(-1)/PI(+1)*R;
//3. FOC capital utilization [name='FOC capital utilization']
r=gammma1+gammma2*(u-1); r=gammma1+gammma2*(u-1);
//4. FOC capital [name='FOC capital']
q=betta*lambda(+1)/lambda*mu_z(+1)^(-1)*mu_I(+1)^(-1)*((1-delta)*q(+1)+r(+1)*u(+1)-(gammma1*(u(+1)-1)+gammma2/2*(u(+1)-1)^2)); q=betta*lambda(+1)/lambda*mu_z(+1)^(-1)*mu_I(+1)^(-1)*((1-delta)*q(+1)+r(+1)*u(+1)-(gammma1*(u(+1)-1)+gammma2/2*(u(+1)-1)^2));
//5. FOC investment [name='FOC investment']
1=q*(1-(kappa/2*(x/x(-1)*mu_z-Lambdax)^2)-(kappa*(x/x(-1)*mu_z-Lambdax)*x/x(-1)*mu_z)) 1=q*(1-(kappa/2*(x/x(-1)*mu_z-Lambdax)^2)-(kappa*(x/x(-1)*mu_z-Lambdax)*x/x(-1)*mu_z))
+betta*q(+1)*lambda(+1)/lambda*mu_z(+1)^(-1)*kappa*(x(+1)/x*mu_z(+1)-Lambdax)*(x(+1)/x*mu_z(+1))^2; +betta*q(+1)*lambda(+1)/lambda*mu_z(+1)^(-1)*kappa*(x(+1)/x*mu_z(+1)-Lambdax)*(x(+1)/x*mu_z(+1))^2;
//6-7. Wage setting [name='Wage setting 1']
f=(eta-1)/eta*wstar^(1-eta)*lambda*w^eta*ld+betta*thetaw*(PI^chiw/PI(+1))^(1-eta)*(wstar(+1)/wstar*mu_z(+1))^(eta-1)*f(+1); f=(eta-1)/eta*wstar^(1-eta)*lambda*w^eta*ld+betta*thetaw*(PI^chiw/PI(+1))^(1-eta)*(wstar(+1)/wstar*mu_z(+1))^(eta-1)*f(+1);
[name='Wage setting 2']
f=varpsi*d*phi*PIstarw^(-eta*(1+gammma))*ld^(1+gammma)+betta*thetaw*(PI^chiw/PI(+1))^(-eta*(1+gammma))*(wstar(+1)/wstar*mu_z(+1))^(eta*(1+gammma))*f(+1); f=varpsi*d*phi*PIstarw^(-eta*(1+gammma))*ld^(1+gammma)+betta*thetaw*(PI^chiw/PI(+1))^(-eta*(1+gammma))*(wstar(+1)/wstar*mu_z(+1))^(eta*(1+gammma))*f(+1);
//8-10. firm's price setting [name='Firm price setting 1']
g1=lambda*mc*yd+betta*thetap*(PI^chi/PI(+1))^(-epsilon)*g1(+1); g1=lambda*mc*yd+betta*thetap*(PI^chi/PI(+1))^(-epsilon)*g1(+1);
[name='Firm price setting 2']
g2=lambda*PIstar*yd+betta*thetap*(PI^chi/PI(+1))^(1-epsilon)*PIstar/PIstar(+1)*g2(+1); g2=lambda*PIstar*yd+betta*thetap*(PI^chi/PI(+1))^(1-epsilon)*PIstar/PIstar(+1)*g2(+1);
[name='Firm price setting 3']
epsilon*g1=(epsilon-1)*g2; epsilon*g1=(epsilon-1)*g2;
//11-12. optimal inputs [name='Optimal capital labor ratio']
u*k/ld=alppha/(1-alppha)*w/r*mu_z*mu_I; u*k/ld=alppha/(1-alppha)*w/r*mu_z*mu_I;
[name='Marginal costs']
mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha; mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha;
//13. law of motion wages [name='law of motion wages']
1=thetaw*(PI(-1)^chiw/PI)^(1-eta)*(w(-1)/w*mu_z^(-1))^(1-eta)+(1-thetaw)*PIstarw^(1-eta); 1=thetaw*(PI(-1)^chiw/PI)^(1-eta)*(w(-1)/w*mu_z^(-1))^(1-eta)+(1-thetaw)*PIstarw^(1-eta);
//14. law of motion prices [name='law of motion prices']
1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon); 1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon);
//15. Taylor Rule [name='Taylor Rule']
R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm); R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm);
//16-17. Market clearing [name='Resource constraint']
yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k; yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k;
[name='Aggregate production']
yd=(mu_A*mu_z^(-1)*(u*k)^alppha*ld^(1-alppha)-Phi)/vp; yd=(mu_A*mu_z^(-1)*(u*k)^alppha*ld^(1-alppha)-Phi)/vp;
//18-20. Price and wage dispersion terms [name='Aggregate labor market']
l=vw*ld; l=vw*ld;
[name='LOM Price dispersion term']
vp=thetap*(PI(-1)^chi/PI)^(-epsilon)*vp(-1)+(1-thetap)*PIstar^(-epsilon); vp=thetap*(PI(-1)^chi/PI)^(-epsilon)*vp(-1)+(1-thetap)*PIstar^(-epsilon);
[name='LOM Wage dispersion term']
vw=thetaw*(w(-1)/w*mu_z^(-1)*PI(-1)^chiw/PI)^(-eta)*vw(-1)+(1-thetaw)*(PIstarw)^(-eta); vw=thetaw*(w(-1)/w*mu_z^(-1)*PI(-1)^chiw/PI)^(-eta)*vw(-1)+(1-thetaw)*(PIstarw)^(-eta);
//21. Law of motion for capital [name='Law of motion for capital']
k(+1)*mu_z*mu_I-(1-delta)*k-mu_z*mu_I*(1-kappa/2*(x/x(-1)*mu_z-Lambdax)^2)*x=0; k(+1)*mu_z*mu_I-(1-delta)*k-mu_z*mu_I*(1-kappa/2*(x/x(-1)*mu_z-Lambdax)^2)*x=0;
//22. Profits [name='Profits']
F=yd-1/(1-alppha)*w*ld; F=yd-1/(1-alppha)*w*ld;
//23. definition optimal wage inflation [name='definition optimal wage inflation']
PIstarw=wstar/w; PIstarw=wstar/w;
//exogenous processes //exogenous processes
//24. Preference Shock [name='Preference Shock']
log(d)=rhod*log(d(-1))+epsd; log(d)=rhod*log(d(-1))+epsd;
//25. Labor disutility Shock [name='Labor disutility Shock']
log(phi)=rhophi*log(phi(-1))+epsphi; log(phi)=rhophi*log(phi(-1))+epsphi;
//26. Investment specific technology [name='Investment specific technology']
log(mu_I)=Lambdamu+epsmu_I; log(mu_I)=Lambdamu+epsmu_I;
//27. Neutral technology [name='Neutral technology']
log(mu_A)=LambdaA+epsA; log(mu_A)=LambdaA+epsA;
//28. Defininition composite technology [name='Defininition composite technology']
mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha)); mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha));
end; end;
......
...@@ -15,6 +15,23 @@ function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_) ...@@ -15,6 +15,23 @@ function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
% - check [scalar] set to 0 if steady state computation worked and to % - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impose restrictions on parameters) % 1 of not (allows to impose restrictions on parameters)
% Copyright (C) 2013-2020 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% read out parameters to access them with their name % read out parameters to access them with their name
NumberOfParameters = M_.param_nbr; NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters for ii = 1:NumberOfParameters
......
This diff is collapsed.
/* /*
* This file replicates the model studied in: * This file replicates the model studied in:
* Aguiar, Mark and Gopinath, Gita (2004): "Emerging Market Business Cycles: * Aguiar, Mark and Gopinath, Gita (2004): “Emerging Market Business Cycles:
* The Cycle is the Trend" (NBER WP 10734). It is different from version published * The Cycle is the Trend(NBER WP 10734). It is different from version published
* in the Journal of Political Economy. * in the Journal of Political Economy.
* *
* This model file is intended to show the capabilities of the Dynare macro * This model file is intended to show the capabilities of the Dynare macro
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* The mod-file reproduces Figure 4 of the working paper, which displays the * The mod-file reproduces Figure 4 of the working paper, which displays the
* model response to 1 percent shock to trend and cyclical TFP. * model response to 1 percent shock to trend and cyclical TFP.
* *
* This implementation was written by Sbastien Villemot and Johannes Pfeifer. * This implementation was written by Sébastien Villemot and Johannes Pfeifer.
* Please note that the following copyright notice only applies to this Dynare * Please note that the following copyright notice only applies to this Dynare
* implementation of the model. * implementation of the model.
*/ */
......
module Dynare
##
# Copyright © 2015-2016 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
##
export @compile, @dynare
function compile(modfile)
# Add cd to path if not already there
if isempty(findin([pwd()], LOAD_PATH))
unshift!(LOAD_PATH, pwd())
end
# Process modfile
println(string("Using ", Sys.WORD_SIZE, "-bit preprocessor"))
preprocessor = string(dirname(@__FILE__()), "/preprocessor", Sys.WORD_SIZE, "/dynare_m")
run(`$preprocessor $modfile language=julia output=dynamic`)
end
macro dynare(modfiles...)
ex = Expr(:toplevel)
if length(modfiles)>1
for modfile in modfiles
eval(:(compile($modfile)))
basename = split(modfile, ".mod"; keep=false)
push!(ex.args, Expr(:import, Symbol(basename[1])))
end
else
eval(:(compile($modfiles)))
basename = split(modfiles[1], ".mod"; keep=false)
push!(ex.args, Expr(:importall, Symbol(basename[1])))
end
return ex
end
macro compile(modfiles...)
for modfile in modfiles
eval(:(compile($modfile)))
end
end
end
This diff is collapsed.
module DynareOptions
##
# Copyright © 2015 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
##
export Options, dynare_options
type PFMSolver
maxit::Int
periods::Int
tolx::Float64
tolf::Float64
end
function pfmsolver_set_defaults()
return PFMSolver(500, # maxit (Maximum number of iterations in Newton algorithm)
400, # periods (Number of periods to return to the steady state)
1e-6, # tolx (Tolerance criterion on the paths for the endogenous variables)
1e-6 # tolf (Tolerance criterion on the stacked non linear equations)
)
end
type Options
dynare_version::String
linear::Bool
pfmsolver::PFMSolver
end
function dynare_options()
return Options("", # dynare_version
false, # linear
pfmsolver_set_defaults() # pfmsolver
)
end
end
module DynareOutput
##
# Copyright © 2015-2018 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
##
export Ouput, dynare_output
type Output
dynare_version::String
steady_state::Vector{Float64}
exo_steady_state::Vector{Float64}
end
function dynare_output()
return Output("", # dynare_version
Vector{Float64}(), # steady_state
Vector{Float64}() # exo_steady_state
)
end
end
This diff is collapsed.
This diff is collapsed.
module Utils
##
# Copyright © 2015 Dynare Team
#
# This file is part of Dynare.
#
# Dynare is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Dynare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
##
export get_power_deriv
function get_power_deriv(x::Float64, p::Real, k::Int)
if abs(x)<1e-12 && p>0 && k>p && typeof(p)==Int
dxp = .0
else
dxp = x^(p-k)
for i = 0:k-1
dxp *= p
p -= 1
end
end
return dxp
end
end
This diff is collapsed.
dnl Copyright © 2009-2019 Dynare Team dnl Copyright © 2009-2021 Dynare Team
dnl dnl
dnl This file is part of Dynare. dnl This file is part of Dynare.
dnl dnl
...@@ -22,6 +22,15 @@ AC_REQUIRE([AX_MATLAB]) ...@@ -22,6 +22,15 @@ AC_REQUIRE([AX_MATLAB])
AC_MSG_CHECKING([for MATLAB version]) AC_MSG_CHECKING([for MATLAB version])
if test -n "$MATLAB_VERSION"; then if test -n "$MATLAB_VERSION"; then
case $MATLAB_VERSION in case $MATLAB_VERSION in
*2021a | *2021A)
MATLAB_VERSION="9.10"
;;
*2020b | *2020B)
MATLAB_VERSION="9.9"
;;
*2020a | *2020A)
MATLAB_VERSION="9.8"
;;
*2019b | *2019B) *2019b | *2019B)
MATLAB_VERSION="9.7" MATLAB_VERSION="9.7"
;; ;;
......
This diff is collapsed.
This diff is collapsed.