Compare commits
10 Commits
24fbc0d923
...
4f2b9b3e62
Author | SHA1 | Date |
---|---|---|
Stéphane Adjemian | 4f2b9b3e62 | |
Johannes Pfeifer | 5d47ac2aa9 | |
Sébastien Villemot | 1ce40d4df5 | |
Sébastien Villemot | 6820edd614 | |
Sébastien Villemot | 4a8c78f703 | |
Sébastien Villemot | 3000e6d691 | |
Johannes Pfeifer | 73d54cea04 | |
Willi Mutschler | 1b3c1c33ce | |
Sébastien Villemot | dd03d51112 | |
Johannes Pfeifer | 4a2724959d |
139
doc/gsa/gsa.tex
139
doc/gsa/gsa.tex
|
@ -22,7 +22,7 @@
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
% ----------------------------------------------------------------
|
% ----------------------------------------------------------------
|
||||||
\title{Sensitivity Analysis Toolbox for DYNARE\thanks{Copyright \copyright~2012 Dynare
|
\title{Sensitivity Analysis Toolbox for Dynare\thanks{Copyright \copyright~2012-2024 Dynare
|
||||||
Team. Permission is granted to copy, distribute and/or modify
|
Team. Permission is granted to copy, distribute and/or modify
|
||||||
this document under the terms of the GNU Free Documentation
|
this document under the terms of the GNU Free Documentation
|
||||||
License, Version 1.3 or any later version published by the Free
|
License, Version 1.3 or any later version published by the Free
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
\author{Marco Ratto\\
|
\author{Marco Ratto\\
|
||||||
European Commission, Joint Research Centre \\
|
European Commission, Joint Research Centre \\
|
||||||
TP361, IPSC, \\21027 Ispra
|
TP581\\21027 Ispra
|
||||||
(VA) Italy\\
|
(VA) Italy\\
|
||||||
\texttt{marco.ratto@jrc.ec.europa.eu}
|
\texttt{Marco.Ratto@ec.europa.eu}
|
||||||
\thanks{The author gratefully thanks Christophe Planas, Kenneth Judd, Michel Juillard,
|
\thanks{The author gratefully thanks Christophe Planas, Kenneth Judd, Michel Juillard,
|
||||||
Alessandro Rossi, Frank Schorfheide and the participants to the
|
Alessandro Rossi, Frank Schorfheide and the participants to the
|
||||||
Courses on Global Sensitivity Analysis for Macroeconomic
|
Courses on Global Sensitivity Analysis for Macroeconomic
|
||||||
|
@ -52,21 +52,21 @@ helpful suggestions.}}
|
||||||
|
|
||||||
%-----------------------------------------------------------------------
|
%-----------------------------------------------------------------------
|
||||||
\begin{abstract}
|
\begin{abstract}
|
||||||
\noindent The Sensitivity Analysis Toolbox for DYNARE is a set of
|
\noindent The Sensitivity Analysis Toolbox for Dynare is a set of
|
||||||
MATLAB routines for the analysis of DSGE models with global
|
MATLAB routines for the analysis of DSGE models with global
|
||||||
sensitivity analysis. The routines are thought to be used within
|
sensitivity analysis. The routines are thought to be used within
|
||||||
the DYNARE v4 environment.
|
the Dynare 6 environment.
|
||||||
|
|
||||||
|
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item \textbf{Keywords}: Stability Mapping , Reduced form solution, DSGE models,
|
\item \textbf{Keywords}: Stability Mapping , Reduced form solution, DSGE models,
|
||||||
Monte Carlo filtering, Global Sensitivity Analysis.
|
Monte Carlo filtering, Global Sensitivity Analysis.
|
||||||
\end{description}
|
\end{description}
|
||||||
\end{abstract}
|
\end{abstract}
|
||||||
\newpage
|
\newpage
|
||||||
% ----------------------------------------------------------------
|
% ----------------------------------------------------------------
|
||||||
\section{Introduction} \label{s:intro}
|
\section{Introduction} \label{s:intro}
|
||||||
The Sensitivity Analysis Toolbox for DYNARE is a collection of
|
The Sensitivity Analysis Toolbox for Dynare is a collection of
|
||||||
MATLAB routines implemented to answer the following questions: (i)
|
MATLAB routines implemented to answer the following questions: (i)
|
||||||
Which is the domain of structural coefficients assuring the
|
Which is the domain of structural coefficients assuring the
|
||||||
stability and determinacy of a DSGE model? (ii) Which parameters
|
stability and determinacy of a DSGE model? (ii) Which parameters
|
||||||
|
@ -81,20 +81,18 @@ described in \cite{Ratto_CompEcon_2008}.
|
||||||
|
|
||||||
|
|
||||||
\section{Use of the Toolbox}
|
\section{Use of the Toolbox}
|
||||||
The DYNARE parser now recognizes sensitivity analysis commands.
|
The Dynare parser now recognizes sensitivity analysis commands.
|
||||||
The syntax is based on a single command:
|
The syntax is based on a single command:
|
||||||
\vspace{0.5cm}
|
\vspace{0.5cm}
|
||||||
|
|
||||||
\verb"dynare_sensitivity(option1=<opt1_val>,option2=<opt2_val>,...)"
|
\verb"sensitivity(option1=<opt1_val>,option2=<opt2_val>,...)"
|
||||||
|
|
||||||
\vspace{0.5cm} \noindent with a list of options described in the
|
\vspace{0.5cm} \noindent with a list of options described in the
|
||||||
next section.
|
next section.
|
||||||
|
|
||||||
With respect to the previous version of the toolbox, in order to
|
In order to work properly, the sensitivity analysis Toolbox does not need
|
||||||
work properly, the sensitivity analysis Toolbox \emph{no longer}
|
a Dynare estimation environment to be set up. Rather, \verb"sensitivity"
|
||||||
needs that the DYNARE estimation environment is set-up.
|
is the only command to run to
|
||||||
|
|
||||||
Therefore, \verb"dynare_sensitivity" is the only command to run to
|
|
||||||
make a sensitivity analysis on a DSGE model\footnote{Of course,
|
make a sensitivity analysis on a DSGE model\footnote{Of course,
|
||||||
when the user needs to perform the mapping of the fit with a
|
when the user needs to perform the mapping of the fit with a
|
||||||
posterior sample, a Bayesian estimation has to be performed
|
posterior sample, a Bayesian estimation has to be performed
|
||||||
|
@ -208,16 +206,17 @@ a multivariate normal MC sample, with covariance matrix based on
|
||||||
the inverse Hessian at the optimum: this analysis is useful when
|
the inverse Hessian at the optimum: this analysis is useful when
|
||||||
ML estimation is done (i.e. no Bayesian estimation);
|
ML estimation is done (i.e. no Bayesian estimation);
|
||||||
\item when \verb"ppost=1" the Toolbox analyses
|
\item when \verb"ppost=1" the Toolbox analyses
|
||||||
the RMSE's for the posterior sample obtained by DYNARE's
|
the RMSE's for the posterior sample obtained by Dynare's
|
||||||
Metropolis procedure.
|
Metropolis procedure.
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
|
|
||||||
The use of cases 2. and 3. requires an estimation step beforehand!
|
The use of cases 2. and 3. require an estimation step beforehand!
|
||||||
To facilitate the sensitivity analysis after estimation, the
|
To facilitate the sensitivity analysis after estimation, the
|
||||||
\verb"dynare_sensitivity" command also allows to indicate some
|
\verb"sensitivity" command also allows to indicate some
|
||||||
options of \verb"dynare_estimation". These are:
|
options of \verb"estimation". These are:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item \verb"datafile"
|
\item \verb"datafile"
|
||||||
|
\item \verb"diffuse_filter"
|
||||||
\item \verb"mode_file"
|
\item \verb"mode_file"
|
||||||
\item \verb"first_obs"
|
\item \verb"first_obs"
|
||||||
\item \verb"lik_init"
|
\item \verb"lik_init"
|
||||||
|
@ -278,10 +277,10 @@ identifiable.
|
||||||
\end{tabular}
|
\end{tabular}
|
||||||
|
|
||||||
\vspace{1cm}
|
\vspace{1cm}
|
||||||
\noindent For example, the following commands in the DYNARE model file
|
\noindent For example, the following commands in the Dynare model file
|
||||||
|
|
||||||
\vspace{1cm}
|
\vspace{1cm}
|
||||||
\noindent\verb"dynare_sensitivity(identification=1, morris=2);"
|
\noindent\verb"sensitivity(identification=1, morris=2);"
|
||||||
|
|
||||||
\vspace{1cm}
|
\vspace{1cm}
|
||||||
\noindent trigger the identification analysis using \cite{Iskrev2010,Iskrev2011}, jointly with the mapping of the acceptable region.
|
\noindent trigger the identification analysis using \cite{Iskrev2010,Iskrev2011}, jointly with the mapping of the acceptable region.
|
||||||
|
@ -293,75 +292,75 @@ Sensitivity analysis results are saved on the hard-disk of the
|
||||||
computer. The Toolbox uses a dedicated folder called \verb"GSA",
|
computer. The Toolbox uses a dedicated folder called \verb"GSA",
|
||||||
located in \\
|
located in \\
|
||||||
\\
|
\\
|
||||||
\verb"<DYNARE_file>\GSA", \\
|
\verb"<Dynare_file>\GSA", \\
|
||||||
\\
|
\\
|
||||||
where \verb"<DYNARE_file>.mod" is the name of the DYNARE model
|
where \verb"<Dynare_file>.mod" is the name of the Dynare model
|
||||||
file.
|
file.
|
||||||
|
|
||||||
\subsection{Binary data files}
|
\subsection{Binary data files}
|
||||||
A set of binary data files is saved in the \verb"GSA" folder:
|
A set of binary data files is saved in the \verb"GSA" folder:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_prior.mat": this file stores
|
\item[]\verb"<Dynare_file>_prior.mat": this file stores
|
||||||
information about the analyses performed sampling from the prior
|
information about the analyses performed sampling from the prior
|
||||||
ranges, i.e. \verb"pprior=1" and \verb"ppost=0";
|
ranges, i.e. \verb"pprior=1" and \verb"ppost=0";
|
||||||
\item[]\verb"<DYNARE_file>_mc.mat": this file stores
|
\item[]\verb"<Dynare_file>_mc.mat": this file stores
|
||||||
information about the analyses performed sampling from
|
information about the analyses performed sampling from
|
||||||
multivariate normal, i.e. \verb"pprior=0" and \verb"ppost=0";
|
multivariate normal, i.e. \verb"pprior=0" and \verb"ppost=0";
|
||||||
\item[]\verb"<DYNARE_file>_post.mat": this file stores information
|
\item[]\verb"<Dynare_file>_post.mat": this file stores information
|
||||||
about analyses performed using the Metropolis posterior sample,
|
about analyses performed using the Metropolis posterior sample,
|
||||||
i.e. \verb"ppost=1".
|
i.e. \verb"ppost=1".
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_prior_*.mat": these files store
|
\item[]\verb"<Dynare_file>_prior_*.mat": these files store
|
||||||
the filtered and smoothed variables for the prior MC sample,
|
the filtered and smoothed variables for the prior MC sample,
|
||||||
generated when doing RMSE analysis (\verb"pprior=1" and
|
generated when doing RMSE analysis (\verb"pprior=1" and
|
||||||
\verb"ppost=0");
|
\verb"ppost=0");
|
||||||
\item[]\verb"<DYNARE_file>_mc_*.mat": these files store
|
\item[]\verb"<Dynare_file>_mc_*.mat": these files store
|
||||||
the filtered and smoothed variables for the multivariate normal MC
|
the filtered and smoothed variables for the multivariate normal MC
|
||||||
sample, generated when doing RMSE analysis (\verb"pprior=0" and
|
sample, generated when doing RMSE analysis (\verb"pprior=0" and
|
||||||
\verb"ppost=0").
|
\verb"ppost=0").
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\subsection{Stability analysis}
|
\subsection{Stability analysis}
|
||||||
Figure files \verb"<DYNARE_file>_prior_*.fig" store results for
|
Figure files \verb"<Dynare_file>_prior_*.fig" store results for
|
||||||
the stability mapping from prior MC samples:
|
the stability mapping from prior MC samples:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_prior_stab_SA_*.fig": plots of the Smirnov
|
\item[]\verb"<Dynare_file>_prior_stab_SA_*.fig": plots of the Smirnov
|
||||||
test analyses confronting the cdf of the sample fulfilling
|
test analyses confronting the CDF of the sample fulfilling
|
||||||
Blanchard-Kahn conditions with the cdf of the rest of the sample;
|
Blanchard-Kahn conditions with the CDF of the rest of the sample;
|
||||||
\item[]\verb"<DYNARE_file>_prior_stab_indet_SA_*.fig": plots of the Smirnov
|
\item[]\verb"<Dynare_file>_prior_stab_indet_SA_*.fig": plots of the Smirnov
|
||||||
test analyses confronting the cdf of the sample producing
|
test analyses confronting the CDF of the sample producing
|
||||||
indeterminacy with the cdf of the original prior sample;
|
indeterminacy with the CDF of the original prior sample;
|
||||||
\item[]\verb"<DYNARE_file>_prior_stab_unst_SA_*.fig": plots of the Smirnov
|
\item[]\verb"<Dynare_file>_prior_stab_unst_SA_*.fig": plots of the Smirnov
|
||||||
test analyses confronting the cdf of the sample producing unstable
|
test analyses confronting the CDF of the sample producing unstable
|
||||||
(explosive roots) behaviour with the cdf of the original prior
|
(explosive roots) behaviour with the CDF of the original prior
|
||||||
sample;
|
sample;
|
||||||
\item[]\verb"<DYNARE_file>_prior_stable_corr_*.fig": plots of
|
\item[]\verb"<Dynare_file>_prior_stable_corr_*.fig": plots of
|
||||||
bivariate projections of the sample fulfilling Blanchard-Kahn
|
bivariate projections of the sample fulfilling Blanchard-Kahn
|
||||||
conditions;
|
conditions;
|
||||||
\item[]\verb"<DYNARE_file>_prior_indeterm_corr_*.fig": plots of
|
\item[]\verb"<Dynare_file>_prior_indeterm_corr_*.fig": plots of
|
||||||
bivariate projections of the sample producing indeterminacy;
|
bivariate projections of the sample producing indeterminacy;
|
||||||
\item[]\verb"<DYNARE_file>_prior_unstable_corr_*.fig": plots of
|
\item[]\verb"<Dynare_file>_prior_unstable_corr_*.fig": plots of
|
||||||
bivariate projections of the sample producing instability;
|
bivariate projections of the sample producing instability;
|
||||||
\item[]\verb"<DYNARE_file>_prior_unacceptable_corr_*.fig": plots of
|
\item[]\verb"<Dynare_file>_prior_unacceptable_corr_*.fig": plots of
|
||||||
bivariate projections of the sample producing unacceptable
|
bivariate projections of the sample producing unacceptable
|
||||||
solutions, i.e. either instability or indeterminacy or the
|
solutions, i.e. either instability or indeterminacy or the
|
||||||
solution could not be found (e.g. the steady state solution could
|
solution could not be found (e.g. the steady state solution could
|
||||||
not be found by the solver).
|
not be found by the solver).
|
||||||
\end{description}
|
\end{description}
|
||||||
Similar conventions apply for \verb"<DYNARE_file>_mc_*.fig" files,
|
Similar conventions apply for \verb"<Dynare_file>_mc_*.fig" files,
|
||||||
obtained when samples from multivariate normal are used.
|
obtained when samples from multivariate normal are used.
|
||||||
|
|
||||||
\subsection{RMSE analysis}
|
\subsection{RMSE analysis}
|
||||||
Figure files \verb"<DYNARE_file>_rmse_*.fig" store results for the
|
Figure files \verb"<Dynare_file>_rmse_*.fig" store results for the
|
||||||
RMSE analysis.
|
RMSE analysis.
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior*.fig": save results for
|
\item[]\verb"<Dynare_file>_rmse_prior*.fig": save results for
|
||||||
the analysis using prior MC samples;
|
the analysis using prior MC samples;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_mc*.fig": save results for
|
\item[]\verb"<Dynare_file>_rmse_mc*.fig": save results for
|
||||||
the analysis using multivariate normal MC samples;
|
the analysis using multivariate normal MC samples;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_post*.fig": save results for
|
\item[]\verb"<Dynare_file>_rmse_post*.fig": save results for
|
||||||
the analysis using Metropolis posterior samples.
|
the analysis using Metropolis posterior samples.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
|
@ -369,33 +368,33 @@ The following types of figures are saved (we show prior sample to
|
||||||
fix ideas, but the same conventions are used for multivariate
|
fix ideas, but the same conventions are used for multivariate
|
||||||
normal and posterior):
|
normal and posterior):
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_*.fig": for each parameter, plots the cdf's
|
\item[]\verb"<Dynare_file>_rmse_prior_*.fig": for each parameter, plots the CDF's
|
||||||
corresponding to the best 10\% RMES's of each observed series;
|
corresponding to the best 10\% RMES's of each observed series;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_dens_*.fig": for each parameter, plots the pdf's
|
\item[]\verb"<Dynare_file>_rmse_prior_dens_*.fig": for each parameter, plots the pdf's
|
||||||
corresponding to the best 10\% RMES's of each observed series;
|
corresponding to the best 10\% RMES's of each observed series;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_<name of observedseries>_corr_*.fig": for each observed series plots the
|
\item[]\verb"<Dynare_file>_rmse_prior_<name of observedseries>_corr_*.fig": for each observed series plots the
|
||||||
bi-dimensional projections of samples with the best 10\% RMSE's,
|
bi-dimensional projections of samples with the best 10\% RMSE's,
|
||||||
when the correlation is significant;
|
when the correlation is significant;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_lnlik*.fig": for each observed
|
\item[]\verb"<Dynare_file>_rmse_prior_lnlik*.fig": for each observed
|
||||||
series, plots \emph{in red} the cdf of the log-likelihood
|
series, plots \emph{in red} the CDF of the log-likelihood
|
||||||
corresponding to the best 10\% RMSE's, \emph{in green} the cdf of
|
corresponding to the best 10\% RMSE's, \emph{in green} the CDF of
|
||||||
the rest of the sample and \emph{in blue }the cdf of the full
|
the rest of the sample and \emph{in blue }the CDF of the full
|
||||||
sample; this allows to see the presence of some idiosyncratic
|
sample; this allows to see the presence of some idiosyncratic
|
||||||
behaviour;
|
behaviour;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_lnpost*.fig": for each observed
|
\item[]\verb"<Dynare_file>_rmse_prior_lnpost*.fig": for each observed
|
||||||
series, plots \emph{in red} the cdf of the log-posterior
|
series, plots \emph{in red} the CDF of the log-posterior
|
||||||
corresponding to the best 10\% RMSE's, \emph{in green} the cdf of
|
corresponding to the best 10\% RMSE's, \emph{in green} the CDF of
|
||||||
the rest of the sample and \emph{in blue }the cdf of the full
|
the rest of the sample and \emph{in blue }the CDF of the full
|
||||||
sample; this allows to see idiosyncratic behaviour;
|
sample; this allows to see idiosyncratic behaviour;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_lnprior*.fig": for each observed
|
\item[]\verb"<Dynare_file>_rmse_prior_lnprior*.fig": for each observed
|
||||||
series, plots \emph{in red} the cdf of the log-prior corresponding
|
series, plots \emph{in red} the CDF of the log-prior corresponding
|
||||||
to the best 10\% RMSE's, \emph{in green} the cdf of the rest of
|
to the best 10\% RMSE's, \emph{in green} the CDF of the rest of
|
||||||
the sample and \emph{in blue }the cdf of the full sample; this
|
the sample and \emph{in blue }the CDF of the full sample; this
|
||||||
allows to see idiosyncratic behaviour;
|
allows to see idiosyncratic behaviour;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_lik_SA_*.fig": when
|
\item[]\verb"<Dynare_file>_rmse_prior_lik_SA_*.fig": when
|
||||||
\verb"lik_only=1", this shows the Smirnov tests for the filtering
|
\verb"lik_only=1", this shows the Smirnov tests for the filtering
|
||||||
of the best 10\% log-likelihood values;
|
of the best 10\% log-likelihood values;
|
||||||
\item[]\verb"<DYNARE_file>_rmse_prior_post_SA_*.fig": when
|
\item[]\verb"<Dynare_file>_rmse_prior_post_SA_*.fig": when
|
||||||
\verb"lik_only=1", this shows the Smirnov test for the filtering
|
\verb"lik_only=1", this shows the Smirnov test for the filtering
|
||||||
of the best 10\% log-posterior values.
|
of the best 10\% log-posterior values.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
@ -405,19 +404,19 @@ In the case of the mapping of the reduced form solution, synthetic
|
||||||
figures are saved in the \verb"\GSA" folder:
|
figures are saved in the \verb"\GSA" folder:
|
||||||
|
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_lags_*.fig":
|
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_lags_*.fig":
|
||||||
shows bar charts of the sensitivity indices for the \emph{ten most
|
shows bar charts of the sensitivity indices for the \emph{ten most
|
||||||
important} parameters driving the reduced form coefficients of the
|
important} parameters driving the reduced form coefficients of the
|
||||||
selected endogenous variables (\verb"namendo") versus lagged
|
selected endogenous variables (\verb"namendo") versus lagged
|
||||||
endogenous variables (\verb"namlagendo"); suffix \verb"log"
|
endogenous variables (\verb"namlagendo"); suffix \verb"log"
|
||||||
indicates the results for log-transformed entries;
|
indicates the results for log-transformed entries;
|
||||||
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_shocks_*.fig":
|
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_shocks_*.fig":
|
||||||
shows bar charts of the sensitivity indices for the \emph{ten most
|
shows bar charts of the sensitivity indices for the \emph{ten most
|
||||||
important} parameters driving the reduced form coefficients of the
|
important} parameters driving the reduced form coefficients of the
|
||||||
selected endogenous variables (\verb"namendo") versus exogenous
|
selected endogenous variables (\verb"namendo") versus exogenous
|
||||||
variables (\verb"namexo"); suffix \verb"log" indicates the results
|
variables (\verb"namexo"); suffix \verb"log" indicates the results
|
||||||
for log-transformed entries;
|
for log-transformed entries;
|
||||||
\item[]\verb"<DYNARE_file>_redform_GSA(_log).fig": shows bar chart of
|
\item[]\verb"<Dynare_file>_redform_GSA(_log).fig": shows bar chart of
|
||||||
all sensitivity indices for each parameter: this allows to notice
|
all sensitivity indices for each parameter: this allows to notice
|
||||||
parameters that have a minor effect for \emph{any} of the reduced
|
parameters that have a minor effect for \emph{any} of the reduced
|
||||||
form coefficients,
|
form coefficients,
|
||||||
|
@ -449,24 +448,24 @@ without the need of any user's intervention.
|
||||||
\subsection{Screening analysis}
|
\subsection{Screening analysis}
|
||||||
The results of the screening analysis with Morris sampling design
|
The results of the screening analysis with Morris sampling design
|
||||||
are stored in the subfolder \verb"\GSA\SCREEN". The data file
|
are stored in the subfolder \verb"\GSA\SCREEN". The data file
|
||||||
\verb"<DYNARE_file>_prior" stores all the information of the
|
\verb"<Dynare_file>_prior" stores all the information of the
|
||||||
analysis (Morris sample, reduced form coefficients, etc.).
|
analysis (Morris sample, reduced form coefficients, etc.).
|
||||||
|
|
||||||
Screening analysis merely concerns reduced form coefficients.
|
Screening analysis merely concerns reduced form coefficients.
|
||||||
Similar synthetic bar charts as for the reduced form analysis with
|
Similar synthetic bar charts as for the reduced form analysis with
|
||||||
MC samples are saved:
|
MC samples are saved:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_lags_*.fig":
|
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_lags_*.fig":
|
||||||
shows bar charts of the elementary effect tests for the \emph{ten
|
shows bar charts of the elementary effect tests for the \emph{ten
|
||||||
most important} parameters driving the reduced form coefficients
|
most important} parameters driving the reduced form coefficients
|
||||||
of the selected endogenous variables (\verb"namendo") versus
|
of the selected endogenous variables (\verb"namendo") versus
|
||||||
lagged endogenous variables (\verb"namlagendo");
|
lagged endogenous variables (\verb"namlagendo");
|
||||||
\item[]\verb"<DYNARE_file>_redform_<endo name>_vs_shocks_*.fig":
|
\item[]\verb"<Dynare_file>_redform_<endo name>_vs_shocks_*.fig":
|
||||||
shows bar charts of the elementary effect tests for the \emph{ten
|
shows bar charts of the elementary effect tests for the \emph{ten
|
||||||
most important} parameters driving the reduced form coefficients
|
most important} parameters driving the reduced form coefficients
|
||||||
of the selected endogenous variables (\verb"namendo") versus
|
of the selected endogenous variables (\verb"namendo") versus
|
||||||
exogenous variables (\verb"namexo");
|
exogenous variables (\verb"namexo");
|
||||||
\item[]\verb"<DYNARE_file>_redform_screen.fig": shows bar chart of
|
\item[]\verb"<Dynare_file>_redform_screen.fig": shows bar chart of
|
||||||
all elementary effect tests for each parameter: this allows to
|
all elementary effect tests for each parameter: this allows to
|
||||||
identify parameters that have a minor effect for \emph{any} of the
|
identify parameters that have a minor effect for \emph{any} of the
|
||||||
reduced form coefficients.
|
reduced form coefficients.
|
||||||
|
|
|
@ -3850,9 +3850,9 @@ speed-up on large models.
|
||||||
.. option:: lmmcp
|
.. option:: lmmcp
|
||||||
|
|
||||||
Solves the perfect foresight model with a Levenberg-Marquardt
|
Solves the perfect foresight model with a Levenberg-Marquardt
|
||||||
mixed complementarity problem (LMMCP) solver (*Kanzow and Petra
|
mixed complementarity problem (LMMCP) solver (*Kanzow and Petra,
|
||||||
(2004)*), which allows to consider inequality constraints on
|
2004*), which allows to consider inequality constraints on
|
||||||
the endogenous variables (such as a ZLB on the nominal interest
|
the endogenous variables (such as a zero lower bound, henceforth ZLB, on the nominal interest
|
||||||
rate or a model with irreversible investment). This option is
|
rate or a model with irreversible investment). This option is
|
||||||
equivalent to ``stack_solve_algo=7`` **and**
|
equivalent to ``stack_solve_algo=7`` **and**
|
||||||
``solve_algo=10``. Using the LMMCP solver avoids the need for min/max
|
``solve_algo=10``. Using the LMMCP solver avoids the need for min/max
|
||||||
|
@ -7490,7 +7490,8 @@ observed variables.
|
||||||
|
|
||||||
Instructs Dynare to use the *Herbst and Schorfheide (2014)*
|
Instructs Dynare to use the *Herbst and Schorfheide (2014)*
|
||||||
version of the Sequential Monte-Carlo sampler instead of the
|
version of the Sequential Monte-Carlo sampler instead of the
|
||||||
standard Random-Walk Metropolis-Hastings.
|
standard Random-Walk Metropolis-Hastings. Does not yet support
|
||||||
|
``moments_varendo``, ``bayesian_irf``, and ``smoother``.
|
||||||
|
|
||||||
``'dsmh'``
|
``'dsmh'``
|
||||||
|
|
||||||
|
|
|
@ -493,52 +493,66 @@ if issmc(options_) || (any(bayestopt_.pshape>0) && options_.mh_replic) || (any(
|
||||||
end
|
end
|
||||||
if ~issmc(options_)
|
if ~issmc(options_)
|
||||||
[error_flag, ~, options_]= metropolis_draw(1, options_, estim_params_, M_);
|
[error_flag, ~, options_]= metropolis_draw(1, options_, estim_params_, M_);
|
||||||
|
else
|
||||||
|
error_flag=false;
|
||||||
end
|
end
|
||||||
if ~(~isempty(options_.sub_draws) && options_.sub_draws==0)
|
if ~(~isempty(options_.sub_draws) && options_.sub_draws==0)
|
||||||
if options_.bayesian_irf
|
if options_.bayesian_irf
|
||||||
if error_flag
|
if ~issmc(options_)
|
||||||
error('%s: I cannot compute the posterior IRFs!',dispString)
|
if error_flag
|
||||||
|
error('%s: I cannot compute the posterior IRFs!',dispString)
|
||||||
|
end
|
||||||
|
oo_=PosteriorIRF('posterior',options_,estim_params_,oo_,M_,bayestopt_,dataset_,dataset_info,dispString);
|
||||||
|
else
|
||||||
|
fprintf('%s: SMC does not yet support the bayesian_irf option. Skipping computation.\n',dispString);
|
||||||
end
|
end
|
||||||
oo_=PosteriorIRF('posterior',options_,estim_params_,oo_,M_,bayestopt_,dataset_,dataset_info,dispString);
|
|
||||||
end
|
end
|
||||||
if options_.moments_varendo
|
if options_.moments_varendo
|
||||||
if error_flag
|
if ~issmc(options_)
|
||||||
error('%s: I cannot compute the posterior moments for the endogenous variables!',dispString)
|
if error_flag
|
||||||
end
|
error('%s: I cannot compute the posterior moments for the endogenous variables!',dispString)
|
||||||
if options_.load_mh_file && options_.mh_replic==0 %user wants to recompute results
|
end
|
||||||
[MetropolisFolder, info] = CheckPath('metropolis',M_.dname);
|
if options_.load_mh_file && options_.mh_replic==0 %user wants to recompute results
|
||||||
if ~info
|
[MetropolisFolder, info] = CheckPath('metropolis',M_.dname);
|
||||||
generic_post_data_file_name={'Posterior2ndOrderMoments','decomposition','PosteriorVarianceDecomposition','correlation','PosteriorCorrelations','conditional decomposition','PosteriorConditionalVarianceDecomposition'};
|
if ~info
|
||||||
for ii=1:length(generic_post_data_file_name)
|
generic_post_data_file_name={'Posterior2ndOrderMoments','decomposition','PosteriorVarianceDecomposition','correlation','PosteriorCorrelations','conditional decomposition','PosteriorConditionalVarianceDecomposition'};
|
||||||
delete_stale_file([MetropolisFolder filesep M_.fname '_' generic_post_data_file_name{1,ii} '*']);
|
for ii=1:length(generic_post_data_file_name)
|
||||||
end
|
delete_stale_file([MetropolisFolder filesep M_.fname '_' generic_post_data_file_name{1,ii} '*']);
|
||||||
% restore compatibility for loading pre-4.6.2 runs where estim_params_ was not saved; see 6e06acc7 and !1944
|
end
|
||||||
NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_posterior_draws*' ]));
|
% restore compatibility for loading pre-4.6.2 runs where estim_params_ was not saved; see 6e06acc7 and !1944
|
||||||
if NumberOfDrawsFiles>0
|
NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_posterior_draws*' ]));
|
||||||
temp=load([M_.dname '/metropolis/' M_.fname '_posterior_draws1']);
|
if NumberOfDrawsFiles>0
|
||||||
if ~isfield(temp,'estim_params_')
|
temp=load([M_.dname '/metropolis/' M_.fname '_posterior_draws1']);
|
||||||
for file_iter=1:NumberOfDrawsFiles
|
if ~isfield(temp,'estim_params_')
|
||||||
save([M_.dname '/metropolis/' M_.fname '_posterior_draws' num2str(file_iter)],'estim_params_','-append')
|
for file_iter=1:NumberOfDrawsFiles
|
||||||
|
save([M_.dname '/metropolis/' M_.fname '_posterior_draws' num2str(file_iter)],'estim_params_','-append')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,estim_params_,var_list_);
|
||||||
|
else
|
||||||
|
fprintf('%s: SMC does not yet support the moments_varendo option. Skipping computation.\n',dispString);
|
||||||
end
|
end
|
||||||
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,estim_params_,var_list_);
|
|
||||||
end
|
end
|
||||||
if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
|
if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
|
||||||
if error_flag
|
if ~ishssmc(options_)
|
||||||
error('%s: I cannot compute the posterior statistics!',dispString)
|
if error_flag
|
||||||
end
|
error('%s: I cannot compute the posterior statistics!',dispString)
|
||||||
if options_.order==1 && ~options_.particle.status
|
end
|
||||||
oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts
|
if options_.order==1 && ~options_.particle.status
|
||||||
|
oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts
|
||||||
|
else
|
||||||
|
error('%s: Particle Smoothers are not yet implemented.',dispString)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error('%s: Particle Smoothers are not yet implemented.',dispString)
|
fprintf('%s: SMC does not yet support the smoother and forecast options. Skipping computation.\n',dispString);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fprintf('%s: sub_draws was set to 0. Skipping posterior computations.',dispString);
|
fprintf('%s: sub_draws was set to 0. Skipping posterior computations.\n',dispString);
|
||||||
end
|
end
|
||||||
xparam1 = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
|
xparam1 = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
|
||||||
M_ = set_all_parameters(xparam1,estim_params_,M_);
|
M_ = set_all_parameters(xparam1,estim_params_,M_);
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ function [steady_state, params, check] = dyn_ramsey_static(ys_init, exo_ss, M_,
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright © 2003-2023 Dynare Team
|
% Copyright © 2003-2024 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -137,7 +137,7 @@ end
|
||||||
% Compute the value of the Lagrange multipliers that minimizes the norm of the
|
% Compute the value of the Lagrange multipliers that minimizes the norm of the
|
||||||
% residuals, given the other endogenous
|
% residuals, given the other endogenous
|
||||||
if options_.bytecode
|
if options_.bytecode
|
||||||
res = bytecode('static', M_, options, xx, exo_ss, M_.params, 'evaluate');
|
res = bytecode('static', M_, options_, xx, exo_ss, M_.params, 'evaluate');
|
||||||
else
|
else
|
||||||
res = feval([M_.fname '.sparse.static_resid'], xx, exo_ss, M_.params);
|
res = feval([M_.fname '.sparse.static_resid'], xx, exo_ss, M_.params);
|
||||||
end
|
end
|
||||||
|
@ -167,7 +167,7 @@ end
|
||||||
function result = check_static_model(ys,exo_ss,M_,options_)
|
function result = check_static_model(ys,exo_ss,M_,options_)
|
||||||
result = false;
|
result = false;
|
||||||
if (options_.bytecode)
|
if (options_.bytecode)
|
||||||
res = bytecode('static', M_, options, ys, exo_ss, M_.params, 'evaluate');
|
res = bytecode('static', M_, options_, ys, exo_ss, M_.params, 'evaluate');
|
||||||
else
|
else
|
||||||
res = feval([M_.fname '.sparse.static_resid'], ys, exo_ss, M_.params);
|
res = feval([M_.fname '.sparse.static_resid'], ys, exo_ss, M_.params);
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ switch options_.stack_solve_algo
|
||||||
case 4
|
case 4
|
||||||
mthd='Sparse LU solver with optimal path length on stacked system';
|
mthd='Sparse LU solver with optimal path length on stacked system';
|
||||||
case 7
|
case 7
|
||||||
mthd='Solver from solve_algo option on stacked system'
|
mthd='Solver from solve_algo option on stacked system';
|
||||||
otherwise
|
otherwise
|
||||||
error('Unsupported stack_solve_algo value')
|
error('Unsupported stack_solve_algo value')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 Dynare Team
|
# Copyright 2023-2024 Dynare Team
|
||||||
# This file is part of Dynare.
|
# This file is part of Dynare.
|
||||||
#
|
#
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
# Dynare is free software: you can redistribute it and/or modify
|
||||||
|
@ -26,38 +26,38 @@
|
||||||
# with the system libraries and adds the path of Dynare to the MATLAB and Octave startup scripts. #
|
# with the system libraries and adds the path of Dynare to the MATLAB and Octave startup scripts. #
|
||||||
# #
|
# #
|
||||||
# MATLAB LICENSE: #
|
# MATLAB LICENSE: #
|
||||||
# The container is created using a network license, so no information on the license is inside the container #
|
# The container is created without any information on a license. To use Dynare with MATLAB, you need to #
|
||||||
# see https://git.dynare.org/dynare/dynare/docker/README.md#matlab-license for more information. #
|
# provide a valid license, see https://git.dynare.org/dynare/dynare/docker/README.md#matlab-license. #
|
||||||
##############################################################################################################
|
##############################################################################################################
|
||||||
|
|
||||||
# Default values which MATLAB and Dynare release to install in the container
|
|
||||||
# The Dynare release must conform to a corresponding tag on https://git.dynare.org/dynare/dynare
|
# The Dynare release must conform to a corresponding tag on https://git.dynare.org/dynare/dynare
|
||||||
|
# Note that Dynare 6.x uses the meson build system, while Dynare 4.x and 5.x use the autoconf/automake build system
|
||||||
# MATLAB release must conform to a corresponding tag on https://hub.docker.com/r/mathworks/matlab/tags
|
# MATLAB release must conform to a corresponding tag on https://hub.docker.com/r/mathworks/matlab/tags
|
||||||
# Octave version the one shipped with the Ubuntu version used in the base container (in 20.04 it is 6.4.0)
|
# Octave version is the one shipped with the Ubuntu version used in the base container (or from a PPA)
|
||||||
ARG MATLAB_RELEASE=R2023a
|
ARG MATLAB_RELEASE=R2023b
|
||||||
ARG DYNARE_RELEASE=5.4
|
ARG DYNARE_RELEASE=6.0
|
||||||
|
|
||||||
# Specify the list of products to install into MATLAB with mpm
|
# Specify the list of products to install into MATLAB with mpm
|
||||||
ARG MATLAB_PRODUCT_LIST="Symbolic_Math_Toolbox Statistics_and_Machine_Learning_Toolbox Optimization_Toolbox Econometrics_Toolbox Parallel_Computing_Toolbox Control_System_Toolbox Global_Optimization_Toolbox"
|
ARG MATLAB_PRODUCT_LIST="Symbolic_Math_Toolbox Statistics_and_Machine_Learning_Toolbox Optimization_Toolbox Econometrics_Toolbox Parallel_Computing_Toolbox Control_System_Toolbox Global_Optimization_Toolbox"
|
||||||
|
|
||||||
# Specify MATLAB Install Location.
|
# Specify MATLAB install location
|
||||||
ARG MATLAB_INSTALL_LOCATION="/opt/matlab/${MATLAB_RELEASE}"
|
ARG MATLAB_INSTALL_LOCATION="/opt/matlab/${MATLAB_RELEASE}"
|
||||||
|
|
||||||
# Specify license server information using the format: port@hostname
|
# Specify license server information using the format: port@hostname
|
||||||
ARG LICENSE_SERVER
|
ARG LICENSE_SERVER
|
||||||
|
|
||||||
# Specify the base image with MATLAB installed.
|
# Specify the base image with pre-installed MATLAB
|
||||||
FROM mathworks/matlab:${MATLAB_RELEASE}
|
FROM mathworks/matlab:${MATLAB_RELEASE}
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Declare build arguments to use at the current build stage.
|
# Declare build arguments to use at the current build stage
|
||||||
ARG MATLAB_RELEASE
|
ARG MATLAB_RELEASE
|
||||||
ARG MATLAB_PRODUCT_LIST
|
ARG MATLAB_PRODUCT_LIST
|
||||||
ARG MATLAB_INSTALL_LOCATION
|
ARG MATLAB_INSTALL_LOCATION
|
||||||
ARG LICENSE_SERVER
|
ARG LICENSE_SERVER
|
||||||
ARG DYNARE_RELEASE
|
ARG DYNARE_RELEASE
|
||||||
|
|
||||||
# Install mpm dependencies.
|
# Install mpm dependencies
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install --no-install-recommends --yes \
|
&& apt-get install --no-install-recommends --yes \
|
||||||
|
@ -70,6 +70,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
|
||||||
# Run mpm to install additional toolboxes for MATLAB in the target location and delete the mpm installation afterwards.
|
# Run mpm to install additional toolboxes for MATLAB in the target location and delete the mpm installation afterwards.
|
||||||
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
|
# If mpm fails to install successfully, then print the logfile in the terminal, otherwise clean up.
|
||||||
|
# Hint: Sometimes there is a segmentation fault when running mpm, just re-run the build command in this case.
|
||||||
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
|
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
|
||||||
&& chmod +x mpm \
|
&& chmod +x mpm \
|
||||||
&& ./mpm install \
|
&& ./mpm install \
|
||||||
|
@ -79,11 +80,39 @@ RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
|
||||||
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
|
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
|
||||||
&& rm -f mpm /tmp/mathworks_root.log
|
&& rm -f mpm /tmp/mathworks_root.log
|
||||||
|
|
||||||
# Install dynare dependencies.
|
# Install specific build-system dependencies based on DYNARE_RELEASE and keep this layer small to reduce image size (apt cache cleanup)
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
RUN case "$DYNARE_RELEASE" in \
|
||||||
&& apt-get update \
|
6.*) \
|
||||||
&& apt-get install --no-install-recommends --yes \
|
export DEBIAN_FRONTEND=noninteractive && \
|
||||||
build-essential \
|
apt-get update && \
|
||||||
|
apt-get install --no-install-recommends --yes \
|
||||||
|
gcc \
|
||||||
|
g++ \
|
||||||
|
meson \
|
||||||
|
pkgconf \
|
||||||
|
python3-pip\
|
||||||
|
&& apt-get clean \
|
||||||
|
&& apt-get autoremove \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* ;; \
|
||||||
|
5.*|4.*) \
|
||||||
|
export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install --no-install-recommends --yes \
|
||||||
|
build-essential \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
doxygen \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& apt-get autoremove \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*;; \
|
||||||
|
*) \
|
||||||
|
echo "Unsupported DYNARE_RELEASE version: $DYNARE_RELEASE. No dependencies will be installed." ;; \
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Install common dependencies for Dynare and keep this layer small to reduce image size (apt cache cleanup)
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install --no-install-recommends --yes \
|
||||||
gfortran \
|
gfortran \
|
||||||
libboost-graph-dev \
|
libboost-graph-dev \
|
||||||
libgsl-dev \
|
libgsl-dev \
|
||||||
|
@ -94,8 +123,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
flex \
|
flex \
|
||||||
libfl-dev \
|
libfl-dev \
|
||||||
bison \
|
bison \
|
||||||
autoconf \
|
|
||||||
automake \
|
|
||||||
texlive \
|
texlive \
|
||||||
texlive-publishers \
|
texlive-publishers \
|
||||||
texlive-latex-extra \
|
texlive-latex-extra \
|
||||||
|
@ -109,7 +136,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
tex-gyre \
|
tex-gyre \
|
||||||
latexmk \
|
latexmk \
|
||||||
libjs-mathjax \
|
libjs-mathjax \
|
||||||
doxygen \
|
|
||||||
x13as \
|
x13as \
|
||||||
liboctave-dev \
|
liboctave-dev \
|
||||||
octave-control \
|
octave-control \
|
||||||
|
@ -123,10 +149,30 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
ghostscript \
|
ghostscript \
|
||||||
epstool \
|
epstool \
|
||||||
git \
|
git \
|
||||||
|
git-lfs \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Dynare 6.x is only compatible with Octave 7.1.0 to 8.4.0
|
||||||
|
# The current base image of R2023b ships is based on Ubuntu 22.04 which ships Octave 6.2.0,
|
||||||
|
# so we add an inofficial Octave PPA to install a compatible version
|
||||||
|
# Once the MATLAB containers are based on Ubuntu 24.04, we can remove this step and use the default Octave version from the Ubuntu repository
|
||||||
|
# Note: the pkg install -forge command takes a long time
|
||||||
|
RUN case "$DYNARE_RELEASE" in \
|
||||||
|
6.*) \
|
||||||
|
export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install --no-install-recommends --yes software-properties-common && \
|
||||||
|
add-apt-repository -y ppa:ubuntuhandbook1/octave && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get remove --purge --yes octave octave-control octave-econometrics octave-io octave-statistics octave-struct octave-parallel && \
|
||||||
|
apt-get install --no-install-recommends --yes octave octave-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
octave --eval "pkg install -forge struct io statistics optim control econometrics parallel" ;; \
|
||||||
|
esac
|
||||||
|
|
||||||
# Rename libraries (see matlab-support package: https://salsa.debian.org/debian/matlab-support/-/blob/master/debian/matlab-support.postinst)
|
# Rename libraries (see matlab-support package: https://salsa.debian.org/debian/matlab-support/-/blob/master/debian/matlab-support.postinst)
|
||||||
RUN if [ -f "${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1" ]; then \
|
RUN if [ -f "${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1" ]; then \
|
||||||
mv ${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1 ${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1.bak; \
|
mv ${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1 ${MATLAB_INSTALL_LOCATION}/sys/os/glnxa64/libgcc_s.so.1.bak; \
|
||||||
|
@ -163,20 +209,34 @@ ENV MLM_LICENSE_FILE=$LICENSE_SERVER
|
||||||
# Get Dynare sources as matlab user
|
# Get Dynare sources as matlab user
|
||||||
USER matlab
|
USER matlab
|
||||||
WORKDIR /home/matlab
|
WORKDIR /home/matlab
|
||||||
|
RUN git lfs install
|
||||||
RUN git clone --depth 1 --branch ${DYNARE_RELEASE} --recurse-submodules https://git.dynare.org/dynare/dynare.git
|
RUN git clone --depth 1 --branch ${DYNARE_RELEASE} --recurse-submodules https://git.dynare.org/dynare/dynare.git
|
||||||
|
|
||||||
# Compile Dynare
|
# Compile Dynare
|
||||||
USER matlab
|
# Dynare 6.x: install meson 1.3.1 using python3-pip because meson package in the Ubuntu repositories is too old
|
||||||
WORKDIR /home/matlab
|
# Once the MATLAB containers are based on Ubuntu 24.04, this step can be removed
|
||||||
RUN cd dynare \
|
RUN case "$DYNARE_RELEASE" in \
|
||||||
&& autoreconf -si \
|
6.*) \
|
||||||
&& ./configure --with-matlab=${MATLAB_INSTALL_LOCATION} MATLAB_VERSION=${MATLAB_RELEASE} \
|
cd dynare && \
|
||||||
&& make -j$(($(nproc)+1))
|
pip3 install meson==1.3.1 && \
|
||||||
|
export PATH="/home/matlab/.local/bin:${PATH}" && \
|
||||||
|
meson setup -Dmatlab_path=${MATLAB_INSTALL_LOCATION} -Dbuildtype=debugoptimized build-matlab && \
|
||||||
|
meson compile -C build-matlab && \
|
||||||
|
meson setup -Dbuild_for=octave -Dbuildtype=debugoptimized build-octave && \
|
||||||
|
meson compile -C build-octave ;; \
|
||||||
|
5.*|4.*) \
|
||||||
|
cd dynare && \
|
||||||
|
autoreconf -si && \
|
||||||
|
./configure --with-matlab=${MATLAB_INSTALL_LOCATION} MATLAB_VERSION=${MATLAB_RELEASE} && \
|
||||||
|
make -j$(($(nproc)+1)) ;; \
|
||||||
|
*) \
|
||||||
|
echo "Unsupported DYNARE_RELEASE version: $DYNARE_RELEASE. Compilation steps will be skipped." ;; \
|
||||||
|
esac
|
||||||
|
|
||||||
# Add path of dynare to startup script for Octave.
|
# Add path of dynare to startup script for Octave
|
||||||
RUN echo "addpath /home/matlab/dynare/matlab" >> /home/matlab/.octaverc
|
RUN echo "addpath /home/matlab/dynare/matlab" >> /home/matlab/.octaverc
|
||||||
|
|
||||||
# Add path of dynare to startup script for MATLAB.
|
# Add path of dynare to startup script for MATLAB
|
||||||
# Note that if startup.m file exists (in newer MATLAB containers), it is a MATLAB function
|
# Note that if startup.m file exists (in newer MATLAB containers), it is a MATLAB function
|
||||||
# and the last line is an "end", so we append the path to the second-to-last line
|
# and the last line is an "end", so we append the path to the second-to-last line
|
||||||
# For some reason we have to do this as root, otherwise the file is not writable
|
# For some reason we have to do this as root, otherwise the file is not writable
|
||||||
|
@ -195,6 +255,6 @@ RUN filename="/home/matlab/Documents/MATLAB/startup.m" && \
|
||||||
fi && \
|
fi && \
|
||||||
chown matlab:matlab "$filename"
|
chown matlab:matlab "$filename"
|
||||||
|
|
||||||
# Set user and work directory.
|
# Set user and work directory
|
||||||
USER matlab
|
USER matlab
|
||||||
WORKDIR /home/matlab
|
WORKDIR /home/matlab
|
|
@ -1,5 +1,5 @@
|
||||||
# Dynare Docker Containers
|
# Dynare Docker Containers
|
||||||
We provide a range of pre-configured Docker containers for [Dynare](https://dynare.org), which include both Octave and MATLAB (pre-configured with Dynare already in the PATH) and all recommended toolboxes. These containers are ideal for using Dynare in CI/CD environments ([example Workflow for GitHub Actions](https://github.com/wmutschl/DSGE_mod/tree/master/.github/workflows)) or High Performance Computing clusters with either [Docker, ENROOT or Singularity](https://wiki.bwhpc.de/e/BwUniCluster2.0/Containers).
|
We provide a range of pre-configured Docker containers for [Dynare](https://dynare.org), which include both Octave and MATLAB (pre-configured with Dynare already in the PATH) and all recommended toolboxes. These containers are ideal for using Dynare in CI/CD environments ([example Workflow for GitHub Actions](https://github.com/JohannesPfeifer/DSGE_mod/tree/master/.github/workflows)) or High Performance Computing clusters with either [Docker, ENROOT or Singularity](https://wiki.bwhpc.de/e/BwUniCluster2.0/Containers).
|
||||||
|
|
||||||
To minimize maintenance efforts while ensuring high levels of security, reliability, and performance, our Docker containers are built from the official [MATLAB container base image](https://hub.docker.com/r/mathworks/matlab) using a custom [Dockerfile](Dockerfile). For more information on building and customizing the containers, see the [built instructions and customization](#built-instructions-and-customization) section below. Additionally, we provide an example [docker-compose file](docker-compose.yml) for complete access to the Ubuntu Desktop via VNC.
|
To minimize maintenance efforts while ensuring high levels of security, reliability, and performance, our Docker containers are built from the official [MATLAB container base image](https://hub.docker.com/r/mathworks/matlab) using a custom [Dockerfile](Dockerfile). For more information on building and customizing the containers, see the [built instructions and customization](#built-instructions-and-customization) section below. Additionally, we provide an example [docker-compose file](docker-compose.yml) for complete access to the Ubuntu Desktop via VNC.
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ To minimize maintenance efforts while ensuring high levels of security, reliabil
|
||||||
|
|
||||||
| Tags | Dynare Version | MATLAB® Version | Octave Version | Operating System | Base Image |
|
| Tags | Dynare Version | MATLAB® Version | Octave Version | Operating System | Base Image |
|
||||||
|--------|----------------|-----------------|----------------|------------------|-------------------------|
|
|--------|----------------|-----------------|----------------|------------------|-------------------------|
|
||||||
| latest | 5.4 | R2023a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2023a |
|
| latest | 6.0 | R2023b | 8.4.0 (PPA) | Ubuntu 22.04 | mathworks/matlab:R2023b |
|
||||||
|
| 6.0 | 6.0 | R2023b | 8.4.0 (PPA) | Ubuntu 22.04 | mathworks/matlab:R2023b |
|
||||||
|
| 5.5 | 5.5 | R2023b | 6.4.0 | Ubuntu 22.04 | mathworks/matlab:R2023b |
|
||||||
| 5.4 | 5.4 | R2023a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2023a |
|
| 5.4 | 5.4 | R2023a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2023a |
|
||||||
| 5.3 | 5.3 | R2022b | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2022b |
|
| 5.3 | 5.3 | R2022b | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2022b |
|
||||||
| 5.2 | 5.2 | R2022a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2022a |
|
| 5.2 | 5.2 | R2022a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2022a |
|
||||||
|
@ -15,14 +17,21 @@ To minimize maintenance efforts while ensuring high levels of security, reliabil
|
||||||
| 5.0 | 5.0 | R2021b | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2021b |
|
| 5.0 | 5.0 | R2021b | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2021b |
|
||||||
| 4.6.4 | 4.6.4 | R2021a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2021a |
|
| 4.6.4 | 4.6.4 | R2021a | 5.2.0 | Ubuntu 20.04 | mathworks/matlab:R2021a |
|
||||||
|
|
||||||
|
Note that we use an inofficial [PPA](https://launchpad.net/~ubuntuhandbook1/+archive/ubuntu/octave) (maintained by [https://ubuntuhandbook.org](https://ubuntuhandbook.org)) to install Octave 8.4.0 on Ubuntu 22.04, the usual disclaimer on PPAs applies.
|
||||||
|
Once Ubuntu 24.04 is released, we will switch to the version from the official repositories.
|
||||||
|
|
||||||
## How to interact with the container
|
## How to interact with the container
|
||||||
|
|
||||||
To pull the latest image to your machine, execute:
|
To pull the latest image to your machine, execute:
|
||||||
```sh
|
```sh
|
||||||
docker pull dynare/dynare:latest
|
docker pull dynare/dynare:latest
|
||||||
```
|
```
|
||||||
In the following we assume that you have access to a MATLAB license using e.g. a [network license server of a University](https://uni-tuebingen.de/de/3107#c4656) and show different workflows how to interact with the container.
|
or a specific version:
|
||||||
Obviously, you would need to adjust the environmental variable `MLM_LICENSE_FILE` to your use-case, please refer to the [MATLAB license](#matlab-license) section on licensing information and how to pass a personal license.
|
```sh
|
||||||
|
docker pull dynare/dynare:6.0
|
||||||
|
```
|
||||||
|
In the following we assume that you have access to a MATLAB license and show different workflows how to interact with the container.
|
||||||
|
Obviously, you need to adjust the environmental variable `MLM_LICENSE_FILE` to your use-case, please refer to the [MATLAB license](#matlab-license) section on licensing information and how to pass a personal license.
|
||||||
Alternatively, if you don't have access to a license or the closed-source mentality of MATLAB is an irreconcilable issue for you, you can equally well use Dynare with the free and open-source alternative Octave.
|
Alternatively, if you don't have access to a license or the closed-source mentality of MATLAB is an irreconcilable issue for you, you can equally well use Dynare with the free and open-source alternative Octave.
|
||||||
|
|
||||||
### Run Dynare in an interactive MATLAB session in the browser
|
### Run Dynare in an interactive MATLAB session in the browser
|
||||||
|
@ -31,9 +40,9 @@ To launch the container with the `-browser` option, execute:
|
||||||
```sh
|
```sh
|
||||||
docker run -it --rm -p 8888:8888 -e MLM_LICENSE_FILE=27000@matlab-campus.uni-tuebingen.de --shm-size=512M dynare/dynare:latest -browser
|
docker run -it --rm -p 8888:8888 -e MLM_LICENSE_FILE=27000@matlab-campus.uni-tuebingen.de --shm-size=512M dynare/dynare:latest -browser
|
||||||
```
|
```
|
||||||
You will receive a URL to access MATLAB in a web browser, for example: `http://localhost:8888` or another IP address that you can use to reach your server, such as through a VPN like [Tailscale](https://tailscale.com) if you are behind a firewall. Enter the URL provided into a web browser. If prompted, enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, switch to the Network License Manager tab and enter the license server address instead. After providing your license information, a MATLAB session will start in the browser. This may take several minutes. To modify the behavior of MATLAB when launched with the `-browser` flag, pass environment variables to the `docker run` command. For more information, see [Advanced Usage](https://github.com/mathworks/matlab-proxy/blob/main/Advanced-Usage.md).
|
You will receive a URL to access MATLAB in a web browser, for example: `http://localhost:8888` or another IP address that you can use to reach your server, such as through a VPN like [Tailscale](https://tailscale.com) if you are behind a firewall. Enter the URL provided into a web browser. Note that if you set `MLM_LICENSE_FILE` to empty or leave it out from the command, you will be prompted to enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, switch to the Network License Manager tab and enter the license server address instead. After providing your license information, a MATLAB session will start in the browser. This may take several minutes. To modify the behavior of MATLAB when launched with the `-browser` flag, pass environment variables to the `docker run` command. For more information, see [Advanced Usage](https://github.com/mathworks/matlab-proxy/blob/main/Advanced-Usage.md).
|
||||||
|
|
||||||
Note that the `-browser` flag is supported by base images starting from `mathworks/matlab:R2022a` using [noVNC](https://novnc.com). Some browsers, like Safari, may not support this workflow.
|
Note that the `-browser` flag is supported by base images starting from `mathworks/matlab:R2022a` using [noVNC](https://novnc.com). Some browsers may not support this workflow.
|
||||||
|
|
||||||
### Run Ubuntu desktop and interact with it via VNC
|
### Run Ubuntu desktop and interact with it via VNC
|
||||||
|
|
||||||
|
@ -45,7 +54,7 @@ To connect to the Ubuntu desktop, either:
|
||||||
|
|
||||||
- Point a browser to port 6080 of the docker host machine running this container (`http://hostname:6080`).
|
- Point a browser to port 6080 of the docker host machine running this container (`http://hostname:6080`).
|
||||||
- Use a VNC client to connect to display 1 of the docker host machine (`hostname:1`). The VNC password is `matlab` by default, you can change that by adjusting the `PASSWORD` environment variable in the run command.
|
- Use a VNC client to connect to display 1 of the docker host machine (`hostname:1`). The VNC password is `matlab` by default, you can change that by adjusting the `PASSWORD` environment variable in the run command.
|
||||||
- If you are behind a firewall, we recommend to use a VPN such as [Tailscale](https://tailscale.com).
|
- If you are behind a firewall, we recommend to use a VPN such as [Tailscale](https://tailscale.com) such that you can access the VNC server via the Tailscale address of the server.
|
||||||
|
|
||||||
### Run Dynare with Octave in an interactive command prompt
|
### Run Dynare with Octave in an interactive command prompt
|
||||||
|
|
||||||
|
@ -92,6 +101,7 @@ The Desktop window of MATLAB will open on your machine. Note that the command ab
|
||||||
### MATLAB license
|
### MATLAB license
|
||||||
|
|
||||||
To run this container, your license must be [configured for cloud use](https://mathworks.com/help/install/license/licensing-for-mathworks-products-running-on-the-cloud.html). Individual and Campus-Wide licenses are already configured for cloud use. If you have a different license type, please contact your license administrator to configure it for cloud use. You can identify your license type and administrator by viewing your MathWorks Account. Administrators can consult the "Administer Network Licenses" documentation. If you don't have a MATLAB license, you can obtain a trial license at [MATLAB Trial for Docker](https://de.mathworks.com/campaigns/products/trials/targeted/dkr.html).
|
To run this container, your license must be [configured for cloud use](https://mathworks.com/help/install/license/licensing-for-mathworks-products-running-on-the-cloud.html). Individual and Campus-Wide licenses are already configured for cloud use. If you have a different license type, please contact your license administrator to configure it for cloud use. You can identify your license type and administrator by viewing your MathWorks Account. Administrators can consult the "Administer Network Licenses" documentation. If you don't have a MATLAB license, you can obtain a trial license at [MATLAB Trial for Docker](https://de.mathworks.com/campaigns/products/trials/targeted/dkr.html).
|
||||||
|
Lastly, if you run the container via a GitHub workflow, you don't need to provide a license as the IP of the GitHub runner is already covered by a sponsored MATLAB license.
|
||||||
|
|
||||||
#### Network license
|
#### Network license
|
||||||
If you're using a network license, you can pass the port and hostname via the `MLM_LICENSE_FILE` environmental variable in your `docker run` command or Docker Compose file. Here's an example `docker run` command that uses a network license:
|
If you're using a network license, you can pass the port and hostname via the `MLM_LICENSE_FILE` environmental variable in your `docker run` command or Docker Compose file. Here's an example `docker run` command that uses a network license:
|
||||||
|
@ -102,14 +112,14 @@ docker run --init -it --rm -e MLM_LICENSE_FILE=27000@matlab-campus.uni-tuebingen
|
||||||
#### Personal License
|
#### Personal License
|
||||||
|
|
||||||
To use a personal license, you must first create a license file via the MATHWORKS License Center, refer to [Option 2](https://de.mathworks.com/matlabcentral/answers/235126-how-do-i-generate-a-matlab-license-file#answer_190013) for detailed instructions.
|
To use a personal license, you must first create a license file via the MATHWORKS License Center, refer to [Option 2](https://de.mathworks.com/matlabcentral/answers/235126-how-do-i-generate-a-matlab-license-file#answer_190013) for detailed instructions.
|
||||||
For this process, you will need the `username` and a `host ID`. In the container, the username is predefined as 'matlab'.
|
For this process, you will need the `username` and a `host ID`. In the container, the username is predefined as `matlab`.
|
||||||
The `host ID` corresponds to the MAC address of any network adapter in the container.
|
The `host ID` corresponds to the MAC address of any network adapter in the container.
|
||||||
In Docker, you can supply a [randomly generated MAC address](https://miniwebtool.com/mac-address-generator/) (e.g., A6-7E-1A-F4-9A-92) during the docker run command.
|
In Docker, you can supply a [randomly generated MAC address](https://miniwebtool.com/mac-address-generator/) (e.g., A6-7E-1A-F4-9A-92) during the docker run command.
|
||||||
Download the file from MATHWORKS License Center and ensure you provide the container with access to the license file by mounting it as a (read-only) volume.
|
Download the file from MATHWORKS License Center and ensure you provide the container with access to the license file by mounting it as a (read-only) volume.
|
||||||
|
|
||||||
Here is an example `docker run` command that utilizes a license file named `matlab-license.lic`, which is located in your home folder:
|
Here is an example `docker run` command that utilizes a license file named `license.lic`, which is located in a folder `$HOME/matlab-license` on the host machine; the MAC address associated with the license is set to `A6-7E-1A-F4-9A-92`:
|
||||||
```sh
|
```sh
|
||||||
docker run --init -it --rm --mac-address A6-7E-1A-F4-9A-92 --shm-size=512M -v $HOME/matlab-license.lic:/licenses/license.lic:ro -e MLM_LICENSE_FILE=/licenses/license.lic dynare/dynare:latest matlab -batch "cd dynare/examples; dynare example1"
|
docker run --init -it --rm --mac-address A6-7E-1A-F4-9A-92 --shm-size=512M -v $HOME/matlab-license/:/licenses:ro -e MLM_LICENSE_FILE=/licenses/license.lic dynare/dynare:latest matlab -batch "cd dynare/examples; dynare example1"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
@ -120,7 +130,9 @@ When running the `docker run` command, you can specify environment variables usi
|
||||||
|
|
||||||
Here are the commands to create the Docker images available at [Docker Hub](https://hub.docker.com/r/dynare/dynare):
|
Here are the commands to create the Docker images available at [Docker Hub](https://hub.docker.com/r/dynare/dynare):
|
||||||
```sh
|
```sh
|
||||||
docker build --build-arg MATLAB_RELEASE=R2023a --build-arg DYNARE_RELEASE=5.4 -t dynare/dynare:latest .
|
docker build --build-arg MATLAB_RELEASE=R2023b --build-arg DYNARE_RELEASE=6.0 -t dynare/dynare:latest .
|
||||||
|
docker build --build-arg MATLAB_RELEASE=R2023b --build-arg DYNARE_RELEASE=6.0 -t dynare/dynare:6.0 .
|
||||||
|
docker build --build-arg MATLAB_RELEASE=R2023b --build-arg DYNARE_RELEASE=5.5 -t dynare/dynare:5.5 .
|
||||||
docker build --build-arg MATLAB_RELEASE=R2023a --build-arg DYNARE_RELEASE=5.4 -t dynare/dynare:5.4 .
|
docker build --build-arg MATLAB_RELEASE=R2023a --build-arg DYNARE_RELEASE=5.4 -t dynare/dynare:5.4 .
|
||||||
docker build --build-arg MATLAB_RELEASE=R2022b --build-arg DYNARE_RELEASE=5.3 -t dynare/dynare:5.3 .
|
docker build --build-arg MATLAB_RELEASE=R2022b --build-arg DYNARE_RELEASE=5.3 -t dynare/dynare:5.3 .
|
||||||
docker build --build-arg MATLAB_RELEASE=R2022a --build-arg DYNARE_RELEASE=5.2 -t dynare/dynare:5.2 .
|
docker build --build-arg MATLAB_RELEASE=R2022a --build-arg DYNARE_RELEASE=5.2 -t dynare/dynare:5.2 .
|
||||||
|
|
|
@ -86,6 +86,8 @@ estimation(order=1, datafile='../fsdat_simul.m', nobs=192, loglinear,
|
||||||
posterior_sampling_method='hssmc',
|
posterior_sampling_method='hssmc',
|
||||||
posterior_sampler_options=('steps',10,
|
posterior_sampler_options=('steps',10,
|
||||||
'lambda',2,
|
'lambda',2,
|
||||||
'particles', 20000,
|
'particles', 5000,
|
||||||
'scale',.5,
|
'scale',.5,
|
||||||
'target', .25));
|
'target', .25),
|
||||||
|
bayesian_irf, smoother, moments_varendo,consider_all_endogenous
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in New Issue