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

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
  • chskcau/dynare-doc-fixes
27 results
Select Git revision
Show changes
Commits on Source (362)
Showing
with 2736 additions and 692 deletions
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
...@@ -37,3 +37,15 @@ dist-hook: ...@@ -37,3 +37,15 @@ dist-hook:
rm -f $(distdir)/matlab/dynare_m$(EXEEXT) $(distdir)/matlab/dynare_version.m rm -f $(distdir)/matlab/dynare_m$(EXEEXT) $(distdir)/matlab/dynare_version.m
$(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave $(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave
rm -rf `find $(distdir)/contrib -name '.git*'` rm -rf `find $(distdir)/contrib -name '.git*'`
install-exec-local:
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
cp -r examples $(DESTDIR)$(pkglibdir)
cp -r matlab $(DESTDIR)$(pkglibdir)
rm -f $(DESTDIR)$(pkglibdir)/matlab/dynare_m
cp preprocessor/dynare_m $(DESTDIR)$(pkglibdir)/matlab
cp -r contrib/ms-sbvar/TZcode/MatlabFiles $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
uninstall-local:
rm -f $(DESTDIR)$(bindir)/dynare++
rm -rf $(DESTDIR)$(pkglibdir)
Announcement for Dynare 4.4.3 (on 2014-07-31)
=============================================
We are pleased to announce the release of Dynare 4.4.3.
This is a bugfix release.
The Windows packages are already available for download at:
http://www.dynare.org/download/dynare-stable
The Mac and GNU/Linux packages (for Debian and Ubuntu LTS) should follow soon.
This release is compatible with MATLAB versions 7.3 (R2006b) to 8.2 (R2013b)
and with GNU Octave versions 3.6 to 3.8.
Here is a list of the problems identified in version 4.4.2 and that have been
fixed in version 4.4.3:
- When loading a dataset in XLS, XLSX or CSV format, the first
observation was discarded.
- Reading data in an Excel-file with only one variable wasz leading
to a crash.
- When using the k_order_perturbation option (which is implicit at
3rd order) without the use_dll option, crashes or unexpected
behavior could happen if some 2nd or 3rd derivative evaluates to
zero (while not being symbolically zero)
- When using external function, Ramsey policy could crash or return
wrong results.
- For Ramsey policy, the equation numbers associated with the
Lagrange multipliers stored in M_.aux_vars were erroneously one too
low
- When updating deep parameters in the steady state file, the changes
were not fully taken into account (this was only affecting the
Ramsey policy).
- When using external functions and the bytecode option, wrong
results were returned (if second order derivates of the external
functions were needed).
- The confidence level for computations in estimation, conf_sig could
not be changed and was fixed at 0.9. The new option mh_conf_sig is
now used to set this interval
- Conditional forecasts with non-diagonal covariance matrix used an
incorrect decomposition of the covariance matrix. A Cholesky
factorization is used.
- Option geweke_interval was not effective, Dynare always defaulted
to the standard value.
- The mode_file option lacked backward compatibility with older
Dynare versions.
- Loading an mh_mode file with the mode_file option was broken.
- Using identification with var_exo_det leaded to crashes (the
preprocessor now returns an error if they are used simultaneously)
- The identification command did not print results if the initial
parameter set was invalid and then crashed later on if the MC
sample is bigger than 1
- Inconsistencies between static and dynamic models leaded to crashes
instead of error messages (only with block option).
- The use of external functions crashed the preprocessor when the
derivatives of the external function are explicitly called in the
model block. The preprocessor now forbids the use of external
functions derivates in the model block.
- Using the block option when a variable does not appear in the
current period crashed Dynare instead of providing an error
message.
Announcement for Dynare 4.4.2 (on 2014-03-04)
=============================================
We are pleased to announce the release of Dynare 4.4.2.
This is a bugfix release.
The Windows packages are already available for download at:
http://www.dynare.org/download/dynare-stable
The Mac and GNU/Linux packages (for Debian and Ubuntu LTS) should follow soon.
This release is compatible with MATLAB versions 7.3 (R2006b) to 8.2 (R2013b)
and with GNU Octave versions 3.6 to 3.8.
Here is a list of the problems identified in version 4.4.1 and that have been
fixed in version 4.4.2:
- Geweke convergence diagnostics was computed on the wrong sample if `mh_drop'
was not equal to the default of 0.5.
- The `loglinear' option of `stoch_simul' was displaying the steady state of
the original values, not the logged ones, and was producing incorrect
simulations and simulated moments. Theoretical moments were unaffected.
- The `optim' option of `estimation (for setting options to `mode_compute')
was only working with at least MATLAB 8.1 (R2013a) or Octave 3.8.
- For unit root models, theoretical HP filtered moments were sometimes
erroneously displayed as NaN.
- Specifying an endogenous variable twice after the `estimation' command would
lead to a crash in the computation of moments.
- Deterministic simulations were crashing on some models with more than one
lead or one lag on exogenous variables.
- Homotopy in stochastic extended path with order greater than 0 was not
working correctly (during the homotopy steps the perfect foresight model
solver was called instead of the stochastic perfect foresight model solver).
- MCMC convergence diagnostics were not computed if `mh_replic' was less than
2000; the test now relies on the total number of iterations (this only makes
a difference if option `load_mh_file' is used).
Announcement for Dynare 4.4.1 (on 2014-01-17)
=============================================
We are pleased to announce the release of Dynare 4.4.1.
This release contains a few changes to the user interface and fixes various
bugs. It also adds compatibility with Octave 3.8.
The Windows packages are already available for download at:
http://www.dynare.org/download/dynare-stable
The Mac and GNU/Linux packages (for Debian and Ubuntu) should follow soon.
All users are encouraged to upgrade.
This release is compatible with MATLAB versions 7.3 (R2006b) to 8.2 (R2013b) and
with GNU Octave versions 3.6 to 3.8.
* Changes to the user interface:
- The syntax introduced in 4.4.0 for conditional forecast in a deterministic
setup was removed, and replaced by a new one that is better suited to the
task. More precisely, such deterministic forecasts are no longer done using
the `conditional_forecast' command. The latter is replaced by a group of
commands: `init_plan', `basic_plan' and `flip_plan'. See the reference
manual for more details.
- Changes to the reporting module: option `annualAverages' to `addTable' has
been removed (use option `tableDataRhs' to `addSeries' instead); option
`vlineAfter' to `addTable' now also accepts a cell array.
- Changes to the date and time series classes: implement broadcasting for
operations (+,-,* and /) between `dseries' class and scalar or vectors; add
the possibility of selecting an observation within a time series using a
formatted string containing a date.
* Bugs and problems identified in version 4.4.0 and that have been fixed in
version 4.4.1:
- In MS-SBVAR, there was a bug preventing the computation of impulse responses
on a constant regime.
- Under Octave, after modifying the MOD file, the changes were not taken into
account at the first Dynare run, but only at the second run.
Announcement for Dynare 4.4.0 (on 2013-12-16)
=============================================
We are pleased to announce the release of Dynare 4.4.0.
This major release adds new features and fixes various bugs.
The Windows packages are already available for download at:
http://www.dynare.org/download/dynare-stable
The Mac and Debian/Ubuntu packages should follow soon.
All users are strongly encouraged to upgrade.
This release is compatible with MATLAB versions ranging from 7.3 (R2006b) to
8.2 (R2013b) and with GNU Octave version 3.6.
Here is the list of major user-visible changes:
* New major algorithms:
- Extended path at order 1 and above, also known as “stochastic extended
path”. This method is triggered by setting the `order' option of the
`extended_path' command to a value greater than 0. Dynare will then use a
Gaussian quadrature to take into account the effects of future uncertainty.
The time series for the endogenous variables are generated by assuming that
the agents believe that there will no more shocks after period t+order.
- Alternative algorithms for computing decision rules of a stochastic model,
based on the cycle reduction and logarithmic reduction algorithms. These
methods are respectively triggered by giving `dr = cycle_reduction' or 'dr
= logarithmic_reduction' as an option to the `stoch_simul' command.
- Pruning now works with 3rd order approximation, along the lines of
Andreasen, Fernández-Villaverde and Rubio-Ramírez (2013).
- Computation of conditional forecast using an extended path method. This is
triggered by the new option `simulation_type = deterministic' in the
`conditional_forecast' command. In this case, the `expectation' command in
the `conditional_forecast_paths' block has to be used to indicate the nature
of expectations (whether shocks are a surprise or are perfectly
anticipated).
- Endogenous priors as in Christiano, Trabandt and Walentin (2011). Those are
triggered by the new option `endogenous_prior' of the `estimation' command.
* Other algorithmic improvements:
- New command `model_diagnostics' to perform various sanity checks on the
model. Note: in the past, some users may have used a preliminary MATLAB
function implementing this; the new command has the same syntax, except that
you shouldn't pass any argument to it.
- Terminal conditions of perfect foresight simulations can now be specified in
growth rates. More specifically, the new option `differentiate_forward_vars'
of the `model' block will create auxiliary forward looking variables
expressed in first differences or growth rates of the actual forward looking
variables defined in the model. These new variables have obvious zero
terminal conditions whatever the simulation context and this in many cases
helps convergence of simulations.
- Convergence diagnostics for single chain MCMC à la Geweke (1992, 1999).
- New optimizer for the posterior mode (triggered by `mode_compute=10'): it
uses the simpsa algorithm, based on the combination of the non-linear
simplex and simulated annealing algorithms and proposed by Cardoso, Salcedo
and Feyo de Azevedo (1996).
- The automatic detrending engine has been extended to work on models written
in logs. The corresponding trend variable type is `log_trend_var', and the
corresponding deflator type is `log_deflator'.
* New features in the user interface:
- New set of functions for easily creating PDF reports including figures and
tables. See the “Reporting” section in the reference manual for more
details.
- New MATLAB/Octave classes for handling time series. See the “Time series”
section in the reference manual for more details.
- Datafiles in CSV format can now be used for estimation.
- New macro processor `length' operator, returns the length of an array.
- New option `all_values_required' of `initval' and `endval' blocks: enforces
initialization of all endogenous and exogenous variables within the block.
- Option `ar' can now be given to the `estimation' command.
- New options `nograph', `nointeractive' and `nowarn' to the `dynare' command,
for a better control of what is displayed.
- New option `nostrict' to the `dynare' command, for allowing Dynare to
continue processing when there are more endogenous variables than equations
or when an undeclared symbol is assigned in `initval' or `endval'.
- The information on MCMC acceptance rates, seeds, last log posterior
likelihood, and last parameter draw are now saved on the disk and can
be displayed with `internals --display-mh-history' or loaded into the
workspace with `internals --load-mh-history'.
- New options `mode_check_neighbourhood_size', `mode_check_symmetric_plots'
and `mode_check_number_of_points', for a better control of the diagnostic
plots.
- New option `parallel_local_files' of `model' block, for transferring extra
files during parallel computations.
- New option `clock' of `set_dynare_seed', for setting a different seed at
each run.
- New option `qz_zero_threshold' of the `check', `stoch_simul' and
`estimation' commands, for a better control of the situation where a
generalized eigenvalue is close to 0/0.
- New `verbatim' block for inclusion of text that should pass through the
preprocessor and be placed as is in the `modfile.m' file.
- New option `mcmc_jumping_covariance' of the `estimation' command, for a
better control of the covariance matrix used for the proposal density of the
MCMC sampler.
- New option `use_calibration' of the `estimated_params_init', for using the
calibration of deep parameters and the elements of the covariance matrix
specified in the `shocks' block as starting values for the estimation.
- New option `save_draws' of the `ms_simulation' command.
- New option `irf_plot_threshold' of the `stoch_simul' and `estimation'
commands, for a better control of the display of IRFs which are almost nil.
- New option `long_name' for endogenous, exogenous and parameter declarations,
which can be used to declare a long name for variables. That long name can
be programmatically retrieved in `M_.endo_names_long'.
* Miscellaneous changes
- The deciles of some posterior moments were erroneously saved in a field
`Distribution' under `oo_'. This field is now called `deciles', for
consistency with other posterior moments and with the manual. Similarly, the
fields `Mean', `Median', `HPDsup', `HPDinf', and `Variance' are now
consistently capitalized.
- The console mode now implies the `nodisplay' option.
* Bugs and problems identified in version 4.3.3 and that have been fixed in
version 4.4.0:
- In an `endval' block, auxiliary variables were not given the right value.
This would not result in wrong results, but could prevent convergence of
the steady state computation.
- Deterministic simulations with `stack_solve_algo=0' (the default value) were
crashing if some exogenous had a lag strictly greater than 1.
- When using the `mode_file' option, the initial estimation checks were not
performed for the loaded mode, but for the original starting values. Thus,
potential prior violations by the mode only appeared during estimation,
leading to potentially cryptic crashes and error messages.
- If a shock/measurement error variance was set to 0 in calibration, the
correlation matrix featured a 0 instead of a 1 on the diagonal, leading to
wrong estimation results.
- In the presence of calibrated covariances, estimation did not enforce
positive definiteness of the covariance matrix.
- Estimation using the `diffuse_filter' option together with the univariate
Kalman filter and a diagonal measurement error matrix was broken.
- A purely backward model with `k_order_solver' was leading to crashes of
MATLAB/Octave.
- Non-linear estimation was not skipping the specified presample when
computing the likelihood.
- IRFs and theoretical moments at order > 1 were broken for purely
forward-looking models.
- Simulated moments with constant variables was leading to crashes when
displaying autocorrelations.
- The `osr' command was sometimes crashing with cryptic error messages because
of some unaccounted error codes returned from a deeper routine.
- The check for stochastic singularity during initial estimation checks was
broken.
- Recursive estimation starting with the pathological case of `nobs=1' was
crashing.
- Conditional variance decomposition within or after estimation was crashing
when at least one shock had been calibrated to zero variance.
- The `estimated_params_init' and `estimated_params_bounds' blocks were broken
for correlations.
- The `filter_step_ahead' option was not producing any output in Bayesian
estimation.
- Deterministic simulations were sometimes erroneously indicating convergence
although the residuals were actually NaN or Inf.
- Supplying a user function in the `mode_compute' option was leading to
a crash.
- Deterministic simulation of models without any exogenous variable was
crashing.
- The MS-SBVAR code was not updating files between runs on Windows. This means
that if a MOD file was updated between runs in the same folder and a
`file_tag' was not changed, then the results would not change.
- The `ramsey_policy' command was not putting in `oo_.planner_objective_value'
the value of the planner objective at the optimum.
* References:
- Andreasen, Martin M., Jesús Fernández-Villaverde, and Juan Rubio-Ramírez
(2013): “The Pruned State-Space System for Non-Linear DSGE Models: Theory
and Empirical Applications,” NBER Working Paper, 18983
- Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): “The
simplex simulated annealing approach to continuous non-linear optimization,”
Computers chem. Engng, 20(9), 1065-1080
- Christiano, Lawrence J., Mathias Trabandt and Karl Walentin (2011):
“Introducing financial frictions and unemployment into a small open economy
model,” Journal of Economic Dynamics and Control, 35(12), 1999-2041
- Geweke, John (1992): “Evaluating the accuracy of sampling-based approaches
to the calculation of posterior moments,” in J.O. Berger, J.M. Bernardo,
A.P. Dawid, and A.F.M. Smith (eds.) Proceedings of the Fourth Valencia
International Meeting on Bayesian Statistics, pp. 169-194, Oxford University
Press
- Geweke, John (1999): “Using simulation methods for Bayesian econometric
models: Inference, development and communication,” Econometric Reviews,
18(1), 1-73
Announcement for Dynare 4.3.3 (on 2013-04-12) Announcement for Dynare 4.3.3 (on 2013-04-12)
============================================= =============================================
......
...@@ -20,7 +20,7 @@ Here, we explain how to build from source: ...@@ -20,7 +20,7 @@ Here, we explain how to build from source:
This source can be retrieved in three forms: This source can be retrieved in three forms:
- via git, at <https://github.com/DynareTeam/dynare.git> - via git, at <https://github.com/DynareTeam/dynare.git>
- using the stable source archive of the latest Dynare version (currently 4.3) from <http://www.dynare.org/download/dynare-4.3/source> - using the stable source archive of the latest Dynare version (currently 4.4) from <http://www.dynare.org/download/dynare-stable/>
- using a source snapshot of the unstable version, from <http://www.dynare.org/download/dynare-unstable/source-snapshot> - using a source snapshot of the unstable version, from <http://www.dynare.org/download/dynare-unstable/source-snapshot>
Note that if you obtain the source code via git, you will need to install more tools (see below). Note that if you obtain the source code via git, you will need to install more tools (see below).
...@@ -49,28 +49,27 @@ A number of tools and libraries are needed in order to recompile everything. You ...@@ -49,28 +49,27 @@ A number of tools and libraries are needed in order to recompile everything. You
- A POSIX compliant shell and an implementation of Make (mandatory) - A POSIX compliant shell and an implementation of Make (mandatory)
- The [GNU Compiler Collection](http://gcc.gnu.org/), with gcc, g++ and gfortran (mandatory) - The [GNU Compiler Collection](http://gcc.gnu.org/), with gcc, g++ and gfortran (mandatory)
- [MATLAB](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=dynare-mingw64-libs.zip) (if you want to compile MEX for MATLAB) - MATLAB (if you want to compile MEX for MATLAB)
- [GNU Octave](http://www.octave.org), with the development headers (if you want to compile MEX for Octave) - [GNU Octave](http://www.octave.org), with the development headers (if you want to compile MEX for Octave)
- [Boost libraries](http://www.boost.org), version 1.36 or later - [Boost libraries](http://www.boost.org), version 1.36 or later
- [Bison](http://www.gnu.org/software/bison/), version 2.3 or later (only if you get the source through Git) - [Bison](http://www.gnu.org/software/bison/), version 2.5 or later (only if you get the source through Git)
- [Flex](http://flex.sourceforge.net/), version 2.5.4 or later (only if you get the source through Git) - [Flex](http://flex.sourceforge.net/), version 2.5.4 or later (only if you get the source through Git)
- [Autoconf](http://www.gnu.org/software/autoconf/), version 2.62 or later (only if you get the source through Git) (see [Installing an updated version of Autoconf in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake)) - [Autoconf](http://www.gnu.org/software/autoconf/), version 2.62 or later (only if you get the source through Git) (see [Installing an updated version of Autoconf in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake))
- [Automake](http://www.gnu.org/software/automake/), version 1.11.2 or later (only if you get the source through Git) (see [Installing an updated version of AutoMake in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake)) - [Automake](http://www.gnu.org/software/automake/), version 1.11.2 or later (only if you get the source through Git) (see [Installing an updated version of AutoMake in your own directory, in GNU/Linux](http://www.dynare.org/DynareWiki/AutoMake))
- [CWEB](http://www-cs-faculty.stanford.edu/%7Eknuth/cweb.html), with its tools `ctangle` and `cweave` (only if you want to build Dynare++ and get the source through Git) - [CWEB](http://www-cs-faculty.stanford.edu/%7Eknuth/cweb.html), with its tools `ctangle` and `cweave` (only if you want to build Dynare++ and get the source through Git)
- An implementation of BLAS and LAPACK: either [ATLAS](http://math-atlas.sourceforge.net/), [OpenBLAS](http://xianyi.github.com/OpenBLAS/), Netlib ([BLAS](http://www.netlib.org/blas/), [LAPACK](http://www.netlib.org/lapack/)) or [MKL](http://software.intel.com/en-us/intel-mkl/) (only if you want to build Dynare++) - An implementation of BLAS and LAPACK: either [ATLAS](http://math-atlas.sourceforge.net/), [OpenBLAS](http://xianyi.github.com/OpenBLAS/), Netlib ([BLAS](http://www.netlib.org/blas/), [LAPACK](http://www.netlib.org/lapack/)) or [MKL](http://software.intel.com/en-us/intel-mkl/) (only if you want to build Dynare++)
- An implementation of [POSIX Threads](http://en.wikipedia.org/wiki/POSIX_Threads) (optional, for taking advantage of multi-core) - An implementation of [POSIX Threads](http://en.wikipedia.org/wiki/POSIX_Threads) (optional, for taking advantage of multi-core)
- [MAT File I/O library](http://sourceforge.net/projects/matio/) (if you want to compile Markov-Switching code, the estimation DLL, k-order DLL and Dynare++ in unstable) - [MAT File I/O library](http://sourceforge.net/projects/matio/) (if you want to compile Markov-Switching code, the estimation DLL, k-order DLL and Dynare++)
- [SLICOT](http://www.slicot.org) (if you want to compile the Kalman steady state DLL) - [SLICOT](http://www.slicot.org) (if you want to compile the Kalman steady state DLL)
- [GSL library](http://www.gnu.org/software/gsl/) (if you want to compile Markov-Switching code) - [GSL library](http://www.gnu.org/software/gsl/) (if you want to compile Markov-Switching code)
- A decent LaTeX distribution (if you want to compile PDF documentation). The following extra components may be needed: - A decent LaTeX distribution (if you want to compile PDF documentation). The following extra components may be needed:
- The Econometrica bibliography style: you need [harvard](http://www.ctan.org/tex-archive/macros/latex/contrib/harvard/) and [economic](http://www.ctan.org/tex-archive/biblio/bibtex/contrib/economic/) packages from CTAN (only if you want to build Dynare user guide, no more needed with Dynare unstable)
- [Eplain](http://www.tug.org/eplain/) TeX macros (only if you want to build Dynare++ source documentation) - [Eplain](http://www.tug.org/eplain/) TeX macros (only if you want to build Dynare++ source documentation)
- [Beamer](http://latex-beamer.sourceforge.net/) (for some PDF presentations) - [Beamer](http://latex-beamer.sourceforge.net/) (for some PDF presentations)
- For building the reference manual: - For building the reference manual:
- [GNU Texinfo](http://www.gnu.org/software/texinfo/) - [GNU Texinfo](http://www.gnu.org/software/texinfo/)
- [Texi2HTML](http://www.nongnu.org/texi2html) and [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output - [Texi2HTML](http://www.nongnu.org/texi2html) and [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output
- [Doxygen](http://www.stack.nl/%7Edimitri/doxygen/) (if you want to build Dynare preprocessor source documentation) - [Doxygen](http://www.stack.nl/%7Edimitri/doxygen/) (if you want to build Dynare preprocessor source documentation)
- For Octave, the development libraries corresponding to the UMFPACK packaged with Octave (only in unstable) - For Octave, the development libraries corresponding to the UMFPACK packaged with Octave
### Preparing the sources ### Preparing the sources
...@@ -78,9 +77,8 @@ If you have downloaded the sources from an official source archive or the source ...@@ -78,9 +77,8 @@ If you have downloaded the sources from an official source archive or the source
If you want to use Git, do the following from a terminal: If you want to use Git, do the following from a terminal:
git clone http://github.com/DynareTeam/dynare.git git clone --recursive http://github.com/DynareTeam/dynare.git
cd dynare cd dynare
git submodule update --init
autoreconf -si autoreconf -si
The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot). The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot).
...@@ -139,12 +137,12 @@ apt-get build-dep dynare ...@@ -139,12 +137,12 @@ apt-get build-dep dynare
Alternatively, if you want to build everything, manually install the following packages: Alternatively, if you want to build everything, manually install the following packages:
- `build-essential` (for gcc, g++ and make) - `build-essential` (for gcc, g++ and make)
- `octave3.2-headers` or `liboctave-dev` (will install ATLAS) - `liboctave-dev` or `octave3.2-headers` (will install ATLAS)
- `libboost-graph-dev` - `libboost-graph-dev`
- `libgsl0-dev` - `libgsl0-dev`
- `libmatio-dev` - `libmatio-dev`
- `libslicot-dev` and `libslicot-pic` - `libslicot-dev` and `libslicot-pic`
- `libsuitesparse-dev` (only for Unstable) - `libsuitesparse-dev`
- `flex` - `flex`
- `bison` - `bison`
- `autoconf` - `autoconf`
...@@ -181,24 +179,29 @@ The following instructions are compatible with MATLAB or with Octave/MinGW (as d ...@@ -181,24 +179,29 @@ The following instructions are compatible with MATLAB or with Octave/MinGW (as d
### Setting up the Compilation Environment ### Setting up the Compilation Environment
- First, you need to setup a Cygwin environment, following the instructions at <http://www.cygwin.com>. You need the following packages: - First, you need to setup a Cygwin environment, following the instructions at <http://www.cygwin.com>. You can install either the 32-bit or the 64-bit version. If you opt for the latter, you need to replace `c:\cygwin` by `c:\cygwin64` in the following.
- Install the following packages:
- `make` - `make`
- `bison` - `bison`
- `flex` - `flex`
- `autoconf` and `autoconf2.5` - `git`, `gettext`
- `automake` and `automake1.11` - `autoconf`
- `texlive`, `texlive-collection-latexextra`, `texlive-collection-formatsextra`, `texlive-collection-publishers` - `automake`
- `texi2html`
- `texlive`, `texlive-collection-latexextra`, `texlive-collection-formatsextra`, `texlive-collection-publishers`, `texlive-collection-fontsrecommended`, `texlive-collection-fontsextra`, `texlive-collection-bibtexextra`, `texlive-collection-genericrecommended`, `texlive-collection-mathextra`, `texlive-collection-binextra`
- `texinfo` - `texinfo`
- `doxygen` - `doxygen`
- `mingw64-i686-gcc`, `mingw64-i686-gcc-g++`, `mingw64-i686-gcc-fortran` (if you have Octave/MinGW or if you have MATLAB 32-bit) - `mingw64-i686-gcc-core`, `mingw64-i686-gcc-g++`, `mingw64-i686-gcc-fortran` (if you have Octave/MinGW or if you have MATLAB 32-bit)
- `mingw64-x86_64-gcc`, `mingw64-x86_64-gcc-g++`, `mingw64-x86_64-gcc-fortran` (if you have MATLAB 64-bit) - `mingw64-x86_64-gcc-core`, `mingw64-x86_64-gcc-g++`, `mingw64-x86_64-gcc-fortran` (if you have MATLAB 64-bit)
- Second, install precompiled librairies for BLAS, LAPACK, Boost and GSL: - Second, install precompiled librairies for BLAS, LAPACK, Boost and GSL:
- If you have Octave or MATLAB 32-bit, download [dynare-mingw32-libs.zip](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=dynare-mingw32-libs.zip), and uncompress it in `c:\cygwin\usr\local\lib\mingw32` - If you have Octave or MATLAB 32-bit, download [dynare-mingw32-libs.zip](http://www.dynare.org/build/dynare-mingw32-libs.zip), and uncompress it in `c:\cygwin\usr\local\lib\mingw32`
- If you have MATLAB 64-bit, download [dynare-mingw64-libs.zip](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=dynare-mingw64-libs.zip), and uncompress it in `c:\cygwin\usr\local\lib\mingw64` - If you have MATLAB 64-bit, download [dynare-mingw64-libs.zip](http://www.dynare.org/build/dynare-mingw64-libs.zip), and uncompress it in `c:\cygwin\usr\local\lib\mingw64`
*Remark*: You need to make sure that Cygwin’s git is used and not a potentially installed msysgit. The latter typically happens when one installs msysgit and allows it to set a system path. This will result in wrong line endings and cryptic error messages à la "syntax error near unexpected token `fi'". In that case it might be necessary to uninstall msysgit and reinstall it without setting a system path.
### Compiling the preprocessor, Dynare++, the MEX for MATLAB and the documentation ### Compiling the preprocessor, Dynare++, the MEX for MATLAB and the documentation
Download and uncompress the Dynare source tree, let’s say in `c:\cygwin\home\user\dynare`. Install the Dynare source tree, let’s say in `c:\cygwin\home\user\dynare` (by either uncompressing a source archive, or by cloning the git repository with `git clone --recursive http://github.com/DynareTeam/dynare.git`).
Launch a Cygwin shell, and enter the Dynare source tree: Launch a Cygwin shell, and enter the Dynare source tree:
``` ```
...@@ -259,23 +262,19 @@ Configure and make: ...@@ -259,23 +262,19 @@ Configure and make:
- Install [Homebrew](http://mxcl.github.io/homebrew/) and [Homebrew Science](https://github.com/Homebrew/homebrew-science) - Install [Homebrew](http://mxcl.github.io/homebrew/) and [Homebrew Science](https://github.com/Homebrew/homebrew-science)
- Install the following brews: - Install the following brews:
``` - ```brew install automake```
brew install automake - ```brew install gsl```
brew install gsl - ```brew install boost```
brew install boost - ```brew install gfortran```
brew install gfortran - ```brew install matlab2tikz --HEAD```
brew install matlab2tikz --HEAD - ```brew install libmatio --with-hdf5```
brew install libmatio --with-hdf5 - ```brew install slicot --with-default-integer-8```
brew install slicot --with-default-integer-8
```
- **(Optional)** To compile Dynare mex files for use on Octave, first install Octave following the [Simple Installation Instructions](http://wiki.octave.org/Octave_for_MacOS_X#Simple_Installation_Instructions_3). Then, you will probably also want to install graphicsmagick via Homebrew with `brew install graphicsmagick`. - **(Optional)** To compile Dynare mex files for use on Octave, first install Octave following the [Simple Installation Instructions](http://wiki.octave.org/Octave_for_MacOS_X#Simple_Installation_Instructions_3). Then, you will probably also want to install graphicsmagick via Homebrew with `brew install graphicsmagick`.
- **(Optional)** To compile Dynare's documentation, first install the latest version of [MacTeX](http://www.tug.org/mactex/). Then install `doxygen`, `latex2html` and `texi2html` via Homebrew with the following commands: - **(Optional)** To compile Dynare's documentation, first install the latest version of [MacTeX](http://www.tug.org/mactex/). Then install `doxygen`, `latex2html` and `texi2html` via Homebrew with the following commands:
``` - ```brew install doxygen```
brew install doxygen - ```brew install latex2html```
brew install latex2html - ```brew install texi2html```
brew install texi2html - **(On OS X 10.7 Only)** Copy [FlexLexer.h](http://www.dynare.org/build/FlexLexer.h) into the `preprocessor` directory (there was an error in the `FlexLexer.h` file distributed with 10.7)
```
- **(On OS X 10.7 Only)** Copy [FlexLexer.h](http://www.dynare.org/DynareWiki/BuildingDynareFromSource?action=AttachFile&do=view&target=FlexLexer.h) into the `preprocessor` directory (there was an error in the `FlexLexer.h` file distributed with 10.7)
- Finally, switch to the root dynare directory. Ensure your path contains `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/sbin`. Run: - Finally, switch to the root dynare directory. Ensure your path contains `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/sbin`. Run:
- `autoconf -si` - `autoconf -si`
- `./configure --with-matlab=/Applications/MATLAB_R2013a.app MATLAB_VERSION=8.1` for builds with Matlab or `./configure` for builds just using Octave - `./configure --with-matlab=/Applications/MATLAB_R2013a.app MATLAB_VERSION=8.1` for builds with Matlab or `./configure` for builds just using Octave
......
...@@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License ...@@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>. dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.62]) AC_PREREQ([2.62])
AC_INIT([dynare], [4.4-unstable]) AC_INIT([dynare], [4.4.3])
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc]) AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax]) AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
...@@ -83,10 +83,6 @@ CPPFLAGS="$CPPFLAGS_SAVED" ...@@ -83,10 +83,6 @@ CPPFLAGS="$CPPFLAGS_SAVED"
# Don't use deprecated hash structures # Don't use deprecated hash structures
AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures]) AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
# Check for dlopen(), needed by tests for estimation DLL
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
# Check for libmatio, needed by Dynare++ # Check for libmatio, needed by Dynare++
AX_MATIO AX_MATIO
AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"]) AM_CONDITIONAL([HAVE_MATIO], [test "x$has_matio" = "xyes"])
...@@ -160,6 +156,12 @@ fi ...@@ -160,6 +156,12 @@ fi
AM_CONDITIONAL([HAVE_BLAS], [test x"$ax_blas_ok" = "xyes"]) AM_CONDITIONAL([HAVE_BLAS], [test x"$ax_blas_ok" = "xyes"])
AM_CONDITIONAL([HAVE_LAPACK], [test x"$ax_lapack_ok" = "xyes"]) AM_CONDITIONAL([HAVE_LAPACK], [test x"$ax_lapack_ok" = "xyes"])
case ${host_os} in
*mingw32*)
# Ensure that -lpthread is statically linked under MinGW
PTHREAD_LIBS="-Wl,-Bstatic -lpthread -Wl,-Bdynamic"
;;
esac
AX_PTHREAD AX_PTHREAD
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
...@@ -192,10 +194,6 @@ AC_CONFIG_FILES([Makefile ...@@ -192,10 +194,6 @@ AC_CONFIG_FILES([Makefile
dynare++/kord/Makefile dynare++/kord/Makefile
dynare++/src/Makefile dynare++/src/Makefile
mex/sources/Makefile mex/sources/Makefile
mex/sources/estimation/Makefile
mex/sources/estimation/tests/Makefile
mex/sources/estimation/libmat/Makefile
mex/sources/estimation/libmat/tests/Makefile
]) ])
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes]) AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
......
switch_dw @ 8b3d1404
Subproject commit 29c446f7fe8a773860ebee347662c4ae2494c5e9 Subproject commit 8b3d14040133ea5b622cde9ea79b3b0b41891bce
utilities_dw @ 216abedb
Subproject commit b388d5eac8c8d092088db5ef805584ae4dd2d952 Subproject commit 216abedb9ab4df5dd4dca07c721f7c07392801e9
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
@emph{Algorithms} @emph{Algorithms}
@end macro @end macro
@macro customhead{title} @macro customhead{title}
@iftex @iftex
@sp 1 @sp 1
...@@ -97,7 +95,7 @@ ...@@ -97,7 +95,7 @@
@c %**end of header @c %**end of header
@copying @copying
Copyright @copyright{} 1996-2013, Dynare Team. Copyright @copyright{} 1996-2014, Dynare Team.
@quotation @quotation
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
...@@ -351,15 +349,15 @@ institutions who cannot afford, or do not want to pay for, MATLAB and ...@@ -351,15 +349,15 @@ institutions who cannot afford, or do not want to pay for, MATLAB and
are willing to bear the concomitant performance loss. are willing to bear the concomitant performance loss.
The development of Dynare is mainly done at The development of Dynare is mainly done at
@uref{http://www.cepremap.ens.fr, Cepremap} by a core team of @uref{http://www.cepremap.fr, Cepremap} by a core team of
researchers who devote part of their time to software development. researchers who devote part of their time to software development.
Currently the development team of Dynare is composed of Stéphane Currently the development team of Dynare is composed of Stéphane
Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani Adjemian (Université du Maine, Gains and Cepremap), Houtan Bastani
(Cepremap), Michel Juillard (Banque de France), Frédéric Karamé (Cepremap), Michel Juillard (Banque de France), Frédéric Karamé
(Université du Maine, Gains and Cepremap), Junior Maih (Norges Bank), (Université du Maine, Gains and Cepremap), Junior Maih (Norges Bank),
Ferhat Mihoubi (Université Paris-Est Créteil, Epee and Cepremap), George Ferhat Mihoubi (Université Paris-Est Créteil, Epee and Cepremap), George
Perendia, Johannes Pfeifer (University of Mannheim), Marco Ratto (JRC) Perendia, Johannes Pfeifer (University of Mannheim), Marco Ratto (European Commission, Joint Research Centre - JRC)
and Sébastien Villemot (Cepremap). and Sébastien Villemot (OFCE – Sciences Po).
Increasingly, the developer base is expanding, as tools developed by Increasingly, the developer base is expanding, as tools developed by
researchers outside of Cepremap are integrated into Dynare. Financial researchers outside of Cepremap are integrated into Dynare. Financial
support is provided by Cepremap, Banque de France and DSGE-net (an support is provided by Cepremap, Banque de France and DSGE-net (an
...@@ -517,9 +515,8 @@ Please refer to the ...@@ -517,9 +515,8 @@ Please refer to the
@uref{http://www.dynare.org/DynareWiki/InstallOnDebianOrUbuntu,Dynare @uref{http://www.dynare.org/DynareWiki/InstallOnDebianOrUbuntu,Dynare
Wiki} for detailed instructions. Wiki} for detailed instructions.
Dynare will be installed under @file{/usr/share/dynare} and Dynare will be installed under @file{/usr/lib/dynare}. Documentation will be
@file{/usr/lib/dynare}. Documentation will be under under @file{/usr/share/doc/dynare-doc}.
@file{/usr/share/doc/dynare}.
@node On Mac OS X @node On Mac OS X
@subsection On Mac OS X @subsection On Mac OS X
...@@ -582,7 +579,7 @@ addpath c:\dynare\4.@var{x}.@var{y}\matlab ...@@ -582,7 +579,7 @@ addpath c:\dynare\4.@var{x}.@var{y}\matlab
Under Debian GNU/Linux or Ubuntu, type: Under Debian GNU/Linux or Ubuntu, type:
@example @example
addpath /usr/share/dynare/matlab addpath /usr/lib/dynare/matlab
@end example @end example
Under Mac OS X, assuming that you have installed Dynare in the standard Under Mac OS X, assuming that you have installed Dynare in the standard
...@@ -682,7 +679,7 @@ In practice, the handling of the model file is done in two steps: in the ...@@ -682,7 +679,7 @@ In practice, the handling of the model file is done in two steps: in the
first one, the model and the processing instructions written by the user first one, the model and the processing instructions written by the user
in a @emph{model file} are interpreted and the proper MATLAB or GNU in a @emph{model file} are interpreted and the proper MATLAB or GNU
Octave instructions are generated; in the second step, the program Octave instructions are generated; in the second step, the program
actually runs the computations. Boths steps are triggered automatically actually runs the computations. Both steps are triggered automatically
by the @code{dynare} command. by the @code{dynare} command.
@deffn {MATLAB/Octave command} dynare @var{FILENAME}[.mod] [@var{OPTIONS}@dots{}] @deffn {MATLAB/Octave command} dynare @var{FILENAME}[.mod] [@var{OPTIONS}@dots{}]
...@@ -704,7 +701,7 @@ Contains variable declarations, and computing tasks ...@@ -704,7 +701,7 @@ Contains variable declarations, and computing tasks
@item @var{FILENAME}_dynamic.m @item @var{FILENAME}_dynamic.m
@vindex M_.lead_lag_incidence @vindex M_.lead_lag_incidence
Contains the dynamic model equations. Note that Dynare might introduce auxiliary equations and variables (@pxref{Auxiliary variables}). Outputs are the residuals of the dynamic model equations in the order the equations were declared and the Jacobian of the dynamic model equations. For higher order approximations also the Hessian and the third-order derivates are provided. When computing the Jacobian of the dynamic model, the order of the endogenous variables in the columns is stored in @code{M_.lead_lag_incidence}. The rows of this matrix represent time periods: the first row denotes a lagged (time t-1) variable, the second row a contemporaneous (time t) variable, and the third row a leaded (time t+1) variable. The colums of the matrix represent the endogenous variables in their order of declaration. A zero in the matrix means that this endogenous does not appear in the model in this time period. The value in the @code{M_.lead_lag_incidence} matrix corresponds to the column of that variable in the Jacobian of the dynamic model. Example: Let the second declared variable be @code{c} and the @code{(3,2)} entry of @code{M_.lead_lag_incidence} be @code{15}. Then the @code{15}th column of the Jacobian is the derivative with respect to @code{y(+1)}. Contains the dynamic model equations. Note that Dynare might introduce auxiliary equations and variables (@pxref{Auxiliary variables}). Outputs are the residuals of the dynamic model equations in the order the equations were declared and the Jacobian of the dynamic model equations. For higher order approximations also the Hessian and the third-order derivatives are provided. When computing the Jacobian of the dynamic model, the order of the endogenous variables in the columns is stored in @code{M_.lead_lag_incidence}. The rows of this matrix represent time periods: the first row denotes a lagged (time t-1) variable, the second row a contemporaneous (time t) variable, and the third row a leaded (time t+1) variable. The columns of the matrix represent the endogenous variables in their order of declaration. A zero in the matrix means that this endogenous does not appear in the model in this time period. The value in the @code{M_.lead_lag_incidence} matrix corresponds to the column of that variable in the Jacobian of the dynamic model. Example: Let the second declared variable be @code{c} and the @code{(3,2)} entry of @code{M_.lead_lag_incidence} be @code{15}. Then the @code{15}th column of the Jacobian is the derivative with respect to @code{y(+1)}.
@item @var{FILENAME}_static.m @item @var{FILENAME}_static.m
Contains the long run static model equations. Note that Dynare might introduce auxiliary equations and variables (@pxref{Auxiliary variables}). Outputs are the residuals of the static model equations in the order the equations were declared and the Jacobian of the static equations. Entry @code{(i,j)} of the Jacobian represents the derivative of the @code{i}th static model equation with respect to the @code{j}th model variable in declaration order. Contains the long run static model equations. Note that Dynare might introduce auxiliary equations and variables (@pxref{Auxiliary variables}). Outputs are the residuals of the static model equations in the order the equations were declared and the Jacobian of the static equations. Entry @code{(i,j)} of the Jacobian represents the derivative of the @code{i}th static model equation with respect to the @code{j}th model variable in declaration order.
...@@ -715,6 +712,15 @@ These files may be looked at to understand errors reported at the simulation sta ...@@ -715,6 +712,15 @@ These files may be looked at to understand errors reported at the simulation sta
@code{dynare} will then run the computing tasks by executing @file{@var{FILENAME}.m}. @code{dynare} will then run the computing tasks by executing @file{@var{FILENAME}.m}.
A few words of warning is warranted here: the filename of the
@file{.mod} file should be chosen in such a way that the generated
@file{.m} files described above do not conflict with @file{.m} files
provided by MATLAB/Octave or by Dynare. Not respecting this rule could
cause crashes or unexpected behaviour. In particular, it means that
the @file{.mod} file cannot be given the name of a MATLAB/Octave or
Dynare command. Under Octave, it also means that the @file{.mod} file
cannot be named @file{test.mod}.
@optionshead @optionshead
@table @code @table @code
...@@ -747,7 +753,7 @@ the macro-processor independently of the rest of Dynare toolbox. ...@@ -747,7 +753,7 @@ the macro-processor independently of the rest of Dynare toolbox.
@item nolinemacro @item nolinemacro
Instructs the macro-preprocessor to omit line numbering information in Instructs the macro-preprocessor to omit line numbering information in
the intermediary @file{.mod} file created after the maco-processing the intermediary @file{.mod} file created after the macro-processing
step. Useful in conjunction with @code{savemacro} when one wants that to step. Useful in conjunction with @code{savemacro} when one wants that to
reuse the intermediary @file{.mod} file, without having it cluttered by reuse the intermediary @file{.mod} file, without having it cluttered by
line numbering directives. line numbering directives.
...@@ -849,7 +855,7 @@ The output of Dynare is left into three main variables in the ...@@ -849,7 +855,7 @@ The output of Dynare is left into three main variables in the
MATLAB/Octave workspace: MATLAB/Octave workspace:
@defvr {MATLAB/Octave variable} M_ @defvr {MATLAB/Octave variable} M_
Structure containing various informations about the model. Structure containing various information about the model.
@end defvr @end defvr
@defvr {MATLAB/Octave variable} options_ @defvr {MATLAB/Octave variable} options_
...@@ -865,11 +871,11 @@ Structure containing the various results of the computations. ...@@ -865,11 +871,11 @@ Structure containing the various results of the computations.
@node Dynare hooks @node Dynare hooks
@section Dynare hooks @section Dynare hooks
It is possible to call pre and post dynare preprocessor hooks written as matlab scripts. It is possible to call pre and post Dynare preprocessor hooks written as MATLAB scripts.
The script @file{@var{MODFILENAME}/hooks/priorprocessing.m} is executed before the The script @file{@var{MODFILENAME}/hooks/priorprocessing.m} is executed before the
call to Dynare's preprocessor, and can be used to programatically transform the mod file call to Dynare's preprocessor, and can be used to programmatically transform the mod file
that will be read by the preprocessor. The script @file{@var{MODFILENAME}/hooks/postprocessing.m} that will be read by the preprocessor. The script @file{@var{MODFILENAME}/hooks/postprocessing.m}
is executed just after the call to Dynare's preprocessor, and can be used to programatically is executed just after the call to Dynare's preprocessor, and can be used to programmatically
transform the files generated by Dynare's preprocessor before actual computations start. The transform the files generated by Dynare's preprocessor before actual computations start. The
pre and/or post dynare preprocessor hooks are executed if and only if the aforementioned scripts pre and/or post dynare preprocessor hooks are executed if and only if the aforementioned scripts
are detected in the same folder as the the model file, @file{@var{FILENAME}.mod}. are detected in the same folder as the the model file, @file{@var{FILENAME}.mod}.
...@@ -1020,9 +1026,9 @@ extension or if the filename contains a non-alphanumeric character; ...@@ -1020,9 +1026,9 @@ extension or if the filename contains a non-alphanumeric character;
Declarations of variables and parameters are made with the following commands: Declarations of variables and parameters are made with the following commands:
@deffn Command var @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command var @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@deffnx Command var (deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffnx Command var (deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@deffnx Command var (log_deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffnx Command var (log_deflator = @var{MODEL_EXPRESSION}) @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1075,7 +1081,7 @@ var c $C$ (long_name=`Consumption'); ...@@ -1075,7 +1081,7 @@ var c $C$ (long_name=`Consumption');
@end deffn @end deffn
@deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1103,7 +1109,7 @@ varexo m gov; ...@@ -1103,7 +1109,7 @@ varexo m gov;
@end deffn @end deffn
@deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1140,7 +1146,7 @@ varexo_det tau; ...@@ -1140,7 +1146,7 @@ varexo_det tau;
@end deffn @end deffn
@deffn Command parameters @var{PARAMETER_NAME} [$@var{LATEX_NAME}$ [(long_name=@var{QUOTED_STRING})]]@dots{}; @deffn Command parameters @var{PARAMETER_NAME} [$@var{LATEX_NAME}$] [(long_name=@var{QUOTED_STRING})]@dots{};
@descriptionhead @descriptionhead
...@@ -1961,7 +1967,7 @@ variables will have a name beginning with @code{AUX_EXO_LEAD} or ...@@ -1961,7 +1967,7 @@ variables will have a name beginning with @code{AUX_EXO_LEAD} or
@code{AUX_EXO_LAG} respectively). @code{AUX_EXO_LAG} respectively).
Another transformation is done for the @code{EXPECTATION} Another transformation is done for the @code{EXPECTATION}
operator. For each occurence of this operator, Dynare creates an operator. For each occurrence of this operator, Dynare creates an
auxiliary variable defined by a new equation, and replaces the auxiliary variable defined by a new equation, and replaces the
expectation operator by a reference to the new auxiliary variable. For expectation operator by a reference to the new auxiliary variable. For
example, the expression @code{EXPECTATION(-1)(x(+1))} is replaced by example, the expression @code{EXPECTATION(-1)(x(+1))} is replaced by
...@@ -2003,20 +2009,20 @@ possibly terminal) conditions. It is also necessary to provide initial ...@@ -2003,20 +2009,20 @@ possibly terminal) conditions. It is also necessary to provide initial
guess values for non-linear solvers. This section describes the guess values for non-linear solvers. This section describes the
statements used for those purposes. statements used for those purposes.
In many contexts (determistic or stochastic), it is necessary to In many contexts (deterministic or stochastic), it is necessary to
compute the steady state of a non-linear model: @code{initval} then compute the steady state of a non-linear model: @code{initval} then
specifies numerical initial values for the non-linear solver. The specifies numerical initial values for the non-linear solver. The
command @code{resid} can be used to compute the equation residuals for command @code{resid} can be used to compute the equation residuals for
the given initial values. the given initial values.
Used in perfect foresight mode, the types of forward-loking models for Used in perfect foresight mode, the types of forward-looking models for
which Dynare was designed require both initial and terminal which Dynare was designed require both initial and terminal
conditions. Most often these initial and terminal conditions are conditions. Most often these initial and terminal conditions are
static equilibria, but not necessarily. static equilibria, but not necessarily.
One typical application is to consider an economy at the equilibrium, One typical application is to consider an economy at the equilibrium,
trigger a shock in first period, and study the trajectory of return at trigger a shock in first period, and study the trajectory of return at
the initial equilbrium. To do that, one needs @code{initval} and the initial equilibrium. To do that, one needs @code{initval} and
@code{shocks} (@pxref{Shocks on exogenous variables}. @code{shocks} (@pxref{Shocks on exogenous variables}.
Another one is to study, how an economy, starting from arbitrary Another one is to study, how an economy, starting from arbitrary
...@@ -2059,7 +2065,7 @@ implemented in @code{simul}. ...@@ -2059,7 +2065,7 @@ implemented in @code{simul}.
For this last reason, it necessary to provide values for all the For this last reason, it necessary to provide values for all the
endogenous variables in an @code{initval} block (even though, endogenous variables in an @code{initval} block (even though,
theoretically, initial conditions are only necessary for lagged theoretically, initial conditions are only necessary for lagged
variables). If some variables, endogenous or exogenous, are not mentionned in the variables). If some variables, endogenous or exogenous, are not mentioned in the
@code{initval} block, a zero value is assumed. @code{initval} block, a zero value is assumed.
Note that if the @code{initval} block is immediately followed by a Note that if the @code{initval} block is immediately followed by a
...@@ -2134,7 +2140,7 @@ form: ...@@ -2134,7 +2140,7 @@ form:
@var{VARIABLE_NAME} = @var{EXPRESSION}; @var{VARIABLE_NAME} = @var{EXPRESSION};
@end example @end example
The @code{endval} block makes only sense in a determistic model, and The @code{endval} block makes only sense in a deterministic model, and
serves two purposes. serves two purposes.
First, it sets the terminal conditions for all the periods succeeding First, it sets the terminal conditions for all the periods succeeding
...@@ -2145,8 +2151,8 @@ for the non-linear solver implemented in @code{simul}. ...@@ -2145,8 +2151,8 @@ for the non-linear solver implemented in @code{simul}.
For this last reason, it necessary to provide values for all the For this last reason, it necessary to provide values for all the
endogenous variables in an @code{endval} block (even though, endogenous variables in an @code{endval} block (even though,
theoretically, initial conditions are only necessary for forward theoretically, terminal conditions are only necessary for forward
variables). If some variables, endogenous or exogenous, are not mentionned in the variables). If some variables, endogenous or exogenous, are not mentioned in the
@code{endval} block, the value assumed is that of the last @code{endval} block, the value assumed is that of the last
@code{initval} block or @code{steady} command. @code{initval} block or @code{steady} command.
...@@ -2195,12 +2201,90 @@ steady; ...@@ -2195,12 +2201,90 @@ steady;
The initial equilibrium is computed by @code{steady} for @code{x=1}, The initial equilibrium is computed by @code{steady} for @code{x=1},
and the terminal one, for @code{x=2}. and the terminal one, for @code{x=2}.
@examplehead
@example
var c k;
varexo x;
@dots{}
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
c = 1.2;
k = 12;
x = 1;
end;
endval;
c = 2;
k = 20;
x = 1.1;
end;
simul(periods=200);
@end example
In this example, the problem is finding the optimal path for consumption
and capital for the periods t=1 to T=200, given the path of the exogenous
technology level @code{x}. Setting @code{x=1.1} in the
@code{endval}-block without a @code{shocks}-block implies that technology
jumps to this new level in t=1 and stays there forever. Because the law
of motion for capital is backward-looking, we also need an initial
condition for @code{k} at time 0, specified in the @code{initval}-block.
Similarly, because the Euler equation is forward-looking, we need a
terminal condition for @code{c} at t=201, which is specified in the
@code{endval}-block. Specifying @code{c} in the @code{initval}-block and
@code{k} in the @code{endval}-block has no impact on the results: due to
the optimization problem in the first period being to choose @code{c,k}
at t=1 given predetermined capital stock @code{k} inherited from t=0 as
well as the current and future values for technology, the value for
@code{c} at time t=0 plays no role. The same applies to the choice of
@code{c,k} at time t=200, which does not depend on @code{k} at t=201. As
the Euler equation shows, that choice only depends on current capital as
well as future consumption @code{c} and technology @code{x}, but not on
future capital @code{k}. The intuitive reason is that those variables are
the consequence of optimization problems taking place in at periods t=0
and t=201, respectively, which are not considered. Thus, when specifying
those values in the @code{initval} and @code{endval}-blocks, Dynare takes
them as given and basically assumes that there were realizations
of exogenous variables and states (basically initial/terminal conditions
at the unspecified time periods t<0 and t>201) that make those choices
equilibrium values.
This also suggest another way of looking at the use of @code{steady}
after @code{initval} and @code{endval}. Instead of saying that the
implicit unspecified conditions before and after the simulation range
have to fit the initial/terminal conditions of the endogenous variables
in those blocks, @code{steady} specifies that those conditions at t<0 and
t>201 are equal to being at the steady state given the exogenous
variables in the @code{initval} and @code{endval}-blocks and sets the
endogenous variables at t=0 and t=201 to the corresponding steady state
equilibrium values.
The fact that @code{c} at t=0 and @code{k} at t=201 specified in
@code{initval} and @code{endval} are taken as given has an important
implication for plotting the simulated vector for the endogenous
variables: this vector will also contain the initial and terminal
conditions and thus is 202 periods long in the example. When you specify
arbitrary values for the initial and terminal conditions for forward- and
backward-looking variables, respectively, these values can be very far
away from the endogenously determined values at t=1 and t=200. While the
values at t=0 and t=201 are unrelated to the dynamics for 0<t<201, they
may result in strange-looking large jumps. In the example above,
consumption will display a large jump from t=0 to t=1 and capital will
jump from t=200 to t=201.
@end deffn @end deffn
@deffn Block histval ; @deffn Block histval ;
@descriptionhead @descriptionhead
@customhead{In a deterministic perfect foresight context}
In models with lags on more than one period, the @code{histval} block In models with lags on more than one period, the @code{histval} block
permits to specify different historical initial values for different permits to specify different historical initial values for different
periods. periods.
...@@ -2228,6 +2312,14 @@ variables are initialized at their steady state value at period 0 and ...@@ -2228,6 +2312,14 @@ variables are initialized at their steady state value at period 0 and
before (except when a @code{steady} command doesn't follow an before (except when a @code{steady} command doesn't follow an
@code{initval} block). @code{initval} block).
@customhead{In a stochastic simulation context}
In the context of stochastic simulations, @code{histval} allows setting
the starting point of those simulations in the state space (it does not
affect the starting point for impulse response functions). As for the case of
perfect foresight simulations, all not explicitly specified variables are set to 0.
Moreover, as only states enter the recursive policy functions, all values specified for control variables will be ignored.
@examplehead @examplehead
@example @example
...@@ -2336,7 +2428,7 @@ in each period. In Dynare, these random values follow a normal ...@@ -2336,7 +2428,7 @@ in each period. In Dynare, these random values follow a normal
distribution with zero mean, but it belongs to the user to specify the distribution with zero mean, but it belongs to the user to specify the
variability of these shocks. The non-zero elements of the matrix of variability of these shocks. The non-zero elements of the matrix of
variance-covariance of the shocks can be entered with the @code{shocks} variance-covariance of the shocks can be entered with the @code{shocks}
command. Or, the entire matrix can be direclty entered with command. Or, the entire matrix can be directly entered with
@code{Sigma_e} (this use is however deprecated). @code{Sigma_e} (this use is however deprecated).
If the variance of an exogenous variable is set to zero, this variable If the variance of an exogenous variable is set to zero, this variable
...@@ -2406,10 +2498,6 @@ values (xx); ...@@ -2406,10 +2498,6 @@ values (xx);
end; end;
@end example @end example
In case of conditional forecasts using an extended path method,
the shock command is extended in order to determine the nature of the expectation
on the endogenous variable paths. The command @code{expectation} has, in this case,
to be added after the @code{values} command (@pxref{Forecasting}).
@customhead{In stochastic context} @customhead{In stochastic context}
...@@ -2451,7 +2539,7 @@ var v, w = 2; ...@@ -2451,7 +2539,7 @@ var v, w = 2;
end; end;
@end example @end example
@customhead{Mixing determininistic and stochastic shocks} @customhead{Mixing deterministic and stochastic shocks}
It is possible to mix deterministic and stochastic shocks to build It is possible to mix deterministic and stochastic shocks to build
models where agents know from the start of the simulation about future models where agents know from the start of the simulation about future
...@@ -2520,7 +2608,7 @@ discouraged.} You should use a @code{shocks} block instead. ...@@ -2520,7 +2608,7 @@ discouraged.} You should use a @code{shocks} block instead.
This special variable specifies directly the covariance matrix of the This special variable specifies directly the covariance matrix of the
stochastic shocks, as an upper (or lower) triangular matrix. Dynare stochastic shocks, as an upper (or lower) triangular matrix. Dynare
builds the corresponding symmetrix matrix. Each row of the triangular builds the corresponding symmetric matrix. Each row of the triangular
matrix, except the last one, must be terminated by a semi-colon matrix, except the last one, must be terminated by a semi-colon
@code{;}. For a given element, an arbitrary @var{EXPRESSION} is @code{;}. For a given element, an arbitrary @var{EXPRESSION} is
allowed (instead of a simple constant), but in that case you need to allowed (instead of a simple constant), but in that case you need to
...@@ -2682,7 +2770,7 @@ values: ...@@ -2682,7 +2770,7 @@ values:
@item 1 @item 1
In this mode, all the parameters are changed simultaneously, and the In this mode, all the parameters are changed simultaneously, and the
distance between the boudaries for each parameter is divided in as distance between the boundaries for each parameter is divided in as
many intervals as there are steps (as defined by @code{homotopy_steps} many intervals as there are steps (as defined by @code{homotopy_steps}
option); the problem is solves as many times as there are steps. option); the problem is solves as many times as there are steps.
...@@ -2724,7 +2812,7 @@ variables are NOT at the value expected by the user ...@@ -2724,7 +2812,7 @@ variables are NOT at the value expected by the user
Default is @code{0}. Default is @code{0}.
@item nocheck @item nocheck
Don't check the steady state values when they are provided explicitely either by a steady state file or a @code{steady_state_model} block. This is useful for models with unit roots as, in this case, the steady state is not unique or doesn't exist. Don't check the steady state values when they are provided explicitly either by a steady state file or a @code{steady_state_model} block. This is useful for models with unit roots as, in this case, the steady state is not unique or doesn't exist.
@item markowitz = @var{DOUBLE} @item markowitz = @var{DOUBLE}
Value of the Markowitz criterion, used to select the pivot. Only used Value of the Markowitz criterion, used to select the pivot. Only used
...@@ -2837,25 +2925,42 @@ steady(homotopy_mode = 1, homotopy_steps = 50); ...@@ -2837,25 +2925,42 @@ steady(homotopy_mode = 1, homotopy_steps = 50);
If you know how to compute the steady state for your model, you can If you know how to compute the steady state for your model, you can
provide a MATLAB/Octave function doing the computation instead of provide a MATLAB/Octave function doing the computation instead of
using @code{steady}. If your MOD-file is called using @code{steady}. Again, there are two options for doing that:
@file{@var{FILENAME}.mod}, the steady state file should be called
@file{@var{FILENAME}_steadystate.m}.
Again, there are two options for creating this file:
@itemize @itemize
@item @item
The easiest way is to write a @code{steady_state_model} block. The easiest way is to write a @code{steady_state_model} block, which
is described below in more details. See also @file{fs2000.mod} in the
@file{examples} directory for an example.
The steady state file generated by Dynare will be called
@file{@var{FILENAME}_steadystate2.m}.
@item @item
You can write the corresponding Matlab function by hand. See @file{fs2000_steadystate.m} You can write the corresponding MATLAB function by hand. If your
in the @file{examples} directory for an example. This option MOD-file is called @file{@var{FILENAME}.mod}, the steady state file
gives a bit more flexibility, at the expense of a heavier must be called @file{@var{FILENAME}_steadystate.m}. See
programming burden and a lesser efficiency. @file{NK_baseline_steadystate.m} in the @file{examples} directory for
an example. This option gives a bit more flexibility, at the expense
of a heavier programming burden and a lesser efficiency.
@end itemize @end itemize
Note that both files allow to update parameters in each call of
the function. This allows for example to calibrate a model to a labor
supply of 0.2 in steady state by setting the labor disutility parameter
to a corresponding value (see @file{NK_baseline_steadystate.m} in the
@file{examples} directory). They can also be used in estimation
where some parameter may be a function of an estimated parameter
and needs to be updated for every parameter draw. For example, one might
want to set the capital utilization cost parameter as a function
of the discount rate to ensure that capacity utilization is 1 in steady
state. Treating both parameters as independent or not updating one as
a function of the other would lead to wrong results. But this also means
that care is required. Do not accidentally overwrite your parameters
with new values as it will lead to wrong results.
@anchor{steady_state_model} @anchor{steady_state_model}
@deffn Block steady_state_model ; @deffn Block steady_state_model ;
...@@ -3017,6 +3122,7 @@ must have full rank. ...@@ -3017,6 +3122,7 @@ must have full rank.
@xref{solve_algo}, for the possible values and their meaning. @xref{solve_algo}, for the possible values and their meaning.
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
@anchor{qz_zero_threshold}
Value used to test if a generalized eigenvalue is 0/0 in the generalized Value used to test if a generalized eigenvalue is 0/0 in the generalized
Schur decomposition (in which case the model does not admit a unique Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}. solution). Default: @code{1e-6}.
...@@ -3155,13 +3261,29 @@ models, this return to equilibrium is only an asymptotic phenomenon, ...@@ -3155,13 +3261,29 @@ models, this return to equilibrium is only an asymptotic phenomenon,
which one must approximate by an horizon of simulation far enough in which one must approximate by an horizon of simulation far enough in
the future. Another exercise for which Dynare is well suited is to the future. Another exercise for which Dynare is well suited is to
study the transition path to a new equilibrium following a permanent study the transition path to a new equilibrium following a permanent
shock. For deterministic simulations, Dynare uses a Newton-type shock. For deterministic simulations, the numerical problem consists of solving
algorithm, first proposed by @cite{Laffargue (1990)} and a nonlinar system of simultaneous equations in @code{n} endogenous
@cite{Boucekkine (1995)}, instead of a first order technique like the variables in @code{T} periods. Dynare offers several algorithms for
one proposed by @cite{Fair and Taylor (1983)}, and used in earlier solving this problem, which can be chosen via the
generation simulation programs. We believe this approach to be in @code{stack_solve_algo}-option. By default (@code{stack_solve_algo=0}),
general both faster and more robust. The details of the algorithm can Dynare uses a Newton-type method to solve the simultaneous equation
be found in @cite{Juillard (1996)}. system. Because the resulting Jacobian is in the order of @code{n} by
@code{T} and hence will be very large for long simulations with many
variables, Dynare makes use of the sparse matrix capacities of
MATLAB/Octave. A slower but potentially less memory consuming alternative
(@code{stack_solve_algo=6}) is based on a Newton-type algorithm first
proposed by @cite{Laffargue (1990)} and @cite{Boucekkine (1995)}, which
uses relaxation techniques. Thereby, the algorithm avoids ever storing
the full Jacobian. The details of the algorithm can be found in
@cite{Juillard (1996)}. The third type of algorithms makes use of block
decomposition techniques (divide-and-conquer methods) that exploit the
structure of the model. The principle is to identify recursive and
simultaneous blocks in the model structure and use this information to
aid the solution process. These solution algorithms can provide a
significant speed-up on large models.
@deffn Command simul ; @deffn Command simul ;
@deffnx Command simul (@var{OPTIONS}@dots{}); @deffnx Command simul (@var{OPTIONS}@dots{});
...@@ -3239,7 +3361,7 @@ periods. Only used when @code{stack_solve_algo = 5}. Default: @code{1}. ...@@ -3239,7 +3361,7 @@ periods. Only used when @code{stack_solve_algo = 5}. Default: @code{1}.
@item datafile = @var{FILENAME} @item datafile = @var{FILENAME}
If the variables of the model are not constant over time, their If the variables of the model are not constant over time, their
initial values, stored in a text file, could be loaded, using that initial values, stored in a text file, could be loaded, using that
option, as initial values before a deteministic simulation. option, as initial values before a deterministic simulation.
@end table @end table
@outputhead @outputhead
...@@ -3376,7 +3498,7 @@ increase it for highly autocorrelated processes. Default: @code{512}. ...@@ -3376,7 +3498,7 @@ increase it for highly autocorrelated processes. Default: @code{512}.
@item irf = @var{INTEGER} @item irf = @var{INTEGER}
@anchor{irf} @anchor{irf}
Number of periods on which to compute the IRFs. Setting @code{irf=0}, Number of periods on which to compute the IRFs. Setting @code{irf=0},
suppresses the plotting of IRF's. Default: @code{40}. suppresses the plotting of IRFs. Default: @code{40}.
@item irf_shocks = ( @var{VARIABLE_NAME} [[,] @var{VARIABLE_NAME} @dots{}] ) @item irf_shocks = ( @var{VARIABLE_NAME} [[,] @var{VARIABLE_NAME} @dots{}] )
@anchor{irf_shocks} @anchor{irf_shocks}
...@@ -3462,9 +3584,7 @@ problems. Default: @code{1.000001} (except when estimating with ...@@ -3462,9 +3584,7 @@ problems. Default: @code{1.000001} (except when estimating with
@code{0.999999} in that case; @pxref{Estimation}). @code{0.999999} in that case; @pxref{Estimation}).
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
Value used to test if a generalized eigenvalue is 0/0 in the generalized @xref{qz_zero_threshold}.
Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}.
@item replic = @var{INTEGER} @item replic = @var{INTEGER}
Number of simulated series used to compute the IRFs. Default: @code{1} Number of simulated series used to compute the IRFs. Default: @code{1}
...@@ -3503,7 +3623,7 @@ period(s). The periods must be strictly positive. Conditional variances are give ...@@ -3503,7 +3623,7 @@ period(s). The periods must be strictly positive. Conditional variances are give
decomposition provides the decomposition of the effects of shocks upon decomposition provides the decomposition of the effects of shocks upon
impact. The results are stored in impact. The results are stored in
@code{oo_.conditional_variance_decomposition} @code{oo_.conditional_variance_decomposition}
(@pxref{oo_.conditional_variance_decomposition}). The variance decomposition is only conducted, if theoretical moments are requested, i.e. using the @code{periods=0}-option. In case of @code{order=2}, Dynare provides a second-order accurate approximation to the true second moments based on the linear terms of the second-order solution (see @cite{Kim, Kim, Schaumburg and Sims (2008)}). (@pxref{oo_.conditional_variance_decomposition}). The variance decomposition is only conducted, if theoretical moments are requested, i.e. using the @code{periods=0}-option. In case of @code{order=2}, Dynare provides a second-order accurate approximation to the true second moments based on the linear terms of the second-order solution (see @cite{Kim, Kim, Schaumburg and Sims (2008)}). Note that the unconditional variance decomposition (i.e. at horizon infinity) is automatically conducted if theoretical moments are requested (@pxref{oo_.variance_decomposition})
@item pruning @item pruning
Discard higher order terms when iteratively computing simulations of Discard higher order terms when iteratively computing simulations of
...@@ -3529,7 +3649,7 @@ Determines the algorithm used to solve the Sylvester equation for block decompos ...@@ -3529,7 +3649,7 @@ Determines the algorithm used to solve the Sylvester equation for block decompos
@item default @item default
Uses the default solver for Sylvester equations (@code{gensylv}) based Uses the default solver for Sylvester equations (@code{gensylv}) based
on Ondra Kamenik algorithm (see on Ondra Kamenik's algorithm (see
@uref{http://www.dynare.org/documentation-and-support/dynarepp/sylvester.pdf/at_download/file,the @uref{http://www.dynare.org/documentation-and-support/dynarepp/sylvester.pdf/at_download/file,the
Dynare Website} for more information). Dynare Website} for more information).
...@@ -3543,7 +3663,7 @@ Default value is @code{default} ...@@ -3543,7 +3663,7 @@ Default value is @code{default}
@item sylvester_fixed_point_tol = @var{DOUBLE} @item sylvester_fixed_point_tol = @var{DOUBLE}
@anchor{sylvester_fixed_point_tol} @anchor{sylvester_fixed_point_tol}
It is the convergence criterion used in the fixed point sylvester solver. Its default value is 1e-12. It is the convergence criterion used in the fixed point Sylvester solver. Its default value is 1e-12.
@item dr = @var{OPTION} @item dr = @var{OPTION}
@anchor{dr} @anchor{dr}
...@@ -3581,7 +3701,11 @@ The convergence criterion used in the logarithmic reduction algorithm. Its defau ...@@ -3581,7 +3701,11 @@ The convergence criterion used in the logarithmic reduction algorithm. Its defau
The maximum number of iterations used in the logarithmic reduction algorithm. Its default value is 100. The maximum number of iterations used in the logarithmic reduction algorithm. Its default value is 100.
@item loglinear @item loglinear
@xref{loglinear}. @xref{loglinear}. Note that ALL variables are log-transformed by using the Jacobian transformation,
not only selected ones. Thus, you have to make sure that your variables have strictly positive
steady states. @code{stoch_simul} will display the moments, decision rules,
and impulse responses for the log-linearized variables. The decision rules saved
in @code{oo_.dr} and the simulated variables will also be the ones for the log-linear variables.
@end table @end table
...@@ -3648,7 +3772,7 @@ number of the matrix in the cell array corresponds to the order of ...@@ -3648,7 +3772,7 @@ number of the matrix in the cell array corresponds to the order of
autocorrelation. The option @code{ar} specifies the number of autocorrelation. The option @code{ar} specifies the number of
autocorrelation matrices available. Contains theoretical autocorrelation matrices available. Contains theoretical
autocorrelations if the @code{periods} option is not present (or an approximation thereof for @code{order=2}), and autocorrelations if the @code{periods} option is not present (or an approximation thereof for @code{order=2}), and
empirical autocorrelations otherwise. empirical autocorrelations otherwise. The field is only created if stationary variables are present.
The element @code{oo_.autocorr@{i@}(k,l)} is equal to the correlation The element @code{oo_.autocorr@{i@}(k,l)} is equal to the correlation
between @math{y^k_t} and @math{y^l_{t-i}}, where @math{y^k} between @math{y^k_t} and @math{y^l_{t-i}}, where @math{y^k}
...@@ -3675,7 +3799,7 @@ details. Beware, this is the @i{autocorrelation} function, not the ...@@ -3675,7 +3799,7 @@ details. Beware, this is the @i{autocorrelation} function, not the
@i{autocovariance} function. @i{autocovariance} function.
@item oo_.gamma@{nar+2@} @item oo_.gamma@{nar+2@}
Variance decomposition. Unconditional variance decomposition @pxref{oo_.variance_decomposition}
@item oo_.gamma@{nar+3@} @item oo_.gamma@{nar+3@}
If a second order approximation has been requested, contains the If a second order approximation has been requested, contains the
...@@ -3686,6 +3810,22 @@ In case of @code{order=2}, the theoretical second moments are a second order acc ...@@ -3686,6 +3810,22 @@ In case of @code{order=2}, the theoretical second moments are a second order acc
@end defvr @end defvr
@anchor{oo_.variance_decomposition}
@defvr {MATLAB/Octave variable} oo_.variance_decomposition
After a run of @code{stoch_simul} when requesting theoretical moments (@code{periods=0}), contains a matrix with the result of the unconditional variance decomposition (i.e. at horizon infinity). The first dimension corresponds to the endogenous variables (in the order of declaration) and the second dimension corresponds to exogenous variables (in the order of declaration). Numbers are in percent and sum up to 100 across columns.
@end defvr
@anchor{oo_.conditional_variance_decomposition}
@defvr {MATLAB/Octave variable} oo_.conditional_variance_decomposition
After a run of @code{stoch_simul} with the
@code{conditional_variance_decomposition} option, contains a
three-dimensional array with the result of the decomposition. The
first dimension corresponds to forecast horizons (as declared with the
option), the second dimension corresponds to endogenous variables (in
the order of declaration), the third dimension corresponds to
exogenous variables (in the order of declaration).
@end defvr
@defvr {MATLAB/Octave variable} oo_.irfs @defvr {MATLAB/Octave variable} oo_.irfs
After a run of @code{stoch_simul} with option @code{irf} different After a run of @code{stoch_simul} with option @code{irf} different
from zero, contains the impulse responses, with the following naming from zero, contains the impulse responses, with the following naming
...@@ -3695,11 +3835,10 @@ For example, @code{oo_.irfs.gnp_ea} contains the effect on @code{gnp} ...@@ -3695,11 +3835,10 @@ For example, @code{oo_.irfs.gnp_ea} contains the effect on @code{gnp}
of a one standard deviation shock on @code{ea}. of a one standard deviation shock on @code{ea}.
@end defvr @end defvr
@vindex oo_.dr
The approximated solution of a model takes the form of a set of decision The approximated solution of a model takes the form of a set of decision
rules or transition equations expressing the current value of the endogenous rules or transition equations expressing the current value of the endogenous
variables of the model as function of the previous state of the model and variables of the model as function of the previous state of the model and
shocks oberved at the beginning of the period. The decision rules are stored shocks observed at the beginning of the period. The decision rules are stored
in the structure @code{oo_.dr} which is described below. in the structure @code{oo_.dr} which is described below.
@deffn Command extended_path ; @deffn Command extended_path ;
...@@ -3980,16 +4119,6 @@ three times in the unfolded @math{G_3} matrix, they must be multiplied ...@@ -3980,16 +4119,6 @@ three times in the unfolded @math{G_3} matrix, they must be multiplied
by 3 when computing the decision rules. by 3 when computing the decision rules.
@end itemize @end itemize
@anchor{oo_.conditional_variance_decomposition}
@defvr {MATLAB/Octave variable} oo_.conditional_variance_decomposition
After a run of @code{stoch_simul} with the
@code{conditional_variance_decomposition} option, contains a
three-dimensional array with the result of the decomposition. The
first dimension corresponds to forecast horizons (as declared with the
option), the second dimension corresponds to endogenous variables (in
the order of declaration), the third dimension corresponds to
exogenous variables (in the order of declaration).
@end defvr
@node Estimation @node Estimation
@section Estimation @section Estimation
...@@ -4185,7 +4314,7 @@ apply. ...@@ -4185,7 +4314,7 @@ apply.
The following line: The following line:
@example @example
corr eps_1, eps_2, 0.5, , , beta_pdf, 0, 0.3, -1, 1; corr eps_1, eps_2, 0.5, , , beta_pdf, 0, 0.3, -1, 1;
@end example @end example
sets a generalized beta prior for the correlation between @code{eps_1} and sets a generalized beta prior for the correlation between @code{eps_1} and
@code{eps_2} with mean 0 and variance 0.3. By setting @code{eps_2} with mean 0 and variance 0.3. By setting
...@@ -4197,7 +4326,7 @@ respectively. The initial value is set to 0.5. ...@@ -4197,7 +4326,7 @@ respectively. The initial value is set to 0.5.
Similarly, the following line: Similarly, the following line:
@example @example
corr eps_1, eps_2, 0.5, -0.5, 1, beta_pdf, 0, 0.3, -1, 1; corr eps_1, eps_2, 0.5, -0.5, 1, beta_pdf, 0, 0.3, -1, 1;
@end example @end example
sets the same generalized beta distribution as before, but now truncates sets the same generalized beta distribution as before, but now truncates
this distribution to [-0.5,1] through the use of @var{LOWER_BOUND} and this distribution to [-0.5,1] through the use of @var{LOWER_BOUND} and
...@@ -4250,7 +4379,7 @@ stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME ...@@ -4250,7 +4379,7 @@ stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME
@table @code @table @code
@item use_calibration @item use_calibration
For not specifically intialized parameters, use the deep parameters and the elements of the covariance matrix specified in the @code{shocks}-block from calibration as starting values for estimation. For components of the @code{shocks}-block that were not explicitly specified during calibration or which violate the prior, the prior mean is used. For not specifically initialized parameters, use the deep parameters and the elements of the covariance matrix specified in the @code{shocks} block from calibration as starting values for estimation. For components of the @code{shocks} block that were not explicitly specified during calibration or which violate the prior, the prior mean is used.
@end table @end table
@xref{estimated_params}, for the meaning and syntax of the various components. @xref{estimated_params}, for the meaning and syntax of the various components.
...@@ -4313,23 +4442,45 @@ acceptance ratio should be close to one third or one quarter. If this ...@@ -4313,23 +4442,45 @@ acceptance ratio should be close to one third or one quarter. If this
not the case, you can stop the MCMC (@code{Ctrl-C}) and change the value not the case, you can stop the MCMC (@code{Ctrl-C}) and change the value
of option @code{mh_jscale} (see below). of option @code{mh_jscale} (see below).
Note that by default Dynare generates random numbers using the algorithm
@code{mt199937ar} (@i{ie} Mersenne Twister method) with a seed set equal
to @code{0}. Consequently the MCMCs in Dynare are deterministic: one
will get exactly the same results across different Dynare runs
(@i{ceteris paribus}). For instance, the posterior moments or posterior
densities will be exactly the same. This behaviour allows to easily
identify the consequences of a change on the model, the priors or the
estimation options. But one may also want to check that across multiple
runs, with different sequences of proposals, the returned results are
almost identical. This should be true if the number of iterations
(@i{ie} the value of @code{mh_replic}) is important enough to ensure the
convergence of the MCMC to its ergodic distribution. In this case the
default behaviour of the random number generators in not wanted, and the
user should set the seed according to the system clock before the
estimation command using the following command:
@example
set_dynare_seed('clock');
@end example
@noindent so that the sequence of proposals will be different across different runs.
@algorithmshead @algorithmshead
The Monte Carlo Markov Chain (MCMC) diagnostics are generated The Monte Carlo Markov Chain (MCMC) diagnostics are generated by the
by the estimation command if @ref{mh_replic} is larger than 2000 and if estimation command if @ref{mh_replic} is larger than 2000 and if option
option @ref{nodiagnostic} is not used. If @ref{mh_nblocks} is equal to one, @ref{nodiagnostic} is not used. If @ref{mh_nblocks} is equal to one, the
the convergence diagnostics of @cite{Geweke (1992,1999)} is computed. It uses a convergence diagnostics of @cite{Geweke (1992,1999)} is computed. It
chi square test to compare the means of the first and last draws specified by uses a chi square test to compare the means of the first and last draws
@ref{geweke_interval} after discarding the burnin of @ref{mh_drop}. The test is specified by @ref{geweke_interval} after discarding the burnin of
computed using variance estimates under the assumption of no serial correlation @ref{mh_drop}. The test is computed using variance estimates under the
as well as using tapering windows specified in @ref{taper_steps}. assumption of no serial correlation as well as using tapering windows
If @ref{mh_nblocks} is larger than 1, the convergence diagnostics of specified in @ref{taper_steps}. If @ref{mh_nblocks} is larger than 1,
@cite{Brooks and Gelman (1998)} are used instead. the convergence diagnostics of @cite{Brooks and Gelman (1998)} are used
As described in section 3 of @cite{Brooks and Gelman (1998)} the univariate instead. As described in section 3 of @cite{Brooks and Gelman (1998)}
convergence diagnostics are based on comparing pooled and within MCMC moments the univariate convergence diagnostics are based on comparing pooled and
(Dynare displays the second and third order moments, and within MCMC moments (Dynare displays the second and third order moments,
the length of the Highest Probability Density interval covering 80% of and the length of the Highest Probability Density interval covering 80%
the posterior distribution). Due to computational reasons, the of the posterior distribution). Due to computational reasons, the
multivariate convergence diagnostic does not follow @cite{Brooks and multivariate convergence diagnostic does not follow @cite{Brooks and
Gelman (1998)} strictly, but rather applies their idea for univariate Gelman (1998)} strictly, but rather applies their idea for univariate
convergence diagnostics to the range of the posterior likelihood convergence diagnostics to the range of the posterior likelihood
...@@ -4359,7 +4510,7 @@ The name of the sheet with the data in an Excel file ...@@ -4359,7 +4510,7 @@ The name of the sheet with the data in an Excel file
@item xls_range = @var{RANGE} @item xls_range = @var{RANGE}
@anchor{xls_range} @anchor{xls_range}
The range with the data in an Excel file The range with the data in an Excel file. For example, @code{xls_range=B2:D200}
@item nobs = @var{INTEGER} @item nobs = @var{INTEGER}
@anchor{nobs} @anchor{nobs}
...@@ -4380,7 +4531,7 @@ The number of the first observation to be used. Default: @code{1} ...@@ -4380,7 +4531,7 @@ The number of the first observation to be used. Default: @code{1}
@item prefilter = @var{INTEGER} @item prefilter = @var{INTEGER}
@anchor{prefilter} @anchor{prefilter}
A value of @code{1} means that the estimation procedure will demean A value of @code{1} means that the estimation procedure will demean
the data. Default: @code{0}, @i{i.e.} no prefiltering each data series by its empirical mean. Default: @code{0}, @i{i.e.} no prefiltering
@item presample = @var{INTEGER} @item presample = @var{INTEGER}
@anchor{presample} @anchor{presample}
...@@ -4390,8 +4541,8 @@ likelihood. These first observations are used as a training sample. Default: @co ...@@ -4390,8 +4541,8 @@ likelihood. These first observations are used as a training sample. Default: @co
@item loglinear @item loglinear
@anchor{loglinear} @anchor{loglinear}
Computes a log-linear approximation of the model instead of a linear Computes a log-linear approximation of the model instead of a linear
approximation. The data must correspond to the definition of the approximation. As always in the context of estimation, the data must correspond to the definition of the
variables used in the model. Default: computes a linear approximation variables used in the model (see @cite{Pfeifer 2013} for more details on how to correctly specify observation equations linking model variables and the data). If you specify the loglinear option, Dynare will take the logarithm of both your model variables and of your data as it assumes the data to correspond to the original non-logged model variables. The displayed posterior results like impulse responses, smoothed variables, and moments will be for the logged variables, not the original un-logged ones. Default: computes a linear approximation
@item plot_priors = @var{INTEGER} @item plot_priors = @var{INTEGER}
Control the plotting of priors: Control the plotting of priors:
...@@ -4404,7 +4555,7 @@ No prior plot ...@@ -4404,7 +4555,7 @@ No prior plot
@item 1 @item 1
Prior density for each estimated parameter is plotted. It is important Prior density for each estimated parameter is plotted. It is important
to check that the actual shape of prior densities matches what you to check that the actual shape of prior densities matches what you
have in mind. Ill choosen values for the prior standard density can have in mind. Ill-chosen values for the prior standard density can
result in absurd prior densities. result in absurd prior densities.
@end table @end table
...@@ -4450,7 +4601,11 @@ Default value is @code{1}. For advanced use only. ...@@ -4450,7 +4601,11 @@ Default value is @code{1}. For advanced use only.
For internal use and testing only. For internal use and testing only.
@item conf_sig = @var{DOUBLE} @item conf_sig = @var{DOUBLE}
@xref{conf_sig}. Confidence interval used for classical forecasting after estimation. See @xref{conf_sig}.
@item mh_conf_sig = @var{DOUBLE}
@anchor{mh_conf_sig}
Confidence/HPD interval used for the computation of prior and posterior statistics like: parameter distributions, prior/posterior moments, conditional variance decomposition, impulse response functions, Bayesian forecasting. Default: @code{0.9}
@item mh_replic = @var{INTEGER} @item mh_replic = @var{INTEGER}
@anchor{mh_replic} Number of replications for Metropolis-Hastings @anchor{mh_replic} Number of replications for Metropolis-Hastings
...@@ -4646,7 +4801,7 @@ Available options are: ...@@ -4646,7 +4801,7 @@ Available options are:
Maximum number of iterations. Default: @code{1000} Maximum number of iterations. Default: @code{1000}
@item 'NumgradAlgorithm' @item 'NumgradAlgorithm'
Possible values are @code{2}, @code{3} and @code{5} respectively corresponding to the two, three and five points formula used to compute the gradient of the objective function (see @cite{Abramowitz and Stegun (1964)}). Values @code{13} and @code{15} are more experimental. If perturbations on the right and the left increase the value of the objective function (we minimize this function) then we force the corresponding element of the gradient to be zero. The idea is to temporarly reduce the size of the optimization problem. Default: @code{2}. Possible values are @code{2}, @code{3} and @code{5} respectively corresponding to the two, three and five points formula used to compute the gradient of the objective function (see @cite{Abramowitz and Stegun (1964)}). Values @code{13} and @code{15} are more experimental. If perturbations on the right and the left increase the value of the objective function (we minimize this function) then we force the corresponding element of the gradient to be zero. The idea is to temporarily reduce the size of the optimization problem. Default: @code{2}.
@item 'NumgradEpsilon' @item 'NumgradEpsilon'
Size of the perturbation used to compute numerically the gradient of the objective function. Default: @code{1e-6} Size of the perturbation used to compute numerically the gradient of the objective function. Default: @code{1e-6}
...@@ -4764,7 +4919,6 @@ To change the defaults of csminwel (@code{mode_compute=4}): ...@@ -4764,7 +4919,6 @@ To change the defaults of csminwel (@code{mode_compute=4}):
Metropolis-Hastings. Default: diagnostics are computed and displayed Metropolis-Hastings. Default: diagnostics are computed and displayed
@item bayesian_irf @item bayesian_irf
@vindex oo_.PosteriorIRF.dsge
@anchor{bayesian_irf} Triggers the computation of the posterior @anchor{bayesian_irf} Triggers the computation of the posterior
distribution of IRFs. The length of the IRFs are controlled by the distribution of IRFs. The length of the IRFs are controlled by the
@code{irf} option. Results are stored in @code{oo_.PosteriorIRF.dsge} @code{irf} option. Results are stored in @code{oo_.PosteriorIRF.dsge}
...@@ -4773,7 +4927,7 @@ distribution of IRFs. The length of the IRFs are controlled by the ...@@ -4773,7 +4927,7 @@ distribution of IRFs. The length of the IRFs are controlled by the
@item dsge_var = @var{DOUBLE} @item dsge_var = @var{DOUBLE}
@anchor{dsge_var} Triggers the estimation of a DSGE-VAR model, where the @anchor{dsge_var} Triggers the estimation of a DSGE-VAR model, where the
weight of the DSGE prior of the VAR model is calibrated to the value weight of the DSGE prior of the VAR model is calibrated to the value
passed (see @cite{Del Negro and Schorfheide (2004)}). NB: The previous method passed (see @cite{Del Negro and Schorfheide (2004)}). It represents ratio of dummy over actual observations. To assure that the prior is proper, the value must be bigger than @math{(k+n)/T}, where @math{k} is the number of estimated parameters, @math{n} is the number of observables, and @math{T} is the number of observations. NB: The previous method
of declaring @code{dsge_prior_weight} as a parameter and then of declaring @code{dsge_prior_weight} as a parameter and then
calibrating it is now deprecated and will be removed in a future release calibrating it is now deprecated and will be removed in a future release
of Dynare. of Dynare.
...@@ -4792,12 +4946,10 @@ deprecated and will be removed in a future release of Dynare. ...@@ -4792,12 +4946,10 @@ deprecated and will be removed in a future release of Dynare.
model. Default: @code{4}. model. Default: @code{4}.
@item moments_varendo @item moments_varendo
@vindex oo_.PosteriorTheoreticalMoments
@anchor{moments_varendo} Triggers the computation of the posterior @anchor{moments_varendo} Triggers the computation of the posterior
distribution of the theoretical moments of the endogenous distribution of the theoretical moments of the endogenous
variables. Results are stored in variables. Results are stored in
@code{oo_.PosteriorTheoreticalMoments} (see below for a description of @code{oo_.PosteriorTheoreticalMoments} (@pxref{oo_.PosteriorTheoreticalMoments}). The number of lags in the autocorrelation function is
this variable). The number of lags in the autocorrelation function is
controlled by the @code{ar} option. controlled by the @code{ar} option.
@item conditional_variance_decomposition = @var{INTEGER} @item conditional_variance_decomposition = @var{INTEGER}
...@@ -4814,30 +4966,24 @@ period 1, the conditional variance decomposition provides the ...@@ -4814,30 +4966,24 @@ period 1, the conditional variance decomposition provides the
decomposition of the effects of shocks upon impact. The results are decomposition of the effects of shocks upon impact. The results are
stored in stored in
@code{oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition}, @code{oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition},
but currently there is no output. Note that this option requires the but currently there is no displayed output. Note that this option requires the
option @code{moments_varendo} to be specified. option @code{moments_varendo} to be specified.
@item filtered_vars @item filtered_vars
@vindex oo_.FilteredVariables
@anchor{filtered_vars} Triggers the computation of the posterior @anchor{filtered_vars} Triggers the computation of the posterior
distribution of filtered endogenous variables/one-step ahead forecasts, i.e. @math{E_{t}{y_{t+1}}}. Results are distribution of filtered endogenous variables/one-step ahead forecasts, i.e. @math{E_{t}{y_{t+1}}}. Results are
stored in @code{oo_.FilteredVariables} (see below for a description of stored in @code{oo_.FilteredVariables} (see below for a description of
this variable) this variable)
@item smoother @item smoother
@vindex oo_.SmoothedVariables
@vindex oo_.SmoothedShocks
@vindex oo_.SmoothedMeasurementErrors
@vindex oo_.UpdatedVariables
@anchor{smoother} Triggers the computation of the posterior distribution @anchor{smoother} Triggers the computation of the posterior distribution
of smoothered endogenous variables and shocks, i.e. the expected value of variables and shocks given the information available in all observations up to the @emph{final} date (@math{E_{T}{y_t}}). Results are stored in of smoothed endogenous variables and shocks, i.e. the expected value of variables and shocks given the information available in all observations up to the @emph{final} date (@math{E_{T}{y_t}}). Results are stored in
@code{oo_.SmoothedVariables}, @code{oo_.SmoothedShocks} and @code{oo_.SmoothedVariables}, @code{oo_.SmoothedShocks} and
@code{oo_.SmoothedMeasurementErrors}. Also triggers the computation of @code{oo_.SmoothedMeasurementErrors}. Also triggers the computation of
@code{oo_.UpdatedVariables}, which contains the estimation of the expected value of variables given the information available at the @emph{current} date (@math{E_{t}{y_t}}). See below for a description of all these @code{oo_.UpdatedVariables}, which contains the estimation of the expected value of variables given the information available at the @emph{current} date (@math{E_{t}{y_t}}). See below for a description of all these
variables. variables.
@item forecast = @var{INTEGER} @item forecast = @var{INTEGER}
@vindex oo_.forecast
@anchor{forecast} Computes the posterior distribution of a forecast on @anchor{forecast} Computes the posterior distribution of a forecast on
@var{INTEGER} periods after the end of the sample used in @var{INTEGER} periods after the end of the sample used in
estimation. If no Metropolis-Hastings is computed, the result is estimation. If no Metropolis-Hastings is computed, the result is
...@@ -4875,7 +5021,7 @@ Use the Univariate Diffuse Kalman Filter ...@@ -4875,7 +5021,7 @@ Use the Univariate Diffuse Kalman Filter
@end table @end table
@noindent @noindent
Default value is @code{0}. Default value is @code{0}. In case of missing observations of single or all series, Dynare treats those missing values as unobserved states and uses the Kalman filter to infer their value (see e.g. @cite{Durbin and Koopman (2012), Ch. 4.10})
@item kalman_tol = @var{DOUBLE} @item kalman_tol = @var{DOUBLE}
...@@ -4887,9 +5033,10 @@ Default value is @code{0}. ...@@ -4887,9 +5033,10 @@ Default value is @code{0}.
forecast covariance matrices. forecast covariance matrices.
@item filter_step_ahead = [@var{INTEGER1}:@var{INTEGER2}] @item filter_step_ahead = [@var{INTEGER1}:@var{INTEGER2}]
See below.
@item filter_step_ahead = [@var{INTEGER1} @var{INTEGER2} @dots{}]
@anchor{filter_step_ahead} @anchor{filter_step_ahead}
@vindex oo_.FilteredVariablesKStepAhead
@vindex oo_.FilteredVariablesKStepAheadVariances
Triggers the computation k-step ahead filtered values. Stores results in Triggers the computation k-step ahead filtered values. Stores results in
@code{oo_.FilteredVariablesKStepAhead} and @code{oo_.FilteredVariablesKStepAhead} and
@code{oo_.FilteredVariablesKStepAheadVariances}. @code{oo_.FilteredVariablesKStepAheadVariances}.
...@@ -4898,15 +5045,9 @@ Triggers the computation k-step ahead filtered values. Stores results in ...@@ -4898,15 +5045,9 @@ Triggers the computation k-step ahead filtered values. Stores results in
@anchor{filter_decomposition} Triggers the computation of the shock @anchor{filter_decomposition} Triggers the computation of the shock
decomposition of the above k-step ahead filtered values. decomposition of the above k-step ahead filtered values.
@item constant
@dots{}
@item noconstant
@dots{}
@item diffuse_filter @item diffuse_filter
Uses the diffuse Kalman filter (as described in Uses the diffuse Kalman filter (as described in
@cite{Durbin and Koopman (2001)} and @cite{Koopman and Durbin @cite{Durbin and Koopman (2012)} and @cite{Koopman and Durbin
(2003)}) to estimate models with non-stationary observed variables. (2003)}) to estimate models with non-stationary observed variables.
When @code{diffuse_filter} is used the @code{lik_init} option of When @code{diffuse_filter} is used the @code{lik_init} option of
...@@ -4921,8 +5062,9 @@ any value of @math{\bar a} of @math{a} is a deterministic steady state for pro ...@@ -4921,8 +5062,9 @@ any value of @math{\bar a} of @math{a} is a deterministic steady state for pro
Note that the nonstationary variables in the model must be integrated processes (their first difference or k-difference must be stationary). Note that the nonstationary variables in the model must be integrated processes (their first difference or k-difference must be stationary).
@item selected_variables_only @item selected_variables_only
@anchor{selected_variables_only}
Only run the smoother on the variables listed just after the Only run the smoother on the variables listed just after the
@code{estimation} command. Default: run the smoother on all the @code{estimation} command. This options is incompatible with requesting classical frequentist forecasts and will be overridden in this case. Default: run the smoother on all the
declared endogenous variables. declared endogenous variables.
@item cova_compute = @var{INTEGER} @item cova_compute = @var{INTEGER}
...@@ -4943,7 +5085,7 @@ Order of approximation, either @code{1} or @code{2}. When equal to ...@@ -4943,7 +5085,7 @@ Order of approximation, either @code{1} or @code{2}. When equal to
@code{2}, the likelihood is evaluated with a particle filter based on @code{2}, the likelihood is evaluated with a particle filter based on
a second order approximation of the model (see a second order approximation of the model (see
@cite{Fernandez-Villaverde and Rubio-Ramirez (2005)}). Default is @cite{Fernandez-Villaverde and Rubio-Ramirez (2005)}). Default is
@code{1}, ie the lilkelihood of the linearized model is evaluated @code{1}, ie the likelihood of the linearized model is evaluated
using a standard Kalman filter. using a standard Kalman filter.
@item irf = @var{INTEGER} @item irf = @var{INTEGER}
...@@ -4967,7 +5109,7 @@ with @ref{dsge_var}. ...@@ -4967,7 +5109,7 @@ with @ref{dsge_var}.
@item lyapunov = @var{OPTION} @item lyapunov = @var{OPTION}
@anchor{lyapunov} @anchor{lyapunov}
Determines the algorithm used to solve the Laypunov equation to initialized the variance-covariance matrix of the Kalman filter using the steady-state value of state variables. Possible values for @code{@var{OPTION}} are: Determines the algorithm used to solve the Lyapunov equation to initialized the variance-covariance matrix of the Kalman filter using the steady-state value of state variables. Possible values for @code{@var{OPTION}} are:
@table @code @table @code
...@@ -4996,11 +5138,11 @@ Default value is @code{default} ...@@ -4996,11 +5138,11 @@ Default value is @code{default}
@item lyapunov_fixed_point_tol = @var{DOUBLE} @item lyapunov_fixed_point_tol = @var{DOUBLE}
@anchor{lyapunov_fixed_point_tol} @anchor{lyapunov_fixed_point_tol}
This is the convergence criterion used in the fixed point lyapunov solver. Its default value is 1e-10. This is the convergence criterion used in the fixed point Lyapunov solver. Its default value is 1e-10.
@item lyapunov_doubling_tol = @var{DOUBLE} @item lyapunov_doubling_tol = @var{DOUBLE}
@anchor{lyapunov_doubling_tol} @anchor{lyapunov_doubling_tol}
This is the convergence criterion used in the doubling algorithm to solve the lyapunov equation. Its default value is 1e-16. This is the convergence criterion used in the doubling algorithm to solve the Lyapunov equation. Its default value is 1e-16.
@item analytic_derivation @item analytic_derivation
Triggers estimation with analytic gradient. The final hessian is also Triggers estimation with analytic gradient. The final hessian is also
...@@ -5008,7 +5150,7 @@ computed analytically. Only works for stationary models without ...@@ -5008,7 +5150,7 @@ computed analytically. Only works for stationary models without
missing observations. missing observations.
@item ar = @var{INTEGER} @item ar = @var{INTEGER}
@xref{ar}. Only useful in conjuction with option @code{moments_varendo}. @xref{ar}. Only useful in conjunction with option @code{moments_varendo}.
@item endogenous_prior @item endogenous_prior
Use endogenous priors as in @cite{Christiano, Trabandt and Walentin Use endogenous priors as in @cite{Christiano, Trabandt and Walentin
...@@ -5023,9 +5165,7 @@ the filter, but rather use a penalty value for the likelihood when ...@@ -5023,9 +5165,7 @@ the filter, but rather use a penalty value for the likelihood when
such a singularity is encountered. Default: @code{1}. such a singularity is encountered. Default: @code{1}.
@item qz_zero_threshold = @var{DOUBLE} @item qz_zero_threshold = @var{DOUBLE}
Value used to test if a generalized eigenvalue is 0/0 in the generalized @xref{qz_zero_threshold}.
Schur decomposition (in which case the model does not admit a unique
solution). Default: @code{1e-6}.
@item taper_steps = [@var{INTEGER1} @var{INTEGER2} @dots{}] @item taper_steps = [@var{INTEGER1} @var{INTEGER2} @dots{}]
@anchor{taper_steps} @anchor{taper_steps}
...@@ -5141,15 +5281,22 @@ Variable set by the @code{estimation} command, if it is used with ...@@ -5141,15 +5281,22 @@ Variable set by the @code{estimation} command, if it is used with
@defvr {MATLAB/Octave variable} oo_.FilteredVariables @defvr {MATLAB/Octave variable} oo_.FilteredVariables
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{filtered_vars} option. Fields are of the form: @code{filtered_vars} option.
After an estimation without Metropolis, fields are of the form:
@example @example
@code{oo_.FilteredVariables.@var{VARIABLE_NAME}} @code{oo_.FilteredVariables.@var{VARIABLE_NAME}}
@end example @end example
After an estimation with Metropolis, fields are of the form:
@example
@code{oo_.FilteredVariables.@var{MOMENT_NAME}.@var{VARIABLE_NAME}}
@end example
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAhead @defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAhead
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{filter_step_ahead} option. @code{filter_step_ahead} option. The k-steps are stored along the rows while the columns indicate the respective variables. The third dimension of the array provides the observation for which the forecast has been made. For example, if @code{filter_step_ahead=[1 2 4]} and @code{nobs=200}, the element (3,5,204) stores the four period ahead filtered value of variable 5 computed at time t=200 for time t=204. The periods at the beginning and end of the sample for which no forecasts can be made, e.g. entries (1,5,1) and (1,5,204) in the example, are set to zero.
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAheadVariances @defvr {MATLAB/Octave variable} oo_.FilteredVariablesKStepAheadVariances
...@@ -5157,6 +5304,16 @@ Variable set by the @code{estimation} command, if it is used with the ...@@ -5157,6 +5304,16 @@ Variable set by the @code{estimation} command, if it is used with the
@code{filter_step_ahead} option. @code{filter_step_ahead} option.
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.Filtered_Variables_X_step_ahead
Variable set by the @code{estimation} command, if it is used with the @code{filter_step_ahead} option in the context of Bayesian estimation. Fields are of the form:
@example
@code{oo_.Filtered_Variables_X_step_ahead.@var{VARIABLE_NAME}}
@end example
The nth entry stores the k-step ahead filtered variable computed at time n for time n+k.
@end defvr
@defvr {MATLAB/Octave variable} oo_.PosteriorIRF.dsge @defvr {MATLAB/Octave variable} oo_.PosteriorIRF.dsge
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{bayesian_irf} option. Fields are of the form: @code{bayesian_irf} option. Fields are of the form:
...@@ -5174,32 +5331,58 @@ Variable set by the @code{estimation} command, if it is used with the ...@@ -5174,32 +5331,58 @@ Variable set by the @code{estimation} command, if it is used with the
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.SmoothedShocks @defvr {MATLAB/Octave variable} oo_.SmoothedShocks
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command (if used with the
@code{smoother} option. Fields are of the form: @code{smoother} option), or by the @code{calib_smoother} command.
After an estimation without Metropolis, or if computed by
@code{calib_smoother}, fields are of the form:
@example @example
@code{oo_.SmoothedShocks.@var{VARIABLE_NAME}} @code{oo_.SmoothedShocks.@var{VARIABLE_NAME}}
@end example @end example
After an estimation with Metropolis, fields are of the form:
@example
@code{oo_.SmoothedShocks.@var{MOMENT_NAME}.@var{VARIABLE_NAME}}
@end example
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.SmoothedVariables @defvr {MATLAB/Octave variable} oo_.SmoothedVariables
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command (if used with the
@code{smoother} option. Fields are of the form: @code{smoother} option), or by the @code{calib_smoother} command.
After an estimation without Metropolis, or if computed by
@code{calib_smoother}, fields are of the form:
@example @example
@code{oo_.SmoothedVariables.@var{VARIABLE_NAME}} @code{oo_.SmoothedVariables.@var{VARIABLE_NAME}}
@end example @end example
After an estimation with Metropolis, fields are of the form:
@example
@code{oo_.SmoothedVariables.@var{MOMENT_NAME}.@var{VARIABLE_NAME}}
@end example
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.UpdatedVariables @defvr {MATLAB/Octave variable} oo_.UpdatedVariables
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command (if used with the
@code{smoother} option. Contains the estimation of the expected value of @code{smoother} option), or by the @code{calib_smoother} command.
variables given the information available at the @emph{current} Contains the estimation of the expected value of variables given the
date. Fields are of the form: information available at the @emph{current} date.
After an estimation without Metropolis, or if computed by
@code{calib_smoother}, fields are of the form:
@example @example
@code{oo_.UpdatedVariables.@var{VARIABLE_NAME}} @code{oo_.UpdatedVariables.@var{VARIABLE_NAME}}
@end example @end example
After an estimation with Metropolis, fields are of the form:
@example
@code{oo_.UpdatedVariables.@var{MOMENT_NAME}.@var{VARIABLE_NAME}}
@end example
@end defvr @end defvr
@defvr {MATLAB/Octave variable} oo_.PosteriorTheoreticalMoments @defvr {MATLAB/Octave variable} oo_.PosteriorTheoreticalMoments
@anchor{oo_.PosteriorTheoreticalMoments}
Variable set by the @code{estimation} command, if it is used with the Variable set by the @code{estimation} command, if it is used with the
@code{moments_varendo} option. Fields are of the form: @code{moments_varendo} option. Fields are of the form:
@example @example
...@@ -5217,9 +5400,9 @@ Auto- and cross-correlation of endogenous variables. Fields are vectors with cor ...@@ -5217,9 +5400,9 @@ Auto- and cross-correlation of endogenous variables. Fields are vectors with cor
@item VarianceDecomposition @item VarianceDecomposition
Decomposition of variance@footnote{When the shocks are correlated, it Decomposition of variance (unconditional variance, i.e. at horizon infinity)@footnote{When the shocks are correlated, it
is the decomposition of orthogonalized shocks via Cholesky is the decomposition of orthogonalized shocks via Cholesky
decompostion according to the order of declaration of shocks decomposition according to the order of declaration of shocks
(@pxref{Variable declarations})} (@pxref{Variable declarations})}
@item ConditionalVarianceDecomposition @item ConditionalVarianceDecomposition
...@@ -5369,8 +5552,12 @@ estimates using a higher tapering are usually more reliable. ...@@ -5369,8 +5552,12 @@ estimates using a higher tapering are usually more reliable.
@descriptionhead @descriptionhead
This command computes odds ratios and estimate a posterior density This command computes odds ratios and estimate a posterior density
over a collection of models. The priors over models can be specified over a collection of models
as the @var{DOUBLE} values, otherwise a uniform prior is assumed. (see e.g. @cite{Koop (2003), Ch. 1}). The priors over models can be specified
as the @var{DOUBLE} values, otherwise a uniform prior over all models is assumed.
In contrast to frequentist econometrics, the models to be compared do not need to be nested.
However, as the computation of posterior odds ratios is a Bayesian technique,
the comparison of models estimated with maximum likelihood is not supported.
@examplehead @examplehead
...@@ -5412,6 +5599,15 @@ calibrated model. ...@@ -5412,6 +5599,15 @@ calibrated model.
@end table @end table
@vindex oo_.shock_decomposition
The results are stored in the field @code{oo_.shock_decomposition}, which is a three
dimensional array. The first dimension contains the endogenous variables for
which the shock decomposition has been requested. The second dimension stores
in the first @code{M_.exo_nbr} columns the contribution of the respective shocks.
Column @code{M_.exo_nbr+1} stores the contribution of the initial conditions,
while column @code{M_.exo_nbr+2} stores the smoothed value of the respective
endogenous variable. The third dimension stores the time periods.
@end deffn @end deffn
...@@ -5444,9 +5640,6 @@ A datafile must be provided, and the observable variables declared with ...@@ -5444,9 +5640,6 @@ A datafile must be provided, and the observable variables declared with
@code{varobs}. The smoother is based on a first-order approximation of @code{varobs}. The smoother is based on a first-order approximation of
the model. the model.
@vindex oo_.SmoothedVariables
@vindex oo_.SmoothedShocks
@vindex oo_.UpdatedVariables
By default, the command computes the smoothed variables and shocks and stores the By default, the command computes the smoothed variables and shocks and stores the
results in @code{oo_.SmoothedVariables} and results in @code{oo_.SmoothedVariables} and
@code{oo_.SmoothedShocks}. It also fills @code{oo_.UpdatedVariables}. @code{oo_.SmoothedShocks}. It also fills @code{oo_.UpdatedVariables}.
...@@ -5484,13 +5677,6 @@ DSGE model, by finding the structural shocks that are needed to match ...@@ -5484,13 +5677,6 @@ DSGE model, by finding the structural shocks that are needed to match
the restricted paths. Use @code{conditional_forecast}, the restricted paths. Use @code{conditional_forecast},
@code{conditional_forecast_paths} and @code{plot_conditional_forecast} @code{conditional_forecast_paths} and @code{plot_conditional_forecast}
for that purpose. for that purpose.
If the model contains strong non-linearities, the conditional forecasts
can be computed using an extended path method with the @code{simulation_type}
option in @code{conditional_forecast} command set to @code{deterministic}.
Because in this case deterministic simulations are carried out,
the nature of the shocks (surprise or perfect foresight) has to be indicated
in the @code{conditional_forecast_paths} block, using the command @code{expectation}
for each endogenous path. The forecasts are plotted using the rplot command.
Finally, it is possible to do forecasting with a Bayesian VAR using Finally, it is possible to do forecasting with a Bayesian VAR using
the @code{bvar_forecast} command. the @code{bvar_forecast} command.
...@@ -5504,7 +5690,7 @@ This command computes a simulation of a stochastic model from an ...@@ -5504,7 +5690,7 @@ This command computes a simulation of a stochastic model from an
arbitrary initial point. arbitrary initial point.
When the model also contains deterministic exogenous shocks, the When the model also contains deterministic exogenous shocks, the
simulation is computed conditionaly to the agents knowing the future simulation is computed conditionally to the agents knowing the future
values of the deterministic exogenous variables. values of the deterministic exogenous variables.
@code{forecast} must be called after @code{stoch_simul}. @code{forecast} must be called after @code{stoch_simul}.
...@@ -5520,7 +5706,7 @@ confidence interval. ...@@ -5520,7 +5706,7 @@ confidence interval.
@table @code @table @code
@item periods = @var{INTEGER} @item periods = @var{INTEGER}
Number of periods of the forecast. Default: @code{40} Number of periods of the forecast. Default: @code{5}.
@item conf_sig = @var{DOUBLE} @item conf_sig = @var{DOUBLE}
@anchor{conf_sig} Level of significance for confidence @anchor{conf_sig} Level of significance for confidence
...@@ -5643,18 +5829,55 @@ Fields are of the form: ...@@ -5643,18 +5829,55 @@ Fields are of the form:
@descriptionhead @descriptionhead
This command computes forecasts on an estimated model for a given This command computes forecasts on an estimated or calibrated model for a
constrained path of some future endogenous variables. This is done, given constrained path of some future endogenous variables. This is done
from the reduced form representation of the DSGE model, by finding the using the reduced form first order state-space representation of the DSGE
structural shocks that are needed to match the restricted paths. This model by finding the structural shocks that are needed to match the
command has to be called after estimation. restricted paths. Consider the an augmented state space representation
that stacks both predetermined and non-predetermined variables into a
vector @math{y_{t}}:
@math{y_t=Ty_{t-1}+R\varepsilon_t}
Both
@math{y_t} and @math{\varepsilon_t} are split up into controlled and
uncontrolled ones to get:
@math{y_t(contr\_vars)=Ty_{t-1}(contr\_vars)+R(contr\_vars,uncontr\_shocks)\varepsilon_t(uncontr\_shocks)
+R(contr\_vars,contr\_shocks)\varepsilon_t(contr\_shocks)}
which can be solved algebraically for @math{\varepsilon_t(contr\_shocks)}.
Using these controlled shocks, the state-space representation can be used
for forecasting. A few things need to be noted. First, it is assumed that
controlled exogenous variables are fully under control of the policy
maker for all forecast periods and not just for the periods where the
endogenous variables are controlled. For all uncontrolled periods, the
controlled exogenous variables are assumed to be 0. This implies that
there is no forecast uncertainty arising from these exogenous variables
in uncontrolled periods. Second, by making use of the first order state
space solution, even if a higher-order approximation was performed, the
conditional forecasts will be based on a first order approximation.
Third, although controlled exogenous variables are taken as instruments
perfectly under the control of the policy-maker, they are nevertheless
random and unforeseen shocks from the perspective of the households. That is,
households are in each period surprised by the realization of a shock
that keeps the controlled endogenous variables at their respective level.
Fourth, keep in mind that if the structural innovations are correlated,
because the calibrated or estimated covariance matrix has non zero off
diagonal elements, the results of the conditional forecasts will depend on
the ordering of the innovations (as declared after @code{varexo}). As in VAR
models, a Cholesky decomposition is used to factorize the covariance matrix
and identify orthogonal impulses. It is preferable to declare the correlations
in the @code{model} block (explicitly imposing the identification restrictions),
unless you are satisfied with the implicit identification restrictions implied
by the Cholesky decomposition.
This command has to be called after @code{estimation} or @code{stoch_simul}.
Use @code{conditional_forecast_paths} block to give the list of Use @code{conditional_forecast_paths} block to give the list of
constrained endogenous, and their constrained future path. constrained endogenous, and their constrained future path.
If an extended path method is applied on the original dsge model, Option @code{controlled_varexo} is used to specify the structural shocks
the nature of the expectation on the constrained endogenous has to be
specified using expectation command. Option
@code{controlled_varexo} is used to specify the structural shocks
which will be matched to generate the constrained path. which will be matched to generate the constrained path.
Use @code{plot_conditional_forecast} to graph the results. Use @code{plot_conditional_forecast} to graph the results.
...@@ -5681,14 +5904,6 @@ Number of simulations. Default: @code{5000}. ...@@ -5681,14 +5904,6 @@ Number of simulations. Default: @code{5000}.
@item conf_sig = @var{DOUBLE} @item conf_sig = @var{DOUBLE}
Level of significance for confidence interval. Default: @code{0.80} Level of significance for confidence interval. Default: @code{0.80}
@item simulation_type = @code{stochastic} | @code{deterministic}
Indicates the nature of simulations used to compute the conditional forecast.
The default value @code{stochastic} is used, when simulations are computed
using the reduced form representation of the DSGE model.
If the model has to be simulated using extended path method on the original
DSGE model, @code{simulation_type} has to be set equal to @code{deterministic}.
@end table @end table
@outputhead @outputhead
...@@ -5758,31 +5973,6 @@ plot_conditional_forecast(periods = 10) a y; ...@@ -5758,31 +5973,6 @@ plot_conditional_forecast(periods = 10) a y;
@end example @end example
@examplehead
@example
/* conditional forecast using extended path method
with perfect foresight on r path*/
var y r
varexo e u;
@dots{}
conditional_forecast_paths;
var y;
periods 1:3, 4:5;
values 2, 5;
var r
periods 1:5;
values 3;
expectation perfect_foresight;
end;
conditional_forecast(parameter_set = calibration, controlled_varexo = (e, u), simulation_type=deterministic);
rplot a;
rplot y;
@end example
@end deffn @end deffn
@deffn Block conditional_forecast_paths ; @deffn Block conditional_forecast_paths ;
...@@ -5795,10 +5985,6 @@ example. ...@@ -5795,10 +5985,6 @@ example.
The syntax of the block is the same than the deterministic shocks in The syntax of the block is the same than the deterministic shocks in
the @code{shocks} blocks (@pxref{Shocks on exogenous variables}). the @code{shocks} blocks (@pxref{Shocks on exogenous variables}).
If the conditional forecast is carried out using the extended path method
on the original DSGE model, the nature of the expectation have to be specified
for each endogenous path, using the @code{expectation} = @code{surprise} | @code{perfect_foresight}.
By default, @code{expectation} is equal to @code{surprise}.
@end deffn @end deffn
...@@ -5832,6 +6018,67 @@ See @file{bvar-a-la-sims.pdf}, which comes with Dynare distribution, ...@@ -5832,6 +6018,67 @@ See @file{bvar-a-la-sims.pdf}, which comes with Dynare distribution,
for more information on this command. for more information on this command.
@end deffn @end deffn
If the model contains strong non-linearities or if some perfectly expected shocks are considered, the forecasts and the conditional forecasts
can be computed using an extended path method. The forecast scenario describing the shocks and/or the constrained paths on some endogenous variables should be build.
The first step is the forecast scenario initialization using the function @code{init_plan}:
@anchor{init_plan}
@deftypefn {MATLAB/Octave command} {HANDLE =} init_plan (DATES) ;
Creates a new forecast scenario for a forecast period (indicated as a dates class, see @ref{dates class members}). This function return a handle on the new forecast scenario.
@end deftypefn
The forecast scenario can contain some simple shocks on the exogenous variables. This shocks are described using the function @code{basic_plan}:
@anchor{basic_plan}
@deftypefn {MATLAB/Octave command} {HANDLE =} basic_plan (HANDLE, 'VARIABLE_NAME', 'SHOCK_TYPE', DATES, MATLAB VECTOR OF DOUBLE | [DOUBLE | EXPRESSION [DOUBLE | | EXPRESSION] ] ) ;
Adds to the forecast scenario a shock on the exogenous variable indicated between quotes in the second argument. The shock type has to be specified in the third argument between quotes: 'surprise' in case of an unexpected shock or 'perfect_foresight' for a perfectly anticipated shock. The fourth argument indicates the period of the shock using a dates class (see @ref{dates class members}). The last argument is the shock path indicated as a Matlab vector of double. This function return the handle of the updated forecast scenario.
@end deftypefn
The forecast scenario can also contain a constrained path on an endogenous variable. The values of the related exogenous variable compatible with the constrained path are in this case computed. In other words, a conditional forecast is performed. This kind of shock is described with the function @code{flip_plan}:
@anchor{flip_plan}
@deftypefn {MATLAB/Octave command} {HANDLE =} flip_plan (HANDLE, 'VARIABLE_NAME, 'VARIABLE_NAME', 'SHOCK_TYPE', DATES, MATLAB VECTOR OF DOUBLE | [DOUBLE | EXPRESSION [DOUBLE | | EXPRESSION] ] ) ;
Adds to the forecast scenario a constrained path on the endogenous variable specified between quotes in the second argument. The associated exogenous variable provided in the third argument between quotes, is considered as an endogenous variable and its values compatible with the constrained path on the endogenous variable will be computed. The nature of the expectation on the constrained path has to be specified in the fourth argument between quotes: 'surprise' in case of an unexpected path or 'perfect_foresight' for a perfectly anticipated path. The fifth argument indicates the period where the path of the endogenous variable is constrained using a dates class (see @ref{dates class members}). The last argument contains the constrained path as a Matlab vector of double. This function return the handle of the updated forecast scenario.
@end deftypefn
Once the forecast scenario if fully described, the forecast is computed with the command @code{det_cond_forecast}:
@anchor{det_cond_forecast}
@deftypefn {MATLAB/Octave command} {DSERIES =} det_cond_forecast (HANDLE[, DSERIES [, DATES]]) ;
Computes the forecast or the conditional forecast using an extended path method for the given forecast scenario (first argument). The past values of the endogenous and exogenous variables provided with a dseries class (see @ref{dseries class members}) can be indicated in the second argument. By default, the past values of the variables are equal to their steady-state values. The initial date of the forecast can be provided in the third argument. By default, the forecast will start at the first date indicated in the @code{init_plan} command. This function returns a dset containing the historical and forecast values for the endogenous and exogenous variables.
@end deftypefn
@examplehead
@example
/* conditional forecast using extended path method
with perfect foresight on r path*/
var y r
varexo e u;
@dots{}
smoothed = dseries('smoothed_variables.csv');
fplan = init_plan(2013Q4:2029Q4);
fplan = flip_plan(fplan, 'y', 'u', 'surprise', 2013Q4:2014Q4, [1 1.1 1.2 1.1 ]);
fplan = flip_plan(fplan, 'r', 'e', 'perfect_foresight', 2013Q4:2014Q4, [2 1.9 1.9 1.9 ]);
dset_forecast = det_cond_forecast(fplan, smoothed);
plot(dset_forecast.@{'y','u'@});
plot(dset_forecast.@{'r','e'@});
@end example
@node Optimal policy @node Optimal policy
@section Optimal policy @section Optimal policy
...@@ -5854,7 +6101,7 @@ This command computes optimal simple policy rules for ...@@ -5854,7 +6101,7 @@ This command computes optimal simple policy rules for
linear-quadratic problems of the form: linear-quadratic problems of the form:
@quotation @quotation
@math{\max_\gamma E(y'_tWy_t)} @math{\min_\gamma E(y'_tWy_t)}
@end quotation @end quotation
such that: such that:
...@@ -5865,42 +6112,82 @@ such that: ...@@ -5865,42 +6112,82 @@ such that:
where: where:
@itemize @itemize
@item
@math{E} denotes the unconditional expectations operator;
@item @item
@math{\gamma} are parameters to be optimized. They must be elements of matrices @math{\gamma} are parameters to be optimized. They must be elements
@math{A_1}, @math{A_2}, @math{A_3}; of the matrices @math{A_1}, @math{A_2}, @math{A_3}, i.e. be specified as
parameters in the @code{params}-command and be entered in the
@code{model}-block;
@item @item
@math{y} are the endogenous variables; @math{y} are the endogenous variables, specified in the
@code{var}-command, whose (co)-variance enters the loss function;
@item @item
@math{e} are the exogenous stochastic shocks; @math{e} are the exogenous stochastic shocks, specified in the
@end itemize @code{varexo}-command;
@item
@math{W} is the weighting matrix;
The parameters to be optimized must be listed with @code{osr_params}. @end itemize
The quadratic objectives must be listed with @code{optim_weights}. The linear quadratic problem consists of choosing a subset of model
parameters to minimize the weighted (co)-variance of a specified subset
of endogenous variables, subject to a linear law of motion implied by the
first order conditions of the model. A few things are worth mentioning.
First, @math{y} denotes the selected endogenous variables' deviations
from their steady state, i.e. in case they are not already mean 0 the
variables entering the loss function are automatically demeaned so that
the centered second moments are minimized. Second, @code{osr} only solves
linear quadratic problems of the type resulting from combining the
specified quadratic loss function with a first order approximation to the
model's equilibrium conditions. The reason is that the first order
state-space representation is used to compute the unconditional
(co)-variances. Hence, @code{osr} will automatically select
@code{order=1}. Third, because the objective involves minimizing a
weighted sum of unconditional second moments, those second moments must
be finite. In particular, unit roots in @math{y} are not allowed.
The subset of the model parameters over which the optimal simple rule is
to be optimized, @math{\gamma}, must be listed with @code{osr_params}.
The weighting matrix @math{W} used for the quadratic objective function
is specified in the @code{optim_weights}-block. By attaching weights to
endogenous variables, the subset of endogenous variables entering the
objective function, @math{y}, is implicitly specified.
The linear quadratic problem is solved using the numerical optimizer
@code{csminwel} of Chris Sims.
This problem is solved using the numerical optimizer @code{csminwel} of Chris Sims.
@optionshead @optionshead
This command accepts the same options as @code{stoch_simul} The @code{osr} command will subsequently run @code{stoch_simul} and
accepts the same options, including restricting the endogenous variables
by listing them after the command, as @code{stoch_simul}
(@pxref{Computing the stochastic solution}) plus (@pxref{Computing the stochastic solution}) plus
@table @code @table @code
@item maxit = @var{INTEGER} @item maxit = @var{INTEGER} Determines the maximum number of iterations
Determines the maximum number of iterations used in the non-linear solver. Default: @code{1000} used in the non-linear solver. Default: @code{1000}
@item tolf = @var{DOUBLE} Convergence criterion for termination based on
the function value. Iteration will cease when it proves impossible to
improve the function value by more than tolf. Default: @code{1e-7}
@item tolf = @var{DOUBLE}
Convergence criterion for termination based on the function value. Iteration will
cease when it proves impossible to improve the function value by more than tolf. Default: @code{1e-7}
@end table @end table
The value of the objective is stored in the variable The value of the objective is stored in the variable
@code{oo_.osr.objective_function}, which is described below. @code{oo_.osr.objective_function}, which is described below.
After running @code{osr} the parameters entering the simple rule will be
set to their optimal value so that subsequent runs of @code{stoch_simul}
will be conducted at these values.
@end deffn @end deffn
@anchor{osr_params} @anchor{osr_params}
...@@ -5913,11 +6200,12 @@ This command declares parameters to be optimized by @code{osr}. ...@@ -5913,11 +6200,12 @@ This command declares parameters to be optimized by @code{osr}.
This block specifies quadratic objectives for optimal policy problems This block specifies quadratic objectives for optimal policy problems
More precisely, this block specifies the nonzero elements of the More precisely, this block specifies the nonzero elements of the weight
quadratic weight matrices for the objectives in @code{osr}. matrix @math{W} used in the quadratic form of the objective function in
@code{osr}.
An element of the diagonal of the weight matrix is given by a line of An element of the diagonal of the weight matrix is given by a line of the
the form: form:
@example @example
@var{VARIABLE_NAME} @var{EXPRESSION}; @var{VARIABLE_NAME} @var{EXPRESSION};
@end example @end example
...@@ -5930,11 +6218,110 @@ the form: ...@@ -5930,11 +6218,110 @@ the form:
@end deffn @end deffn
@examplehead
@example
var y inflation r;
varexo y_ inf_;
parameters delta sigma alpha kappa gammarr gammax0 gammac0 gamma_y_ gamma_inf_;
delta = 0.44;
kappa = 0.18;
alpha = 0.48;
sigma = -0.06;
gammarr = 0;
gammax0 = 0.2;
gammac0 = 1.5;
gamma_y_ = 8;
gamma_inf_ = 3;
model(linear);
y = delta * y(-1) + (1-delta)*y(+1)+sigma *(r - inflation(+1)) + y_;
inflation = alpha * inflation(-1) + (1-alpha) * inflation(+1) + kappa*y + inf_;
r = gammax0*y(-1)+gammac0*inflation(-1)+gamma_y_*y_+gamma_inf_*inf_;
end;
shocks;
var y_; stderr 0.63;
var inf_; stderr 0.4;
end;
optim_weights;
inflation 1;
y 1;
y, inflation 0.5;
end;
osr_params gammax0 gammac0 gamma_y_ gamma_inf_;
osr y;
@end example
@defvr {MATLAB/Octave variable} oo_.osr.objective_function @defvr {MATLAB/Octave variable} oo_.osr.objective_function
After an execution of the @code{osr} command, this variable contains After an execution of the @code{osr} command, this variable contains the value of
the value of the objective under optimal policy. the objective under optimal policy.
@end defvr @end defvr
@anchor{Ramsey}
@deffn Command ramsey_model (@var{OPTIONS}@dots{});
@descriptionhead
This command computes the First Order Conditions for maximizing the policy maker objective function subject to the
constraints provided by the equilibrium path of the economy.
The planner objective must be declared with the @code{planner_objective} command.
This command only creates the expanded model, it doesn't perform any
computations. It needs to be followed by other instructions to actually
perfrom desired computations. Note that it is the only way to perform
perfect foresight simulation of the Ramsey policy problem.
@xref{Auxiliary
variables}, for an explanation of how Lagrange multipliers are
automatically created.
@optionshead
This command accepts the following options:
@table @code
@item planner_discount = @var{EXPRESSION}
Declares the discount factor of the central planner. Default: @code{1.0}
@item instruments = (@var{VARIABLE_NAME},@dots{})
Declares instrument variables for the computation of the steady state
under optimal policy. Requires a @code{steady_state_model} block or a
@code{@dots{}_steadystate.m} file. See below.
@end table
@customhead{Steady state}
Dynare takes advantage of the fact that the Lagrange multipliers appear
linearly in the equations of the steady state of the model under optimal
policy. Nevertheless, it is in general very difficult to compute the
steady state with simply a numerical guess in @code{initval} for the
endogenous variables.
It greatly facilitates the computation, if the user provides an
analytical solution for the steady state (in @code{steady_state_model}
block or in a @code{@dots{}_steadystate.m} file). In this case, it is
necessary to provide a steady state solution CONDITIONAL on the value
of the instruments in the optimal policy problem and declared with
option @code{instruments}. Note that choosing the instruments is
partly a matter of interpretation and you can choose instruments that
are handy from a mathematical point of view but different from the
instruments you would refer to in the analysis of the paper. A typical
example is choosing inflation or nominal interest rate as an
instrument.
@end deffn
@deffn Command ramsey_policy [@var{VARIABLE_NAME}@dots{}]; @deffn Command ramsey_policy [@var{VARIABLE_NAME}@dots{}];
@deffnx Command ramsey_policy (@var{OPTIONS}@dots{}) [@var{VARIABLE_NAME}@dots{}]; @deffnx Command ramsey_policy (@var{OPTIONS}@dots{}) [@var{VARIABLE_NAME}@dots{}];
...@@ -6040,7 +6427,10 @@ This command declares the policy maker objective, for use with ...@@ -6040,7 +6427,10 @@ This command declares the policy maker objective, for use with
You need to give the one-period objective, not the discounted lifetime You need to give the one-period objective, not the discounted lifetime
objective. The discount factor is given by the @code{planner_discount} objective. The discount factor is given by the @code{planner_discount}
option of @code{ramsey_policy} and @code{discretionary_policy}. option of @code{ramsey_policy} and @code{discretionary_policy}. The
objective function can only contain current endogenous variables and no
exogenous ones. This limitation is easily circumvented by defining an
appropriate auxiliary variable in the model.
With @code{ramsey_policy}, you are not limited to quadratic With @code{ramsey_policy}, you are not limited to quadratic
objectives: you can give any arbitrary nonlinear expression. objectives: you can give any arbitrary nonlinear expression.
...@@ -6765,7 +7155,7 @@ the given chain. One, but not both, of @code{coefficients} or ...@@ -6765,7 +7155,7 @@ the given chain. One, but not both, of @code{coefficients} or
@code{variances} must appear. Default: @code{none} @code{variances} must appear. Default: @code{none}
@item equations @item equations
Defines the equation controlled by the given chain. If not specificed, Defines the equation controlled by the given chain. If not specified,
then all equations are controlled by @code{chain}. Default: @code{none} then all equations are controlled by @code{chain}. Default: @code{none}
@item chain = @var{INTEGER} @item chain = @var{INTEGER}
...@@ -6838,6 +7228,25 @@ To be documented. For now, see the wiki: @uref{http://www.dynare.org/DynareWiki/ ...@@ -6838,6 +7228,25 @@ To be documented. For now, see the wiki: @uref{http://www.dynare.org/DynareWiki/
@end deffn @end deffn
@deffn Block svar_identification ;
@descriptionhead
This block is terminated by @code{end;}, and contains lines of the
form:
@example
UPPER_CHOLESKY;
LOWER_CHOLESKY;
EXCLUSION CONSTANTS;
EXCLUSION LAG @var{INTEGER}; @var{VARIABLE_NAME} [,@var{VARIABLE_NAME}@dots{}]
EXCLUSION LAG @var{INTEGER}; EQUATION @var{INTEGER}, @var{VARIABLE_NAME} [,@var{VARIABLE_NAME}@dots{}]
RESTRICTION EQUATION @var{INTEGER}, @var{EXPRESSION} = @var{EXPRESSION};
@end example
To be documented. For now, see the wiki: @uref{http://www.dynare.org/DynareWiki/MarkovSwitchingInterface}
@end deffn
@anchor{ms_estimation} @anchor{ms_estimation}
@deffn Command ms_estimation (@var{OPTIONS}@dots{}); @deffn Command ms_estimation (@var{OPTIONS}@dots{});
@descriptionhead @descriptionhead
...@@ -6924,11 +7333,14 @@ The first period of data (@i{i.e.} for quarterly data, an integer in ...@@ -6924,11 +7333,14 @@ The first period of data (@i{i.e.} for quarterly data, an integer in
[@code{1,4}]). Default: @code{1} [@code{1,4}]). Default: @code{1}
@item final_year = @var{INTEGER} @item final_year = @var{INTEGER}
The last year of data. Default: Set to encompass entire dataset The last year of data. Default: Set to encompass entire dataset.
@item final_subperiod = @var{INTEGER} @item final_subperiod = @var{INTEGER}
The final period of data (@i{i.e.} for monthly data, an integer in The final period of data (@i{i.e.} for monthly data, an integer in
[@code{1,12}]. Default: Set to encompass entire dataset [@code{1,12}]. Default: When final_year is also missing, set to
encompass entire dataset; when final_year is indicated, set to the
maximum number of subperiods given the frequency (@i{i.e}. 4 for
quarterly data, 12 for monthly,...).
@item datafile = @var{FILENAME} @item datafile = @var{FILENAME}
@xref{datafile}. @xref{datafile}.
...@@ -6949,7 +7361,7 @@ Use cross @math{A^0} and @math{A^+} restrictions. Default: @code{off} ...@@ -6949,7 +7361,7 @@ Use cross @math{A^0} and @math{A^+} restrictions. Default: @code{off}
Use contemporaneous recursive reduced form. Default: @code{off} Use contemporaneous recursive reduced form. Default: @code{off}
@item no_bayesian_prior @item no_bayesian_prior
Do not use bayesian prior. Default: @code{off} (@i{i.e.} use bayesian Do not use Bayesian prior. Default: @code{off} (@i{i.e.} use Bayesian
prior) prior)
@item alpha = @var{INTEGER} @item alpha = @var{INTEGER}
...@@ -6975,7 +7387,7 @@ parameters. Default: @code{Random Walk} ...@@ -6975,7 +7387,7 @@ parameters. Default: @code{Random Walk}
@item convergence_starting_value = @var{DOUBLE} @item convergence_starting_value = @var{DOUBLE}
This is the tolerance criterion for convergence and refers to changes in This is the tolerance criterion for convergence and refers to changes in
the objective function value. It should be rather loose since it will the objective function value. It should be rather loose since it will
gradually be tighened during estimation. Default: @code{1e-3} gradually be tightened during estimation. Default: @code{1e-3}
@item convergence_ending_value = @var{DOUBLE} @item convergence_ending_value = @var{DOUBLE}
The convergence criterion ending value. Values much smaller than square The convergence criterion ending value. Values much smaller than square
...@@ -7024,7 +7436,7 @@ The entire process described by @ref{max_block_iterations} is repeated ...@@ -7024,7 +7436,7 @@ The entire process described by @ref{max_block_iterations} is repeated
with random starting values drawn from the posterior. This specifies the with random starting values drawn from the posterior. This specifies the
number of random starting values used. Set this to @code{0} to not use number of random starting values used. Set this to @code{0} to not use
random starting values. A larger number should be specified to ensure random starting values. A larger number should be specified to ensure
that the entire parameter space has been covererd. Default: @code{5} that the entire parameter space has been covered. Default: @code{5}
@item number_of_small_perturbations = @var{INTEGER} @item number_of_small_perturbations = @var{INTEGER}
The number of small perturbations to make after the large perturbations The number of small perturbations to make after the large perturbations
...@@ -7038,7 +7450,7 @@ small number will result in a small perturbation. Default: @code{1} ...@@ -7038,7 +7450,7 @@ small number will result in a small perturbation. Default: @code{1}
@item max_number_of_stages = @var{INTEGER} @item max_number_of_stages = @var{INTEGER}
The small and large perturbation are repeated until improvement has The small and large perturbation are repeated until improvement has
stopped. This specifices the maximum number of stages allowed. Default: stopped. This specifics the maximum number of stages allowed. Default:
@code{20} @code{20}
@item random_function_convergence_criterion = @var{DOUBLE} @item random_function_convergence_criterion = @var{DOUBLE}
...@@ -7099,7 +7511,7 @@ The total number of draws is equal to ...@@ -7099,7 +7511,7 @@ The total number of draws is equal to
@code{thinning_factor*mh_replic+drop}. Default: @code{1} @code{thinning_factor*mh_replic+drop}. Default: @code{1}
@item adaptive_mh_draws = @var{INTEGER} @item adaptive_mh_draws = @var{INTEGER}
Tuning period for Metropolis-Hasting draws. Default: @code{30,000} Tuning period for Metropolis-Hastings draws. Default: @code{30,000}
@item save_draws @item save_draws
Save all elements of @math{A^0}, @math{A^+}, @math{Q}, and Save all elements of @math{A^0}, @math{A^+}, @math{Q}, and
...@@ -7144,7 +7556,7 @@ log marginal densities are contained in the @code{oo_.ms} structure. ...@@ -7144,7 +7556,7 @@ log marginal densities are contained in the @code{oo_.ms} structure.
@item simulation_file_tag = @var{FILENAME} @item simulation_file_tag = @var{FILENAME}
@anchor{simulation_file_tag} The portion of the filename associated with @anchor{simulation_file_tag} The portion of the filename associated with
the simulation run. Defualt: @code{<file_tag>} the simulation run. Default: @code{<file_tag>}
@item proposal_type = @var{INTEGER} @item proposal_type = @var{INTEGER}
The proposal type: The proposal type:
...@@ -7778,7 +8190,7 @@ Includes @file{modeldesc.mod}, calibrates parameters and runs ...@@ -7778,7 +8190,7 @@ Includes @file{modeldesc.mod}, calibrates parameters and runs
stochastic simulations stochastic simulations
@item estim.mod @item estim.mod
Includes @file{modeldesc.mod}, declares priors on parameters and runs Includes @file{modeldesc.mod}, declares priors on parameters and runs
bayesian estimation Bayesian estimation
@end table @end table
Dynare can be called on @file{simul.mod} and @file{estim.mod}, but it Dynare can be called on @file{simul.mod} and @file{estim.mod}, but it
...@@ -7871,7 +8283,7 @@ The labor share in GDP is defined as: ...@@ -7871,7 +8283,7 @@ The labor share in GDP is defined as:
In the model, @math{\alpha} is a (share) parameter, and In the model, @math{\alpha} is a (share) parameter, and
@code{lab_rat} is an endogenous variable. @code{lab_rat} is an endogenous variable.
It is clear that calibrating @math{\alpha} is not straigthforward; but It is clear that calibrating @math{\alpha} is not straightforward; but
on the contrary, we have real world data for @code{lab_rat}, and on the contrary, we have real world data for @code{lab_rat}, and
it is clear that these two variables are economically linked. it is clear that these two variables are economically linked.
...@@ -8096,6 +8508,12 @@ the one that is highest on the MATLAB/Octave path). ...@@ -8096,6 +8508,12 @@ the one that is highest on the MATLAB/Octave path).
@end deffn @end deffn
@deffn {MATLAB/Octave command} write_latex_definitions ;
Writes the names, @LaTeX{} names and long names of model variables to
tables in a file named @code{<<M_.fname>>_latex_definitions.tex}.
@end deffn
@node The Configuration File @node The Configuration File
...@@ -8169,7 +8587,7 @@ processing. Currently, there is only one option available. ...@@ -8169,7 +8587,7 @@ processing. Currently, there is only one option available.
@descriptionhead @descriptionhead
The @code{[hooks]} block can be used to specify configuration options The @code{[hooks]} block can be used to specify configuration options
that will be used when running dynare. that will be used when running Dynare.
@optionshead @optionshead
...@@ -8438,14 +8856,16 @@ using time series. ...@@ -8438,14 +8856,16 @@ using time series.
@subsection dates in a mod file @subsection dates in a mod file
Dynare understands dates in a mod file. Users can declare annual, Dynare understands dates in a mod file. Users can declare annual,
quaterly, monthly or weekly dates using the following syntax: quarterly, monthly or weekly dates using the following syntax:
@example @example
1990Y 1990Y
1990Q3 1990Q3
1990M11 1990M11
1990W49 1990W49
@end example @end example
@noindent Behind the scene, the dynare's preprocessor translates these expressions
@noindent Behind the scene, Dynare's preprocessor translates these expressions
into instantiations of the Matlab/Octave's class @dates described into instantiations of the Matlab/Octave's class @dates described
below. Basic operations can be performed on dates: below. Basic operations can be performed on dates:
@table @strong @table @strong
...@@ -8461,11 +8881,15 @@ Increments a date by one period. @code{+1950Q1} is identical to @code{1950Q2}, @ ...@@ -8461,11 +8881,15 @@ Increments a date by one period. @code{+1950Q1} is identical to @code{1950Q2}, @
@item minus binary operator (@code{-}) @item minus binary operator (@code{-})
The difference between two dates is a number of periods. For instance if @code{1951Q2-1950Q1} is equal to @code{5} (quarters). Has two functions: difference and subtraction. If the second argument
is a date, calculates the difference between the first date and the
second date (@i{e.g.} @code{1951Q2-1950Q1} is equal to @code{5}). If
the second argument is an integer @code{X}, subtracts @code{X} periods
from the date (@i{e.g.} @code{1951Q2-2} is equal to @code{1950Q4}).
@item minus unary operator (@code{-}) @item minus unary operator (@code{-})
Substracts one period to a date. @code{-1950Q1} is identical to @code{1949Q4}. The unary minus operator is the reciprocal of the unary plus operator, @code{+-1950Q1} is identical to @code{1950Q1}. Subtracts one period to a date. @code{-1950Q1} is identical to @code{1949Q4}. The unary minus operator is the reciprocal of the unary plus operator, @code{+-1950Q1} is identical to @code{1950Q1}.
@item colon operator (@code{:}) @item colon operator (@code{:})
...@@ -8485,7 +8909,10 @@ Tests if two @dates objects are equal. @code{+1950Q1==1950Q2} returns @code{1}, ...@@ -8485,7 +8909,10 @@ Tests if two @dates objects are equal. @code{+1950Q1==1950Q2} returns @code{1},
@item ne operator (not equal, @code{~=}) @item ne operator (not equal, @code{~=})
Tests if two @dates objects are not equal. @code{+1950Q1==1950Q2} returns @code{0}, @code{1950Q1==1950Q2} returns @code{1}. If the compared objects have both @code{n>1} elements, the @code{ne} operator returns a column vector, @code{n} by @code{1}, of zeros and ones. Tests if two @dates objects are not equal. @code{+1950Q1~=1950Q2}
returns @code{0} while @code{1950Q1~=1950Q2} returns @code{1}. If the
compared objects both have @code{n>1} elements, the @code{ne} operator
returns an @code{n} by @code{1} column vector of zeros and ones.
@item lt operator (less than, @code{<}) @item lt operator (less than, @code{<})
...@@ -8507,6 +8934,33 @@ Tests if a @dates object follows another @dates object or is equal to this objec ...@@ -8507,6 +8934,33 @@ Tests if a @dates object follows another @dates object or is equal to this objec
@noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}). @noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}).
@remarkhead
@noindent Dynare substitutes any occurrence of dates in the mod file into an instantiation of the @dates class regardless of the context. For instance, @code{d = 1950Q1;} will be translated as @code{d = dates('1950Q1');}. This automatic substitution can lead to a crash if a date is defined in a string. Typically, if the user wants to display a date:
@example
disp('Initial period is 1950Q1');
@end example
@noindent Dynare will translate this as:
@example
disp('Initial period is dates('1950Q1')');
@end example
@noindent which will lead to a crash because this expression is illegal in Matlab. For this situation, Dynare provides the @code{$} escape parameter. The following expression:
@example
disp('Initial period is $1950Q1');
@end example
@noindent will be translated as:
@example
disp('Initial period is 1950Q1');
@end example
@noindent in the generated MATLAB script.
@node dates class @node dates class
@subsection dates class @subsection dates class
...@@ -8515,7 +8969,7 @@ The @dates class has three members: ...@@ -8515,7 +8969,7 @@ The @dates class has three members:
@anchor{dates class members} @anchor{dates class members}
@item freq @item freq
an integer equal to 1, 4, 12 or 52 (resp. for annual, quaterly, monthly an integer equal to 1, 4, 12 or 52 (resp. for annual, quarterly, monthly
or weekly dates). or weekly dates).
@item ndat @item ndat
...@@ -8523,12 +8977,14 @@ an integer scalar, the number of declared dates in the object. ...@@ -8523,12 +8977,14 @@ an integer scalar, the number of declared dates in the object.
@item time @item time
a @code{ndat}*2 array of integers, the years are stored in the first a @code{ndat}*2 array of integers, the years are stored in the first
column, the subperiods (1 for annual dates, 1-4 for quaterly dates, 1-12 column, the subperiods (1 for annual dates, 1-4 for quarterly dates, 1-12
for monthly dates and 1-52 for weekly dates) are stored in the second for monthly dates and 1-52 for weekly dates) are stored in the second
column. column.
@end table @end table
@noindent Each member is private, one can display the content of a member but cannot change its value: @noindent Each member is private, one can display the content of a member but cannot change its value:
@example @example
>> d = dates('2009Q2'); >> d = dates('2009Q2');
>> d.time >> d.time
...@@ -8547,15 +9003,19 @@ ans = ...@@ -8547,15 +9003,19 @@ ans =
@deftypefn {dates} dates () @deftypefn {dates} dates ()
@deftypefnx {dates} dates (@code{FREQ}) @deftypefnx {dates} dates (@code{FREQ})
Returns an empty @dates object with a given frequency (if the constructor is called with one input argument). @code{FREQ} is a character equal to 'Y' or 'A' for annual dates, 'Q' for quaterly dates, 'M' for monthly dates or 'W' for weekly dates. Note that @code{FREQ} is not case sensitive, so that, for instance, 'q' is also allowed for quaterly dates. The frequency can also be set with an integer scalar equal to 1 (annual), 4 (quaterly), 12 (monthly) or 52 (weekly). The instantiation of empty objects can be used to rename the @dates class. For instance, if one only works with quaterly dates, he can create @code{qq} as: Returns an empty @dates object with a given frequency (if the constructor is called with one input argument). @code{FREQ} is a character equal to 'Y' or 'A' for annual dates, 'Q' for quarterly dates, 'M' for monthly dates or 'W' for weekly dates. Note that @code{FREQ} is not case sensitive, so that, for instance, 'q' is also allowed for quarterly dates. The frequency can also be set with an integer scalar equal to 1 (annual), 4 (quarterly), 12 (monthly) or 52 (weekly). The instantiation of empty objects can be used to rename the @dates class. For instance, if one only works with quarterly dates, he can create @code{qq} as:
@example @example
qq = dates('Q') qq = dates('Q')
@end example @end example
and a @dates object holding the date @code{2009Q2}:
@noindent and a @dates object holding the date @code{2009Q2}:
@example @example
d0 = dates(2009,2); d0 = qq(2009,2);
@end example @end example
@noindent which is much simpler if @dates objects have to be defined programatically.
@noindent which is much simpler if @dates objects have to be defined programmatically.
@end deftypefn @end deftypefn
...@@ -8568,7 +9028,6 @@ Returns a @dates object that represents a date as given by the string @code{STRI ...@@ -8568,7 +9028,6 @@ Returns a @dates object that represents a date as given by the string @code{STRI
@end deftypefn @end deftypefn
@sp 1 @sp 1
@deftypefn {dates} dates (@code{DATES}) @deftypefn {dates} dates (@code{DATES})
...@@ -8582,7 +9041,7 @@ Returns a copy of the @dates object @code{DATES} passed as input arguments. If ...@@ -8582,7 +9041,7 @@ Returns a copy of the @dates object @code{DATES} passed as input arguments. If
@deftypefn {dates} dates (@code{FREQ}, @code{YEAR}, @code{SUBPERIOD}) @deftypefn {dates} dates (@code{FREQ}, @code{YEAR}, @code{SUBPERIOD})
where @code{FREQ} is a single character ('Y', 'A', 'Q', 'M', 'W') or integer (1, 4, 12 or 52) specifying the frequency, @code{YEAR} and @code{SUBPERIOD} are @code{n*1} vectors of integers. Returns a @dates object with @code{n} elements. If @code{FREQ} is equal to @code{'Y', 'A'} or @code{1}, the third argument is not needed (because @code{SUBPERIOD} is necessarly a vector of ones in this case). where @code{FREQ} is a single character ('Y', 'A', 'Q', 'M', 'W') or integer (1, 4, 12 or 52) specifying the frequency, @code{YEAR} and @code{SUBPERIOD} are @code{n*1} vectors of integers. Returns a @dates object with @code{n} elements. If @code{FREQ} is equal to @code{'Y', 'A'} or @code{1}, the third argument is not needed (because @code{SUBPERIOD} is necessarily a vector of ones in this case).
@end deftypefn @end deftypefn
...@@ -8598,21 +9057,25 @@ do4 = dates('Q',1950, 1); ...@@ -8598,21 +9057,25 @@ do4 = dates('Q',1950, 1);
@sp 1 @sp 1
A list of the available methods, by alphabetical order, is given below. Note that the Matlab/Octave classes do not allow in place modifications: when a method is applied to an object a new object is instantiated. For instance, to apply the method @code{multiplybytwo} to an object @code{X} we write: @noindent A list of the available methods, by alphabetical order, is given below. Note that the Matlab/Octave classes do not allow in place modifications: when a method is applied to an object a new object is instantiated. For instance, to apply the method @code{multiplybytwo} to an object @code{X} we write:
@example @example
Y = X.multiplybytwo() Y = X.multiplybytwo()
@end example @end example
or equivalently:
@noindent or equivalently:
@example @example
Y = multiplybytwo(X) Y = multiplybytwo(X)
@end example @end example
the object @code{X} is left unchanged, and the object @code{Y} is a modified copy of @code{X}.
@noindent the object @code{X} is left unchanged, and the object @code{Y} is a modified copy of @code{X}.
@sp 1 @sp 1
@deftypefn {dates} {@var{B} = } append (@var{A}, @var{a}) @deftypefn {dates} {@var{C} = } append (@var{A}, @var{B})
Appends @dates object @var{a}, or a string that can be interpreted as a date, to the @dates object @var{A}. If @code{a} is a @dates object it is assumed that it has no more than one element. Appends @dates object @var{B}, or a string that can be interpreted as a date, to the @dates object @var{A}. If @var{B} is a @dates object it is assumed that it has no more than one element.
@examplehead @examplehead
@example @example
...@@ -8770,6 +9233,27 @@ C = <dates: 1951Q1, 1951Q2, 1951Q3, 1951Q4> ...@@ -8770,6 +9233,27 @@ C = <dates: 1951Q1, 1951Q2, 1951Q3, 1951Q4>
@sp 1 @sp 1
@deftypefn{dates} {@var{C} =} setdiff (@var{A}, @var{B})
Overloads the Matlab/Octave @code{setdiff} function. All the input arguments must be @dates objects. The returned argument is a @dates object all dates present in @var{A} but not in @var{B}. If @var{A} and @var{B} are disjoint @dates objects, the function returns @var{A}. Returned dates in @dates object @var{C} are sorted by increasing order.
@examplehead
@example
>> A = dates('1950Q1'):dates('1969Q4') ;
>> B = dates('1960Q1'):dates('1969Q4') ;
>> C = dates('1970Q1'):dates('1979Q4') ;
>> d1 = setdiff(d1,d2);
>> d2 = setdiff(d1,d3);
d1 = <dates: 1950Q1, 1950Q2, ..., 1959Q3, 1959Q4>
d2 = <dates: 1950Q1, 1950Q2, ..., 1969Q3, 1969Q4>
@end example
@end deftypefn
@sp 1
@deftypefn{dates} {@var{B} =} isempty (@var{A}) @deftypefn{dates} {@var{B} =} isempty (@var{A})
Overloads the Matlab/Octave isempty function for @dates object. Overloads the Matlab/Octave isempty function for @dates object.
...@@ -8918,6 +9402,26 @@ ans = <dates: 1950Q3, 1950Q4, 1960Q1> ...@@ -8918,6 +9402,26 @@ ans = <dates: 1950Q3, 1950Q4, 1960Q1>
@sp 1 @sp 1
@deftypefn{dates} {@var{C} =} ne (@var{A}, @var{B})
Overloads the Matlab/Octave @code{ne} (not equal, @code{~=}) operator. @dates objects @var{A} and @var{B} must have the same number of elements (say, @code{n}) or one of the inputs must be a single element @dates object. The returned argument is a @code{n} by @code{1} vector of zeros and ones. The i-th element of @var{C} is equal to @code{1} if and only if the dates @code{A(i)} and @code{B(i)} are different.
@examplehead
@example
>> A = dates('1950Q1','1951Q2');
>> B = dates('1950Q1','1950Q2');
>> A~=B
ans =
0
1
@end example
@end deftypefn
@sp 1
@deftypefn{dates} {@var{C} =} plus (@var{A}, @var{B}) @deftypefn{dates} {@var{C} =} plus (@var{A}, @var{B})
Overloads the Matlab/Octave @code{plus} operator (@code{+}). If both input arguments are @dates objects, then the method combines A and B without removing repetitions. If @var{B} is a vector of integers, the @code{plus} operator shifts the @dates object by @var{B} periods forward. Overloads the Matlab/Octave @code{plus} operator (@code{+}). If both input arguments are @dates objects, then the method combines A and B without removing repetitions. If @var{B} is a vector of integers, the @code{plus} operator shifts the @dates object by @var{B} periods forward.
...@@ -9070,7 +9574,7 @@ A @code{nobs} by @code{vobs} array of doubles, the data. ...@@ -9070,7 +9574,7 @@ A @code{nobs} by @code{vobs} array of doubles, the data.
@end table @end table
@noindent The following constructors are available: @noindent @code{freq}, @code{nobs}, @code{vobs}, @code{data}, @code{name}, @code{tex} are private members. The following constructors are available:
@deftypefn {dseries} dseries () @deftypefn {dseries} dseries ()
@deftypefnx {dseries} dseries (@var{INITIAL_DATE}) @deftypefnx {dseries} dseries (@var{INITIAL_DATE})
...@@ -9100,9 +9604,9 @@ If a @file{.mat} file is used instead, it should provide the same informations. ...@@ -9100,9 +9604,9 @@ If a @file{.mat} file is used instead, it should provide the same informations.
@sp 1 @sp 1
@deftypefn {dseries} dseries (@var{DATA_MATRIX}, @var{INITIAL_DATE}, @var{LIST_OF_NAMES}, @var{LIST_OF_TEX_NAMES}) @deftypefn {dseries} dseries (@var{DATA_MATRIX}[, @var{INITIAL_DATE}[, @var{LIST_OF_NAMES}[, @var{LIST_OF_TEX_NAMES}]]])
If the data is not read from a file, it can be provided via a @math{T}x@math{N} matrix as the first argument to @code{dseries}' constructor, with @math{T} representing the number of observations on @math{N} variables. The second argument, @var{INITIAL_DATE}, can be either a @dates object representing the period of the first observation or a string which would be used to instantiate a @dates object. The third argument, @var{LIST_OF_NAMES}, is a @math{N} by @math{1} cell of strings with one entry for each variable name. The final argument, @var{LIST_OF_TEX_NAMES}, is a @math{N} by @math{1} cell of strings composed of the @LaTeX{} names associated with the variables. Input arguments two, three and four are optional. The default value for @var{INITIAL_DATE} is @code{1Y}. If the data is not read from a file, it can be provided via a @math{T}x@math{N} matrix as the first argument to @code{dseries}' constructor, with @math{T} representing the number of observations on @math{N} variables. The optional second argument, @var{INITIAL_DATE}, can be either a @dates object representing the period of the first observation or a string which would be used to instantiate a @dates object. Its default value is @code{dates('1Y')}. The optional third argument, @var{LIST_OF_NAMES}, is a @math{N} by @math{1} cell of strings with one entry for each variable name. The default name associated with column @code{i} of @var{DATA_MATRIX} is @code{Variable_i}. The final argument, @var{LIST_OF_TEX_NAMES}, is a @math{N} by @math{1} cell of strings composed of the @LaTeX{} names associated with the variables. The default @LaTeX{} name associated with column @code{i} of @var{DATA_MATRIX} is @code{Variable\_i}.
@end deftypefn @end deftypefn
...@@ -9116,21 +9620,23 @@ Various ways to create a @code{dseries} object: ...@@ -9116,21 +9620,23 @@ Various ways to create a @code{dseries} object:
@example In a mod file: @example In a mod file:
do1 = dseries(1999Q3); do1 = dseries(1999Q3);
do2 = dseries(`filename.csv'); do2 = dseries('filename.csv');
do3 = dseries([1; 2; 3], 1999Q3, @{`var123'@}, @{`var_@{123@}'@}); do3 = dseries([1; 2; 3], 1999Q3, @{'var123'@}, @{'var_@{123@}'@});
@end example @end example
@sp 1 @sp 1
@example In a Matlab/Octave script: @example In a Matlab/Octave script:
>> do1 = dseries(dates('1999Q3')); >> do1 = dseries(dates('1999Q3'));
>> do2 = dseries(`filename.csv'); >> do2 = dseries('filename.csv');
>> do3 = dseries([1; 2; 3], dates('1999Q3'), @{`var123'@}, @{`var_@{123@}'@}); >> do3 = dseries([1; 2; 3], dates('1999Q3'), @{'var123'@}, @{'var_@{123@}'@});
@end example @end example
@sp 1 @sp 1
A list of the available methods, by alphabetical order, is given below. @noindent One can easily create subsamples from a @dseries object using the overloaded parenthesis operator. If @var{ds} is a @dseries object with @math{T} observations and @var{d} is a @dates object with @math{S<T} elements, such that @math{min(d)} is not smaller than the date associated to the first observation in @var{ds} and @math{max(d)} is not greater than the date associated to the last observation, then @code{ds(d)} instantiates a new @dseries object containing the subsample defined by @var{d}.
@noindent A list of the available methods, by alphabetical order, is given below.
@deftypefn {dseries} {[@var{A}, @var{B}] = } align (@var{A}, @var{B}) @deftypefn {dseries} {[@var{A}, @var{B}] = } align (@var{A}, @var{B})
...@@ -9172,7 +9678,7 @@ ts1 is a dseries object: ...@@ -9172,7 +9678,7 @@ ts1 is a dseries object:
@deftypefn {dseries} {@var{B} = } baxter_king_filter (@var{A}, @var{hf}, @var{lf}, @var{K}) @deftypefn {dseries} {@var{B} = } baxter_king_filter (@var{A}, @var{hf}, @var{lf}, @var{K})
Implementation of Baxter and King (1999) band pass filter for @dseries objects. This filter isolates business cycle fluctuations with a period of length ranging between @var{hf} (high frequency) to @var{lf} (low frequency) using a symetric moving average smoother with @math{2K+1} points, so that K observations at the beginning and at the end of the sample are lost in the computation of the filter. Implementation of the Baxter and King (1999) band pass filter for @dseries objects. This filter isolates business cycle fluctuations with a period of length ranging between @var{hf} (high frequency) to @var{lf} (low frequency) using a symmetric moving average smoother with @math{2K+1} points, so that K observations at the beginning and at the end of the sample are lost in the computation of the filter. The default value for @var{hf} is @math{6}, for @var{lf} is @math{32}, and for @var{K} is 12.
@examplehead @examplehead
@example @example
...@@ -9226,7 +9732,7 @@ Sanity check of @dseries object @var{A}. Returns @math{1} if there is an error, ...@@ -9226,7 +9732,7 @@ Sanity check of @dseries object @var{A}. Returns @math{1} if there is an error,
@deftypefn {dseries} {@var{B} = } cumsum (@var{A}[, @var{d}[, @var{v}]]) @deftypefn {dseries} {@var{B} = } cumsum (@var{A}[, @var{d}[, @var{v}]])
Overloads the Matlab/Octave @code{cumsum} function for @dseries objects. The cumulated sum cannot be computed if the variables in @dseries object @var{A} have @code{NaN}s. If a @dates object @var{d} is provided as a second argument, then the method computes the cumulated sum with the additional constraint that the variables in the @dseries object @var{B} are zero in period @var{d}. If a single observation @dseries object @var{v} is provided as a third argument, the cumulated sum in @var{B} is such that @code{B(d)} matches @var{v}. Overloads the Matlab/Octave @code{cumsum} function for @dseries objects. The cumulated sum cannot be computed if the variables in @dseries object @var{A} has @code{NaN}s. If a @dates object @var{d} is provided as a second argument, then the method computes the cumulated sum with the additional constraint that the variables in the @dseries object @var{B} are zero in period @var{d}. If a single observation @dseries object @var{v} is provided as a third argument, the cumulated sum in @var{B} is such that @code{B(@var{d})} matches @var{v} (@dseries objects @var{A} and @var{v} must have the same number of variables).
@examplehead @examplehead
@example @example
...@@ -9321,7 +9827,7 @@ Overloads the Matlab/Octave @code{exp} function for @dseries objects. ...@@ -9321,7 +9827,7 @@ Overloads the Matlab/Octave @code{exp} function for @dseries objects.
@sp 1 @sp 1
@deftypefn{dseries} {@var{C} =} extract (@var{A}, @var{B}[, ]...) @deftypefn{dseries} {@var{C} =} extract (@var{A}, @var{B}[, ...])
Extracts some variables from a @dseries object @var{A} and returns a @dseries object @var{C}. The input arguments following @var{A} are strings representing the variables to be selected in the new @dseries object @var{C}. To simplify the creation of sub-objects, the @dseries class overloads the curly braces (@code{D = extract (A, B, C)} is equivalent to @code{D = A@{B,C@}}) and allows implicit loops (defined between a pair of @@ symbol, see examples below) or Matlab/Octave's regular expressions (introduced by square brackets). Extracts some variables from a @dseries object @var{A} and returns a @dseries object @var{C}. The input arguments following @var{A} are strings representing the variables to be selected in the new @dseries object @var{C}. To simplify the creation of sub-objects, the @dseries class overloads the curly braces (@code{D = extract (A, B, C)} is equivalent to @code{D = A@{B,C@}}) and allows implicit loops (defined between a pair of @@ symbol, see examples below) or Matlab/Octave's regular expressions (introduced by square brackets).
...@@ -9363,9 +9869,16 @@ ans is a dseries object: ...@@ -9363,9 +9869,16 @@ ans is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} {@var{D} =} horzcat (@var{A}, @var{B}[, ]...) @deftypefn{dseries} {@var{D} =} horzcat (@var{A}, @var{B}[, ...])
Overloads the @code{horzcat} Matlab/Octave's method for @dseries objects. Returns a @dseries object @var{D} containing the variables in @dseries objects passed as inputs: @var{A}, @var{B}, ... If the inputs are not defined on the same time ranges, the method add @code{NaN}s to the variables so that the variables are redefined on the smallest common time range. Note that the names in the @dseries objects passed as inputs must be different and these objects must have common frequency. Overloads the @code{horzcat} Matlab/Octave's method for @dseries
objects. Returns a @dseries object @var{D} containing the variables
in @dseries objects passed as inputs: @var{A}, @var{B}, ... If the
inputs are not defined on the same time ranges, the method adds
@code{NaN}s to the variables so that the variables are redefined on
the smallest common time range. Note that the names in the @dseries
objects passed as inputs must be different and these objects must have
common frequency.
@examplehead @examplehead
@example @example
...@@ -9394,7 +9907,10 @@ ts2 is a dseries object: ...@@ -9394,7 +9907,10 @@ ts2 is a dseries object:
@deftypefn {dseries} {@var{B} = } hpcycle (@var{A}[, @var{lambda}]) @deftypefn {dseries} {@var{B} = } hpcycle (@var{A}[, @var{lambda}])
Extracts the cycle component from a @dseries @var{A} object using Hodrick Prescott filter and returns a @dseries object, @var{B}. Default value for @var{lambda}, the smoothing parameter, is @math{1600}. Extracts the cycle component from a @dseries @var{A} object using
Hodrick Prescott (1997) filter and returns a @dseries object, @var{B}. The
default value for @var{lambda}, the smoothing parameter, is
@math{1600}.
@examplehead @examplehead
@example @example
...@@ -9440,7 +9956,7 @@ The previous code should produce something like: ...@@ -9440,7 +9956,7 @@ The previous code should produce something like:
@deftypefn {dseries} {@var{B} = } hptrend (@var{A}[, @var{lambda}]) @deftypefn {dseries} {@var{B} = } hptrend (@var{A}[, @var{lambda}])
Extracts the trend component from a @dseries @var{A} object using Hodrick Prescott filter and returns a @dseries object, @var{B}. Default value for @var{lambda}, the smoothing parameter, is @math{1600}. Extracts the trend component from a @dseries @var{A} object using Hodrick Prescott (1997) filter and returns a @dseries object, @var{B}. Default value for @var{lambda}, the smoothing parameter, is @math{1600}.
@examplehead @examplehead
Using the same generating data process as in the previous example: Using the same generating data process as in the previous example:
...@@ -9472,7 +9988,7 @@ The previous code should produce something like: ...@@ -9472,7 +9988,7 @@ The previous code should produce something like:
@deftypefn {dseries} {@var{C} = } insert (@var{A}, @var{B}, @var{I}) @deftypefn {dseries} {@var{C} = } insert (@var{A}, @var{B}, @var{I})
Inserts variables contained in @dseries object @var{B} in @dseries object @var{A} at positions specified by integer scalars in vector @var{I}, returns augmented @dseries object @var{C}. The integer scalars in @var{I} must take values between @code{1} and @code{A.length()+1} and refers to @var{A}'s column numbers. The @dseries objects @var{A} and @var{B} need not to be defined over the same time ranges, but it is assumled that they have common frequency. Inserts variables contained in @dseries object @var{B} in @dseries object @var{A} at positions specified by integer scalars in vector @var{I}, returns augmented @dseries object @var{C}. The integer scalars in @var{I} must take values between @code{1} and @code{A.length()+1} and refers to @var{A}'s column numbers. The @dseries objects @var{A} and @var{B} need not to be defined over the same time ranges, but it is assumed that they have common frequency.
@examplehead @examplehead
@example @example
...@@ -9620,6 +10136,7 @@ ts2 is a dseries object: ...@@ -9620,6 +10136,7 @@ ts2 is a dseries object:
@noindent @remarkhead @noindent @remarkhead
@noindent The overloading of the parenthesis for @dseries objects, allows to easily create new @dseries objects by copying/pasting equations declared in the @code{model} block. For instance, if an Euler equation is defined in the @code{model} block: @noindent The overloading of the parenthesis for @dseries objects, allows to easily create new @dseries objects by copying/pasting equations declared in the @code{model} block. For instance, if an Euler equation is defined in the @code{model} block:
@example @example
model; model;
... ...
...@@ -9627,11 +10144,14 @@ model; ...@@ -9627,11 +10144,14 @@ model;
... ...
end; end;
@end example @end example
@noindent and if variables @var{C}, @var{A} and @var{K} are defined as @dseries objects, then by writting: @noindent and if variables @var{C}, @var{A} and @var{K} are defined as @dseries objects, then by writting:
@example @example
Residuals = 1/C - beta/C(1)*(exp(A(1))*K^(alpha-1)+1-delta) ; Residuals = 1/C - beta/C(1)*(exp(A(1))*K^(alpha-1)+1-delta) ;
@end example @end example
@noindent outside of the @code{model} block, we create a new @dseries object, called @var{Residuals}, for the residuals of the Euler equation (the conditional expectation of the equation defined in the @code{model} block is zero, but the residuals are non zero).
@noindent outside of the @code{model} block, we create a new @dseries object, called @code{Residuals}, for the residuals of the Euler equation (the conditional expectation of the equation defined in the @code{model} block is zero, but the residuals are non zero).
@sp 1 @sp 1
...@@ -9699,7 +10219,28 @@ ans is a dseries object: ...@@ -9699,7 +10219,28 @@ ans is a dseries object:
@deftypefn{dseries} {@var{C} =} minus (@var{A}, @var{B}) @deftypefn{dseries} {@var{C} =} minus (@var{A}, @var{B})
Overloads the @code{minus} (@code{-}) operator for @dseries objects, element by element substraction. If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{minus} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)-B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, the @code{minus} operator will substract the variable defined in @var{B} to each variable in @var{A}. If @var{B} is a double scalar, then the method @code{minus} will substract @var{B} to all the observations/variables in @var{A}. Overloads the @code{minus} (@code{-}) operator for @dseries objects,
element by element subtraction. If both @var{A} and @var{B}
are @dseries objects, they do not need to be defined over the same
time ranges. If @var{A} and @var{B} are @dseries objects with
@math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B}
variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and
@math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B},
@code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the
@code{minus} operator will compute for each couple @math{(t,n)}, with
@math{1\le t\le T_A} and @math{1\le n\le N_A},
@code{C.data(t,n)=A.data(t,n)-B.data(t,n)}. If @math{N_B} is equal to
@math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is
``broadcast'' across the larger @dseries (@var{A}) so that they have
compatible shapes, the @code{minus} operator will subtract the
variable defined in @var{B} from each variable in @var{A}. If @var{B}
is a double scalar, then the method @code{minus} will subtract
@var{B} from all the observations/variables in @var{A}. If @var{B} is
a row vector of length @math{N_A}, then the @code{minus} method will
subtract @code{B(i)} from all the observations of variable @code{i},
for @math{i=1,...,N_A}. If @var{B} is a column vector of length
@math{T_A}, then the @code{minus} method will subtract @code{B} from
all the variables.
@examplehead @examplehead
@example @example
...@@ -9746,9 +10287,61 @@ ans is a dseries object: ...@@ -9746,9 +10287,61 @@ ans is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} {@var{C} =} mpower (@var{A}, @var{B})
Overloads the @code{mpower} (@code{^}) operator for @dseries objects and computes element-by-element power. @var{A} is a @dseries object with @code{N} variables and @code{T} observations. If @var{B} is a real scalar, then @code{mpower(@var{A},@var{B})} returns a @dseries object @var{C} with @code{C.data(t,n)=A.data(t,n)^C}. If @var{B} is a @dseries object with @code{N} variables and @code{T} observations then @code{mpower(@var{A},@var{B})} returns a @dseries object @var{C} with @code{C.data(t,n)=A.data(t,n)^C.data(t,n)}.
@examplehead
@example
>> ts0 = dseries(transpose(1:3));
>> ts1 = ts0^2
ts1 is a dseries object:
| power(Variable_1,2)
1Y | 1
2Y | 4
3Y | 9
>> ts2 = ts0^ts0
ts2 is a dseries object:
| power(Variable_1,Variable_1)
1Y | 1
2Y | 4
3Y | 27
@end example
@end deftypefn
@sp 1
@deftypefn{dseries} {@var{C} =} mrdivide (@var{A}, @var{B}) @deftypefn{dseries} {@var{C} =} mrdivide (@var{A}, @var{B})
Overloads the @code{mrdivide} (@code{/}) operator for @dseries objects, element by element division (like the @code{./} Matlab/Octave operator). If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{mrdivide} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)/B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, @code{mrdivides} operator will divide each variable defined in @var{A} by the variable in @var{B}, observation per observation. If @var{B} is a double scalar, then the method @code{mrdivide} will divide all the observations/variables in @var{A} by @var{B}. Overloads the @code{mrdivide} (@code{/}) operator for @dseries
objects, element by element division (like the @code{./} Matlab/Octave
operator). If both @var{A} and @var{B} are @dseries objects, they do
not need to be defined over the same time ranges. If @var{A} and
@var{B} are @dseries objects with @math{T_A} and @math{T_B}
observations and @math{N_A} and @math{N_B} variables, then @math{N_A}
must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal
to @math{N_A} or @math{1}. If @math{T_A=T_B},
@code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the
@code{mrdivide} operator will compute for each couple @math{(t,n)},
with @math{1\le t\le T_A} and @math{1\le n\le N_A},
@code{C.data(t,n)=A.data(t,n)/B.data(t,n)}. If @math{N_B} is equal to
@math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is
``broadcast'' across the larger @dseries (@var{A}) so that they have
compatible shapes. In this case the @code{mrdivides} operator will
divide each variable defined in @var{A} by the variable in @var{B},
observation per observation. If @var{B} is a double scalar, then
@code{mrdivide} will divide all the observations/variables in @var{A}
by @var{B}. If @var{B} is a row vector of length @math{N_A}, then
@code{mrdivide} will divide all the observations of variable @code{i}
by @code{B(i)}, for @math{i=1,...,N_A}. If @var{B} is a column vector
of length @math{T_A}, then @code{mrdivide} will perform a division of
all the variables by @code{B}, element by element.
@examplehead @examplehead
@example @example
...@@ -9778,7 +10371,29 @@ ans is a dseries object: ...@@ -9778,7 +10371,29 @@ ans is a dseries object:
@deftypefn{dseries} {@var{C} =} mtimes (@var{A}, @var{B}) @deftypefn{dseries} {@var{C} =} mtimes (@var{A}, @var{B})
Overloads the @code{mtimes} (@code{*}) operator for @dseries objects, Hadammard product (the @code{.*} Matlab/Octave operator). If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{mtimes} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)*B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, @code{mtimes} operator will multiply each variable defined in @var{A} by the variable in @var{B}, observation per observation. If @var{B} is a double scalar, then the method @code{mtimes} will multiply all the observations/variables in @var{A} by @var{B}. Overloads the @code{mtimes} (@code{*}) operator for @dseries objects
and the Hadammard product (the @code{.*} Matlab/Octave operator). If
both @var{A} and @var{B} are @dseries objects, they do not need to be
defined over the same time ranges. If @var{A} and @var{B} are @dseries
objects with @math{T_A} and @math{T_B} observations and @math{N_A} and
@math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or
@math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If
@math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and
@math{N_A=N_B}, then the @code{mtimes} operator will compute for each
couple @math{(t,n)}, with @math{1\le t\le T_A} and @math{1\le n\le N_A},
@code{C.data(t,n)=A.data(t,n)*B.data(t,n)}. If @math{N_B} is equal to
@math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is
``broadcast'' across the larger @dseries (@var{A}) so that they have
compatible shapes, @code{mtimes} operator will multiply each variable
defined in @var{A} by the variable in @var{B}, observation per
observation. If @var{B} is a double scalar, then the method
@code{mtimes} will multiply all the observations/variables in @var{A}
by @var{B}. If @var{B} is a row vector of length @math{N_A}, then the
@code{mtimes} method will multiply all the observations of variable
@code{i} by @code{B(i)}, for @math{i=1,...,N_A}. If @var{B} is a
column vector of length @math{T_A}, then the @code{mtimes} method will
perform a multiplication of all the variables by @code{B}, element by
element.
@end deftypefn @end deftypefn
...@@ -9859,15 +10474,35 @@ Overloads Matlab/Octave's @code{plot} function for @dseries objects. Returns a M ...@@ -9859,15 +10474,35 @@ Overloads Matlab/Octave's @code{plot} function for @dseries objects. Returns a M
@deftypefn{dseries} {@var{C} =} plus (@var{A}, @var{B}) @deftypefn{dseries} {@var{C} =} plus (@var{A}, @var{B})
Overloads the @code{plus} (@code{+}) operator for @dseries objects, element by element addition. If both @var{A} and @var{B} are @dseries objects, they do not need to be defined over the same time ranges. If @var{A} and @var{B} are @dseries object with @math{T_A} and @math{T_B} observations and @math{N_A} and @math{N_B} variables, then @math{N_A} must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal to @math{N_A} or @math{1}. If @math{T_A=T_B}, @code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the @code{minus} operator will compute for each couple @math{(t,n)}, with @math{1<=t<=T_A} and @math{1<=n<=N_A}, @code{C.data(t,n)=A.data(t,n)+B.data(t,n)}. If @math{N_B} is equal to @math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is ``broadcast'' across the larger @dseries (@var{A}) so that they have compatible shapes, the @code{plus} operator will add the variable defined in @var{B} to each variable in @var{A}. If @var{B} is a double scalar, then the method @code{add} will add @var{B} to all the observations/variables in @var{A}. Overloads the @code{plus} (@code{+}) operator for @dseries objects,
element by element addition. If both @var{A} and @var{B} are @dseries
objects, they do not need to be defined over the same time ranges. If
@var{A} and @var{B} are @dseries objects with @math{T_A} and @math{T_B}
observations and @math{N_A} and @math{N_B} variables, then @math{N_A}
must be equal to @math{N_B} or @math{1} and @math{N_B} must be equal
to @math{N_A} or @math{1}. If @math{T_A=T_B},
@code{isequal(A.init,B.init)} returns 1 and @math{N_A=N_B}, then the
@code{plus} operator will compute for each couple @math{(t,n)}, with
@math{1\le t\le T_A} and @math{1\le n\le N_A},
@code{C.data(t,n)=A.data(t,n)+B.data(t,n)}. If @math{N_B} is equal to
@math{1} and @math{N_A>1}, the smaller @dseries object (@var{B}) is
``broadcast'' across the larger @dseries (@var{A}) so that they have
compatible shapes, the @code{plus} operator will add the variable
defined in @var{B} to each variable in @var{A}. If @var{B} is a double
scalar, then the method @code{plus} will add @var{B} to all the
observations/variables in @var{A}. If @var{B} is a row vector of
length @math{N_A}, then the @code{plus} method will add @code{B(i)} to
all the observations of variable @code{i}, for @math{i=1,...,N_A}. If
@var{B} is a column vector of length @math{T_A}, then the @code{plus}
method will add @code{B} to all the variables.
@end deftypefn @end deftypefn
@sp 1 @sp 1
@deftypefn{dseries} {@var{B} =} pop (@var{A}[, @var{a}]) @deftypefn{dseries} {@var{C} =} pop (@var{A}[, @var{B}])
Removes variable @var{a} from @dseries object @var{A}. By default, if the second argument is not provided, the last variable is removed. Removes variable @var{B} from @dseries object @var{A}. By default, if the second argument is not provided, the last variable is removed.
@examplehead @examplehead
@example @example
...@@ -9889,7 +10524,7 @@ ts1 is a dseries object: ...@@ -9889,7 +10524,7 @@ ts1 is a dseries object:
@deftypefn{dseries} {@var{B} =} qdiff (@var{A}) @deftypefn{dseries} {@var{B} =} qdiff (@var{A})
@deftypefnx{dseries} {@var{B} =} qgrowth (@var{A}) @deftypefnx{dseries} {@var{B} =} qgrowth (@var{A})
Computes quaterly differences or growth rates. Computes quarterly differences or growth rates.
@examplehead @examplehead
@example @example
...@@ -9924,7 +10559,8 @@ ts1 is a dseries object: ...@@ -9924,7 +10559,8 @@ ts1 is a dseries object:
@deftypefn{dseries} {@var{B} =} rename (@var{A},@var{oldname},@var{newname}) @deftypefn{dseries} {@var{B} =} rename (@var{A},@var{oldname},@var{newname})
Rename variable @var{oldname} to @var{newname} in @dseries object @var{A}, returns a @dseries object. Rename variable @var{oldname} to @var{newname} in @dseries object
@var{A}. Returns a @dseries object.
@examplehead @examplehead
@example @example
...@@ -9942,26 +10578,36 @@ ts1 is a dseries object: ...@@ -9942,26 +10578,36 @@ ts1 is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} save (@var{A}[, @var{basename}[, @var{format}]]) @deftypefn{dseries} save (@var{A}, @var{basename}[, @var{format}])
Overloads the Matlab/Octave @code{save} function, saves @dseries object @var{A} to disk. Possible formats are @code{csv} (this is the default), @code{m} (Matlab/Octave script), and @code{mat} (Matlab binary data file). The name of the file without extension is specified by @var{basename}, by default @var{basename} is the name of the first input (namely, the @dseries object @var{A}). Overloads the Matlab/Octave @code{save} function and saves @dseries
object @var{A} to disk. Possible formats are @code{csv} (this is the
default), @code{m} (Matlab/Octave script), and @code{mat} (Matlab
binary data file). The name of the file without extension is specified
by @var{basename}.
@examplehead @examplehead
@example @example
>> ts0 = dseries(ones(2,2)); >> ts0 = dseries(ones(2,2));
>> ts0.save(); >> ts0.save('ts0');
@end example @end example
@noindent The last command will create a file @code{ts0.csv} with the following content: @noindent The last command will create a file @code{ts0.csv} with the following content:
@example @example
,Variable_1,Variable_2 ,Variable_1,Variable_2
1Y, 1, 1 1Y, 1, 1
2Y, 1, 1 2Y, 1, 1
@end example @end example
To create a Matlab/octave script, the following command:
@noindent To create a Matlab/octave script, the following command:
@example @example
>> ts0.save([],'m'); >> ts0.save('ts0','m');
@end example @end example
will produce a file @code{ts0.m} with the following content:
@noindent will produce a file @code{ts0.m} with the following content:
@example @example
% File created on 14-Nov-2013 12:08:52. % File created on 14-Nov-2013 12:08:52.
...@@ -9979,6 +10625,7 @@ Variable_2 = [ ...@@ -9979,6 +10625,7 @@ Variable_2 = [
1 1
1]; 1];
@end example @end example
@noindent The generated (@code{csv}, @code{m}, or @code{mat}) files can be loaded when instantiating a @dseries object as explained above. @noindent The generated (@code{csv}, @code{m}, or @code{mat}) files can be loaded when instantiating a @dseries object as explained above.
@end deftypefn @end deftypefn
...@@ -9987,7 +10634,12 @@ Variable_2 = [ ...@@ -9987,7 +10634,12 @@ Variable_2 = [
@deftypefn{dseries} {@var{B} =} set_names (@var{A}, @var{s1}, @var{s2}, ...) @deftypefn{dseries} {@var{B} =} set_names (@var{A}, @var{s1}, @var{s2}, ...)
Renames variables in @dseries object @var{A}, returns a @dseries object @var{B} with new names @var{s1}, @var{s2}, @var{s3}, ... The number of input arguments after the first one (@dseries object @var{A}) must be equal to @code{A.vobs} (the number of variables in @var{A}). @var{s1} will be the name of the first variable in @var{B}, @var{s2} the name of the second variable in @var{B}, and so on. Renames variables in @dseries object @var{A} and returns a @dseries
object @var{B} with new names @var{s1}, @var{s2}, @var{s3}, ... The
number of input arguments after the first one (@dseries object
@var{A}) must be equal to @code{A.vobs} (the number of variables in
@var{A}). @var{s1} will be the name of the first variable in @var{B},
@var{s2} the name of the second variable in @var{B}, and so on.
@examplehead @examplehead
@example @example
...@@ -10024,7 +10676,8 @@ ans = ...@@ -10024,7 +10676,8 @@ ans =
@deftypefn{dseries} {@var{B} =} tex_rename (@var{A}, @var{name}, @var{newtexname}) @deftypefn{dseries} {@var{B} =} tex_rename (@var{A}, @var{name}, @var{newtexname})
Redefines the tex name of variable @var{name} to @var{newtexname} in @dseries object @var{A}, returns a @dseries object. Redefines the tex name of variable @var{name} to @var{newtexname}
in @dseries object @var{A}. Returns a @dseries object.
@end deftypefn @end deftypefn
...@@ -10055,9 +10708,14 @@ ts1 is a dseries object: ...@@ -10055,9 +10708,14 @@ ts1 is a dseries object:
@sp 1 @sp 1
@deftypefn{dseries} {@var{D} =} vertcat (@var{A}, @var{B}[, ]...) @deftypefn{dseries} {@var{D} =} vertcat (@var{A}, @var{B}[, ...])
Overloads the @code{vertcat} Matlab/Octave's method for @dseries objects. This method is used to append more observations to a @dseries object. Returns a @dseries object @var{D} containing the variables in @dseries objects passed as inputs. All the input arguments must be @dseries objects with the same variables defined on @emph{different time ranges}. Overloads the @code{vertcat} Matlab/Octave method for @dseries
objects. This method is used to append more observations to a @dseries
object. Returns a @dseries object @var{D} containing the variables
in @dseries objects passed as inputs. All the input arguments must
be @dseries objects with the same variables defined on @emph{different
time ranges}.
@examplehead @examplehead
@example @example
...@@ -10094,7 +10752,7 @@ created through Dynare or pick out the pieces you want for inclusion ...@@ -10094,7 +10752,7 @@ created through Dynare or pick out the pieces you want for inclusion
in your own paper. in your own paper.
Reports are created and modified by calling methods on class Reports are created and modified by calling methods on class
objects. The objects are hierarchichal, with the following order (from objects. The objects are hierarchical, with the following order (from
highest to lowest): @code{Report, Page, Section, Graph/Table/Vspace, highest to lowest): @code{Report, Page, Section, Graph/Table/Vspace,
Series}. For simplicity of syntax, we abstract away from these Series}. For simplicity of syntax, we abstract away from these
classes, allowing you to operate directly on a @code{Report} object, classes, allowing you to operate directly on a @code{Report} object,
...@@ -10113,8 +10771,8 @@ with the example at the end of the section. ...@@ -10113,8 +10771,8 @@ with the example at the end of the section.
Options to the methods are passed differently than those to Dynare Options to the methods are passed differently than those to Dynare
commands. They take the form of named options to Matlab functions commands. They take the form of named options to Matlab functions
where the arguments come in pairs (@i{e.g.} where the arguments come in pairs (@i{e.g.}
@code{function_name(`option_1_name', `option_1_value', @code{function_name('option_1_name', `option_1_value',
`option_2_name', `option_2_value', ...)}, where @code{option_X_name} 'option_2_name', 'option_2_value', ...)}, where @code{option_X_name}
is the name of the option while @code{option_X_value} is the value is the name of the option while @code{option_X_value} is the value
assigned to that option). The ordering of the option pairs matters assigned to that option). The ordering of the option pairs matters
only in the unusual case when an option is provided twice (probably only in the unusual case when an option is provided twice (probably
...@@ -10206,7 +10864,7 @@ command. Default: @code{`!'} ...@@ -10206,7 +10864,7 @@ command. Default: @code{`!'}
@end table @end table
@end defmethod @end defmethod
@defmethod Report addGraph data, figname, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTickLabels, yrange, showZeroline @defmethod Report addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline
Adds a @code{Graph} to a @code{Section}. Adds a @code{Graph} to a @code{Section}.
@optionshead @optionshead
@table @code @table @code
...@@ -10219,6 +10877,10 @@ The @code{dseries} that provides the data for the graph. Default: ...@@ -10219,6 +10877,10 @@ The @code{dseries} that provides the data for the graph. Default:
The name to use when saving this figure. Default: @code{[tempname The name to use when saving this figure. Default: @code{[tempname
`.tex']} `.tex']}
@item figDirName, @code{STRING}
The name of the folder in which to store this figure. Default:
@code{tmpFigDir}
@item graphSize, @code{NUMERICAL_VECTOR} @item graphSize, @code{NUMERICAL_VECTOR}
The width and height to be passed to the third and fourth elements of The width and height to be passed to the third and fourth elements of
the array passed to the @code{`Position'} option of Matlab's the array passed to the @code{`Position'} option of Matlab's
...@@ -10275,9 +10937,16 @@ The y-axis label. Default: @code{none} ...@@ -10275,9 +10937,16 @@ The y-axis label. Default: @code{none}
@item xrange, @code{dates} @item xrange, @code{dates}
The boundary on the x-axis to display in the graph. Default: all The boundary on the x-axis to display in the graph. Default: all
@anchor{xTicks}
@item xTicks, @code{NUMERICAL_VECTOR}
Used only in conjunction with @ref{xTickLabels}, this option denotes
the numerical position of the label along the x-axis. The positions
begin at @math{1}. Default: set by Matlab/Octave.
@anchor{xTickLabels}
@item xTickLabels, @code{CELL_ARRAY_STRINGS} @item xTickLabels, @code{CELL_ARRAY_STRINGS}
The labels to use for the xticks in the graph. Default: the dates of The labels to be mapped to the ticks provided by
the @code{dseries} @ref{xTicks}. Default: the dates of the @code{dseries}
@item yrange, @code{NUMERICAL_VECTOR} @item yrange, @code{NUMERICAL_VECTOR}
The boundary on the y-axis to display in the graph, represented as a The boundary on the y-axis to display in the graph, represented as a
...@@ -10290,16 +10959,11 @@ Display a solid black line at @math{y = 0}. Default: @code{false} ...@@ -10290,16 +10959,11 @@ Display a solid black line at @math{y = 0}. Default: @code{false}
@end table @end table
@end defmethod @end defmethod
@defmethod Report addTable annualAverages, data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines @defmethod Report addTable data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines
Adds a @code{Table} to a @code{Section}. Adds a @code{Table} to a @code{Section}.
@optionshead @optionshead
@table @code @table @code
@item annualAverages, @code{bool}
Compute the average over every year in the table and display it in a
column to the right of the data (one column for every year). Only
works for quarterly data. Default: @code{false}
@item data, @code{dseries} @item data, @code{dseries}
@xref{data}. @xref{data}.
...@@ -10321,8 +10985,9 @@ Title for the table. Default: @code{none} ...@@ -10321,8 +10985,9 @@ Title for the table. Default: @code{none}
@item titleSize, @code{STRING} @item titleSize, @code{STRING}
@LaTeX{} string representing the size of the table title. Default: @code{large} @LaTeX{} string representing the size of the table title. Default: @code{large}
@item vlineAfter, @code{dates} @item vlineAfter, @code{dates} | @code{CELL_ARRAY_DATES}
Show a vertical line after the specified date. Default: @code{empty} Show a vertical line after the specified date (or dates if a cell
array of dates is passed). Default: @code{empty}
@item vlineAfterEndOfPeriod, @code{BOOLEAN} @item vlineAfterEndOfPeriod, @code{BOOLEAN}
Show a vertical line after the end of every period (@i{i.e.} after Show a vertical line after the end of every period (@i{i.e.} after
...@@ -10334,7 +10999,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal ...@@ -10334,7 +10999,7 @@ Whether or not to show vertical lines separating the columns. Default: @code{fal
@end defmethod @end defmethod
@anchor{addSeries} @anchor{addSeries}
@defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol @defmethod Report addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol
Adds a @code{Series} to a @code{Graph} or a @code{Table}. Adds a @code{Series} to a @code{Graph} or a @code{Table}.
@optionshead @optionshead
@table @code @table @code
...@@ -10363,6 +11028,13 @@ The face color of the graph marker. Default: @code{`auto'} ...@@ -10363,6 +11028,13 @@ The face color of the graph marker. Default: @code{`auto'}
@item graphMarkerSize, @code{DOUBLE} @item graphMarkerSize, @code{DOUBLE}
The size of the graph marker. Default: @code{6} The size of the graph marker. Default: @code{6}
@item tableDataRhs, @code{dseries}
A series to be added to the right of the current series. Usefull for
displaying aggregate data for a series. @i{e.g} if the series is
quarterly @code{tableDataRhs} could point to the yearly averages of
the quarterly series. This would cause quarterly data to be displayed
followed by annual data. Default: @code{empty}
@item tableRowColor, @code{STRING} @item tableRowColor, @code{STRING}
The color that you want the row to be. Predefined values include The color that you want the row to be. Predefined values include
@code{LightCyan} and @code{Gray}. Default: @code{white}. @code{LightCyan} and @code{Gray}. Default: @code{white}.
...@@ -10515,8 +11187,12 @@ Two examples of a small RBC model in a stochastic setup, presented in ...@@ -10515,8 +11187,12 @@ Two examples of a small RBC model in a stochastic setup, presented in
@cite{Collard (2001)} (see the file @file{guide.pdf} which comes with @cite{Collard (2001)} (see the file @file{guide.pdf} which comes with
Dynare). Dynare).
@item example3.mod
A small RBC model in a stochastic setup, presented in
@cite{Collard (2001)}. The steady state is solved analytically using the @code{steady_state_model} block (@pxref{steady_state_model}).
@item fs2000.mod @item fs2000.mod
A cash in advance model, estimated by @cite{Schorfheide (2000)}. A cash in advance model, estimated by @cite{Schorfheide (2000)}. The file shows how to use Dynare for estimation.
@item fs2000_nonstationary.mod @item fs2000_nonstationary.mod
The same model than @file{fs2000.mod}, but written in non-stationary The same model than @file{fs2000.mod}, but written in non-stationary
...@@ -10524,12 +11200,15 @@ form. Detrending of the equations is done by Dynare. ...@@ -10524,12 +11200,15 @@ form. Detrending of the equations is done by Dynare.
@item bkk.mod @item bkk.mod
Multi-country RBC model with time to build, presented in @cite{Backus, Multi-country RBC model with time to build, presented in @cite{Backus,
Kehoe and Kydland (1992)}. Kehoe and Kydland (1992)}. The file shows how to use Dynare's macro-processor.
@item agtrend.mod @item agtrend.mod
Small open economy RBC model with shocks to the growth trend, presented Small open economy RBC model with shocks to the growth trend, presented
in @cite{Aguiar and Gopinath (2004)}. in @cite{Aguiar and Gopinath (2004)}.
@item NK_baseline.mod
Baseline New Keynesian Model estimated in @cite{Fernández-Villaverde (2010)}. It demonstrates how to use an explicit steady state file to update parameters and call a numerical solver.
@end table @end table
@node Dynare misc commands @node Dynare misc commands
...@@ -10570,10 +11249,10 @@ At this time, will work properly for only a small number of routines. At ...@@ -10570,10 +11249,10 @@ At this time, will work properly for only a small number of routines. At
the top of the (available) Matlab/Octave routines a commented block for the top of the (available) Matlab/Octave routines a commented block for
the internal documentation is written in the GNU texinfo documentation the internal documentation is written in the GNU texinfo documentation
format. This block is processed by calling texinfo from format. This block is processed by calling texinfo from
matlab. Consequently, texinfo has to be installed on your machine. MATLAB. Consequently, texinfo has to be installed on your machine.
@item --display-mh-history @item --display-mh-history
Displays informations about the previously saved MCMC draws generated by a mod file named @var{MODFILENAME}. This file must be in the current directory. Displays information about the previously saved MCMC draws generated by a mod file named @var{MODFILENAME}. This file must be in the current directory.
@examplehead @examplehead
@example @example
>> internals --display-mh-history MODFILENAME >> internals --display-mh-history MODFILENAME
...@@ -10627,7 +11306,7 @@ Aguiar, Mark and Gopinath, Gita (2004): ``Emerging Market Business ...@@ -10627,7 +11306,7 @@ Aguiar, Mark and Gopinath, Gita (2004): ``Emerging Market Business
Cycles: The Cycle is the Trend,'' @i{NBER Working Paper}, 10734 Cycles: The Cycle is the Trend,'' @i{NBER Working Paper}, 10734
@item @item
Andreasen, Martin M., Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2013): ``The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications,'' @i{NBER Working Paper}, 18983 Andreasen, Martin M., Jesús Fernández-Villaverde, and Juan Rubio-Ramírez (2013): ``The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications,'' @i{NBER Working Paper}, 18983
@item @item
Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992): Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992):
...@@ -10645,8 +11324,7 @@ monitoring convergence of iterative simulations,'' @i{Journal of ...@@ -10645,8 +11324,7 @@ monitoring convergence of iterative simulations,'' @i{Journal of
computational and graphical statistics}, 7, pp. 434--455 computational and graphical statistics}, 7, pp. 434--455
@item @item
Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): ``The simplex simulated annealing approach to continuous non-linear optimization'', @i{Computers chem. Engng}, 20(9), 1065-1080 Cardoso, Margarida F., R. L. Salcedo and S. Feyo de Azevedo (1996): ``The simplex simulated annealing approach to continuous non-linear optimization,'' @i{Computers chem. Engng}, 20(9), 1065-1080
@item @item
Collard, Fabrice (2001): ``Stochastic simulations with Dynare: A practical guide'' Collard, Fabrice (2001): ``Stochastic simulations with Dynare: A practical guide''
...@@ -10678,8 +11356,8 @@ Models: New Solution Algorithms,'' @i{Macroeconomic Dynamics}, 11(1), ...@@ -10678,8 +11356,8 @@ Models: New Solution Algorithms,'' @i{Macroeconomic Dynamics}, 11(1),
31--55 31--55
@item @item
Durbin, J. and S. J. Koopman (2001), @i{Time Series Analysis by State Durbin, J. and S. J. Koopman (2012), @i{Time Series Analysis by State
Space Methods}, Oxford University Press Space Methods}, Second Revised Edition, Oxford University Press
@item @item
Fair, Ray and John Taylor (1983): ``Solution and Maximum Likelihood Fair, Ray and John Taylor (1983): ``Solution and Maximum Likelihood
...@@ -10696,9 +11374,13 @@ Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2005): ``Estimating ...@@ -10696,9 +11374,13 @@ Fernández-Villaverde, Jesús and Juan Rubio-Ramírez (2005): ``Estimating
Dynamic Equilibrium Economies: Linear versus Nonlinear Likelihood,'' Dynamic Equilibrium Economies: Linear versus Nonlinear Likelihood,''
@i{Journal of Applied Econometrics}, 20, 891--910 @i{Journal of Applied Econometrics}, 20, 891--910
@item
Fernández-Villaverde, Jesús (2010): ``The econometrics of DSGE models,''
@i{SERIEs}, 1, 3--49
@item @item
Geweke, John (1992): ``Evaluating the accuracy of sampling-based approaches Geweke, John (1992): ``Evaluating the accuracy of sampling-based approaches
to the calculation of posterior moments'', in J.O. Berger, J.M. Bernardo, to the calculation of posterior moments,'' in J.O. Berger, J.M. Bernardo,
A.P. Dawid, and A.F.M. Smith (eds.) Proceedings of the Fourth Valencia A.P. Dawid, and A.F.M. Smith (eds.) Proceedings of the Fourth Valencia
International Meeting on Bayesian Statistics, pp. 169--194, Oxford University Press International Meeting on Bayesian Statistics, pp. 169--194, Oxford University Press
...@@ -10731,6 +11413,9 @@ Kim, Jinill, Sunghyun Kim, Ernst Schaumburg, and Christopher A. Sims ...@@ -10731,6 +11413,9 @@ Kim, Jinill, Sunghyun Kim, Ernst Schaumburg, and Christopher A. Sims
discrete time dynamic equilibrium models,'' @i{Journal of Economic discrete time dynamic equilibrium models,'' @i{Journal of Economic
Dynamics and Control}, 32(11), 3397--3414 Dynamics and Control}, 32(11), 3397--3414
@item
Koop, Gary (2003), @i{Bayesian Econometrics}, John Wiley & Sons
@item @item
Koopman, S. J. and J. Durbin (2003): ``Filtering and Smoothing of Koopman, S. J. and J. Durbin (2003): ``Filtering and Smoothing of
State Vector for Diffuse State Space Models,'' @i{Journal of Time State Vector for Diffuse State Space Models,'' @i{Journal of Time
...@@ -10755,6 +11440,9 @@ Pearlman, Joseph, David Currie, and Paul Levine (1986): ``Rational ...@@ -10755,6 +11440,9 @@ Pearlman, Joseph, David Currie, and Paul Levine (1986): ``Rational
expectations models with partial information,'' @i{Economic expectations models with partial information,'' @i{Economic
Modelling}, 3(2), 90--105 Modelling}, 3(2), 90--105
@item
Pfeifer, Johannes (2013): ``A Guide to Specifying Observation Equations for the Estimation of DSGE Models''
@item @item
Rabanal, Pau and Juan Rubio-Ramirez (2003): ``Comparing New Keynesian Rabanal, Pau and Juan Rubio-Ramirez (2003): ``Comparing New Keynesian
Models of the Business Cycle: A Bayesian Approach,'' Federal Reserve Models of the Business Cycle: A Bayesian Approach,'' Federal Reserve
......
...@@ -101,7 +101,7 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail, ...@@ -101,7 +101,7 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail,
majflt = -1; majflt = -1;
#endif #endif
#if !defined(__MINGW32__) && !defined(__CYGWIN32__) #if !defined(__MINGW32__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) && !defined(__MINGW64__) && !defined(__CYGWIN64__)
getloadavg(&load_avg, 1); getloadavg(&load_avg, 1);
#else #else
load_avg = -1.0; load_avg = -1.0;
......
// Copyright (C) 2006-2011, Ondra Kamenik // Copyright (C) 2006-2011, Ondra Kamenik
#include "forw_subst_builder.h" #include "forw_subst_builder.h"
using namespace ogdyn; using namespace ogdyn;
...@@ -47,8 +48,10 @@ void ForwSubstBuilder::substitute_for_term(int t, int i, int j) ...@@ -47,8 +48,10 @@ void ForwSubstBuilder::substitute_for_term(int t, int i, int j)
// first make lagsubst be substitution setting f(x(+4)) to f(x(+1)) // first make lagsubst be substitution setting f(x(+4)) to f(x(+1))
// this is lag = -3 (1-mlead) // this is lag = -3 (1-mlead)
map<int,int> lagsubst; map<int,int> lagsubst;
model.variable_shift_map(model.eqs.nulary_of_term(t), 1-mlead, lagsubst); unordered_set<int> nult = model.eqs.nulary_of_term(t);// make copy of nult!
model.variable_shift_map(nult, 1-mlead, lagsubst);
int lagt = model.eqs.add_substitution(t, lagsubst); int lagt = model.eqs.add_substitution(t, lagsubst);
// now maxlead of lagt is +1 // now maxlead of lagt is +1
// add AUXLD_*_*_1 = f(x(+1)) to the model // add AUXLD_*_*_1 = f(x(+1)) to the model
char name[100]; char name[100];
...@@ -82,7 +85,9 @@ void ForwSubstBuilder::substitute_for_term(int t, int i, int j) ...@@ -82,7 +85,9 @@ void ForwSubstBuilder::substitute_for_term(int t, int i, int j)
aux_map.insert(Tsubstmap::value_type(ss, lagt)); aux_map.insert(Tsubstmap::value_type(ss, lagt));
} }
// now we have to substitute AUXLEAD_*_*{mlead-1}(+1) for t // now we have to substitute AUXLD_*_*{mlead-1}(+1) for t
sprintf(name, "AUXLD_%d_%d_%d", i, j, mlead-1);
ss = model.atoms.get_name_storage().query(name);
model.substitute_atom_for_term(ss, +1, t); model.substitute_atom_for_term(ss, +1, t);
} }
} }
......
...@@ -15,7 +15,14 @@ ...@@ -15,7 +15,14 @@
* equations. Moreover, it makes use of a steady state file to i) set * equations. Moreover, it makes use of a steady state file to i) set
* parameters that depend on other parameters that are potentially estimated * parameters that depend on other parameters that are potentially estimated
* and ii) solve a nonlinear equation using a numerical solver to find the steady * and ii) solve a nonlinear equation using a numerical solver to find the steady
* state of labor. * state of labor. It provides an example on how the steady state file can be used
* to circumvent some of the limitation of Dynare mod-file by accessing an external
* file that allows calling general Matlab routines. These capacities will mostly be
* interesting for power users. If one just wants to provide analytical steady state
* values and update parameters, the steady_state_model-block allows an easy and convenient
* alternative. It even allows calling numerical solvers like fsolve. For an example, see
* 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 Dynare's end of period stock notation, we use the
* predetermined_variables-command. * predetermined_variables-command.
......
function [ys,check] = NK_baseline_steadystate(ys,exe) function [ys,check] = NK_baseline_steadystate(ys,exo)
global M_ lgy_ % function [ys,check] = NK_baseline_steadystate(ys,exo)
% computes the steady state for the NK_baseline.mod and uses a numerical
if isfield(M_,'param_nbr') == 1 % solver to do so
% Inputs:
% - ys [vector] vector of initial values for the steady state of
% the endogenous variables
% - exo [vector] vector of values for the exogenous variables
%
% Output:
% - ys [vector] vector of steady state values fpr the the endogenous variables
% - check [scalar] set to 0 if steady state computation worked and to
% 1 of not (allows to impos restriction on parameters)
global M_
% read out parameters to access them with their name
NumberOfParameters = M_.param_nbr; NumberOfParameters = M_.param_nbr;
for i = 1:NumberOfParameters for ii = 1:NumberOfParameters
paramname = deblank(M_.param_names(i,:)); paramname = deblank(M_.param_names(ii,:));
eval([ paramname ' = M_.params(' int2str(i) ');']); eval([ paramname ' = M_.params(' int2str(ii) ');']);
end end
% initialize indicator
check = 0; check = 0;
end
%% Enter model equations here %% Enter model equations here
...@@ -32,6 +45,11 @@ Lambdax=mu_z; ...@@ -32,6 +45,11 @@ Lambdax=mu_z;
%set the parameter gammma1 %set the parameter gammma1
gammma1=mu_z*mu_I/betta-(1-delta); gammma1=mu_z*mu_I/betta-(1-delta);
if gammma1<0 % parameter violates restriction; Preventing this cannot be implemented via prior restriction as it is a composite of different parameters and the valid prior region has unknown form
check=1; %set failure indicator
return; %return without updating steady states
end
r=1*gammma1; r=1*gammma1;
R=1+(PI*mu_z/betta-1); R=1+(PI*mu_z/betta-1);
...@@ -49,9 +67,17 @@ vp=(1-thetap)/(1-thetap*PI^((1-chi)*epsilon))*PIstar^(-epsilon); ...@@ -49,9 +67,17 @@ vp=(1-thetap)/(1-thetap*PI^((1-chi)*epsilon))*PIstar^(-epsilon);
vw=(1-thetaw)/(1-thetaw*PI^((1-chiw)*eta)*mu_z^eta)*PIstarw^(-eta); vw=(1-thetaw)/(1-thetaw*PI^((1-chiw)*eta)*mu_z^eta)*PIstarw^(-eta);
tempvaromega=alppha/(1-alppha)*w/r*mu_z*mu_I; tempvaromega=alppha/(1-alppha)*w/r*mu_z*mu_I;
ld=fsolve(@(ld)(1-betta*thetaw*mu_z^(eta-1)*PI^(-(1-chiw)*(1-eta)))/(1-betta*thetaw*mu_z^(eta*(1+gammma))*PI^(eta*(1-chiw)*(1+gammma)))... [ld,fval,exitflag]=fsolve(@(ld)(1-betta*thetaw*mu_z^(eta-1)*PI^(-(1-chiw)*(1-eta)))/(1-betta*thetaw*mu_z^(eta*(1+gammma))*PI^(eta*(1-chiw)*(1+gammma)))...
-(eta-1)/eta*wstar/(varpsi*PIstarw^(-eta*gammma)*ld^gammma)*((1-h*mu_z^(-1))^(-1)-betta*h*(mu_z-h)^(-1))*... -(eta-1)/eta*wstar/(varpsi*PIstarw^(-eta*gammma)*ld^gammma)*((1-h*mu_z^(-1))^(-1)-betta*h*(mu_z-h)^(-1))*...
((mu_A*mu_z^(-1)*vp^(-1)*tempvaromega^alppha-tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld-vp^(-1)*Phi)^(-1),0.25,options); ((mu_A*mu_z^(-1)*vp^(-1)*tempvaromega^alppha-tempvaromega*(1-(1-delta)*(mu_z*mu_I)^(-1)))*ld-vp^(-1)*Phi)^(-1),0.25,options);
if exitflag <1
%indicate the SS computation was not sucessful; this would also be detected by Dynare
%setting the indicator here shows how to use this functionality to
%filter out parameter draws
check=1; %set failure indicator
return; %return without updating steady states
end
l=vw*ld; l=vw*ld;
k=tempvaromega*ld; k=tempvaromega*ld;
...@@ -68,27 +94,12 @@ g2=epsilon/(epsilon-1)*g1; ...@@ -68,27 +94,12 @@ g2=epsilon/(epsilon-1)*g1;
%% end own model equations %% end own model equations
for iter = 1:length(M_.params) %update parameters set in the file
for iter = 1:length(M_.params)
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ]) eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
end end
if isfield(M_,'param_nbr') == 1 NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
if isfield(M_,'orig_endo_nbr') == 1 varname = deblank(M_.endo_names(ii,:));
NumberOfEndogenousVariables = M_.orig_endo_nbr; eval(['ys(' int2str(ii) ') = ' varname ';']);
else
NumberOfEndogenousVariables = M_.endo_nbr;
end
ys = zeros(NumberOfEndogenousVariables,1);
for i = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(i,:));
eval(['ys(' int2str(i) ') = ' varname ';']);
end
else
ys=zeros(length(lgy_),1);
for i = 1:length(lgy_)
ys(i) = eval(lgy_(i,:));
end
check = 0;
end end
/*
* Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE:
* A practical guide" (see "guide.pdf" in the documentation directory).
*
* This file uses the steady_state_model-block to provide analytical steady state values.
* To do so, the equations of the model have been transformed into a non-linear equation in
* labor h. Within the steady_state_model-block, a helper function is called that uses fsolve
* to solve this non-linear equation. The use of the helper function is necessary to avoid
* interference of the Matlab syntax with Dynare's preprocessor. A more complicated alternative
* that provides more flexibility in the type of commands executed and functions called is the use
* of an explicit steady state file. See the NK_baseline.mod in the Examples Folder.
*
* This mod-file also shows how to use Dynare's capacities to generate TeX-files of the model equations.
* If you want to see the model equations belonging to this mod-file, run it using Dynare
* and then use a TeX-editor to compile the TeX-files generated.
*/
/*
* Copyright (C) 2013 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/>.
*/
var y, c, k, a, h, b;
varexo e, u;
parameters beta $\beta$
rho $\rho$
alpha $\alpha$
delta $\delta$
theta $\theta$
psi $\psi$
tau $\tau$;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
steady_state_model;
h=example3_steady_state_helper(alpha,beta,delta,psi,theta);
k=((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h;
y = k^alpha*h^(1-alpha);
c=(1-alpha)*y/(theta*h^(1+psi));
a=0;
b=0;
end;
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
//use command to generate TeX-Files with dynamic and static model equations
write_latex_dynamic_model;
write_latex_static_model;
stoch_simul;
function h=example3_steady_state_helper(alpha,beta,delta,psi,theta)
options=optimset('Display','Final','TolX',1e-10,'TolFun',1e-10);
h=fsolve(@(h)1- ((((((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h)^(alpha-1))*(h^(1-alpha))-(((1-alpha)*((((1/beta-(1-delta))/alpha)^(1/(alpha-1)))^alpha))/(theta*h^psi))/(((1/beta-(1-delta))/alpha)^(1/(alpha-1))*h))+(1-delta)),0.2,options);
...@@ -87,6 +87,32 @@ var e_a; stderr 0.014; ...@@ -87,6 +87,32 @@ var e_a; stderr 0.014;
var e_m; stderr 0.005; var e_m; stderr 0.005;
end; end;
steady_state_model;
dA = exp(gam);
gst = 1/dA;
m = mst;
khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1));
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1);
nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp );
n = xist/(nust+xist);
P = xist + nust;
k = khst*n;
l = psi*mst*n/( (1-psi)*(1-n) );
c = mst/P;
d = l - mst + 1;
y = k^alp*n^(1-alp)*gst^alp;
R = mst/bet;
W = l/n;
ist = y-c;
q = 1 - d;
e = 1;
gp_obs = m/dA;
gy_obs = dA;
end;
steady; steady;
check; check;
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dynare Upstream-Name: Dynare
Upstream-Contact: Dynare Team, whose members in 2013 are: Upstream-Contact: Dynare Team, whose members in 2014 are:
Stéphane Adjemian <stephane.adjemian@univ-lemans.fr> Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
Houtan Bastani <houtan@dynare.org> Houtan Bastani <houtan@dynare.org>
Michel Juillard <michel.juillard@mjui.fr> Michel Juillard <michel.juillard@mjui.fr>
...@@ -14,7 +14,7 @@ Upstream-Contact: Dynare Team, whose members in 2013 are: ...@@ -14,7 +14,7 @@ Upstream-Contact: Dynare Team, whose members in 2013 are:
Source: http://www.dynare.org Source: http://www.dynare.org
Files: * Files: *
Copyright: 1996-2013 Dynare Team Copyright: 1996-2014 Dynare Team
License: GPL-3+ License: GPL-3+
Files: matlab/AIM/SP* Files: matlab/AIM/SP*
...@@ -75,17 +75,13 @@ Copyright: 1995-2007 Kurt Hornik ...@@ -75,17 +75,13 @@ Copyright: 1995-2007 Kurt Hornik
2008-2009 Dynare Team 2008-2009 Dynare Team
License: GPL-3+ License: GPL-3+
Files: matlab/missing/bicgstab/bicgstab.m
Copyright: 2008 Radek Salac
License: GPL-3+
Files: matlab/missing/strjoin/strjoin.m Files: matlab/missing/strjoin/strjoin.m
Copyright: 2007 Muthiah Annamalai <muthiah.annamalai@uta.edu> Copyright: 2007 Muthiah Annamalai <muthiah.annamalai@uta.edu>
2013 Dynare Team 2013 Dynare Team
License: GPL-3+ License: GPL-3+
Files: doc/dynare.texi doc/*.tex doc/*.svg doc/*.dia doc/*.pdf doc/*.bib Files: doc/dynare.texi doc/*.tex doc/*.svg doc/*.dia doc/*.pdf doc/*.bib
Copyright: 1996-2013 Dynare Team Copyright: 1996-2014 Dynare Team
License: GFDL-NIV-1.3+ License: GFDL-NIV-1.3+
Files: doc/userguide/*.tex doc/userguide/*.bib doc/userguide/*.pdf Files: doc/userguide/*.tex doc/userguide/*.bib doc/userguide/*.pdf
...@@ -119,17 +115,11 @@ License: GPL-3+ with Autoconf exception ...@@ -119,17 +115,11 @@ License: GPL-3+ with Autoconf exception
Files: m4/ax_boost_base.m4 Files: m4/ax_boost_base.m4
Copyright: 2008 Thomas Porschberg <thomas@randspringer.de> Copyright: 2008 Thomas Porschberg <thomas@randspringer.de>
2009 Dynare Team 2009 Dynare Team
License: other License: permissive
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved.
Files: m4/ax_compare_version.m4 Files: m4/ax_compare_version.m4
Copyright: 2008 Tim Toolan <toolan@ele.uri.edu> Copyright: 2008 Tim Toolan <toolan@ele.uri.edu>
License: other License: permissive
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved.
Files: m4/ax_latex_bibtex_test.m4 m4/ax_latex_class.m4 m4/ax_tex_test.m4 Files: m4/ax_latex_bibtex_test.m4 m4/ax_latex_class.m4 m4/ax_tex_test.m4
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch> Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
...@@ -345,3 +335,8 @@ License: LGPL-3+ ...@@ -345,3 +335,8 @@ License: LGPL-3+
. .
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
License: permissive
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved.
dnl Detect the MATIO Library. dnl Detect the MATIO Library.
dnl dnl
dnl Copyright (C) 2012 Dynare Team dnl Copyright (C) 2012-2014 Dynare Team
dnl dnl
dnl This file is part of Dynare. dnl This file is part of Dynare.
dnl dnl
...@@ -41,9 +41,10 @@ AC_ARG_WITH(matio, AC_HELP_STRING([--with-matio=DIR], [prefix to MATIO installat ...@@ -41,9 +41,10 @@ AC_ARG_WITH(matio, AC_HELP_STRING([--with-matio=DIR], [prefix to MATIO installat
LDFLAGS="$LDFLAGS_MATIO $LDFLAGS" LDFLAGS="$LDFLAGS_MATIO $LDFLAGS"
dnl Workaround for the matio from RHEL 6 + EPEL 6 dnl Workaround for the matio from RHEL 6 + EPEL 6
dnl If detected, libz is added to LIBS, used for matio test dnl If detected, libz and libhdf5 are added to LIBS, used for matio test
LIBS="" LIBS=""
AC_CHECK_LIB([z], [compress]) AC_CHECK_LIB([z], [compress])
AC_CHECK_LIB([hdf5], [H5Fcreate])
AC_CHECK_HEADER([matio.h], [], [has_matio=no]) AC_CHECK_HEADER([matio.h], [], [has_matio=no])
AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no]) AC_CHECK_LIB([matio], [Mat_Open], [LIBADD_MATIO="-lmatio $LIBS"], [has_matio=no])
......
dnl Copyright (C) 2009-2013 Dynare Team dnl Copyright (C) 2009-2015 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 "x$MATLAB_VERSION" != "x"; then if test "x$MATLAB_VERSION" != "x"; then
case $MATLAB_VERSION in case $MATLAB_VERSION in
*2015a | *2015A)
MATLAB_VERSION="8.5"
;;
*2014b | *2014B)
MATLAB_VERSION="8.4"
;;
*2014a | *2014A)
MATLAB_VERSION="8.3"
;;
*2013b | *2013B) *2013b | *2013B)
MATLAB_VERSION="8.2" MATLAB_VERSION="8.2"
;; ;;
......
function C = ne(A,B) % --*-- Unitary tests --*--
% Overloads ~= operator for dates objects.
%
% INPUTS
% o A dates object with n or 1 elements.
% o B dates object with n or 1 elements.
%
% OUTPUTS
% o C column vector of max(n,1) elements (zeros or ones).
% Copyright (C) 2013 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/>.
if ~isequal(nargin,2)
error('dates::ne: I need exactly two input arguments!')
end
if ~isdates(A) || ~isdates(B)
error(['dates::ne: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be dates objects!'])
end
if ~isequal(A.freq,B.freq)
C = 0;
return
end
if isequal(A.ndat, B.ndat)
C = transpose(any(transpose(ne(A.time,B.time))));
else
if isequal(A.ndat,1) || isequal(B.ndat,1)
C = transpose(any(transpose(bsxfun(@ne,A.time,B.time))));
else
C = 0;
end
end
%@test:1
%$ % Define some dates objects
%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
%$ d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ;
%$ d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ;
%$
%$ % Call the tested routine.
%$ t1 = d1~=d1;
%$ t2 = d1~=d2;
%$ t3 = d1~=d3;
%$
%$ % Check the results.
%$ t(1) = dyn_assert(t1,zeros(4,1));
%$ t(2) = dyn_assert(t2,ones(4,1));
%$ t(3) = dyn_assert(t3,[0; 1; 0; 1]);
%$ T = all(t);
%@eof:1
%@test:2
%$ % Define some dates objects
%$ d1 = dates('1950Q1') ;
%$ d2 = dates('1960Q1') ;
%$ d3 = dates('1960Q1') ;
%$
%$ % Call the tested routine.
%$ t1 = d1~=d1;
%$ t2 = d1~=d2;
%$ t3 = d1~=d3;
%$
%$ % Check the results.
%$ t(1) = dyn_assert(t1,0);
%$ t(2) = dyn_assert(t2,1);
%$ t(3) = dyn_assert(t3,1);
%$ T = all(t);
%@eof:2
%@test:3
%$ % Define some dates objects
%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
%$ d2 = dates('1950Q2') ;
%$ d3 = dates('1970Q1') ;
%$
%$ % Call the tested routine.
%$ t1 = d1~=d2;
%$ t2 = d1~=d3;
%$
%$ % Check the results.
%$ t(1) = dyn_assert(t1,[1; 0; 1; 1]);
%$ t(2) = dyn_assert(t2,ones(4,1));
%$ T = all(t);
%@eof:3