Commit 9b00852e authored by Stéphane Adjemian's avatar Stéphane Adjemian Committed by Stéphane Adjemian
Browse files

Added routines for generating internal documentation.

parent 0c61ddc6
function build_internal_documentation()
% The name of the function should be explicit...
datafiles = [];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'initialize_dataset'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'descriptive_statistics'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_stdv'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_cova'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_corr'}];
datafiles = [ datafiles ; {'../../matlab/utilities/dataset'}, {'compute_acov'}];
estimationfiles = [];
simulationfiles = [];
miscfiles = [];
% Data.
if exist('data.texi')
fid = fopen('data.texi','w');
if rows(datafiles)
for i=1:rows(datafiles)
block = get_internal_doc_block(datafiles{i,2},datafiles{i,1});
if isempty(block), continue, end
for j=1:rows(block)
fprintf(fid,[block(j,:) '\n']);
% Estimation.
if exist('estimation.texi')
fid = fopen('estimation.texi','w');
if rows(estimationfiles)
for i=1:rows(datafiles)
block = get_internal_doc_block(datafiles{i,2},datafiles{i,1});
if isempty(block), continue, end
for j=1:rows(block)
fprintf(fid,[block(j,:) '\n']);
% Simulation.
if exist('simulation.texi')
fid = fopen('simulation.texi','w');
if rows(simulationfiles)
for i=1:rows(datafiles)
block = get_internal_doc_block(datafiles{i,2},datafiles{i,1});
if isempty(block), continue, end
for j=1:rows(block)
fprintf(fid,[block(j,:) '\n']);
% Miscellaneous.
if exist('misc.texi')
fid = fopen('misc.texi','w');
if rows(miscfiles)
for i=1:rows(datafiles)
block = get_internal_doc_block(datafiles{i,2},datafiles{i,1});
if isempty(block), continue, end
for j=1:rows(block)
fprintf(fid,[block(j,:) '\n']);
\ No newline at end of file
function dynInfo(fun)
[pathstr, name, ext] = fileparts(which(fun));
if strcmp(ext(2:end),'m')
block = get_internal_doc_block(name,pathstr);
if ~isempty(block)
fid = fopen([fun '.texi'],'wt');
for i=1:size(block,1)
disp(' ')
disp(' ')
system(['makeinfo --plaintext --no-split --no-validate ' fun '.texi']);
delete([fun '.texi']);
disp('No documentation for this routine!')
disp('Not a known matlab/octave routine!')
\ No newline at end of file
function block = get_internal_doc_block(fname,fpath)
% Extract doc sections from matlab's routine.
% Copyright (C) 2011 Dynare Team
% stephane DOT adjemian AT univ DASH lemans DOT fr
% 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
% 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 <>.
% Default output
block = [];
% Open the matlab file.
mid = fopen([fpath '/' fname '.m'],'r');
% Read the matlab file.
file = textscan(mid,'%s','delimiter','\n');
file = file{1};
% Close the matlab file.
% Locate the test blocks.
b1 = find(strncmp(file,'%@info:',7))+1;
b2 = find(strncmp(file,'%@eod:',6))-1;
b = find(strncmp(file,'%!',2));
if ( isempty(b1) && isempty(b2) && isempty(b) )
% No internal documentation available.
if ( (~isempty(b1) && isempty(b2) && isempty(b)) || ...
(isempty(b1) && ~isempty(b2) && isempty(b)) || ...
(isempty(b1) && isempty(b2) && ~isempty(b)) || ...
(isempty(b1) && ~isempty(b2) && ~isempty(b)) || ...
(~isempty(b1) && isempty(b2) && ~isempty(b)) || ...
(~isempty(b1) && ~isempty(b2) && isempty(b)) )
error('get_internal_doc_block:: There is a problem with the internal block definition!')
if ( b2~=b(end) || b1~=b(1) || any(b-transpose(b1:1:b2)) )
error('get_internal_doc_block:: There is a problem with the internal block definition!')
% Extract the internal documentation block.
for i=b(1):1:b(end)
str = file{i};
block = char(block, str(3:end));
block = block(2:end,:);
\ No newline at end of file
\input texinfo
@c %**start of header
@documentencoding UTF-8
@settitle Dynare Internal Documentation
@dircategory Math
* Dynare: (dynare). A platform for handling a wide class
of economic models.
@end direntry
@include ../version.texi
@c Define some macros
@macro descriptionhead
@sp 1
@end ifnothtml
@end macro
@macro optionshead
@sp 1
@end iftex
@end macro
@macro examplehead
@sp 1
@end iftex
@end macro
@macro outputhead
@sp 1
@end iftex
@end macro
@macro customhead{title}
@sp 1
@end iftex
@end macro
@c %**end of header
Copyright @copyright{} 1996-2011, Dynare Team.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license can be found at @uref{}.
@end quotation
@end copying
@title Dynare
@subtitle Internal documentation, version @value{VERSION}
@author Stéphane Adjemian
@author Houtan Bastani
@author Michel Juillard
@author Junior Maih
@author Ferhat Mihoubi
@author George Perendia
@author Marco Ratto
@author Sébastien Villemot
@vskip 0pt plus 1filll
@end titlepage
@node Top
@top Dynare
This is Dynare Internal Documentation, version @value{VERSION}.
@end ifnottex
* Introduction::
* Dynare Structures::
* Data::
* Estimation::
* Simulation::
* Bibliography::
* Function Index::
* Variable Index::
--- The Detailed Node Listing ---
* What is Dynare ?::
* Documentation sources::
Dynare structures
* dataset_::
* M_::
* options_::
* oo_::
* Create a data structure::
* Compute descripive statistics::
* Functions::
* Likelihood of DSGE models::
* DsgeVar likelihood::
* Simulated Method of Moments::
* Perfect foresight models::
* Solve rational expectation models with perturbation::
@end detailmenu
@end menu
@node Introduction
@chapter Introduction
* What is Dynare ?::
* Documentation sources::
@end menu
@node What is Dynare ?
@section What is Dynare ?
Dynare is a software platform for handling a wide class of economic
models, in particular dynamic stochastic general equilibrium (DSGE)
and overlapping generations (OLG) models. The models solved by Dynare
include those relying on the @i{rational expectations} hypothesis, wherein
agents form their expectations about the future in a way consistent
with the model. But Dynare is also able to handle models where
expectations are formed differently: on one extreme, models where
agents perfectly anticipate the future; on the other extreme, models
where agents have limited rationality or imperfect knowledge of the
state of the economy and, hence, form their expectations through a
learning process. In terms of types of agents, models solved by Dynare
can incorporate consumers, productive firms, governments, monetary
authorities, investors and financial intermediaries. Some degree of
heterogeneity can be achieved by including several distinct classes of
agents in each of the aforementioned agent categories.
Dynare offers a user-friendly and intuitive way of describing these
models. It is able to perform simulations of the model given a
calibration of the model parameters and is also able to estimate these
parameters given a dataset. In practice, the user will write a text
file containing the list of model variables, the dynamic equations
linking these variables together, the computing tasks to be performed
and the desired graphical or numerical outputs.
A large panel of applied mathematics and computer science techniques
are internally employed by Dynare: multivariate nonlinear solving and
optimization, matrix factorizations, local functional approximation,
Kalman filters and smoothers, MCMC techniques for Bayesian estimation,
graph algorithms, optimal control, @dots{}
Various public bodies (central banks, ministries of economy and
finance, international organisations) and some private financial
institutions use Dynare for performing policy analysis exercises and
as a support tool for forecasting exercises. In the academic world,
Dynare is used for research and teaching purposes in postgraduate
macroeconomics courses.
Dynare is a free software, which means that it can be downloaded free
of charge, that its source code is freely available, and that it can
be used for both non-profit and for-profit purposes. Most of the
source files are covered by the GNU General Public Licence (GPL)
version 3 or later (there are some exceptions to this, see the file
@file{license.txt} in Dynare distribution). It is available for the
Windows, Mac and Linux platforms and is fully documented through a
user guide and a reference manual. Part of Dynare is programmed in
C++, while the rest is written using the
@uref{, MATLAB} programming
language. The latter implies that commercially-available MATLAB
software is required in order to run Dynare. However, as an
alternative to MATLAB, Dynare is also able to run on top of
@uref{, GNU Octave} (basically a free clone of
MATLAB): this possibility is particularly interesting for students or
institutions who cannot afford, or do not want to pay for, MATLAB and
are willing to bear the concomitant performance loss.
The development of Dynare is mainly done at
@uref{, Cepremap} by a core team of
researchers who devote part of their time to software
development. Currently the development team of Dynare is composed of
Stéphane Adjemian (Université du Maine, Gains and Cepremap), Houtan
Bastani (Cepremap), Michel Juillard (Banque de France), Frédéric
Karamé (Université d'Évry, Epee and Cepremap), Junior Maih (Norges
Bank), Ferhat Mihoubi (Université d'Évry, Epee and Cepremap), George
Perendia, Marco Ratto (JRC) and Sébastien Villemot (Cepremap and Paris
School of Economics). Financial support is provided by Cepremap,
Banque de France and DSGE-net (an international research network for
DSGE modeling). Increasingly, the developer base is expanding, as
tools developed by researchers outside of Cepremap are integrated into
Interaction between developers and users of Dynare is central to the
project. A @uref{, web forum} is available
for users who have questions about the usage of Dynare or who want to
report bugs. Training sessions are given through the Dynare Summer
School, which is organized every year and is attended by about 40
people. Finally, priorities in terms of future developments and
features to be added are decided in cooperation with the institutions
providing financial support.
@node Documentation sources
@section Documentation sources
The present document is a reference manual for Dynare codes. It is not
intended for basic usage, but for users willing to use Dynare as a library.
There is also a reference manual for Dynare, documenting
all commands and features in a systematic fashion.
New users should rather begin with Dynare User Guide (@cite{Mancini
(2007)}), distributed with Dynare and also available from the
@uref{,official Dynare web site}.
Other useful sources of information include the
@uref{,Dynare wiki} and the
@uref{, Dynare forums}.
@node Dynare structures
@chapter Dynare structures
* options_::
* dataset_::
* M_::
* oo_::
* StateSpaceModel_::
@end menu
The data are organized in structures. General options are stored in @var{options_}, the model is decribed
in @var{M_}, the dataset used for estimation purposes is given in @var{dataset_}, results are saved in @var{oo_}, ...
@node options_
@section options_
The following table documents the options appearing in this structure and specify the default values.
@node dataset_
@section dataset_
@node M_
@section M_
@node oo_
@section oo_
@node StateSpaceModel_
@section StateSpaceModel_
@node Data
@chapter Data
@include data.texi
@node Estimation
@chapter Estimation
@include estimation.texi
@node Simulation
@chapter Simulation
@include simulation.texi
@node Miscellaneous
@chapter Miscellaneous
@include misc.texi
@node Bibliography
@chapter Bibliography
Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992):
``International Real Business Cycles,'' @i{Journal of Political
Economy}, 100(4), 745--775.
Boucekkine, Raouf (1995): ``An alternative methodology for solving
nonlinear forward-looking models,'' @i{Journal of Economic Dynamics
and Control}, 19, 711--734.
Collard, Fabrice (2001): ``Stochastic simulations with Dynare: A practical guide''.
Collard, Fabrice and Michel Juillard (2001a): ``Accuracy of stochastic
perturbation methods: The case of asset pricing models,'' @i{Journal
of Economic Dynamics and Control}, 25, 979--999.
Collard, Fabrice and Michel Juillard (2001b): ``A Higher-Order Taylor
Expansion Approach to Simulation of Stochastic Forward-Looking Models
with an Application to a Non-Linear Phillips Curve,'' @i{Computational
Economics}, 17, 125--139.
Durbin, J. and S. J. Koopman (2001), @i{Time Series Analysis by State
Space Methods}, Oxford University Press.
Fair, Ray and John Taylor (1983): ``Solution and Maximum Likelihood
Estimation of Dynamic Nonlinear Rational Expectation Models,''
@i{Econometrica}, 51, 1169--1185.
Fernandez-Villaverde, Jesus and Juan Rubio-Ramirez (2004): ``Comparing
Dynamic Equilibrium Economies to Data: A Bayesian Approach,''
@i{Journal of Econometrics}, 123, 153--187.
Ireland, Peter (2004): ``A Method for Taking Models to the Data,''
@i{Journal of Economic Dynamics and Control}, 28, 1205--26.
Judd, Kenneth (1996): ``Approximation, Perturbation, and Projection
Methods in Economic Analysis'', in @i{Handbook of Computational
Economics}, ed. by Hans Amman, David Kendrick, and John Rust, North
Holland Press, 511--585.
Juillard, Michel (1996): ``Dynare: A program for the resolution and
simulation of dynamic models with forward variables through the use of
a relaxation algorithm,'' CEPREMAP, @i{Couverture Orange}, 9602.
Kim, Jinill, Sunghyun Kim, Ernst Schaumburg, and Christopher A. Sims
(2008): ``Calculating and using second-order accurate solutions of
discrete time dynamic equilibrium models,'' @i{Journal of Economic
Dynamics and Control}, 32(11), 3397--3414.
Koopman, S. J. and J. Durbin (2003): ``Filtering and Smoothing of
State Vector for Diffuse State Space Models,'' @i{Journal of Time
Series Analysis}, 24(1), 85--98.
Laffargue, Jean-Pierre (1990): ``Résolution d'un modèle
macroéconomique avec anticipations rationnelles'', @i{Annales
d'Économie et Statistique}, 17, 97--119.
Lubik, Thomas and Frank Schorfheide (2007): ``Do Central Banks Respond
to Exchange Rate Movements? A Structural Investigation,'' @i{Journal
of Monetary Economics}, 54(4), 1069--1087.
Mancini-Griffoli, Tommaso (2007): ``Dynare User Guide: An introduction
to the solution and estimation of DSGE models''.
Pearlman, Joseph, David Currie, and Paul Levine (1986): ``Rational
expectations models with partial information,'' @i{Economic
Modelling}, 3(2), 90--105.
Rabanal, Pau and Juan Rubio-Ramirez (2003): ``Comparing New Keynesian
Models of the Business Cycle: A Bayesian Approach,'' Federal Reserve
of Atlanta, @i{Working Paper Series}, 2003-30.
Schorfheide, Frank (2000): ``Loss Function-based evaluation of DSGE
models,'' @i{Journal of Applied Econometrics}, 15(6), 645--670.
Schmitt-Grohé, Stephanie and Martin Uríbe (2004): ``Solving Dynamic
General Equilibrium Models Using a Second-Order Approximation to the
Policy Function,'' @i{Journal of Economic Dynamics and Control},
28(4), 755--775.
Smets, Frank and Rafael Wouters (2003): ``An Estimated Dynamic
Stochastic General Equilibrium Model of the Euro Area,'' @i{Journal of
the European Economic Association}, 1(5), 1123--1175.
@end itemize
@node Command and Function Index
@unnumbered Command and Function Index
@printindex fn
@node Variable Index
@unnumbered Variable Index
@printindex vr
......@@ -49,6 +49,7 @@ addpath([dynareroot '/ms-sbvar/switching_specification']);
addpath([dynareroot '/ms-sbvar/mhm_specification']);
addpath([dynareroot '/parallel/'])
addpath([dynareroot '/gsa/'])
addpath([dynareroot '../doc/m/'])
% For functions that exist only under some Octave versions
% or some MATLAB versions, and for which we provide some replacement functions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment