Merge commit 'upstream/4.2.4'
Sébastien Villemot
12 years ago
18 | 18 | EXTRA_DIST = \ |
19 | 19 | matlab \ |
20 | 20 | uncrustify.cfg \ |
21 | NEWS \ | |
21 | 22 | license.txt \ |
22 | 23 | dynare.el \ |
23 | 24 | windows/dynare.nsi \ |
41 | 41 | DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ |
42 | 42 | $(srcdir)/Makefile.in $(top_srcdir)/configure \ |
43 | 43 | $(top_srcdir)/matlab/dynare_version.m.in \ |
44 | $(top_srcdir)/windows/dynare-version.nsi.in config.guess \ | |
44 | $(top_srcdir)/windows/dynare-version.nsi.in NEWS config.guess \ | |
45 | 45 | config.sub depcomp install-sh missing ylwrap |
46 | 46 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
47 | 47 | am__aclocal_m4_deps = $(top_srcdir)/m4/ax_blas.m4 \ |
50 | 50 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
51 | 51 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
52 | 52 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
53 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
53 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
54 | 54 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
55 | 55 | $(top_srcdir)/configure.ac |
56 | 56 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
166 | 166 | LN_S = @LN_S@ |
167 | 167 | LTLIBOBJS = @LTLIBOBJS@ |
168 | 168 | MAKEINFO = @MAKEINFO@ |
169 | MATLAB = @MATLAB@ | |
169 | 170 | MKDIR_P = @MKDIR_P@ |
170 | 171 | OBJEXT = @OBJEXT@ |
171 | 172 | OCTAVE = @OCTAVE@ |
251 | 252 | EXTRA_DIST = \ |
252 | 253 | matlab \ |
253 | 254 | uncrustify.cfg \ |
255 | NEWS \ | |
254 | 256 | license.txt \ |
255 | 257 | dynare.el \ |
256 | 258 | windows/dynare.nsi \ |
0 | Announcement for Dynare 4.2.4 (on 2011-12-02) | |
1 | ============================================= | |
2 | ||
3 | We are pleased to announce the release of Dynare 4.2.4. | |
4 | ||
5 | This is a bugfix release. It comes only a few days after the previous release, | |
6 | because version 4.2.3 was affected by a critical bug (see below). | |
7 | ||
8 | The Windows package for the new release is already available for download at | |
9 | the official Dynare website <http://www.dynare.org>. The Mac and Linux packages | |
10 | should follow soon. | |
11 | ||
12 | All users are strongly encouraged to upgrade, especially those who have | |
13 | installed the buggy 4.2.3 release. | |
14 | ||
15 | The new release is compatible with MATLAB versions ranging from 7.0 (R14) to | |
16 | 7.13 (R2011b) and with GNU Octave versions ranging from 3.0 to 3.4. | |
17 | ||
18 | Here is the list of the problems identified in version 4.2.3 and that have been | |
19 | fixed in version 4.2.4: | |
20 | ||
21 | * Second order approximation was broken for most models, giving incorrect | |
22 | results (this problem only affects version 4.2.3, not previous versions) | |
23 | ||
24 | * Bayesian priors with inverse gamma distribution and very small variances | |
25 | were giving incorrect results in some cases | |
26 | ||
27 | * The `model_diagnostics' command was broken | |
28 | ||
29 | ||
30 | Announcement for Dynare 4.2.3 (on 2011-11-30) | |
31 | ============================================= | |
32 | ||
33 | We are pleased to announce the release of Dynare 4.2.3. | |
34 | ||
35 | This is a bugfix release. | |
36 | ||
37 | The Windows package is already available for download at the official | |
38 | Dynare website <http://www.dynare.org>. The Mac and Linux packages | |
39 | should follow soon. | |
40 | ||
41 | All users are strongly encouraged to upgrade. | |
42 | ||
43 | This release is compatible with MATLAB versions ranging from 7.0 (R14) | |
44 | to 7.13 (R2011b) and with GNU Octave versions ranging from 3.0 to 3.4. | |
45 | ||
46 | Here is a non-exhaustive list of the problems identified in version 4.2.2 and | |
47 | that have been fixed in version 4.2.3: | |
48 | ||
49 | * `steady_state_model' was broken for lags higher than 2 | |
50 | ||
51 | * `simult_.m' was not working correctly with `order=3' if `k_order_solver' had | |
52 | not been explicitly specified | |
53 | ||
54 | * `stoch_simul' with `order=3' and without `periods' option was reporting | |
55 | dummy theoretical moments | |
56 | ||
57 | * Under Octave, option `solve_algo=0' was causing crashes in `check' and | |
58 | `stoch_simul' | |
59 | ||
60 | * Identification module was broken | |
61 | ||
62 | * The test for singularity in the model reporting eigenvalues close to 0/0 was | |
63 | sometimes reporting false positives | |
64 | ||
65 | * The `conditional_variance_decomposition' option was not working if one | |
66 | period index was 0. Now, Dynare reports an error if the periods are not | |
67 | strictly positive. | |
68 | ||
69 | * Second order approximation was buggy if one variable was not present at the | |
70 | current period | |
71 | ||
72 | ||
73 | Announcement for Dynare 4.2.2 (on 2011-10-04) | |
74 | ============================================= | |
75 | ||
76 | We are pleased to announce the release of Dynare 4.2.2. | |
77 | ||
78 | This is a bugfix release. | |
79 | ||
80 | The Windows package is already available for download at the official | |
81 | Dynare website <http://www.dynare.org>. The Mac and Linux packages | |
82 | should follow soon. | |
83 | ||
84 | All users are strongly encouraged to upgrade. | |
85 | ||
86 | This release is compatible with MATLAB versions ranging from 7.0 (R14) | |
87 | to 7.13 (R2011b) and with GNU Octave versions ranging from 3.0 to 3.4. | |
88 | ||
89 | Here is a list of the problems identified in version 4.2.1 and that have | |
90 | been fixed in version 4.2.2: | |
91 | ||
92 | * The secondary rank test following the order test of the Blanchard and | |
93 | Kahn condition was faulty and almost never triggered | |
94 | ||
95 | * The variance prior for BVAR “à la Sims” with only one lag was | |
96 | inconsistent. The solution implemented consists of adding one extra | |
97 | observation in the presample used to compute the prior; as a | |
98 | consequence, the numerical results for all estimations will be | |
99 | slightly different in future releases (thanks to Marek Jarociński for | |
100 | spotting this) | |
101 | ||
102 | * The `conditional_forecast' command was buggy: it was always using the | |
103 | posterior mode, whatever the value of the `parameter_set' option | |
104 | ||
105 | * `STEADY_STATE' was not working correctly with certain types of | |
106 | expressions (the priority of the addition and substraction operators | |
107 | was incorrectly handled) | |
108 | ||
109 | * With the `block' option of `model', the preprocessor was failing on | |
110 | expressions of the form "a^b" (with no endogenous in "a" but an | |
111 | endogenous in "b") | |
112 | ||
113 | * Some native MATLAB statements were not correctly passed on to MATLAB | |
114 | (e.g. x = { 'foo' 'bar' } ) | |
115 | ||
116 | * `external_function' was crashing in some circumstances | |
117 | ||
118 | * The lambda parameter for HP filter was restricted to integer values | |
119 | for no good reason | |
120 | ||
121 | * The `load_mh_file' option of `estimation' was crashing under Octave | |
122 | for Windows (MinGW version) | |
123 | ||
124 | * Computation of steady state was failing on model contains auxiliary | |
125 | variables created by leads or lags larger than 2 or by of the | |
126 | `EXPECTATION' operator | |
127 | ||
128 | * Compilation of MEX files for MATLAB was failing with GCC 4.6 | |
129 | ||
130 | ||
131 | Announcement for Dynare 4.2.1 (on 2011-05-24) | |
132 | ============================================= | |
133 | ||
134 | We are pleased to announce the release of Dynare 4.2.1. | |
135 | ||
136 | Many bugs have been fixed since the previous release. The reference | |
137 | manual has also been improved: new contents has been added at various | |
138 | places, the structure has been improved, an index of functions and | |
139 | variables has been added, the PDF/HTML rendering has been improved. | |
140 | ||
141 | The Windows package is already available for download at the official | |
142 | Dynare website [1]. The Mac and Linux packages should follow soon. | |
143 | ||
144 | All users are strongly encouraged to upgrade. | |
145 | ||
146 | This release is compatible with MATLAB versions ranging from 7.0 (R14) | |
147 | to 7.12 (R2011a) and with GNU Octave versions ranging from 3.0 to 3.4. | |
148 | ||
149 | Here is a list of the main bugfixes since version 4.2.0: | |
150 | ||
151 | * The `STEADY_STATE' operator has been fixed | |
152 | ||
153 | * Problems with MATLAB 7.3 (R2006b) and older have been fixed | |
154 | ||
155 | * The `partial_information' option of `stoch_simul' has been fixed | |
156 | ||
157 | * Option `conditional_variance_decomposition' of `stoch_simul' and | |
158 | `estimation' has been fixed | |
159 | ||
160 | * Automatic detrending now works in conjunction with the `EXPECTATION' | |
161 | operator | |
162 | ||
163 | * Percentage signs inside strings in MATLAB statements (like disp('% | |
164 | This is not a comment %')) now work | |
165 | ||
166 | * Beta prior with a very small standard deviation now work even if you | |
167 | do not have the MATLAB Statistical toolbox | |
168 | ||
169 | * External functions can now been used in assignment of model local | |
170 | variables | |
171 | ||
172 | * `identification' command has been fixed | |
173 | ||
174 | * Option `cova_compute' of `estimation' command has been fixed | |
175 | ||
176 | * Random crashes with 3rd order approximation without `use_dll' option | |
177 | have been eliminated | |
178 | ||
179 | [1] http://www.dynare.org | |
180 | ||
181 | ||
182 | Announcement for Dynare 4.2.0 (on 2011-02-15) | |
183 | ============================================= | |
184 | ||
185 | We are pleased to announce the release of Dynare 4.2.0. | |
186 | ||
187 | This major release adds new features and fixes various bugs. | |
188 | ||
189 | The Windows package is already available for download. The Mac and Linux | |
190 | packages should follow soon. | |
191 | ||
192 | All users are strongly encouraged to upgrade. | |
193 | ||
194 | This release is compatible with MATLAB versions ranging from 6.5 (R13) to 7.11 | |
195 | (R2010b) and with GNU Octave versions 3.0.x and 3.2.x (support for GNU Octave | |
196 | 3.4.x is not complete and will be added in the next minor release). | |
197 | ||
198 | Here is the list of major user-visible changes: | |
199 | ||
200 | * New solution algorithms: | |
201 | ||
202 | - Pruning for second order simulations has been added, as described in Kim, | |
203 | Kim, Schaumburg and Sims (2008) [1,2] | |
204 | ||
205 | - Models under partial information can be solved, as in Pearlman, Currie and | |
206 | Levine (1986) [3,4] | |
207 | ||
208 | - New nonlinear solvers for faster deterministic simulations and steady state | |
209 | computation [5] | |
210 | ||
211 | * Dynare can now use the power of multi-core computers or of a cluster of | |
212 | computer using parallelization [6] | |
213 | ||
214 | * New features in the user interface: | |
215 | ||
216 | - A steady state file can now be automatically generated, provided that the | |
217 | model can be solved analytically, and that the steady state as a function | |
218 | of the parameters is declared with the new "steady_state_model" command [7] | |
219 | ||
220 | - For non-stationary models, Dynare is now able of automatically removing | |
221 | trends in all the equations: the user writes the equations in | |
222 | non-stationary form and declares the deflator of each variable. Then Dynare | |
223 | perform a check to determine if the proposed deflators are compatible with | |
224 | balanced growth path, and, if yes, then it computes the detrended equations | |
225 | [8] | |
226 | ||
227 | - It is now possible to use arbitrary functions in the model block [9] | |
228 | ||
229 | * Other minor changes to the user interface: | |
230 | ||
231 | - New primitives allowed in model block: normpdf(), erf() | |
232 | ||
233 | - New syntax for DSGE-VAR [10] | |
234 | ||
235 | - Syntax of deterministic shocks has changed: after the values keyword, | |
236 | arbitrary expressions must be enclosed within parentheses (but numeric | |
237 | constants are still accepted as is) | |
238 | ||
239 | * Various improvements: | |
240 | ||
241 | - Third order simulations now work without the "USE_DLL" option: | |
242 | installing a C++ compiler is no longer necessary for 3rd order | |
243 | ||
244 | - The HP filter works for empirical moments (previously it was only available | |
245 | for theoretical moments) | |
246 | ||
247 | - "ramsey_policy" now displays the planner objective value function under | |
248 | Ramsey policy and stores it in "oo_.planner_objective_value" | |
249 | ||
250 | - Estimation: if the "selected_variables_only" option is present, then the | |
251 | smoother will only be run on variables listed just after the estimation | |
252 | command | |
253 | ||
254 | - Estimation: in the "shocks" block, it is now possible to calibrate | |
255 | measurement errors on endogenous variables (using the same keywords than | |
256 | for calibrating variance/covariance matrix of exogenous shocks) | |
257 | ||
258 | - It is possibile to choose the parameter set for shock decomposition [11] | |
259 | ||
260 | - The diffuse filter now works under Octave | |
261 | ||
262 | - New option "console" on the Dynare command-line: use it when running Dynare | |
263 | from the console, it will replace graphical waitbars by text waitbars for | |
264 | long computations | |
265 | ||
266 | - Steady option "solve_algo=0" (uses fsolve()) now works under Octave | |
267 | ||
268 | * For Emacs users: | |
269 | ||
270 | - New Dynare mode for Emacs editor (contributed by Yannick Kalantzis) | |
271 | ||
272 | - Reference manual now available in Info format (distributed with | |
273 | Debian/Ubuntu packages) | |
274 | ||
275 | * Miscellaneous: | |
276 | ||
277 | - Deterministic models: leads and lags of two or more on endogenous | |
278 | variables are now substituted by auxiliary variables; exogenous variables | |
279 | are left as is [12] | |
280 | ||
281 | [1] Kim, J., S. Kim, E. Schaumburg and C.A. Sims (2008), "Calculating and using | |
282 | second-order accurate solutions of discrete time dynamic equilibrium | |
283 | models", Journal of Economic Dynamics and Control, 32(11), 3397-3414 | |
284 | [2] It is triggered by option "pruning" of "stoch_simul" (only 2nd order, not | |
285 | available at 3rd order) | |
286 | [3] Pearlman J., D. Currie and P. Levine (1986), "Rational expectations models | |
287 | with partial information", Economic Modelling, 3(2), 90-105 | |
288 | [4] http://www.dynare.org/DynareWiki/PartialInformation | |
289 | [5] http://www.dynare.org/DynareWiki/FastDeterministicSimulationAndSteadyStateComputation | |
290 | [6] http://www.dynare.org/DynareWiki/ParallelDynare | |
291 | [7] See the entry for "steady_state_model" in the reference manual for more | |
292 | details and an example | |
293 | [8] http://www.dynare.org/DynareWiki/RemovingTrends | |
294 | [9] http://www.dynare.org/DynareWiki/ExternalFunctions | |
295 | [10] http://www.dynare.org/DynareWiki/DsgeVar | |
296 | [11] http://www.dynare.org/DynareWiki/ShockDecomposition | |
297 | [12] http://www.dynare.org/DynareWiki/AuxiliaryVariables |
975 | 975 | m4_include([m4/ax_latex_bibtex_test.m4]) |
976 | 976 | m4_include([m4/ax_latex_class.m4]) |
977 | 977 | m4_include([m4/ax_latex_test.m4]) |
978 | m4_include([m4/ax_matlab.m4]) | |
978 | 979 | m4_include([m4/ax_prog_ln_s.m4]) |
979 | 980 | m4_include([m4/ax_pthread.m4]) |
980 | 981 | m4_include([m4/ax_tex_test.m4]) |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.2. | |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.4. | |
3 | 3 | # |
4 | 4 | # |
5 | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
556 | 556 | # Identity of this package. |
557 | 557 | PACKAGE_NAME='dynare' |
558 | 558 | PACKAGE_TARNAME='dynare' |
559 | PACKAGE_VERSION='4.2.2' | |
560 | PACKAGE_STRING='dynare 4.2.2' | |
559 | PACKAGE_VERSION='4.2.4' | |
560 | PACKAGE_STRING='dynare 4.2.4' | |
561 | 561 | PACKAGE_BUGREPORT='' |
562 | 562 | PACKAGE_URL='' |
563 | 563 | |
607 | 607 | ENABLE_ORG_EXPORT_TRUE |
608 | 608 | ENABLE_OCTAVE_FALSE |
609 | 609 | ENABLE_OCTAVE_TRUE |
610 | HAVE_CMD_LINE_MATLAB_FALSE | |
611 | HAVE_CMD_LINE_MATLAB_TRUE | |
610 | 612 | ENABLE_MATLAB_FALSE |
611 | 613 | ENABLE_MATLAB_TRUE |
614 | MATLAB | |
612 | 615 | subdirs |
613 | 616 | PTHREAD_CFLAGS |
614 | 617 | PTHREAD_LIBS |
775 | 778 | with_lapack |
776 | 779 | with_pthread |
777 | 780 | enable_matlab |
781 | with_matlab | |
778 | 782 | enable_octave |
779 | 783 | enable_org_export |
780 | 784 | ' |
1335 | 1339 | # Omit some internal or obsolete options to make the list less imposing. |
1336 | 1340 | # This message is too long to be a string in the A/UX 3.1 sh. |
1337 | 1341 | cat <<_ACEOF |
1338 | \`configure' configures dynare 4.2.2 to adapt to many kinds of systems. | |
1342 | \`configure' configures dynare 4.2.4 to adapt to many kinds of systems. | |
1339 | 1343 | |
1340 | 1344 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1341 | 1345 | |
1405 | 1409 | |
1406 | 1410 | if test -n "$ac_init_help"; then |
1407 | 1411 | case $ac_init_help in |
1408 | short | recursive ) echo "Configuration of dynare 4.2.2:";; | |
1412 | short | recursive ) echo "Configuration of dynare 4.2.4:";; | |
1409 | 1413 | esac |
1410 | 1414 | cat <<\_ACEOF |
1411 | 1415 | |
1434 | 1438 | --with-blas=<lib> use BLAS library <lib> |
1435 | 1439 | --with-lapack=<lib> use LAPACK library <lib> |
1436 | 1440 | --without-pthread don't use POSIX threads |
1441 | --with-matlab=ARG check for MATLAB [[yes]] | |
1437 | 1442 | |
1438 | 1443 | Some influential environment variables: |
1439 | 1444 | CC C compiler command |
1515 | 1520 | test -n "$ac_init_help" && exit $ac_status |
1516 | 1521 | if $ac_init_version; then |
1517 | 1522 | cat <<\_ACEOF |
1518 | dynare configure 4.2.2 | |
1523 | dynare configure 4.2.4 | |
1519 | 1524 | generated by GNU Autoconf 2.68 |
1520 | 1525 | |
1521 | 1526 | Copyright (C) 2010 Free Software Foundation, Inc. |
2010 | 2015 | This file contains any messages produced by compilers while |
2011 | 2016 | running configure, to aid debugging if configure makes a mistake. |
2012 | 2017 | |
2013 | It was created by dynare $as_me 4.2.2, which was | |
2018 | It was created by dynare $as_me 4.2.4, which was | |
2014 | 2019 | generated by GNU Autoconf 2.68. Invocation command line was |
2015 | 2020 | |
2016 | 2021 | $ $0 $@ |
2826 | 2831 | |
2827 | 2832 | # Define the identity of the package. |
2828 | 2833 | PACKAGE='dynare' |
2829 | VERSION='4.2.2' | |
2834 | VERSION='4.2.4' | |
2830 | 2835 | |
2831 | 2836 | |
2832 | 2837 | cat >>confdefs.h <<_ACEOF |
4307 | 4312 | # On mingw32, we don't want dynamic libgcc |
4308 | 4313 | # Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions) |
4309 | 4314 | LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" |
4315 | have_windows="yes" | |
4310 | 4316 | ;; |
4311 | 4317 | *cygwin*) |
4312 | 4318 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You are compiling for the Cygwin target. This means that the preprocessor will" >&5 |
4320 | 4326 | # And by default, the AC_PROG_F77 will pick up g77 if it is present (even if gfortran is also here) |
4321 | 4327 | F77=gfortran |
4322 | 4328 | fi |
4329 | have_windows="yes" | |
4323 | 4330 | ;; |
4324 | 4331 | esac |
4325 | 4332 | |
8444 | 8451 | |
8445 | 8452 | subdirs="$subdirs mex/build/matlab" |
8446 | 8453 | |
8454 | ||
8455 | ax_enable_matlab= | |
8456 | ||
8457 | # Check whether --with-matlab was given. | |
8458 | if test "${with_matlab+set}" = set; then : | |
8459 | withval=$with_matlab; case $withval in | |
8460 | yes | no) | |
8461 | # Explicitly enable or disable MATLAB but determine | |
8462 | # MATLAB prefix automatically. | |
8463 | ax_enable_matlab=$withval | |
8464 | ;; | |
8465 | *) | |
8466 | # Enable MATLAB and use ARG as the MATLAB prefix. | |
8467 | # ARG must be an existing directory. | |
8468 | ax_enable_matlab=yes | |
8469 | MATLAB=`cd "${withval-/}" > /dev/null 2>&1 && pwd` | |
8470 | if test -z "$MATLAB" ; then | |
8471 | as_fn_error $? "invalid value '$withval' for --with-matlab" "$LINENO" 5 | |
8472 | fi | |
8473 | ;; | |
8474 | esac | |
8475 | fi | |
8476 | ||
8477 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MATLAB prefix" >&5 | |
8478 | $as_echo_n "checking for MATLAB prefix... " >&6; } | |
8479 | if ${ax_cv_matlab+:} false; then : | |
8480 | $as_echo_n "(cached) " >&6 | |
8481 | else | |
8482 | if test "${MATLAB+set}" = set ; then | |
8483 | ax_cv_matlab=`cd "${MATLAB-/}" > /dev/null 2>&1 && pwd` | |
8484 | else | |
8485 | ax_cv_matlab= | |
8486 | IFS=${IFS= } ; ax_ifs=$IFS ; IFS=: | |
8487 | for ax_dir in ${PATH-/opt/bin:/usr/local/bin:/usr/bin:/bin} ; do | |
8488 | if test -z "$ax_dir" ; then | |
8489 | ax_dir=. | |
8490 | fi | |
8491 | if test -x "$ax_dir/matlab" ; then | |
8492 | ax_dir=`echo "$ax_dir" | sed 's,/bin$,,'` | |
8493 | # Directory sanity check. | |
8494 | ax_cv_matlab=`cd "${ax_dir-/}" > /dev/null 2>&1 && pwd` | |
8495 | if test -n "$ax_cv_matlab" ; then | |
8496 | break | |
8497 | fi | |
8498 | fi | |
8499 | done | |
8500 | IFS=$ax_ifs | |
8501 | fi | |
8502 | if test -z "$ax_cv_matlab" ; then | |
8503 | ax_cv_matlab="not found" | |
8504 | fi | |
8505 | fi | |
8506 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_matlab" >&5 | |
8507 | $as_echo "$ax_cv_matlab" >&6; } | |
8508 | if test "$ax_cv_matlab" = "not found" ; then | |
8509 | unset MATLAB | |
8510 | else | |
8511 | # Strip trailing dashes. | |
8512 | MATLAB=`echo "$ax_cv_matlab" | sed 's,/*$,,'` | |
8513 | fi | |
8514 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable MATLAB support" >&5 | |
8515 | $as_echo_n "checking whether to enable MATLAB support... " >&6; } | |
8516 | if test x$ax_enable_matlab != xno ; then | |
8517 | if test "${MATLAB+set}" = set && test -d "$MATLAB/extern/include" ; then | |
8518 | ax_enable_matlab=yes | |
8519 | elif test x$ax_enable_matlab = x ; then | |
8520 | ax_enable_matlab=no | |
8521 | else | |
8522 | # Fail if MATLAB was explicitly enabled. | |
8523 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: failure" >&5 | |
8524 | $as_echo "failure" >&6; } | |
8525 | as_fn_error $? "check your MATLAB setup" "$LINENO" 5 | |
8526 | fi | |
8527 | fi | |
8528 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_matlab" >&5 | |
8529 | $as_echo "$ax_enable_matlab" >&6; } | |
8530 | if test x$ax_enable_matlab = xyes ; then | |
8531 | ||
8532 | $as_echo "#define HAVE_MATLAB 1" >>confdefs.h | |
8533 | ||
8534 | fi | |
8535 | ||
8536 | ||
8447 | 8537 | fi |
8448 | 8538 | if test "x$enable_matlab" = "xyes"; then |
8449 | 8539 | ENABLE_MATLAB_TRUE= |
8451 | 8541 | else |
8452 | 8542 | ENABLE_MATLAB_TRUE='#' |
8453 | 8543 | ENABLE_MATLAB_FALSE= |
8544 | fi | |
8545 | ||
8546 | if test "x$ax_enable_matlab" = "xyes" -a "x$have_windows" = "x"; then | |
8547 | HAVE_CMD_LINE_MATLAB_TRUE= | |
8548 | HAVE_CMD_LINE_MATLAB_FALSE='#' | |
8549 | else | |
8550 | HAVE_CMD_LINE_MATLAB_TRUE='#' | |
8551 | HAVE_CMD_LINE_MATLAB_FALSE= | |
8454 | 8552 | fi |
8455 | 8553 | |
8456 | 8554 | |
8848 | 8946 | as_fn_error $? "conditional \"ENABLE_MATLAB\" was never defined. |
8849 | 8947 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
8850 | 8948 | fi |
8949 | if test -z "${HAVE_CMD_LINE_MATLAB_TRUE}" && test -z "${HAVE_CMD_LINE_MATLAB_FALSE}"; then | |
8950 | as_fn_error $? "conditional \"HAVE_CMD_LINE_MATLAB\" was never defined. | |
8951 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 | |
8952 | fi | |
8851 | 8953 | if test -z "${ENABLE_OCTAVE_TRUE}" && test -z "${ENABLE_OCTAVE_FALSE}"; then |
8852 | 8954 | as_fn_error $? "conditional \"ENABLE_OCTAVE\" was never defined. |
8853 | 8955 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
9265 | 9367 | # report actual input values of CONFIG_FILES etc. instead of their |
9266 | 9368 | # values after options handling. |
9267 | 9369 | ac_log=" |
9268 | This file was extended by dynare $as_me 4.2.2, which was | |
9370 | This file was extended by dynare $as_me 4.2.4, which was | |
9269 | 9371 | generated by GNU Autoconf 2.68. Invocation command line was |
9270 | 9372 | |
9271 | 9373 | CONFIG_FILES = $CONFIG_FILES |
9322 | 9424 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
9323 | 9425 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
9324 | 9426 | ac_cs_version="\\ |
9325 | dynare config.status 4.2.2 | |
9427 | dynare config.status 4.2.4 | |
9326 | 9428 | configured by $0, generated by GNU Autoconf 2.68, |
9327 | 9429 | with options \\"\$ac_cs_config\\" |
9328 | 9430 |
17 | 17 | dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | |
19 | 19 | AC_PREREQ([2.61]) |
20 | AC_INIT([dynare], [4.2.2]) | |
20 | AC_INIT([dynare], [4.2.4]) | |
21 | 21 | AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc]) |
22 | 22 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
23 | 23 | |
30 | 30 | # On mingw32, we don't want dynamic libgcc |
31 | 31 | # Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions) |
32 | 32 | LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" |
33 | have_windows="yes" | |
33 | 34 | ;; |
34 | 35 | *cygwin*) |
35 | 36 | AC_MSG_WARN([You are compiling for the Cygwin target. This means that the preprocessor will]) |
40 | 41 | # And by default, the AC_PROG_F77 will pick up g77 if it is present (even if gfortran is also here) |
41 | 42 | F77=gfortran |
42 | 43 | fi |
44 | have_windows="yes" | |
43 | 45 | ;; |
44 | 46 | esac |
45 | 47 | |
195 | 197 | AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes]) |
196 | 198 | if test "x$enable_matlab" = "xyes"; then |
197 | 199 | AC_CONFIG_SUBDIRS([mex/build/matlab]) |
200 | AX_MATLAB | |
198 | 201 | fi |
199 | 202 | AM_CONDITIONAL([ENABLE_MATLAB], [test "x$enable_matlab" = "xyes"]) |
203 | AM_CONDITIONAL([HAVE_CMD_LINE_MATLAB], [test "x$ax_enable_matlab" = "xyes" -a "x$have_windows" = "x"]) | |
200 | 204 | |
201 | 205 | AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes]) |
202 | 206 | if test "x$enable_octave" = "xyes"; then |
45 | 45 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
46 | 46 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
47 | 47 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
48 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
48 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
49 | 49 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
50 | 50 | $(top_srcdir)/configure.ac |
51 | 51 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
181 | 181 | LN_S = @LN_S@ |
182 | 182 | LTLIBOBJS = @LTLIBOBJS@ |
183 | 183 | MAKEINFO = @MAKEINFO@ |
184 | MATLAB = @MATLAB@ | |
184 | 185 | MKDIR_P = @MKDIR_P@ |
185 | 186 | OBJEXT = @OBJEXT@ |
186 | 187 | OCTAVE = @OCTAVE@ |
20 | 20 | License, Version 1.3 or any later version published by the Free |
21 | 21 | Software Foundation; with no Invariant Sections, no Front-Cover |
22 | 22 | Texts, and no Back-Cover Texts. A copy of the license can be found |
23 | at: \url{http://www.gnu.org/licenses/fdl.txt} } | |
23 | at: \url{http://www.gnu.org/licenses/fdl.txt} | |
24 | \newline | |
25 | The author acknowledges funding through the Seventh Framework Programme | |
26 | for Research (FP7) of the European Commission's Socio-economic Sciences and | |
27 | Humanities (SSH) Program under grant agreement SSH-CT-2009-225149.} | |
24 | 28 | } |
25 | 29 | |
26 | 30 | \date{First version: December 2009 \hspace{1cm} This version: April 2011} |
Binary diff not shown
272 | 272 | researchers who devote part of their time to software |
273 | 273 | development. Currently the development team of Dynare is composed of |
274 | 274 | Stéphane Adjemian (Université du Maine, Gains and Cepremap), Houtan |
275 | Bastani (Cepremap), Michel Juillard (Banque de France), Frédéric | |
276 | Karamé (Université d'Évry, Epee and Cepremap), Junior Maih (Norges | |
277 | Bank), Ferhat Mihoubi (Université d'Évry, Epee and Cepremap), George | |
278 | Perendia, Marco Ratto (JRC) and Sébastien Villemot (Cepremap and Paris | |
279 | School of Economics). Financial support is provided by Cepremap, | |
280 | Banque de France and DSGE-net (an international research network for | |
281 | DSGE modeling). Increasingly, the developer base is expanding, as | |
282 | tools developed by researchers outside of Cepremap are integrated into | |
283 | Dynare. | |
275 | Bastani (Cepremap), Michel Juillard (Banque de France), Frédéric Karamé | |
276 | (Université d'Évry, Epee and Cepremap), Junior Maih (Norges Bank), | |
277 | Ferhat Mihoubi (Université d'Évry, Epee and Cepremap), George Perendia, | |
278 | Marco Ratto (JRC) and Sébastien Villemot (Cepremap and Paris School of | |
279 | Economics). Increasingly, the developer base is expanding, as tools | |
280 | developed by researchers outside of Cepremap are integrated into | |
281 | Dynare. Financial support is provided by Cepremap, Banque de France and | |
282 | DSGE-net (an international research network for DSGE modeling). The | |
283 | Dynare project also received funding through the Seventh Framework | |
284 | Programme for Research (FP7) of the European Commission's Socio-economic | |
285 | Sciences and Humanities (SSH) Program from October 2008 to September | |
286 | 2011 under grant agreement SSH-CT-2009-225149. | |
284 | 287 | |
285 | 288 | Interaction between developers and users of Dynare is central to the |
286 | 289 | project. A @uref{http://www.dynare.org/phpBB3, web forum} is available |
335 | 338 | @node Software requirements |
336 | 339 | @section Software requirements |
337 | 340 | |
338 | Packaged versions of Dynare are available for Windows XP/Vista, | |
341 | Packaged versions of Dynare are available for Windows XP/Vista/Seven, | |
339 | 342 | @uref{http://www.debian.org,Debian GNU/Linux}, |
340 | 343 | @uref{http://www.ubuntu.com/,Ubuntu} and Mac OS X Leopard/Snow |
341 | 344 | Leopard. Dynare should work on other systems, but some compilation |
342 | 345 | steps are necessary in that case. |
343 | 346 | |
344 | In order to run Dynare, you need at least one of the following: | |
347 | In order to run Dynare, you need one of the following: | |
345 | 348 | |
346 | 349 | @itemize |
347 | 350 | |
348 | 351 | @item |
349 | MATLAB version 7.0 (R14) or above; note that no toolbox is needed by | |
350 | Dynare, | |
352 | MATLAB version 7.0 (R14) or above; | |
351 | 353 | |
352 | 354 | @item |
353 | 355 | GNU Octave version 3.0.0 or above. |
355 | 357 | |
356 | 358 | Some installation instructions for GNU Octave can be found on the |
357 | 359 | @uref{http://www.dynare.org/DynareWiki/DynareOctave,Dynare Wiki}. |
360 | ||
361 | The following optional extensions are also useful to benefit from extra | |
362 | features, but are in no way required: | |
363 | ||
364 | @itemize | |
365 | ||
366 | @item | |
367 | If under MATLAB: the optimization toolbox, the statistics toolbox; | |
368 | ||
369 | @item | |
370 | If under GNU Octave, the following | |
371 | @uref{http://octave.sourceforge.net/,Octave-Forge} package: optim. | |
372 | ||
373 | @end itemize | |
358 | 374 | |
359 | 375 | If you plan to use the @code{use_dll} option of the @code{model} |
360 | 376 | command, you will need to install the necessary requirements for |
2897 | 2913 | |
2898 | 2914 | @item conditional_variance_decomposition = [@var{INTEGER1} @var{INTEGER2} @dots{}] |
2899 | 2915 | Computes a conditional variance decomposition for the specified |
2900 | period(s). Conditional variances are given by | |
2916 | period(s). The periods must be strictly positive. Conditional variances are given by | |
2901 | 2917 | @math{var(y_{t+k}|t)}. For period 1, the conditional variance |
2902 | 2918 | decomposition provides the decomposition of the effects of shocks upon |
2903 | 2919 | impact. The results are stored in |
2904 | @var{oo_.conditional_variance_decomposition} | |
2920 | @code{oo_.conditional_variance_decomposition} | |
2905 | 2921 | (@pxref{oo_.conditional_variance_decomposition}). |
2906 | 2922 | |
2907 | 2923 | @item pruning |
2908 | 2924 | Discard higher order terms when iteratively computing simulations of |
2909 | the solution, as in @cite{Schaumburg and Sims (2008)}. | |
2925 | the solution, as in @cite{Kim, Kim, Schaumburg and Sims (2008)}. | |
2910 | 2926 | |
2911 | 2927 | @item partial_information |
2912 | 2928 | @anchor{partial_information} |
3739 | 3755 | |
3740 | 3756 | @item optim = (@var{fmincon options}) |
3741 | 3757 | Can be used to set options for @code{fmincon}, the optimizing function |
3742 | of MATLAB Optimizaiton toolbox. Use MATLAB's syntax for these | |
3758 | of MATLAB Optimization toolbox. Use MATLAB's syntax for these | |
3743 | 3759 | options. Default: |
3744 | 3760 | @code{('display','iter','LargeScale','off','MaxFunEvals',100000,'TolFun',1e-8,'TolX',1e-6)} |
3745 | 3761 | |
3976 | 3992 | Variable set by the @code{estimation} command, if it is used with the |
3977 | 3993 | @code{filtered_vars} option. Fields are of the form: |
3978 | 3994 | @example |
3979 | @code{oo_.FilteredVariables.@var{MOMENT_NAME}.@var{VARIABLE_NAME}} | |
3995 | @code{oo_.FilteredVariables.@var{VARIABLE_NAME}} | |
3980 | 3996 | @end example |
3981 | 3997 | @end defvr |
3982 | 3998 | |
3992 | 4008 | Variable set by the @code{estimation} command, if it is used with the |
3993 | 4009 | @code{smoother} option. Fields are of the form: |
3994 | 4010 | @example |
3995 | @code{oo_.SmoothedMeasurementErrors.@var{MOMENT_NAME}.@var{VARIABLE_NAME}} | |
4011 | @code{oo_.SmoothedMeasurementErrors.@var{VARIABLE_NAME}} | |
3996 | 4012 | @end example |
3997 | 4013 | @end defvr |
3998 | 4014 | |
4000 | 4016 | Variable set by the @code{estimation} command, if it is used with the |
4001 | 4017 | @code{smoother} option. Fields are of the form: |
4002 | 4018 | @example |
4003 | @code{oo_.SmoothedShocks.@var{MOMENT_NAME}.@var{VARIABLE_NAME}} | |
4019 | @code{oo_.SmoothedShocks.@var{VARIABLE_NAME}} | |
4004 | 4020 | @end example |
4005 | 4021 | @end defvr |
4006 | 4022 | |
4008 | 4024 | Variable set by the @code{estimation} command, if it is used with the |
4009 | 4025 | @code{smoother} option. Fields are of the form: |
4010 | 4026 | @example |
4011 | @code{oo_.SmoothedVariables.@var{MOMENT_NAME}.@var{VARIABLE_NAME}} | |
4027 | @code{oo_.SmoothedVariables.@var{VARIABLE_NAME}} | |
4012 | 4028 | @end example |
4013 | 4029 | @end defvr |
4014 | 4030 |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
0 | @set UPDATED 30 September 2011 | |
1 | @set UPDATED-MONTH September 2011 | |
2 | @set EDITION 4.2.2 | |
3 | @set VERSION 4.2.2 | |
0 | @set UPDATED 25 November 2011 | |
1 | @set UPDATED-MONTH November 2011 | |
2 | @set EDITION 4.2.4 | |
3 | @set VERSION 4.2.4 |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
0 | @set UPDATED 30 September 2011 | |
1 | @set UPDATED-MONTH September 2011 | |
2 | @set EDITION 4.2.2 | |
3 | @set VERSION 4.2.2 | |
0 | @set UPDATED 25 November 2011 | |
1 | @set UPDATED-MONTH November 2011 | |
2 | @set EDITION 4.2.4 | |
3 | @set VERSION 4.2.4 |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
143 | 143 | LN_S = @LN_S@ |
144 | 144 | LTLIBOBJS = @LTLIBOBJS@ |
145 | 145 | MAKEINFO = @MAKEINFO@ |
146 | MATLAB = @MATLAB@ | |
146 | 147 | MKDIR_P = @MKDIR_P@ |
147 | 148 | OBJEXT = @OBJEXT@ |
148 | 149 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
143 | 143 | LN_S = @LN_S@ |
144 | 144 | LTLIBOBJS = @LTLIBOBJS@ |
145 | 145 | MAKEINFO = @MAKEINFO@ |
146 | MATLAB = @MATLAB@ | |
146 | 147 | MKDIR_P = @MKDIR_P@ |
147 | 148 | OBJEXT = @OBJEXT@ |
148 | 149 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
130 | 130 | LN_S = @LN_S@ |
131 | 131 | LTLIBOBJS = @LTLIBOBJS@ |
132 | 132 | MAKEINFO = @MAKEINFO@ |
133 | MATLAB = @MATLAB@ | |
133 | 134 | MKDIR_P = @MKDIR_P@ |
134 | 135 | OBJEXT = @OBJEXT@ |
135 | 136 | OCTAVE = @OCTAVE@ |
43 | 43 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
45 | 45 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
46 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
47 | 47 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
48 | 48 | $(top_srcdir)/configure.ac |
49 | 49 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
128 | 128 | LN_S = @LN_S@ |
129 | 129 | LTLIBOBJS = @LTLIBOBJS@ |
130 | 130 | MAKEINFO = @MAKEINFO@ |
131 | MATLAB = @MATLAB@ | |
131 | 132 | MKDIR_P = @MKDIR_P@ |
132 | 133 | OBJEXT = @OBJEXT@ |
133 | 134 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
124 | 124 | LN_S = @LN_S@ |
125 | 125 | LTLIBOBJS = @LTLIBOBJS@ |
126 | 126 | MAKEINFO = @MAKEINFO@ |
127 | MATLAB = @MATLAB@ | |
127 | 128 | MKDIR_P = @MKDIR_P@ |
128 | 129 | OBJEXT = @OBJEXT@ |
129 | 130 | OCTAVE = @OCTAVE@ |
43 | 43 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
45 | 45 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
46 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
47 | 47 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
48 | 48 | $(top_srcdir)/configure.ac |
49 | 49 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
144 | 144 | LN_S = @LN_S@ |
145 | 145 | LTLIBOBJS = @LTLIBOBJS@ |
146 | 146 | MAKEINFO = @MAKEINFO@ |
147 | MATLAB = @MATLAB@ | |
147 | 148 | MKDIR_P = @MKDIR_P@ |
148 | 149 | OBJEXT = @OBJEXT@ |
149 | 150 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
144 | 144 | LN_S = @LN_S@ |
145 | 145 | LTLIBOBJS = @LTLIBOBJS@ |
146 | 146 | MAKEINFO = @MAKEINFO@ |
147 | MATLAB = @MATLAB@ | |
147 | 148 | MKDIR_P = @MKDIR_P@ |
148 | 149 | OBJEXT = @OBJEXT@ |
149 | 150 | OCTAVE = @OCTAVE@ |
43 | 43 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
45 | 45 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
46 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
47 | 47 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
48 | 48 | $(top_srcdir)/configure.ac |
49 | 49 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
141 | 141 | LN_S = @LN_S@ |
142 | 142 | LTLIBOBJS = @LTLIBOBJS@ |
143 | 143 | MAKEINFO = @MAKEINFO@ |
144 | MATLAB = @MATLAB@ | |
144 | 145 | MKDIR_P = @MKDIR_P@ |
145 | 146 | OBJEXT = @OBJEXT@ |
146 | 147 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
143 | 143 | LN_S = @LN_S@ |
144 | 144 | LTLIBOBJS = @LTLIBOBJS@ |
145 | 145 | MAKEINFO = @MAKEINFO@ |
146 | MATLAB = @MATLAB@ | |
146 | 147 | MKDIR_P = @MKDIR_P@ |
147 | 148 | OBJEXT = @OBJEXT@ |
148 | 149 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
139 | 139 | LN_S = @LN_S@ |
140 | 140 | LTLIBOBJS = @LTLIBOBJS@ |
141 | 141 | MAKEINFO = @MAKEINFO@ |
142 | MATLAB = @MATLAB@ | |
142 | 143 | MKDIR_P = @MKDIR_P@ |
143 | 144 | OBJEXT = @OBJEXT@ |
144 | 145 | OCTAVE = @OCTAVE@ |
25 | 25 | char mes[1500]; |
26 | 26 | mes[0] = '\0'; |
27 | 27 | printMessage(mes, 1499); |
28 | printf(mes); | |
28 | puts(mes); | |
29 | 29 | } |
30 | 30 | |
31 | 31 | int SylvException::printMessage(char* str, int maxlen) const |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
125 | 125 | LN_S = @LN_S@ |
126 | 126 | LTLIBOBJS = @LTLIBOBJS@ |
127 | 127 | MAKEINFO = @MAKEINFO@ |
128 | MATLAB = @MATLAB@ | |
128 | 129 | MKDIR_P = @MKDIR_P@ |
129 | 130 | OBJEXT = @OBJEXT@ |
130 | 131 | OCTAVE = @OCTAVE@ |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
143 | 143 | LN_S = @LN_S@ |
144 | 144 | LTLIBOBJS = @LTLIBOBJS@ |
145 | 145 | MAKEINFO = @MAKEINFO@ |
146 | MATLAB = @MATLAB@ | |
146 | 147 | MKDIR_P = @MKDIR_P@ |
147 | 148 | OBJEXT = @OBJEXT@ |
148 | 149 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
137 | 137 | LN_S = @LN_S@ |
138 | 138 | LTLIBOBJS = @LTLIBOBJS@ |
139 | 139 | MAKEINFO = @MAKEINFO@ |
140 | MATLAB = @MATLAB@ | |
140 | 141 | MKDIR_P = @MKDIR_P@ |
141 | 142 | OBJEXT = @OBJEXT@ |
142 | 143 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
129 | 129 | LN_S = @LN_S@ |
130 | 130 | LTLIBOBJS = @LTLIBOBJS@ |
131 | 131 | MAKEINFO = @MAKEINFO@ |
132 | MATLAB = @MATLAB@ | |
132 | 133 | MKDIR_P = @MKDIR_P@ |
133 | 134 | OBJEXT = @OBJEXT@ |
134 | 135 | OCTAVE = @OCTAVE@ |
42 | 42 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 46 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 47 | $(top_srcdir)/configure.ac |
48 | 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
126 | 126 | LN_S = @LN_S@ |
127 | 127 | LTLIBOBJS = @LTLIBOBJS@ |
128 | 128 | MAKEINFO = @MAKEINFO@ |
129 | MATLAB = @MATLAB@ | |
129 | 130 | MKDIR_P = @MKDIR_P@ |
130 | 131 | OBJEXT = @OBJEXT@ |
131 | 132 | OCTAVE = @OCTAVE@ |
5 | 5 | Michel Juillard <michel.juillard@mjui.fr> |
6 | 6 | Ferhat Mihoubi <fmihoubi@univ-evry.fr> |
7 | 7 | George Perendia <george@perendia.orangehome.co.uk> |
8 | Marco Ratto <marco.ratto@jrc.it> | |
8 | Marco Ratto <marco.ratto@jrc.ec.europa.eu> | |
9 | 9 | Sébastien Villemot <sebastien.villemot@ens.fr> |
10 | 10 | Source: http://www.dynare.org |
11 | 11 | |
127 | 127 | |
128 | 128 | Files: doc/dynare.texi doc/*.tex doc/*.svg doc/*.dia doc/*.pdf doc/*.bib |
129 | 129 | Copyright: 1996-2011 Dynare Team |
130 | License: GFDL-1.3+ | |
130 | License: GFDL-NIV-1.3+ | |
131 | 131 | Permission is granted to copy, distribute and/or modify this document |
132 | 132 | under the terms of the GNU Free Documentation License, Version 1.3 or |
133 | 133 | any later version published by the Free Software Foundation; with no |
137 | 137 | |
138 | 138 | Files: doc/userguide/*.tex doc/userguide/*.bib doc/userguide/*.pdf |
139 | 139 | Copyright: 2007-2011 Tommaso Mancini Griffoli |
140 | License: GFDL-1.3+ | |
140 | License: GFDL-NIV-1.3+ | |
141 | 141 | Permission is granted to copy, distribute and/or modify this document |
142 | 142 | under the terms of the GNU Free Documentation License, Version 1.3 or |
143 | 143 | any later version published by the Free Software Foundation; with no |
145 | 145 | . |
146 | 146 | A copy of the license can be found at <http://www.gnu.org/licenses/fdl.txt> |
147 | 147 | |
148 | Files: doc/dr.tex | |
149 | Copyright: 2009,2011 Sébastien Villemot | |
150 | License: GFDL-1.3+ | |
151 | Permission is granted to copy, distribute and/or modify this document | |
152 | under the terms of the GNU Free Documentation License, Version 1.3 or | |
153 | any later version published by the Free Software Foundation; with no | |
154 | Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. | |
155 | . | |
156 | A copy of the license can be found at <http://www.gnu.org/licenses/fdl.txt> | |
157 | ||
158 | Files: doc/bvar_a_la_sims.tex | |
148 | Files: doc/dr.tex doc/bvar_a_la_sims.tex | |
159 | 149 | Copyright: 2007-2011 Sébastien Villemot |
160 | License: GFDL-1.3+ | |
150 | License: GFDL-NIV-1.3+ | |
161 | 151 | Permission is granted to copy, distribute and/or modify this document |
162 | 152 | under the terms of the GNU Free Documentation License, Version 1.3 or |
163 | 153 | any later version published by the Free Software Foundation; with no |
61 | 61 | ax_mexopts_ok="yes" |
62 | 62 | ;; |
63 | 63 | maci | maci64) |
64 | SDKROOT='/Developer/SDKs/MacOSX10.5.sdk' | |
65 | MACOSX_DEPLOYMENT_TARGET='10.5' | |
64 | SDKROOT='/Developer/SDKs/MacOSX10.6.sdk' | |
65 | MACOSX_DEPLOYMENT_TARGET='10.6' | |
66 | 66 | if test "${MATLAB_ARCH}" = "maci"; then |
67 | 67 | ARCHS='i386' |
68 | MATLAB_FFLAGS='' | |
69 | 68 | else |
70 | 69 | ARCHS='x86_64' |
71 | MATLAB_FFLAGS='-m64' | |
72 | 70 | fi |
73 | 71 | MATLAB_DEFS="$MATLAB_DEFS -DNDEBUG" |
74 | 72 | MATLAB_CFLAGS="-fno-common -no-cpp-precomp -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -fexceptions -O2" |
75 | 73 | MATLAB_LDFLAGS="-L$MATLAB/bin/${MATLAB_ARCH} -Wl,-twolevel_namespace -undefined error -arch $ARCHS -Wl,-syslibroot,$SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -bundle -Wl,-exported_symbols_list,\$(top_srcdir)/mexFunction-MacOSX.map" |
76 | 74 | MATLAB_LIBS="-lmx -lmex -lmat -lstdc++ -lmwlapack" |
77 | 75 | MATLAB_CXXFLAGS="-fno-common -no-cpp-precomp -fexceptions -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -O2" |
78 | MATLAB_FFLAGS="-fexceptions $MATLAB_FFLAGS -fbackslash" | |
76 | MATLAB_FFLAGS="-fexceptions -fbackslash -arch $ARCHS" | |
79 | 77 | # Starting from MATLAB 7.5, BLAS and LAPACK are in distinct libraries |
80 | 78 | AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.5], [MATLAB_LIBS="${MATLAB_LIBS} -lmwblas"]) |
81 | 79 | ax_mexopts_ok="yes" |
125 | 125 | %------------------------------------------------------------------------------ |
126 | 126 | [T,R,SteadyState,info] = dynare_resolve('restrict'); |
127 | 127 | |
128 | if info(1) == 1 || info(1) == 2 || info(1) == 5 | |
128 | if info(1) == 1 || info(1) == 2 || info(1) == 7 || info(1) == 5 | |
129 | 129 | fval = bayestopt_.penalty+1; |
130 | 130 | cost_flag = 0; |
131 | 131 | return |
270 | 270 | % ------------------------------------------------------------------------------ |
271 | 271 | lnprior = priordens(xparam1,bayestopt_.pshape,bayestopt_.p6,bayestopt_.p7,bayestopt_.p3,bayestopt_.p4); |
272 | 272 | fval = (likelihood-lnprior); |
273 | options_.kalman_algo = kalman_algo;⏎ | |
273 | options_.kalman_algo = kalman_algo; |
31 | 31 | % |
32 | 32 | % You should have received a copy of the GNU General Public License |
33 | 33 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
34 | ||
35 | if any(Steps <= 0) | |
36 | error(['Conditional variance decomposition: All periods must be strictly ' ... | |
37 | 'positive']) | |
38 | end | |
34 | 39 | |
35 | 40 | number_of_state_innovations = ... |
36 | 41 | StateSpaceModel.number_of_state_innovations; |
0 | function err = ig1fun(nu,mu2,sigma2) | |
1 | % Copyright (C) 2011 Dynare Team | |
2 | % | |
3 | % This file is part of Dynare. | |
4 | % | |
5 | % Dynare is free software: you can redistribute it and/or modify | |
6 | % it under the terms of the GNU General Public License as published by | |
7 | % the Free Software Foundation, either version 3 of the License, or | |
8 | % (at your option) any later version. | |
9 | % | |
10 | % Dynare is distributed in the hope that it will be useful, | |
11 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | % GNU General Public License for more details. | |
14 | % | |
15 | % You should have received a copy of the GNU General Public License | |
16 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | err = log(2*mu2) - log((sigma2+mu2)*(nu-2)) + 2*( gammaln(nu/2)-gammaln((nu-1)/2) ); |
0 | function [s,nu] = inverse_gamma_specification(mu,sigma,type) | |
0 | function [s,nu] = inverse_gamma_specification(mu,sigma,type,use_fzero_flag) | |
1 | % Computes the inverse Gamma hyperparameters from the prior mean and standard deviation. | |
1 | 2 | |
2 | % function [s,nu] = inverse_gamma_specification(mu,sigma,type) | |
3 | % Specification of the inverse Gamma function parameters | |
4 | % X ~ IG(s,nu) | |
5 | % | |
6 | % INPUTS | |
7 | % mu: expectation | |
8 | % sigma: standard deviation | |
9 | % type=1: inverse Gamma 1 | |
10 | % type=2: inverse Gamma 2 | |
3 | %@info: | |
4 | %! @deftypefn {Function File} {[@var{s}, @var{nu} ]=} colon (@var{mu}, @var{sigma}, @var{type}, @var{use_fzero_flag}) | |
5 | %! @anchor{distributions/inverse_gamma_specification} | |
6 | %! @sp 1 | |
7 | %! Computes the inverse Gamma (type 1 or 2) hyperparameters from the prior mean (@var{mu}) and standard deviation (@var{sigma}). | |
8 | %! @sp 2 | |
9 | %! @strong{Inputs} | |
10 | %! @sp 1 | |
11 | %! @table @ @var | |
12 | %! @item mu | |
13 | %! Double scalar, prior mean. | |
14 | %! @item sigma | |
15 | %! Positive double scalar, prior standard deviation. | |
16 | %! @item type | |
17 | %! Integer scalar equal to one or two, type of the Inverse-Gamma distribution. | |
18 | %! @item use_fzero_flag | |
19 | %! Integer scalar equal to 0 (default) or 1. Use (matlab/octave's implementation of) fzero to solve for @var{nu} if equal to 1, use | |
20 | %! dynare's implementation of the secant method otherwise. | |
21 | %! @end table | |
22 | %! @sp 1 | |
23 | %! @strong{Outputs} | |
24 | %! @sp 1 | |
25 | %! @table @ @var | |
26 | %! @item s | |
27 | %! Positive double scalar (greater than two), first hypermarameter of the Inverse-Gamma prior. | |
28 | %! @item nu | |
29 | %! Positive double scala, second hypermarameter of the Inverse-Gamma prior. | |
30 | %! @end table | |
31 | %! @sp 2 | |
32 | %! @strong{This function is called by:} | |
33 | %! @sp 1 | |
34 | %! @ref{set_prior} | |
35 | %! @sp 2 | |
36 | %! @strong{This function calls:} | |
37 | %! @sp 2 | |
38 | %! @strong{Remark:} | |
39 | %! The call to the matlab's implementation of the secant method is here for testing purpose and should not be used. This routine fails | |
40 | %! more often in finding an interval for nu containing a signe change because it expands the interval on both sides and eventually | |
41 | %! violates the condition nu>2. | |
42 | %! | |
43 | %! @end deftypefn | |
44 | %@eod: | |
11 | 45 | |
12 | % OUTPUTS | |
13 | % s: shape parameter | |
14 | % nu: scale parameter | |
15 | % | |
16 | % SPECIAL REQUIREMENTS | |
17 | % none | |
18 | ||
19 | % Copyright (C) 2003-2010 Dynare Team | |
46 | % Copyright (C) 2003-2011 Dynare Team | |
20 | 47 | % |
21 | 48 | % This file is part of Dynare. |
22 | 49 | % |
33 | 60 | % You should have received a copy of the GNU General Public License |
34 | 61 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
35 | 62 | |
63 | check_solution_flag = 1; | |
64 | ||
65 | if nargin==3 | |
66 | use_fzero_flag = 0; | |
67 | end | |
68 | ||
36 | 69 | sigma2 = sigma^2; |
37 | 70 | mu2 = mu^2; |
38 | 71 | |
39 | if type == 2; % Inverse Gamma 2 | |
72 | if type == 2; % Inverse Gamma 2 | |
40 | 73 | nu = 2*(2+mu2/sigma2); |
41 | 74 | s = 2*mu*(1+mu2/sigma2); |
42 | elseif type == 1; % Inverse Gamma 1 | |
43 | if sigma2 < Inf; | |
75 | elseif type == 1; % Inverse Gamma 1 | |
76 | if sigma2 < Inf | |
44 | 77 | nu = sqrt(2*(2+mu2/sigma2)); |
45 | nu2 = 2*nu; | |
46 | nu1 = 2; | |
47 | err = 2*mu2*gamma(nu/2)^2-(sigma2+mu2)*(nu-2)*gamma((nu-1)/2)^2; | |
48 | while abs(nu2-nu1) > 1e-12 | |
49 | if err > 0 | |
50 | nu1 = nu; | |
51 | if nu < nu2 | |
52 | nu = nu2; | |
78 | if use_fzero_flag | |
79 | nu = fzero(@(nu)ig1fun(nu,mu2,sigma2),nu); | |
80 | else | |
81 | nu2 = 2*nu; | |
82 | nu1 = 2; | |
83 | err = ig1fun(nu,mu2,sigma2); | |
84 | err2 = ig1fun(nu2,mu2,sigma2); | |
85 | if err2>0 % Too short interval. | |
86 | while nu2<500 % Shift the interval containing the root. | |
87 | nu1 = nu2; | |
88 | nu2 = nu2*1.01; | |
89 | err2 = ig1fun(nu2,mu2,sigma2); | |
90 | if err2<0 | |
91 | break | |
92 | end | |
93 | end | |
94 | if err2>0 | |
95 | error('inverse_gamma_specification:: Failed in finding an interval containing a sign change! You should check that the prior variance is not too small compared to the prior mean...'); | |
96 | end | |
97 | end | |
98 | % Sove for nu using the secant method. | |
99 | while abs(nu2-nu1) > 1e-14 | |
100 | if err > 0 | |
101 | nu1 = nu; | |
102 | if nu < nu2 | |
103 | nu = nu2; | |
104 | else | |
105 | nu = 2*nu; | |
106 | nu2 = nu; | |
107 | end | |
53 | 108 | else |
54 | nu = 2*nu; | |
55 | 109 | nu2 = nu; |
56 | 110 | end |
57 | else | |
58 | nu2 = nu; | |
111 | nu = (nu1+nu2)/2; | |
112 | err = ig1fun(nu,mu2,sigma2); | |
59 | 113 | end |
60 | nu = (nu1+nu2)/2; | |
61 | err = 2*mu2*gamma(nu/2)^2-(sigma2+mu2)*(nu-2)*gamma((nu-1)/2)^2; | |
62 | 114 | end |
63 | 115 | s = (sigma2+mu2)*(nu-2); |
64 | else; | |
116 | if check_solution_flag | |
117 | if abs(mu-sqrt(s/2)*gamma((nu-1)/2)/gamma(nu/2))>1e-9 | |
118 | error('inverse_gamma_specification:: Failed in solving for the hyperparameters!'); | |
119 | end | |
120 | if abs(sigma-sqrt(s/(nu-2)-mu^2))>1e-9 | |
121 | error('inverse_gamma_specification:: Failed in solving for the hyperparameters!'); | |
122 | end | |
123 | end | |
124 | else | |
65 | 125 | nu = 2; |
66 | 126 | s = 2*mu2/pi; |
67 | end; | |
68 | else; | |
127 | end | |
128 | else | |
69 | 129 | s = -1; |
70 | 130 | nu = -1; |
71 | end; | |
131 | end | |
72 | 132 | |
73 | % 01/18/2004 MJ replaced fsolve with secant | |
74 | % suppressed chck | |
75 | % changed order of output parameters⏎ | |
133 | %@test:1 | |
134 | %$ [s0,nu0] = inverse_gamma_specification(.75,.2,1,0); | |
135 | %$ [s1,nu1] = inverse_gamma_specification(.75,.2,1,1); | |
136 | %$ [s3,nu3] = inverse_gamma_specification(.75,.1,1,0); | |
137 | %$ [s4,nu4] = inverse_gamma_specification(.75,.1,1,1); | |
138 | %$ % Check the results. | |
139 | %$ t(1) = dyn_assert(s0,s1,1e-6); | |
140 | %$ t(2) = dyn_assert(nu0,nu1,1e-6); | |
141 | %$ t(3) = isnan(s4); | |
142 | %$ t(4) = isnan(nu4); | |
143 | %$ t(5) = dyn_assert(s3,16.240907971002265,1e-6);; | |
144 | %$ t(6) = dyn_assert(nu3,30.368398202624046,1e-6);; | |
145 | %$ T = all(t); | |
146 | %@eof:1⏎ |
48 | 48 | % You should have received a copy of the GNU General Public License |
49 | 49 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
50 | 50 | |
51 | lead_lag_incidence = M_.lead_lag_incidence; | |
52 | ||
51 | 53 | info = 0; |
52 | 54 | |
53 | 55 | if M_.maximum_endo_lag == 0 && options_.order > 1 |
63 | 65 | |
64 | 66 | xlen = M_.maximum_endo_lead + M_.maximum_endo_lag + 1; |
65 | 67 | klen = M_.maximum_endo_lag + M_.maximum_endo_lead + 1; |
66 | iyv = M_.lead_lag_incidence'; | |
68 | iyv = lead_lag_incidence'; | |
67 | 69 | iyv = iyv(:); |
68 | 70 | iyr0 = find(iyv) ; |
69 | 71 | it_ = M_.maximum_lag + 1 ; |
139 | 141 | klen = M_.maximum_lag + M_.maximum_lead + 1; |
140 | 142 | dr.ys = [oo_.steady_state;zeros(M_.exo_nbr,1);multbar]; |
141 | 143 | oo_.steady_state = dr.ys; |
144 | lead_lag_incidence = M_.lead_lag_incidence; | |
142 | 145 | else |
143 | 146 | klen = M_.maximum_lag + M_.maximum_lead + 1; |
144 | 147 | iyv = M_.lead_lag_incidence'; |
206 | 209 | nboth = dr.nboth; |
207 | 210 | order_var = dr.order_var; |
208 | 211 | nd = size(kstate,1); |
209 | nz = nnz(M_.lead_lag_incidence); | |
212 | nz = nnz(lead_lag_incidence); | |
210 | 213 | |
211 | 214 | sdyn = M_.endo_nbr - nstatic; |
212 | 215 | |
213 | [junk,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ... | |
216 | [junk,cols_b,cols_j] = find(lead_lag_incidence(M_.maximum_endo_lag+1, ... | |
214 | 217 | order_var)); |
215 | 218 | b = zeros(M_.endo_nbr,M_.endo_nbr); |
216 | 219 | b(:,cols_b) = jacobia_(:,cols_j); |
255 | 258 | info(2) = temp'*temp; |
256 | 259 | end |
257 | 260 | if options_.loglinear == 1 |
258 | klags = find(M_.lead_lag_incidence(1,:)); | |
261 | klags = find(lead_lag_incidence(1,:)); | |
259 | 262 | dr.ghx = repmat(1./dr.ys,1,size(dr.ghx,2)).*dr.ghx.* ... |
260 | 263 | repmat(dr.ys(klags),size(dr.ghx,1),1); |
261 | 264 | dr.ghu = repmat(1./dr.ys,1,size(dr.ghu,2)).*dr.ghu; |
309 | 312 | error('Problem with AIM solver - Try to remove the "aim_solver" option') |
310 | 313 | end |
311 | 314 | else % use original Dynare solver |
312 | k1 = M_.lead_lag_incidence(find([1:klen] ~= M_.maximum_endo_lag+1),:); | |
315 | k1 = lead_lag_incidence(find([1:klen] ~= M_.maximum_endo_lag+1),:); | |
313 | 316 | a = aa(:,nonzeros(k1')); |
314 | 317 | b(:,cols_b) = aa(:,cols_j); |
315 | 318 | b10 = b(1:nstatic,1:nstatic); |
351 | 354 | mexErrCheck('mjdgges', err); |
352 | 355 | |
353 | 356 | if info1 |
354 | info(1) = 2; | |
355 | info(2) = info1; | |
357 | if info1 == -30 | |
358 | info(1) = 7; | |
359 | else | |
360 | info(1) = 2; | |
361 | info(2) = info1; | |
362 | info(3) = size(e,2); | |
363 | end | |
356 | 364 | return |
357 | 365 | end |
358 | 366 | |
366 | 374 | % lambda = qz(A,B) won't return infinite eigenvalues |
367 | 375 | if ~exist('OCTAVE_VERSION') |
368 | 376 | dr.eigval = eig(e,d); |
369 | end | |
370 | for i=1:nd | |
371 | if abs(ss(i,i)) < 1e-6 && abs(tt(i,i)) < 1e-6 | |
372 | info(1) = 7; | |
373 | end | |
374 | 377 | end |
375 | 378 | return |
376 | 379 | end |
472 | 475 | |
473 | 476 | %exogenous deterministic variables |
474 | 477 | if M_.exo_det_nbr > 0 |
475 | f1 = sparse(jacobia_(:,nonzeros(M_.lead_lag_incidence(M_.maximum_endo_lag+2:end,order_var)))); | |
476 | f0 = sparse(jacobia_(:,nonzeros(M_.lead_lag_incidence(M_.maximum_endo_lag+1,order_var)))); | |
478 | f1 = sparse(jacobia_(:,nonzeros(lead_lag_incidence(M_.maximum_endo_lag+2:end,order_var)))); | |
479 | f0 = sparse(jacobia_(:,nonzeros(lead_lag_incidence(M_.maximum_endo_lag+1,order_var)))); | |
477 | 480 | fudet = sparse(jacobia_(:,nz+M_.exo_nbr+1:end)); |
478 | 481 | M1 = inv(f0+[zeros(M_.endo_nbr,nstatic) f1*gx zeros(M_.endo_nbr,nyf-nboth)]); |
479 | 482 | M2 = M1*f1; |
489 | 492 | end |
490 | 493 | |
491 | 494 | % Second order |
492 | %tempex = oo_.exo_simul ; | |
493 | ||
494 | %hessian = real(hessext('ff1_',[z; oo_.exo_steady_state]))' ; | |
495 | kk = flipud(cumsum(flipud(M_.lead_lag_incidence(M_.maximum_endo_lag+1:end,order_var)),1)); | |
496 | if M_.maximum_endo_lag > 0 | |
497 | kk = [cumsum(M_.lead_lag_incidence(1:M_.maximum_endo_lag,order_var),1); kk]; | |
498 | end | |
499 | kk = kk'; | |
500 | kk = find(kk(:)); | |
501 | nk = size(kk,1) + M_.exo_nbr + M_.exo_det_nbr; | |
502 | k1 = M_.lead_lag_incidence(:,order_var); | |
503 | k1 = k1'; | |
504 | k1 = k1(:); | |
505 | k1 = k1(kk); | |
506 | k2 = find(k1); | |
507 | kk1(k1(k2)) = k2; | |
508 | kk1 = [kk1 length(k1)+1:length(k1)+M_.exo_nbr+M_.exo_det_nbr]; | |
509 | kk = reshape([1:nk^2],nk,nk); | |
510 | kk1 = kk(kk1,kk1); | |
511 | %[junk,junk,hessian] = feval([M_.fname '_dynamic'],z, oo_.exo_steady_state); | |
512 | hessian(:,kk1(:)) = hessian1; | |
495 | k1 = nonzeros(lead_lag_incidence(:,order_var)'); | |
496 | kk = [k1; length(k1)+(1:M_.exo_nbr+M_.exo_det_nbr)']; | |
497 | nk = size(kk,1); | |
498 | kk1 = reshape([1:nk^2],nk,nk); | |
499 | kk1 = kk1(kk,kk); | |
500 | hessian = hessian1(:,kk1(:)); | |
513 | 501 | clear hessian1 |
514 | 502 | |
515 | %oo_.exo_simul = tempex ; | |
516 | %clear tempex | |
517 | ||
518 | n1 = 0; | |
519 | n2 = np; | |
520 | 503 | zx = zeros(np,np); |
521 | 504 | zu=zeros(np,M_.exo_nbr); |
522 | for i=2:M_.maximum_endo_lag+1 | |
523 | k1 = sum(kstate(:,2) == i); | |
524 | zx(n1+1:n1+k1,n2-k1+1:n2)=eye(k1); | |
525 | n1 = n1+k1; | |
526 | n2 = n2-k1; | |
527 | end | |
528 | kk = flipud(cumsum(flipud(M_.lead_lag_incidence(M_.maximum_endo_lag+1:end,order_var)),1)); | |
505 | zx(1:np,:)=eye(np); | |
529 | 506 | k0 = [1:M_.endo_nbr]; |
530 | 507 | gx1 = dr.ghx; |
531 | 508 | hu = dr.ghu(nstatic+[1:npred],:); |
532 | zx = [zx; gx1]; | |
533 | zu = [zu; dr.ghu]; | |
534 | for i=1:M_.maximum_endo_lead | |
535 | k1 = find(kk(i+1,k0) > 0); | |
536 | zu = [zu; gx1(k1,1:npred)*hu]; | |
537 | gx1 = gx1(k1,:)*hx; | |
538 | zx = [zx; gx1]; | |
539 | kk = kk(:,k0); | |
540 | k0 = k1; | |
541 | end | |
509 | k0 = find(lead_lag_incidence(M_.maximum_endo_lag+1,order_var)'); | |
510 | zx = [zx; gx1(k0,:)]; | |
511 | zu = [zu; dr.ghu(k0,:)]; | |
512 | k1 = find(lead_lag_incidence(M_.maximum_endo_lag+2,order_var)'); | |
513 | zu = [zu; gx1(k1,:)*hu]; | |
514 | zx = [zx; gx1(k1,:)*hx]; | |
542 | 515 | zx=[zx; zeros(M_.exo_nbr,np);zeros(M_.exo_det_nbr,np)]; |
543 | 516 | zu=[zu; eye(M_.exo_nbr);zeros(M_.exo_det_nbr,M_.exo_nbr)]; |
544 | 517 | [nrzx,nczx] = size(zx); |
549 | 522 | |
550 | 523 | %lhs |
551 | 524 | n = M_.endo_nbr+sum(kstate(:,2) > M_.maximum_endo_lag+1 & kstate(:,2) < M_.maximum_endo_lag+M_.maximum_endo_lead+1); |
552 | A = zeros(n,n); | |
553 | B = zeros(n,n); | |
554 | A(1:M_.endo_nbr,1:M_.endo_nbr) = jacobia_(:,M_.lead_lag_incidence(M_.maximum_endo_lag+1,order_var)); | |
525 | A = zeros(M_.endo_nbr,M_.endo_nbr); | |
526 | B = zeros(M_.endo_nbr,M_.endo_nbr); | |
527 | A(:,k0) = jacobia_(:,nonzeros(lead_lag_incidence(M_.maximum_endo_lag+1,order_var))); | |
555 | 528 | % variables with the highest lead |
556 | k1 = find(kstate(:,2) == M_.maximum_endo_lag+M_.maximum_endo_lead+1); | |
557 | if M_.maximum_endo_lead > 1 | |
558 | k2 = find(kstate(:,2) == M_.maximum_endo_lag+M_.maximum_endo_lead); | |
559 | [junk,junk,k3] = intersect(kstate(k1,1),kstate(k2,1)); | |
560 | else | |
561 | k2 = [1:M_.endo_nbr]; | |
562 | k3 = kstate(k1,1); | |
563 | end | |
529 | k1 = find(kstate(:,2) == M_.maximum_endo_lag+2); | |
564 | 530 | % Jacobian with respect to the variables with the highest lead |
565 | B(1:M_.endo_nbr,end-length(k2)+k3) = jacobia_(:,kstate(k1,3)+M_.endo_nbr); | |
531 | fyp = jacobia_(:,kstate(k1,3)+nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:))); | |
532 | B(:,nstatic+npred-dr.nboth+1:end) = fyp; | |
566 | 533 | offset = M_.endo_nbr; |
567 | k0 = [1:M_.endo_nbr]; | |
568 | 534 | gx1 = dr.ghx; |
569 | for i=1:M_.maximum_endo_lead-1 | |
570 | k1 = find(kstate(:,2) == M_.maximum_endo_lag+i+1); | |
571 | [k2,junk,k3] = find(kstate(k1,3)); | |
572 | A(1:M_.endo_nbr,offset+k2) = jacobia_(:,k3+M_.endo_nbr); | |
573 | n1 = length(k1); | |
574 | A(offset+[1:n1],nstatic+[1:npred]) = -gx1(kstate(k1,1),1:npred); | |
575 | gx1 = gx1*hx; | |
576 | A(offset+[1:n1],offset+[1:n1]) = eye(n1); | |
577 | n0 = length(k0); | |
578 | E = eye(n0); | |
579 | if i == 1 | |
580 | [junk,junk,k4]=intersect(kstate(k1,1),[1:M_.endo_nbr]); | |
581 | else | |
582 | [junk,junk,k4]=intersect(kstate(k1,1),kstate(k0,1)); | |
583 | end | |
584 | i1 = offset-n0+n1; | |
585 | B(offset+[1:n1],offset-n0+[1:n0]) = -E(k4,:); | |
586 | k0 = k1; | |
587 | offset = offset + n1; | |
588 | end | |
589 | 535 | [junk,k1,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+M_.maximum_endo_lead+1,order_var)); |
590 | 536 | A(1:M_.endo_nbr,nstatic+1:nstatic+npred)=... |
591 | A(1:M_.endo_nbr,nstatic+[1:npred])+jacobia_(:,k2)*gx1(k1,1:npred); | |
537 | A(1:M_.endo_nbr,nstatic+[1:npred])+fyp*gx1(k1,1:npred); | |
592 | 538 | C = hx; |
593 | 539 | D = [rhs; zeros(n-M_.endo_nbr,size(rhs,2))]; |
594 | 540 | |
599 | 545 | %ghxu |
600 | 546 | %rhs |
601 | 547 | hu = dr.ghu(nstatic+1:nstatic+npred,:); |
602 | %kk = reshape([1:np*np],np,np); | |
603 | %kk = kk(1:npred,1:npred); | |
604 | %rhs = -hessian*kron(zx,zu)-f1*dr.ghxx(end-nyf+1:end,kk(:))*kron(hx(1:npred,:),hu(1:npred,:)); | |
605 | ||
606 | 548 | [err, rhs] = sparse_hessian_times_B_kronecker_C(hessian,zx,zu,options_.threads.kronecker.sparse_hessian_times_B_kronecker_C); |
607 | 549 | mexErrCheck('sparse_hessian_times_B_kronecker_C', err); |
608 | 550 | |
609 | nyf1 = sum(kstate(:,2) == M_.maximum_endo_lag+2); | |
610 | 551 | hu1 = [hu;zeros(np-npred,M_.exo_nbr)]; |
611 | %B1 = [B(1:M_.endo_nbr,:);zeros(size(A,1)-M_.endo_nbr,size(B,2))]; | |
612 | 552 | [nrhx,nchx] = size(hx); |
613 | 553 | [nrhu1,nchu1] = size(hu1); |
614 | 554 | |
623 | 563 | |
624 | 564 | %ghuu |
625 | 565 | %rhs |
626 | kk = reshape([1:np*np],np,np); | |
627 | kk = kk(1:npred,1:npred); | |
628 | ||
629 | 566 | [err, rhs] = sparse_hessian_times_B_kronecker_C(hessian,zu,options_.threads.kronecker.sparse_hessian_times_B_kronecker_C); |
630 | 567 | mexErrCheck('sparse_hessian_times_B_kronecker_C', err); |
631 | 568 | |
638 | 575 | |
639 | 576 | dr.ghxx = dr.ghxx(1:M_.endo_nbr,:); |
640 | 577 | dr.ghxu = dr.ghxu(1:M_.endo_nbr,:); |
641 | dr.ghuu = dr.ghuu(1:M_.endo_nbr,:); | |
578 | rdr.ghuu = dr.ghuu(1:M_.endo_nbr,:); | |
642 | 579 | |
643 | 580 | |
644 | 581 | % dr.ghs2 |
646 | 583 | % reordering predetermined variables in diminishing lag order |
647 | 584 | O1 = zeros(M_.endo_nbr,nstatic); |
648 | 585 | O2 = zeros(M_.endo_nbr,M_.endo_nbr-nstatic-npred); |
649 | LHS = jacobia_(:,M_.lead_lag_incidence(M_.maximum_endo_lag+1,order_var)); | |
586 | LHS = zeros(M_.endo_nbr,M_.endo_nbr); | |
587 | LHS(:,k0) = jacobia_(:,nonzeros(lead_lag_incidence(M_.maximum_endo_lag+1,order_var))); | |
650 | 588 | RHS = zeros(M_.endo_nbr,M_.exo_nbr^2); |
651 | 589 | kk = find(kstate(:,2) == M_.maximum_endo_lag+2); |
652 | 590 | gu = dr.ghu; |
654 | 592 | Gu = [dr.ghu(nstatic+[1:npred],:); zeros(np-npred,M_.exo_nbr)]; |
655 | 593 | Guu = [dr.ghuu(nstatic+[1:npred],:); zeros(np-npred,M_.exo_nbr*M_.exo_nbr)]; |
656 | 594 | E = eye(M_.endo_nbr); |
657 | M_.lead_lag_incidenceordered = flipud(cumsum(flipud(M_.lead_lag_incidence(M_.maximum_endo_lag+1:end,order_var)),1)); | |
658 | if M_.maximum_endo_lag > 0 | |
659 | M_.lead_lag_incidenceordered = [cumsum(M_.lead_lag_incidence(1:M_.maximum_endo_lag,order_var),1); M_.lead_lag_incidenceordered]; | |
660 | end | |
661 | M_.lead_lag_incidenceordered = M_.lead_lag_incidenceordered'; | |
662 | M_.lead_lag_incidenceordered = M_.lead_lag_incidenceordered(:); | |
663 | k1 = find(M_.lead_lag_incidenceordered); | |
664 | M_.lead_lag_incidenceordered(k1) = [1:length(k1)]'; | |
665 | M_.lead_lag_incidenceordered =reshape(M_.lead_lag_incidenceordered,M_.endo_nbr,M_.maximum_endo_lag+M_.maximum_endo_lead+1)'; | |
666 | 595 | kh = reshape([1:nk^2],nk,nk); |
667 | 596 | kp = sum(kstate(:,2) <= M_.maximum_endo_lag+1); |
668 | 597 | E1 = [eye(npred); zeros(kp-npred,npred)]; |
669 | 598 | H = E1; |
670 | 599 | hxx = dr.ghxx(nstatic+[1:npred],:); |
671 | for i=1:M_.maximum_endo_lead | |
672 | for j=i:M_.maximum_endo_lead | |
673 | [junk,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+j+1,order_var)); | |
674 | [junk,k3a,k3] = ... | |
675 | find(M_.lead_lag_incidenceordered(M_.maximum_endo_lag+j+1,:)); | |
676 | nk3a = length(k3a); | |
677 | [err, B1] = sparse_hessian_times_B_kronecker_C(hessian(:,kh(k3,k3)),gu(k3a,:),options_.threads.kronecker.sparse_hessian_times_B_kronecker_C); | |
678 | mexErrCheck('sparse_hessian_times_B_kronecker_C', err); | |
679 | RHS = RHS + jacobia_(:,k2)*guu(k2a,:)+B1; | |
680 | end | |
681 | % LHS | |
682 | [junk,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+i+1,order_var)); | |
683 | LHS = LHS + jacobia_(:,k2)*(E(k2a,:)+[O1(k2a,:) dr.ghx(k2a,:)*H O2(k2a,:)]); | |
684 | ||
685 | if i == M_.maximum_endo_lead | |
686 | break | |
687 | end | |
688 | ||
689 | kk = find(kstate(:,2) == M_.maximum_endo_lag+i+1); | |
690 | gu = dr.ghx*Gu; | |
691 | [nrGu,ncGu] = size(Gu); | |
692 | [err, G1] = A_times_B_kronecker_C(dr.ghxx,Gu,options_.threads.kronecker.A_times_B_kronecker_C); | |
693 | mexErrCheck('A_times_B_kronecker_C', err); | |
694 | [err, G2] = A_times_B_kronecker_C(hxx,Gu,options_.threads.kronecker.A_times_B_kronecker_C); | |
695 | mexErrCheck('A_times_B_kronecker_C', err); | |
696 | guu = dr.ghx*Guu+G1; | |
697 | Gu = hx*Gu; | |
698 | Guu = hx*Guu; | |
699 | Guu(end-npred+1:end,:) = Guu(end-npred+1:end,:) + G2; | |
700 | H = E1 + hx*H; | |
701 | end | |
600 | [junk,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+2,order_var)); | |
601 | k3 = nnz(M_.lead_lag_incidence(1:M_.maximum_endo_lag+1,:))+(1:dr.nsfwrd)'; | |
602 | [err, B1] = sparse_hessian_times_B_kronecker_C(hessian(:,kh(k3,k3)),gu(k2a,:),options_.threads.kronecker.sparse_hessian_times_B_kronecker_C); | |
603 | mexErrCheck('sparse_hessian_times_B_kronecker_C', err); | |
604 | RHS = RHS + jacobia_(:,k2)*guu(k2a,:)+B1; | |
605 | ||
606 | % LHS | |
607 | LHS = LHS + jacobia_(:,k2)*(E(k2a,:)+[O1(k2a,:) dr.ghx(k2a,:)*H O2(k2a,:)]); | |
608 | ||
702 | 609 | RHS = RHS*M_.Sigma_e(:); |
703 | 610 | dr.fuu = RHS; |
704 | 611 | %RHS = -RHS-dr.fbias; |
44 | 44 | density = @(x,a,b,aa,bb) betapdf((x-aa)/(bb-aa), a, b)/(bb-aa); |
45 | 45 | infbound = betainv(truncprior,p6(indx),p7(indx))*(p4(indx)-p3(indx))+p3(indx); |
46 | 46 | supbound = betainv(1-truncprior,p6(indx),p7(indx))*(p4(indx)-p3(indx))+p3(indx); |
47 | stepsize = (supbound-infbound)/steps; | |
48 | abscissa = infbound:stepsize:supbound; | |
47 | abscissa = linspace(infbound,supbound,steps); | |
49 | 48 | dens = density(abscissa,p6(indx),p7(indx),p3(indx),p4(indx)); |
50 | 49 | case 2% Generalized Gamma prior |
51 | 50 | density = @(x,a,b,c) gampdf(x-c,a,b); |
60 | 59 | rethrow(lasterror) |
61 | 60 | end |
62 | 61 | end |
63 | stepsize = (supbound-infbound)/steps; | |
64 | abscissa = infbound:stepsize:supbound; | |
62 | abscissa = linspace(infbound,supbound,steps); | |
65 | 63 | dens = density(abscissa,p6(indx),p7(indx),p3(indx)); |
66 | 64 | case 3% Gaussian prior |
67 | 65 | infbound = norminv(truncprior,p6(indx),p7(indx)); |
68 | 66 | supbound = norminv(1-truncprior,p6(indx),p7(indx)); |
69 | stepsize = (supbound-infbound)/steps; | |
70 | abscissa = infbound:stepsize:supbound; | |
67 | abscissa = linspace(infbound,supbound,steps); | |
71 | 68 | dens = normpdf(abscissa,p6(indx),p7(indx)); |
72 | 69 | case 4% Inverse-gamma of type 1 prior |
73 | 70 | try |
81 | 78 | rethrow(lasterror) |
82 | 79 | end |
83 | 80 | end |
84 | stepsize = (supbound-infbound)/steps; | |
85 | abscissa = infbound:stepsize:supbound; | |
81 | abscissa = linspace(infbound,supbound,steps); | |
86 | 82 | dens = exp(lpdfig1(abscissa-p3(indx),p6(indx),p7(indx))); |
87 | 83 | case 5% Uniform prior |
88 | 84 | infbound = p6(indx); |
89 | 85 | supbound = p7(indx); |
90 | stepsize = (supbound-infbound)/steps; | |
91 | abscissa = infbound:stepsize:supbound; | |
86 | abscissa = linspace(infbound,supbound,steps); | |
92 | 87 | dens = ones(1, steps) / (supbound-infbound); |
93 | 88 | case 6% Inverse-gamma of type 2 prior |
94 | 89 | try |
102 | 97 | rethrow(lasterror) |
103 | 98 | end |
104 | 99 | end |
105 | stepsize = (supbound-infbound)/steps ; | |
106 | abscissa = infbound:stepsize:supbound; | |
100 | abscissa = linspace(infbound,supbound,steps); | |
107 | 101 | dens = exp(lpdfig2(abscissa-p3(indx),p6(indx),p7(indx))); |
108 | 102 | otherwise |
109 | 103 | error(sprintf('draw_prior_density: unknown distribution shape (index %d, type %d)', indx, pshape(indx))); |
110 | 104 | end |
111 | 105 | |
112 | k = [1:length(dens)]; | |
113 | 106 | if pshape(indx) ~= 5 |
114 | 107 | [junk,k1] = max(dens); |
115 | 108 | if k1 == 1 || k1 == length(dens) |
116 | k = find(dens < 10); | |
109 | k = find(dens > 10); | |
110 | dens(k) = NaN; | |
117 | 111 | end |
118 | 112 | end |
119 | binf = abscissa(k(1)); | |
120 | bsup = abscissa(k(length(k))); | |
121 | x = abscissa(k); | |
122 | f = dens(k); | |
113 | binf = abscissa(1); | |
114 | bsup = abscissa(end); | |
115 | x = abscissa; | |
116 | f = dens; | |
123 | 117 | f(find(x<bayestopt_.lb(indx)))=0; |
124 | f(find(x>bayestopt_.ub(indx)))=0;⏎ | |
118 | f(find(x>bayestopt_.ub(indx)))=0; |
0 | function h = dyn_waitbar(prctdone, varargin) | |
1 | % h = dyn_waitbar(prctdone, varargin) | |
2 | % adaptive waitbar, producing console mode waitbars with | |
3 | % octave and when console_mode=1 | |
4 | ||
5 | % | |
6 | % Copyright (C) 2011 Dynare Team | |
7 | % | |
8 | % This file is part of Dynare. | |
9 | % | |
10 | % Dynare is free software: you can redistribute it and/or modify | |
11 | % it under the terms of the GNU General Public License as published by | |
12 | % the Free Software Foundation, either version 3 of the License, or | |
13 | % (at your option) any later version. | |
14 | % | |
15 | % Dynare is distributed in the hope that it will be useful, | |
16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | % GNU General Public License for more details. | |
19 | % | |
20 | % You should have received a copy of the GNU General Public License | |
21 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
22 | global options_ | |
23 | persistent running_text newString | |
24 | ||
25 | if prctdone==0, | |
26 | init=1; | |
27 | else | |
28 | init=0; | |
29 | end | |
30 | ||
31 | if exist('OCTAVE_VERSION') || options_.console_mode, | |
32 | ||
33 | if nargout, | |
34 | h=[]; | |
35 | end | |
36 | ||
37 | if init, | |
38 | diary off; | |
39 | running_text = varargin{1}; | |
40 | newString=''; | |
41 | return; | |
42 | elseif nargin>2, | |
43 | running_text = varargin{2}; | |
44 | end | |
45 | ||
46 | if exist('OCTAVE_VERSION'), | |
47 | printf([running_text,' %3.f%% done\r'], prctdone*100); | |
48 | else | |
49 | s0=repmat('\b',1,length(newString)); | |
50 | newString=sprintf([running_text,' %3.f%% done'], prctdone*100); | |
51 | fprintf([s0,'%s'],newString); | |
52 | end | |
53 | ||
54 | else | |
55 | if nargout, | |
56 | h = waitbar(prctdone,varargin{:}); | |
57 | else | |
58 | waitbar(prctdone,varargin{:}); | |
59 | end | |
60 | end | |
61 |
0 | function dyn_waitbar_close(h) | |
1 | % h = dyn_waitbar_close(h) | |
2 | % adaptive close waitbar, compatible with | |
3 | % octave and when console_mode=1 | |
4 | ||
5 | % | |
6 | % Copyright (C) 2011 Dynare Team | |
7 | % | |
8 | % This file is part of Dynare. | |
9 | % | |
10 | % Dynare is free software: you can redistribute it and/or modify | |
11 | % it under the terms of the GNU General Public License as published by | |
12 | % the Free Software Foundation, either version 3 of the License, or | |
13 | % (at your option) any later version. | |
14 | % | |
15 | % Dynare is distributed in the hope that it will be useful, | |
16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | % GNU General Public License for more details. | |
19 | % | |
20 | % You should have received a copy of the GNU General Public License | |
21 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
22 | global options_ | |
23 | ||
24 | if exist('OCTAVE_VERSION') || options_.console_mode, | |
25 | clear dyn_waitbar; | |
26 | diary on, | |
27 | fprintf('\n'); | |
28 | else | |
29 | close(h), | |
30 | end |
51 | 51 | addpath([dynareroot '/missing/rows_columns']) |
52 | 52 | % Replacement for vec() (inexistent under MATLAB) |
53 | 53 | addpath([dynareroot '/missing/vec']) |
54 | if ~license('test', 'statistics_toolbox') | |
54 | if isempty(license('inuse','statistics_toolbox')) | |
55 | 55 | % Replacements for functions of the stats toolbox |
56 | 56 | addpath([dynareroot '/missing/stats/']) |
57 | 57 | end |
115 | 115 | if exist(mexpath, 'dir') |
116 | 116 | addpath(mexpath) |
117 | 117 | end |
118 | end | |
119 | end | |
120 | ||
121 | if strcmp(computer, 'MACI') | |
122 | if matlab_ver_less_than('7.5') | |
123 | mexpath = [dynareroot '../mex/matlab/osx32-7.4']; | |
124 | if exist(mexpath, 'dir') | |
125 | addpath(mexpath) | |
126 | end | |
127 | else | |
128 | mexpath = [dynareroot '../mex/matlab/osx32-7.5-7.13']; | |
129 | if exist(mexpath, 'dir') | |
130 | addpath(mexpath) | |
131 | end | |
132 | end | |
133 | end | |
134 | ||
135 | if strcmp(computer, 'MACI64') | |
136 | mexpath = [dynareroot '../mex/matlab/osx64']; | |
137 | if exist(mexpath, 'dir') | |
138 | addpath(mexpath) | |
118 | 139 | end |
119 | 140 | end |
120 | 141 |
944 | 944 | fprintf(fidTeX,' \n'); |
945 | 945 | end |
946 | 946 | if nbplt == 1 |
947 | hh = figure('Name','Smoothed shocks'); | |
947 | if options_.nograph | |
948 | hh = figure('Name','Smoothed shocks','Visible','off'); | |
949 | else | |
950 | hh = figure('Name','Smoothed shocks'); | |
951 | end | |
948 | 952 | NAMES = []; |
949 | 953 | if options_.TeX, TeXNAMES = []; end |
950 | 954 | for i=1:M_.exo_nbr |
980 | 984 | eval(['print -dpdf ' M_.fname '_SmoothedShocks' int2str(1)]); |
981 | 985 | saveas(hh,[M_.fname '_SmoothedShocks' int2str(1) '.fig']); |
982 | 986 | end |
983 | if options_.nograph, close(hh), end | |
984 | 987 | if options_.TeX |
985 | 988 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
986 | 989 | for jj = 1:M_.exo_nbr |
997 | 1000 | end |
998 | 1001 | else |
999 | 1002 | for plt = 1:nbplt-1 |
1000 | hh = figure('Name','Smoothed shocks'); | |
1003 | if options_.nograph | |
1004 | hh = figure('Name','Smoothed shocks','Visible','off'); | |
1005 | else | |
1006 | hh = figure('Name','Smoothed shocks'); | |
1007 | end | |
1001 | 1008 | set(0,'CurrentFigure',hh) |
1002 | 1009 | NAMES = []; |
1003 | 1010 | if options_.TeX, TeXNAMES = []; end |
1035 | 1042 | eval(['print -dpdf ' M_.fname '_SmoothedShocks' int2str(plt)]); |
1036 | 1043 | saveas(hh,[M_.fname '_SmoothedShocks' int2str(plt) '.fig']); |
1037 | 1044 | end |
1038 | if options_.nograph, close(hh), end | |
1039 | 1045 | if options_.TeX |
1040 | 1046 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1041 | 1047 | for jj = 1:nstar |
1049 | 1055 | fprintf(fidTeX,'\n'); |
1050 | 1056 | end |
1051 | 1057 | end |
1052 | hh = figure('Name','Smoothed shocks'); | |
1058 | if options_.nograph | |
1059 | hh = figure('Name','Smoothed shocks','Visible','off'); | |
1060 | else | |
1061 | hh = figure('Name','Smoothed shocks'); | |
1062 | end | |
1053 | 1063 | set(0,'CurrentFigure',hh) |
1054 | 1064 | NAMES = []; |
1055 | 1065 | if options_.TeX, TeXNAMES = []; end |
1091 | 1101 | eval(['print -dpdf ' M_.fname '_SmoothedShocks' int2str(nbplt)]); |
1092 | 1102 | saveas(hh,[M_.fname '_SmoothedShocks' int2str(nbplt) '.fig']); |
1093 | 1103 | end |
1094 | if options_.nograph, close(hh), end | |
1095 | 1104 | if options_.TeX |
1096 | 1105 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1097 | 1106 | for jj = 1:size(NAMES,1); |
1127 | 1136 | number_of_plots_to_draw = 0; |
1128 | 1137 | index = []; |
1129 | 1138 | for i=1:n_varobs |
1130 | if max(abs(measurement_error(10:end))) > 0.000000001 | |
1139 | if max(abs(measurement_error)) > 0.000000001 | |
1131 | 1140 | number_of_plots_to_draw = number_of_plots_to_draw + 1; |
1132 | 1141 | index = cat(1,index,i); |
1133 | 1142 | end |
1142 | 1151 | fprintf(fidTeX,' \n'); |
1143 | 1152 | end |
1144 | 1153 | if nbplt == 1 |
1145 | hh = figure('Name','Smoothed observation errors'); | |
1154 | if options_.nograph | |
1155 | hh = figure('Name','Smoothed observation errors','Visible','off'); | |
1156 | else | |
1157 | hh = figure('Name','Smoothed observation errors'); | |
1158 | end | |
1146 | 1159 | set(0,'CurrentFigure',hh) |
1147 | 1160 | NAMES = []; |
1148 | 1161 | if options_.TeX, TeXNAMES = []; end |
1178 | 1191 | eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(1)]); |
1179 | 1192 | saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(1) '.fig']); |
1180 | 1193 | end |
1181 | if options_.nograph, close(hh), end | |
1182 | 1194 | if options_.TeX |
1183 | 1195 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1184 | 1196 | for jj = 1:number_of_plots_to_draw |
1194 | 1206 | fclose(fidTeX); |
1195 | 1207 | end |
1196 | 1208 | else |
1197 | for plt = 1:nbplt-1 | |
1198 | hh = figure('Name','Smoothed observation errors'); | |
1209 | for plt = 1:nbplt | |
1210 | if options_.nograph | |
1211 | hh = figure('Name','Smoothed observation errors','Visible','off'); | |
1212 | else | |
1213 | hh = figure('Name','Smoothed observation errors'); | |
1214 | end | |
1199 | 1215 | set(0,'CurrentFigure',hh) |
1200 | 1216 | NAMES = []; |
1201 | 1217 | if options_.TeX, TeXNAMES = []; end |
1202 | for i=1:nstar | |
1218 | for i=1:min(nstar,number_of_plots_to_draw-(nbplt-1)*nstar) | |
1203 | 1219 | k = (plt-1)*nstar+i; |
1204 | 1220 | subplot(nr,nc,i); |
1205 | 1221 | plot([1 gend],[0 0],'-r','linewidth',.5) |
1232 | 1248 | eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(plt)]); |
1233 | 1249 | saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(plt) '.fig']); |
1234 | 1250 | end |
1235 | if options_.nograph, close(hh), end | |
1236 | 1251 | if options_.TeX |
1237 | 1252 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1238 | 1253 | for jj = 1:nstar |
1246 | 1261 | fprintf(fidTeX,'\n'); |
1247 | 1262 | end |
1248 | 1263 | end |
1249 | hh = figure('Name','Smoothed observation errors'); | |
1250 | set(0,'CurrentFigure',hh) | |
1251 | NAMES = []; | |
1252 | if options_.TeX, TeXNAMES = []; end | |
1253 | for i=1:number_of_plots_to_draw-(nbplt-1)*nstar | |
1254 | k = (nbplt-1)*nstar+i; | |
1255 | if lr ~= 0 | |
1256 | subplot(lr,lc,i); | |
1257 | else | |
1258 | subplot(nr,nc,i); | |
1259 | end | |
1260 | plot([1 gend],[0 0],'-r','linewidth',0.5) | |
1261 | hold on | |
1262 | plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1) | |
1263 | hold off | |
1264 | name = deblank(options_.varobs(index(k),:)); | |
1265 | if isempty(NAMES) | |
1266 | NAMES = name; | |
1267 | else | |
1268 | NAMES = char(NAMES,name); | |
1269 | end | |
1270 | if ~isempty(options_.XTick) | |
1271 | set(gca,'XTick',options_.XTick) | |
1272 | set(gca,'XTickLabel',options_.XTickLabel) | |
1273 | end | |
1274 | if options_.TeX | |
1275 | idx = strmatch(options_.varobs(index(k)),M_.endo_names,'exact'); | |
1276 | texname = M_.endo_names_tex(idx,:); | |
1277 | if isempty(TeXNAMES) | |
1278 | TeXNAMES = ['$ ' deblank(texname) ' $']; | |
1279 | else | |
1280 | TeXNAMES = char(TeXNAMES,['$ ' deblank(texname) ' $']); | |
1281 | end | |
1282 | end | |
1283 | title(name,'Interpreter','none'); | |
1284 | end | |
1285 | eval(['print -depsc2 ' M_.fname '_SmoothedObservationErrors' int2str(nbplt) '.eps']); | |
1286 | if ~exist('OCTAVE_VERSION') | |
1287 | eval(['print -dpdf ' M_.fname '_SmoothedObservationErrors' int2str(nbplt)]); | |
1288 | saveas(hh,[M_.fname '_SmoothedObservationErrors' int2str(nbplt) '.fig']); | |
1289 | end | |
1290 | if options_.nograph, close(hh), end | |
1291 | if options_.TeX | |
1292 | fprintf(fidTeX,'\\begin{figure}[H]\n'); | |
1293 | for jj = 1:size(NAMES,1); | |
1294 | fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:))); | |
1295 | end | |
1296 | fprintf(fidTeX,'\\centering \n'); | |
1297 | fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_SmoothedObservedErrors%s}\n',M_.fname,int2str(nbplt)); | |
1298 | fprintf(fidTeX,'\\caption{Smoothed observed errors.}'); | |
1299 | fprintf(fidTeX,'\\label{Fig:SmoothedObservedErrors:%s}\n',int2str(nbplt)); | |
1300 | fprintf(fidTeX,'\\end{figure}\n'); | |
1301 | fprintf(fidTeX,'\n'); | |
1302 | fprintf(fidTeX,'%% End of TeX file.\n'); | |
1303 | fclose(fidTeX); | |
1304 | end | |
1305 | 1264 | end |
1306 | 1265 | end |
1307 | 1266 | %% |
1315 | 1274 | fprintf(fidTeX,' \n'); |
1316 | 1275 | end |
1317 | 1276 | if nbplt == 1 |
1318 | hh = figure('Name','Historical and smoothed variables'); | |
1277 | if options_.nograph | |
1278 | hh = figure('Name','Historical and smoothed variables','Visible','off'); | |
1279 | else | |
1280 | hh = figure('Name','Historical and smoothed variables'); | |
1281 | end | |
1319 | 1282 | NAMES = []; |
1320 | 1283 | if options_.TeX, TeXNAMES = []; end |
1321 | 1284 | for i=1:n_varobs |
1351 | 1314 | eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(1)]); |
1352 | 1315 | saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(1) '.fig']); |
1353 | 1316 | end |
1354 | if options_.nograph, close(hh), end | |
1355 | 1317 | if options_.TeX |
1356 | 1318 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1357 | 1319 | for jj = 1:n_varobs |
1368 | 1330 | end |
1369 | 1331 | else |
1370 | 1332 | for plt = 1:nbplt-1 |
1371 | hh = figure('Name','Historical and smoothed variables'); | |
1333 | if options_.nograph | |
1334 | hh = figure('Name','Historical and smoothed variables','Visible','off'); | |
1335 | else | |
1336 | hh = figure('Name','Historical and smoothed variables'); | |
1337 | end | |
1372 | 1338 | set(0,'CurrentFigure',hh) |
1373 | 1339 | NAMES = []; |
1374 | 1340 | if options_.TeX, TeXNAMES = []; end |
1406 | 1372 | eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)]); |
1407 | 1373 | saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt) '.fig']); |
1408 | 1374 | end |
1409 | if options_.nograph, close(hh), end | |
1410 | 1375 | if options_.TeX |
1411 | 1376 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1412 | 1377 | for jj = 1:nstar |
1420 | 1385 | fprintf(fidTeX,'\n'); |
1421 | 1386 | end |
1422 | 1387 | end |
1423 | hh = figure('Name','Historical and smoothed variables'); | |
1388 | if options_.nograph | |
1389 | hh = figure('Name','Historical and smoothed variables','Visible','off'); | |
1390 | else | |
1391 | hh = figure('Name','Historical and smoothed variables'); | |
1392 | end | |
1424 | 1393 | set(0,'CurrentFigure',hh) |
1425 | 1394 | NAMES = []; |
1426 | 1395 | if options_.TeX, TeXNAMES = []; end |
1462 | 1431 | eval(['print -dpdf ' M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt)]); |
1463 | 1432 | saveas(hh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(nbplt) '.fig']); |
1464 | 1433 | end |
1465 | if options_.nograph, close(hh), end | |
1466 | 1434 | if options_.TeX |
1467 | 1435 | fprintf(fidTeX,'\\begin{figure}[H]\n'); |
1468 | 1436 | for jj = 1:size(NAMES,1); |
60 | 60 | end |
61 | 61 | |
62 | 62 | %% Set the order of approximation to one (if needed). |
63 | if options_.order > 1 | |
64 | if ~exist('particle','dir') | |
65 | disp('This version of Dynare cannot estimate non linearized models!') | |
66 | disp('Set "order" equal to 1.') | |
67 | disp(' ') | |
68 | options_.order = 1; | |
69 | end | |
70 | end | |
71 | ||
72 | %% Set options_.lik_init equal to 3 if diffuse filter is used. | |
73 | if (options_.diffuse_filter==1) && (options_.lik_init==1) | |
63 | if options_.order > 1 && ~isfield(options_,'nonlinear_filter') | |
64 | disp('This version of Dynare cannot estimate non linearized models!') | |
65 | disp('Set "order" equal to 1.') | |
66 | disp(' ') | |
67 | options_.order = 1; | |
68 | end | |
69 | ||
70 | % Set options_.lik_init equal to 3 if diffuse filter is used or | |
71 | % kalman_algo refers to a diffuse filter algorithm. | |
72 | if (options_.diffuse_filter==1) || (options_.kalman_algo > 2) | |
74 | 73 | options_.lik_init = 3; |
75 | 74 | end |
76 | 75 | |
124 | 123 | [xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_); |
125 | 124 | if any(bayestopt_.pshape > 0) |
126 | 125 | % Plot prior densities. |
127 | if options_.plot_priors | |
126 | if ~options_.nograph && options_.plot_priors | |
128 | 127 | plot_priors(bayestopt_,M_,options_) |
129 | 128 | end |
130 | 129 | % Set prior bounds |
162 | 162 | run_index = 0; |
163 | 163 | |
164 | 164 | if SampleSize > 1, |
165 | h = waitbar(0,'Monte Carlo identification checks ...'); | |
165 | h = dyn_waitbar(0,'Monte Carlo identification checks ...'); | |
166 | 166 | end |
167 | 167 | [I,J]=find(M_.lead_lag_incidence'); |
168 | 168 | |
408 | 408 | end |
409 | 409 | |
410 | 410 | if SampleSize > 1, |
411 | waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
411 | dyn_waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
412 | 412 | end |
413 | 413 | end |
414 | 414 | end |
416 | 416 | |
417 | 417 | |
418 | 418 | if SampleSize > 1, |
419 | close(h), | |
419 | dyn_waitbar_close(h), | |
420 | 420 | normTAU=std(TAU')'; |
421 | 421 | normLRE=std(LRE')'; |
422 | 422 | normGAM=std(GAM')'; |
449 | 449 | idemoments0=idemoments; |
450 | 450 | idelre0 = idelre; |
451 | 451 | iteration = 0; |
452 | h = waitbar(0,'Monte Carlo identification checks ...'); | |
452 | h = dyn_waitbar(0,'Monte Carlo identification checks ...'); | |
453 | 453 | for file_index=1:length(identFiles) |
454 | 454 | load([IdentifDirectoryName '/' M_.fname '_identif_' int2str(file_index)], 'stoH', 'stoJJ', 'stoLRE') |
455 | 455 | for index=1:size(stoH,3), |
470 | 470 | identification_checks(stoH(:,:,index)./normH(:,ones(nparam,1)), ... |
471 | 471 | stoJJ(:,:,index)./normJ(:,ones(nparam,1)), ... |
472 | 472 | stoLRE(:,:,index)./normLRE(:,ones(size(stoLRE,2),1))); |
473 | waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
473 | dyn_waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
474 | 474 | end |
475 | 475 | end |
476 | close(h); | |
476 | dyn_waitbar_close(h); | |
477 | 477 | save([IdentifDirectoryName '/' M_.fname '_identif.mat'], 'idemodel', 'idemoments', 'idelre', '-append') |
478 | 478 | end |
479 | 479 | iteration = 0; |
480 | h = waitbar(0,'Monte Carlo identification checks ...'); | |
480 | h = dyn_waitbar(0,'Monte Carlo identification checks ...'); | |
481 | 481 | for file_index=1:length(identFiles) |
482 | 482 | load([IdentifDirectoryName '/' M_.fname '_identif_' int2str(file_index)], 'stoH', 'stoJJ', 'stoLRE') |
483 | 483 | for index=1:size(stoH,3), |
491 | 491 | FOCR(iteration,:) = ((GAM(:,iteration)./GAM(:,1)-1)./GAM(:,1))'*stoJJ(:,:,index); |
492 | 492 | FOCHR(iteration,:) = ((TAU(:,iteration)./TAU(:,1)-1)./TAU(:,1))'*stoH(:,:,index); |
493 | 493 | |
494 | waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
495 | end | |
496 | end | |
497 | close(h); | |
494 | dyn_waitbar(iteration/SampleSize,h,['MC Identification checks ',int2str(iteration),'/',int2str(SampleSize)]) | |
495 | end | |
496 | end | |
497 | dyn_waitbar_close(h); | |
498 | 498 | end |
499 | 499 | |
500 | 500 | % if SampleSize>1, |
577 | 577 | for ip=1:nparam, |
578 | 578 | text(ip,dy(1),name{is(ip)},'rotation',90,'HorizontalAlignment','right','interpreter','none') |
579 | 579 | end |
580 | legend('relative to param value','relative to prior std','Location','Best') | |
580 | legend('relative to param value','relative to prior std',0) | |
581 | 581 | title('Identification strength in the moments (log-scale)') |
582 | 582 | |
583 | 583 | subplot(212) |
604 | 604 | text(ip,dy(1),name{is(ip)},'rotation',90,'HorizontalAlignment','right','interpreter','none') |
605 | 605 | end |
606 | 606 | title('Sensitivity in the moments') |
607 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ide_strength.eps']); | |
608 | if ~exist('OCTAVE_VERSION'), | |
609 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_ide_strength']) | |
610 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ide_strength']); | |
611 | end | |
607 | 612 | |
608 | 613 | if advanced, |
609 | 614 | figure('Name','Identification in the model'), |
656 | 661 | end |
657 | 662 | title('Sensitivity in the model') |
658 | 663 | |
659 | if options_.nograph, close(gcf); end | |
664 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_sensitivity.eps']); | |
665 | if ~exist('OCTAVE_VERSION'), | |
666 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_sensitivity']) | |
667 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_sensitivity']); | |
668 | end | |
669 | close(gcf); | |
660 | 670 | |
661 | 671 | % identificaton patterns |
662 | 672 | for j=1:size(cosnJ,2), |
684 | 694 | ax=colormap; |
685 | 695 | ax(1,:)=[0.9 0.9 0.9]; |
686 | 696 | colormap(ax); |
687 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_ident_collinearity_', int2str(j)]) | |
688 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_collinearity_', int2str(j)]); | |
689 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_collinearity_', int2str(j)]); | |
690 | if options_.nograph, close(gcf); end | |
697 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_collinearity_', int2str(j) '.eps']); | |
698 | if ~exist('OCTAVE_VERSION'), | |
699 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_ident_collinearity_', int2str(j)]) | |
700 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_collinearity_', int2str(j)]); | |
701 | end | |
702 | close(gcf); | |
691 | 703 | end |
692 | 704 | disp('') |
693 | 705 | [U,S,V]=svd(siJ./normJ(:,ones(nparam,1)),0); |
728 | 740 | title(['Singular value ',num2str(Stit)]) |
729 | 741 | end |
730 | 742 | figure(f1); |
731 | saveas(f1,[IdentifDirectoryName,'/',M_.fname,'_ident_pattern_1']) | |
732 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_pattern_1']); | |
733 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_pattern_1']); | |
743 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_pattern_1.eps']); | |
744 | if ~exist('OCTAVE_VERSION'), | |
745 | saveas(f1,[IdentifDirectoryName,'/',M_.fname,'_ident_pattern_1']) | |
746 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_pattern_1']); | |
747 | end | |
734 | 748 | if nparam>4, |
735 | 749 | figure(f2), |
736 | saveas(f2,[IdentifDirectoryName,'/',M_.fname,'_ident_pattern_2']) | |
737 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_pattern_2']); | |
738 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_pattern_2']); | |
750 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_pattern_2.eps']); | |
751 | if ~exist('OCTAVE_VERSION'), | |
752 | saveas(f2,[IdentifDirectoryName,'/',M_.fname,'_ident_pattern_2']) | |
753 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_pattern_2']); | |
754 | end | |
739 | 755 | end |
740 | 756 | |
741 | 757 | if SampleSize>1, |
742 | options_.nograph=1; | |
743 | 758 | figure('Name','Condition Number'), |
744 | 759 | subplot(221) |
745 | 760 | hist(log10(idemodel.cond)) |
750 | 765 | subplot(223) |
751 | 766 | hist(log10(idelre.cond)) |
752 | 767 | title('log10 of Condition number in the LRE model') |
753 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_ident_COND']) | |
754 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_COND']); | |
755 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_COND']); | |
756 | if options_.nograph, close(gcf); end | |
768 | eval(['print -depsc2 ' IdentifDirectoryName '/' M_.fname '_ident_COND.eps']); | |
769 | if ~exist('OCTAVE_VERSION'), | |
770 | saveas(gcf,[IdentifDirectoryName,'/',M_.fname,'_ident_COND']) | |
771 | eval(['print -dpdf ' IdentifDirectoryName '/' M_.fname '_ident_COND']); | |
772 | end | |
773 | close(gcf) | |
757 | 774 | ncut=floor(SampleSize/10*9); |
758 | [~,is]=sort(idelre.cond); | |
775 | [dum,is]=sort(idelre.cond); | |
759 | 776 | [proba, dproba] = stab_map_1(pdraws, is(1:ncut), is(ncut+1:end), 'HighestCondNumberLRE', 1, [], IdentifDirectoryName); |
760 | [~,is]=sort(idemodel.cond); | |
777 | [dum,is]=sort(idemodel.cond); | |
761 | 778 | [proba, dproba] = stab_map_1(pdraws, is(1:ncut), is(ncut+1:end), 'HighestCondNumberModel', 1, [], IdentifDirectoryName); |
762 | [~,is]=sort(idemoments.cond); | |
779 | [dum,is]=sort(idemoments.cond); | |
763 | 780 | [proba, dproba] = stab_map_1(pdraws, is(1:ncut), is(ncut+1:end), 'HighestCondNumberMoments', 1, [], IdentifDirectoryName); |
764 | 781 | % [proba, dproba] = stab_map_1(idemoments.Mco', is(1:ncut), is(ncut+1:end), 'HighestCondNumberMoments_vs_Mco', 1, [], IdentifDirectoryName); |
765 | 782 | for j=1:nparam, |
768 | 785 | % if ~isempty(ibeh) && ~isempty(inonbeh) |
769 | 786 | % [proba, dproba] = stab_map_1(pdraws, ibeh, inonbeh, ['HighestMultiCollinearity_',name{j}], 1, [], IdentifDirectoryName); |
770 | 787 | % end |
771 | [~,is]=sort(idemoments.Mco(j,:)); | |
788 | [dum,is]=sort(idemoments.Mco(j,:)); | |
789 | options_.nograph=1; | |
772 | 790 | [proba, dproba] = stab_map_1(pdraws, is(1:ncut), is(ncut+1:end), ['HighestMultiCollinearity_',name{j}], 1, [], IdentifDirectoryName); |
773 | 791 | end |
774 | 792 | end |
37 | 37 | options_ = set_default_option(options_,'solve_algo',2); |
38 | 38 | info = 0; |
39 | 39 | if options_.solve_algo == 0 |
40 | if ~exist('OCTAVE_VERSION') && ~license('test', 'optimization_toolbox') | |
40 | if ~exist('OCTAVE_VERSION') && isempty(license('inuse','optimization_toolbox')) | |
41 | 41 | error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox') |
42 | 42 | end |
43 | 43 | options=optimset('fsolve'); |
80 | 80 | |
81 | 81 | int_width = zeros(horizon,M_.endo_nbr); |
82 | 82 | for i=1:nvar |
83 | int_width(:,i) = fact*sqrt(var_yf(:,i)); | |
83 | int_width(:,i) = -fact*sqrt(var_yf(:,i)); | |
84 | 84 | end |
85 | 85 | |
86 | 86 | yf = yf(ivar,:); |
27 | 27 | % You should have received a copy of the GNU General Public License |
28 | 28 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
29 | 29 | |
30 | global oo_ M_ options_ estim_params_ | |
30 | global oo_ M_ options_ estim_params_ bayestopt_ | |
31 | 31 | |
32 | 32 | estim_params_ = []; |
33 | bayestopt_ = []; | |
33 | 34 | |
34 | 35 | options_.console_mode = 0; |
35 | 36 |
69 | 69 | eH(ind1,length(find(vnorm(H)<eps))+1:end) = e1; % non-zero eigenvectors |
70 | 70 | eH(find(vnorm(H)<eps),1:length(find(vnorm(H)<eps)))=eye(length(find(vnorm(H)<eps))); |
71 | 71 | condH = cond(H1); |
72 | rankH = rank(HH./norm(HH),1.e-10); | |
72 | rankH = rank(H./norm(H),1.e-10); | |
73 | 73 | rankHH = rankH; |
74 | 74 | |
75 | 75 | ind2 = find(vnorm(JJ)>=eps); % take non-zero columns |
84 | 84 | M_.fname,... |
85 | 85 | oo_.exo_steady_state,... |
86 | 86 | oo_.exo_det_steady_state,... |
87 | M_.params,... | |
87 | 88 | options_.bytecode); |
88 | 89 | else |
89 | 90 | error([M_.fname '_steadystate.m doesn''t match the model']); |
70 | 70 | end |
71 | 71 | xh1=x; |
72 | 72 | end |
73 | save gstep.mat | |
73 | save gstep.mat x h1 f0 | |
74 | 74 | end |
75 | 75 | |
76 | save gstep.mat | |
76 | save gstep.mat x h1 f0 | |
77 | 77 | |
78 | 78 | |
79 |
5 | 5 | % |
6 | 6 | % adapted from Michel Juillard original rutine hessian.m |
7 | 7 | % |
8 | % func = name of the function: func must give two outputs: | |
8 | % func = function handle. The function must give two outputs: | |
9 | 9 | % - the log-likelihood AND the single contributions at times t=1,...,T |
10 | 10 | % of the log-likelihood to compute outer product gradient |
11 | 11 | % x = parameter values |
147 | 147 | h1(i)=h10; |
148 | 148 | i=0; |
149 | 149 | end |
150 | save hess.mat | |
151 | 150 | end |
152 | 151 | |
153 | 152 | h_1=h1; |
181 | 180 | xh_1(i)=x(i); |
182 | 181 | xh_1(j)=x(j); |
183 | 182 | j=j+1; |
184 | save hess.mat | |
185 | 183 | end |
186 | 184 | i=i+1; |
187 | 185 | end |
205 | 203 | A=diag(2.*h1); % rescaling matrix |
206 | 204 | % igg=inv(hh_mat); % inverted rescaled outer product hessian |
207 | 205 | ihh=A'*(hh_mat\A); % inverted outer product hessian |
208 | if hflag>0 & min(eig(reshape(hessian_mat,n,n)))>0, | |
206 | if hflag>0 && min(eig(reshape(hessian_mat,n,n)))>0, | |
209 | 207 | hh0 = A*reshape(hessian_mat,n,n)*A'; %rescaled second order derivatives |
210 | 208 | hh = reshape(hessian_mat,n,n); %rescaled second order derivatives |
211 | 209 | sd0=sqrt(diag(hh0)); %rescaled 'standard errors' using second order derivatives |
243 | 241 | end |
244 | 242 | hh1=h1; |
245 | 243 | htol1=htol; |
246 | save hess.mat | |
247 | % 11/25/03 SA Created from Hessian_sparse (removed sparse) | |
248 | ||
249 | ||
244 | save hess.mat hessian_mat |
25 | 25 | % |
26 | 26 | % You should have received a copy of the GNU General Public License |
27 | 27 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
28 | ||
29 | if exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0') | |
30 | % The set() command on the handle returned by area() crashes in Octave 3.2 | |
31 | error('plot_conditional_forecast: you need Octave >= 3.4 (because of a bug in older versions)') | |
32 | end | |
28 | 33 | |
29 | 34 | load conditional_forecasts; |
30 | 35 |
47 | 47 | error(['The Jacobian matrix evaluated at the steady state contains elements ' ... |
48 | 48 | 'that are not real or are infinite']) |
49 | 49 | case 7 |
50 | error(['One of the eigenvalues is is close to 0/0 (the absolute ' ... | |
51 | 'value of numerator and denominator is smaller than 1e-6).']) | |
50 | error(['One of the eigenvalues is close to 0/0 (the absolute ' ... | |
51 | 'value of numerator and denominator is smaller than 1e-6)']) | |
52 | 52 | case 19 |
53 | 53 | error('The steadystate file did not compute the steady state (inconsistent deep parameters).') |
54 | 54 | case 20 |
25 | 25 | |
26 | 26 | if options_.noprint == 0 |
27 | 27 | disp_steady_state(M_,oo_) |
28 | for i=M_.orig_endo_nbr:M_.endo_nbr | |
29 | if strmatch('mult_',M_.endo_names(i,:)) | |
30 | disp(sprintf('%s \t\t %g',M_.endo_names(i,:), ... | |
31 | oo_.dr.ys(i))); | |
32 | end | |
33 | end | |
34 | 28 | end |
35 | 29 | |
36 | 30 |
43 | 43 | |
44 | 44 | dyn_size_01 = size(dyn_data_01,1); |
45 | 45 | var_size_01 = size(var_names_01,1); |
46 | if exist(file_name_01) | |
46 | if exist([file_name_01 '.m'],'file') | |
47 | 47 | file_name_02 = [file_name_01 '.m']; |
48 | 48 | dyn_instr_01 = file_name_01; |
49 | 49 | eval(dyn_instr_01); |
55 | 55 | end |
56 | 56 | dyn_data_01(:,dyn_i_01) = dyn_tmp_01; |
57 | 57 | end |
58 | elseif exist([file_name_01 '.mat']) | |
58 | elseif exist([file_name_01 '.mat'],'file') | |
59 | 59 | file_name_02 = [file_name_01 '.mat']; |
60 | 60 | s = load(file_name_01); |
61 | 61 | for dyn_i_01=1:var_size_01 |
66 | 66 | end |
67 | 67 | dyn_data_01(:,dyn_i_01) = dyn_tmp_01; |
68 | 68 | end |
69 | elseif exist([file_name_01 '.xls']) | |
69 | elseif exist([file_name_01 '.xls'],'file') | |
70 | 70 | file_name_02 = [file_name_01 '.xls']; |
71 | 71 | [num,txt,raw] = xlsread(file_name_01,xls_sheet,xls_range); |
72 | 72 | for dyn_i_01=1:var_size_01 |
70 | 70 | check1 = 0; |
71 | 71 | % testing for steadystate file |
72 | 72 | if (~options_.bytecode) |
73 | fh = str2func([M_.fname '_static']); | |
73 | fh = [M_.fname '_static']; | |
74 | 74 | end; |
75 | 75 | |
76 | 76 | if options_.steadystate_flag |
221 | 221 | bayestopt_.p4(k(k2)) = Inf(length(k2),1); |
222 | 222 | for i=1:length(k) |
223 | 223 | [bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ... |
224 | inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),1) ; | |
224 | inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),1,0) ; | |
225 | 225 | bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 4) ; |
226 | 226 | end |
227 | 227 | |
243 | 243 | bayestopt_.p4(k(k2)) = Inf(length(k2),1); |
244 | 244 | for i=1:length(k) |
245 | 245 | [bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ... |
246 | inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),2); | |
246 | inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),2,0); | |
247 | 247 | bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 6) ; |
248 | 248 | end |
249 | 249 |
37 | 37 | lead_lag_incidence = M_.lead_lag_incidence; |
38 | 38 | klen = max_lag + max_lead + 1; |
39 | 39 | |
40 | fwrd_var = find(any(lead_lag_incidence(max_lag+2:end,:),1))'; | |
40 | fwrd_var = find(lead_lag_incidence(max_lag+2:end,:))'; | |
41 | 41 | if max_lag > 0 |
42 | pred_var = find(any(lead_lag_incidence(1,:),1))'; | |
42 | pred_var = find(lead_lag_incidence(1,:))'; | |
43 | 43 | both_var = intersect(pred_var,fwrd_var); |
44 | 44 | pred_var = setdiff(pred_var,both_var); |
45 | 45 | fwrd_var = setdiff(fwrd_var,both_var); |
60 | 60 | if max_lag > 0 |
61 | 61 | kmask = []; |
62 | 62 | if max_lead > 0 |
63 | kmask = [cumsum(flipud(lead_lag_incidence(max_lag+2:end,order_var)),1)] ; | |
63 | kmask = lead_lag_incidence(max_lag+2,order_var) ; | |
64 | 64 | end |
65 | kmask = [kmask; flipud(cumsum(lead_lag_incidence(1,order_var),1))] ; | |
65 | kmask = [kmask; lead_lag_incidence(1,order_var)] ; | |
66 | 66 | else |
67 | kmask = cumsum(flipud(lead_lag_incidence(max_lag+2:klen,order_var)),1) ; | |
67 | kmask = lead_lag_incidence(max_lag+2,order_var) ; | |
68 | 68 | end |
69 | 69 | |
70 | 70 | kmask = kmask'; |
37 | 37 | |
38 | 38 | y_ = zeros(size(y0,1),iter+M_.maximum_lag); |
39 | 39 | y_(:,1) = y0; |
40 | ||
41 | % stoch_simul sets k_order_solver=1 if order=3, but does so only locally, so we | |
42 | % have to do it here also | |
43 | if options_.order == 3 | |
44 | options_.k_order_solver = 1; | |
45 | end | |
40 | 46 | |
41 | 47 | if ~options_.k_order_solver |
42 | 48 | if iorder==1 |
352 | 352 | [r, y, g1, g2, g3] = feval(fname, y, x, params, ... |
353 | 353 | steady_state, it_, 0); |
354 | 354 | else |
355 | [r, y, g1] = feval(fname, y, x, params, steady_state); | |
355 | [r, y, g1] = feval(fname, y, x, params); | |
356 | 356 | end; |
357 | 357 | if max(abs(r)) >= options_.solve_tolf |
358 | 358 | [dx,flag1] = bicgstab(g1,-r,1e-7,Blck_size,L1,U1); |
77 | 77 | else |
78 | 78 | [r, g1, ssss] = feval([M_.fname '_static'], b, ss, ... |
79 | 79 | [oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params); |
80 | idx = find(abs(ssss-oo_.steady_state)>10*options_.dynatol); | |
81 | if ~isempty(idx) | |
82 | check1 = 1; | |
83 | end | |
80 | 84 | end |
81 | 85 | end |
82 | check1 = any(check2); | |
83 | idx = find(abs(ssss-oo_.steady_state)>10*options_.dynatol); | |
84 | if ~isempty(idx) | |
85 | check1 = 1; | |
86 | end | |
86 | check1 = check1 | any(check2); | |
87 | 87 | elseif options_.bytecode |
88 | 88 | [check1, residuals] = bytecode('evaluate','static',oo_.steady_state,... |
89 | 89 | [oo_.exo_steady_state; ... |
130 | 130 | if PI_PCL_solver |
131 | 131 | PCL_Part_info_moments (0, PCL_varobs, oo_.dr, i_var); |
132 | 132 | elseif options_.periods == 0 |
133 | disp_th_moments(oo_.dr,var_list); | |
133 | % There is no code for theoretical moments at 3rd order | |
134 | if options_.order <= 2 | |
135 | disp_th_moments(oo_.dr,var_list); | |
136 | end | |
134 | 137 | else |
135 | 138 | disp_moments(oo_.endo_simul,var_list); |
136 | 139 | end |
42 | 42 | |
43 | 43 | if nargin<5 |
44 | 44 | nodecomposition = 0; |
45 | end | |
46 | ||
47 | if options_.order >= 3 | |
48 | error('Theoretical moments not implemented above 2nd order') | |
45 | 49 | end |
46 | 50 | |
47 | 51 | endo_nbr = M_.endo_nbr; |
55 | 55 | |
56 | 56 | if nargin>1 |
57 | 57 | dim = varargin{1}; |
58 | if isempty(dim) | |
59 | idx = find(size(A)~=1); | |
60 | dim = idx(1); | |
61 | elseif dim~=floor(dim) || dim<1 | |
58 | if ~isempty(dim) && (dim~=floor(dim) || dim<1), | |
62 | 59 | error('Dimension must be positive integer'); |
63 | 60 | end |
64 | 61 | if nargin>2 |
66 | 63 | end |
67 | 64 | end |
68 | 65 | |
69 | ||
66 | if isempty(dim) | |
67 | idx = find(size(A)~=1); | |
68 | dim = idx(1); | |
69 | end | |
70 | ||
70 | 71 | if isempty(ntype) |
71 | 72 | y = sqrt(sum( abs(A).^2 , dim) ); |
72 | 73 | elseif ntype==1 |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.2. | |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.4. | |
3 | 3 | # |
4 | 4 | # |
5 | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
556 | 556 | # Identity of this package. |
557 | 557 | PACKAGE_NAME='dynare' |
558 | 558 | PACKAGE_TARNAME='dynare' |
559 | PACKAGE_VERSION='4.2.2' | |
560 | PACKAGE_STRING='dynare 4.2.2' | |
559 | PACKAGE_VERSION='4.2.4' | |
560 | PACKAGE_STRING='dynare 4.2.4' | |
561 | 561 | PACKAGE_BUGREPORT='' |
562 | 562 | PACKAGE_URL='' |
563 | 563 | |
1252 | 1252 | # Omit some internal or obsolete options to make the list less imposing. |
1253 | 1253 | # This message is too long to be a string in the A/UX 3.1 sh. |
1254 | 1254 | cat <<_ACEOF |
1255 | \`configure' configures dynare 4.2.2 to adapt to many kinds of systems. | |
1255 | \`configure' configures dynare 4.2.4 to adapt to many kinds of systems. | |
1256 | 1256 | |
1257 | 1257 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1258 | 1258 | |
1322 | 1322 | |
1323 | 1323 | if test -n "$ac_init_help"; then |
1324 | 1324 | case $ac_init_help in |
1325 | short | recursive ) echo "Configuration of dynare 4.2.2:";; | |
1325 | short | recursive ) echo "Configuration of dynare 4.2.4:";; | |
1326 | 1326 | esac |
1327 | 1327 | cat <<\_ACEOF |
1328 | 1328 | |
1430 | 1430 | test -n "$ac_init_help" && exit $ac_status |
1431 | 1431 | if $ac_init_version; then |
1432 | 1432 | cat <<\_ACEOF |
1433 | dynare configure 4.2.2 | |
1433 | dynare configure 4.2.4 | |
1434 | 1434 | generated by GNU Autoconf 2.68 |
1435 | 1435 | |
1436 | 1436 | Copyright (C) 2010 Free Software Foundation, Inc. |
1607 | 1607 | This file contains any messages produced by compilers while |
1608 | 1608 | running configure, to aid debugging if configure makes a mistake. |
1609 | 1609 | |
1610 | It was created by dynare $as_me 4.2.2, which was | |
1610 | It was created by dynare $as_me 4.2.4, which was | |
1611 | 1611 | generated by GNU Autoconf 2.68. Invocation command line was |
1612 | 1612 | |
1613 | 1613 | $ $0 $@ |
2423 | 2423 | |
2424 | 2424 | # Define the identity of the package. |
2425 | 2425 | PACKAGE='dynare' |
2426 | VERSION='4.2.2' | |
2426 | VERSION='4.2.4' | |
2427 | 2427 | |
2428 | 2428 | |
2429 | 2429 | cat >>confdefs.h <<_ACEOF |
3072 | 3072 | ax_mexopts_ok="yes" |
3073 | 3073 | ;; |
3074 | 3074 | maci | maci64) |
3075 | SDKROOT='/Developer/SDKs/MacOSX10.5.sdk' | |
3076 | MACOSX_DEPLOYMENT_TARGET='10.5' | |
3075 | SDKROOT='/Developer/SDKs/MacOSX10.6.sdk' | |
3076 | MACOSX_DEPLOYMENT_TARGET='10.6' | |
3077 | 3077 | if test "${MATLAB_ARCH}" = "maci"; then |
3078 | 3078 | ARCHS='i386' |
3079 | MATLAB_FFLAGS='' | |
3080 | 3079 | else |
3081 | 3080 | ARCHS='x86_64' |
3082 | MATLAB_FFLAGS='-m64' | |
3083 | 3081 | fi |
3084 | 3082 | MATLAB_DEFS="$MATLAB_DEFS -DNDEBUG" |
3085 | 3083 | MATLAB_CFLAGS="-fno-common -no-cpp-precomp -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -fexceptions -O2" |
3086 | 3084 | MATLAB_LDFLAGS="-L$MATLAB/bin/${MATLAB_ARCH} -Wl,-twolevel_namespace -undefined error -arch $ARCHS -Wl,-syslibroot,$SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -bundle -Wl,-exported_symbols_list,\$(top_srcdir)/mexFunction-MacOSX.map" |
3087 | 3085 | MATLAB_LIBS="-lmx -lmex -lmat -lstdc++ -lmwlapack" |
3088 | 3086 | MATLAB_CXXFLAGS="-fno-common -no-cpp-precomp -fexceptions -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -O2" |
3089 | MATLAB_FFLAGS="-fexceptions $MATLAB_FFLAGS -fbackslash" | |
3087 | MATLAB_FFLAGS="-fexceptions -fbackslash -arch $ARCHS" | |
3090 | 3088 | # Starting from MATLAB 7.5, BLAS and LAPACK are in distinct libraries |
3091 | 3089 | |
3092 | 3090 | |
6188 | 6186 | # report actual input values of CONFIG_FILES etc. instead of their |
6189 | 6187 | # values after options handling. |
6190 | 6188 | ac_log=" |
6191 | This file was extended by dynare $as_me 4.2.2, which was | |
6189 | This file was extended by dynare $as_me 4.2.4, which was | |
6192 | 6190 | generated by GNU Autoconf 2.68. Invocation command line was |
6193 | 6191 | |
6194 | 6192 | CONFIG_FILES = $CONFIG_FILES |
6245 | 6243 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
6246 | 6244 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
6247 | 6245 | ac_cs_version="\\ |
6248 | dynare config.status 4.2.2 | |
6246 | dynare config.status 4.2.4 | |
6249 | 6247 | configured by $0, generated by GNU Autoconf 2.68, |
6250 | 6248 | with options \\"\$ac_cs_config\\" |
6251 | 6249 |
17 | 17 | dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | |
19 | 19 | AC_PREREQ([2.61]) |
20 | AC_INIT([dynare], [4.2.2]) | |
20 | AC_INIT([dynare], [4.2.4]) | |
21 | 21 | AC_CONFIG_SRCDIR([configure.ac]) |
22 | 22 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
23 | 23 |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.2. | |
2 | # Generated by GNU Autoconf 2.68 for dynare 4.2.4. | |
3 | 3 | # |
4 | 4 | # |
5 | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
555 | 555 | # Identity of this package. |
556 | 556 | PACKAGE_NAME='dynare' |
557 | 557 | PACKAGE_TARNAME='dynare' |
558 | PACKAGE_VERSION='4.2.2' | |
559 | PACKAGE_STRING='dynare 4.2.2' | |
558 | PACKAGE_VERSION='4.2.4' | |
559 | PACKAGE_STRING='dynare 4.2.4' | |
560 | 560 | PACKAGE_BUGREPORT='' |
561 | 561 | PACKAGE_URL='' |
562 | 562 | |
1235 | 1235 | # Omit some internal or obsolete options to make the list less imposing. |
1236 | 1236 | # This message is too long to be a string in the A/UX 3.1 sh. |
1237 | 1237 | cat <<_ACEOF |
1238 | \`configure' configures dynare 4.2.2 to adapt to many kinds of systems. | |
1238 | \`configure' configures dynare 4.2.4 to adapt to many kinds of systems. | |
1239 | 1239 | |
1240 | 1240 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1241 | 1241 | |
1305 | 1305 | |
1306 | 1306 | if test -n "$ac_init_help"; then |
1307 | 1307 | case $ac_init_help in |
1308 | short | recursive ) echo "Configuration of dynare 4.2.2:";; | |
1308 | short | recursive ) echo "Configuration of dynare 4.2.4:";; | |
1309 | 1309 | esac |
1310 | 1310 | cat <<\_ACEOF |
1311 | 1311 | |
1409 | 1409 | test -n "$ac_init_help" && exit $ac_status |
1410 | 1410 | if $ac_init_version; then |
1411 | 1411 | cat <<\_ACEOF |
1412 | dynare configure 4.2.2 | |
1412 | dynare configure 4.2.4 | |
1413 | 1413 | generated by GNU Autoconf 2.68 |
1414 | 1414 | |
1415 | 1415 | Copyright (C) 2010 Free Software Foundation, Inc. |
1586 | 1586 | This file contains any messages produced by compilers while |
1587 | 1587 | running configure, to aid debugging if configure makes a mistake. |
1588 | 1588 | |
1589 | It was created by dynare $as_me 4.2.2, which was | |
1589 | It was created by dynare $as_me 4.2.4, which was | |
1590 | 1590 | generated by GNU Autoconf 2.68. Invocation command line was |
1591 | 1591 | |
1592 | 1592 | $ $0 $@ |
2402 | 2402 | |
2403 | 2403 | # Define the identity of the package. |
2404 | 2404 | PACKAGE='dynare' |
2405 | VERSION='4.2.2' | |
2405 | VERSION='4.2.4' | |
2406 | 2406 | |
2407 | 2407 | |
2408 | 2408 | cat >>confdefs.h <<_ACEOF |
5508 | 5508 | # report actual input values of CONFIG_FILES etc. instead of their |
5509 | 5509 | # values after options handling. |
5510 | 5510 | ac_log=" |
5511 | This file was extended by dynare $as_me 4.2.2, which was | |
5511 | This file was extended by dynare $as_me 4.2.4, which was | |
5512 | 5512 | generated by GNU Autoconf 2.68. Invocation command line was |
5513 | 5513 | |
5514 | 5514 | CONFIG_FILES = $CONFIG_FILES |
5565 | 5565 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
5566 | 5566 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
5567 | 5567 | ac_cs_version="\\ |
5568 | dynare config.status 4.2.2 | |
5568 | dynare config.status 4.2.4 | |
5569 | 5569 | configured by $0, generated by GNU Autoconf 2.68, |
5570 | 5570 | with options \\"\$ac_cs_config\\" |
5571 | 5571 |
17 | 17 | dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | |
19 | 19 | AC_PREREQ([2.61]) |
20 | AC_INIT([dynare], [4.2.2]) | |
20 | AC_INIT([dynare], [4.2.4]) | |
21 | 21 | AC_CONFIG_SRCDIR([configure.ac]) |
22 | 22 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
23 | 23 |
41 | 41 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
42 | 42 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
43 | 43 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
44 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
44 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
45 | 45 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
46 | 46 | $(top_srcdir)/configure.ac |
47 | 47 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
103 | 103 | LN_S = @LN_S@ |
104 | 104 | LTLIBOBJS = @LTLIBOBJS@ |
105 | 105 | MAKEINFO = @MAKEINFO@ |
106 | MATLAB = @MATLAB@ | |
106 | 107 | MKDIR_P = @MKDIR_P@ |
107 | 108 | OBJEXT = @OBJEXT@ |
108 | 109 | OCTAVE = @OCTAVE@ |
59 | 59 | pei = eval_i; |
60 | 60 | for (per = eval_r; per <= &eval_r[i_n-1]; ++per) |
61 | 61 | { |
62 | *per = *par / *pb; | |
62 | if ((fabs(*par) > 1e-6) || (fabs(*pb) > 1e-6)) | |
63 | *per = *par / *pb; | |
64 | else | |
65 | { | |
66 | /* the ratio is too close to 0/0; | |
67 | returns specific error number only if no other error */ | |
68 | if (i_info == 0) | |
69 | *info = -30; | |
70 | } | |
63 | 71 | if (*pai == 0.0 && *pb == 0.0) |
64 | 72 | *pei = 0.0; |
65 | 73 | else |
3604 | 3604 | |
3605 | 3605 | // Order of auxiliary variable definition equations: |
3606 | 3606 | // - expectation (entered before this function is called) |
3607 | // - lead variables from lower lead to higher lead (need to be listed in reverse order) | |
3607 | // - lead variables from lower lead to higher lead | |
3608 | 3608 | // - lag variables from lower lag to higher lag |
3609 | if ((type == avEndoLead) || (type == avExoLead)) | |
3610 | copy(neweqs.rbegin(), neweqs.rend(), back_inserter(aux_equations)); | |
3611 | else | |
3612 | copy(neweqs.begin(), neweqs.end(), back_inserter(aux_equations)); | |
3609 | copy(neweqs.begin(), neweqs.end(), back_inserter(aux_equations)); | |
3613 | 3610 | |
3614 | 3611 | if (neweqs.size() > 0) |
3615 | 3612 | { |
3759 | 3756 | it != trendVars.end(); it++) |
3760 | 3757 | eval_context[*it] = 2; //not <= 0 bc of log, not 1 bc of powers |
3761 | 3758 | } |
3759 | ||
3760 | bool | |
3761 | DynamicModel::isModelLocalVariableUsed() const | |
3762 | { | |
3763 | set<int> used_local_vars; | |
3764 | size_t i = 0; | |
3765 | while (i < equations.size() && used_local_vars.size() == 0) | |
3766 | { | |
3767 | equations[i]->collectModelLocalVariables(used_local_vars); | |
3768 | i++; | |
3769 | } | |
3770 | return used_local_vars.size() > 0; | |
3771 | } | |
3772 |
495 | 495 | else |
496 | 496 | return (-1); |
497 | 497 | }; |
498 | bool isModelLocalVariableUsed() const; | |
498 | 499 | }; |
499 | 500 | |
500 | 501 | #endif |
44 | 44 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
45 | 45 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
46 | 46 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
47 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
47 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
48 | 48 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
49 | 49 | $(top_srcdir)/configure.ac |
50 | 50 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
184 | 184 | LN_S = @LN_S@ |
185 | 185 | LTLIBOBJS = @LTLIBOBJS@ |
186 | 186 | MAKEINFO = @MAKEINFO@ |
187 | MATLAB = @MATLAB@ | |
187 | 188 | MKDIR_P = @MKDIR_P@ |
188 | 189 | OBJEXT = @OBJEXT@ |
189 | 190 | OCTAVE = @OCTAVE@ |
139 | 139 | cerr << "ERROR: In 'model' block, 'use_dll' option is not compatible with 'block' or 'bytecode'" << endl; |
140 | 140 | exit(EXIT_FAILURE); |
141 | 141 | } |
142 | ||
142 | if (block || byte_code) | |
143 | if (dynamic_model.isModelLocalVariableUsed()) | |
144 | { | |
145 | cerr << "ERROR: In 'model' block, 'block' or 'bytecode' options are not yet compatible with pound expressions" << endl; | |
146 | exit(EXIT_FAILURE); | |
147 | } | |
143 | 148 | if ((stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present) && no_static) |
144 | 149 | { |
145 | 150 | cerr << "ERROR: no_static option is incompatible with stoch_simul, estimation, osr, ramsey_policy, steady and check commands" << endl; |
378 | 383 | << "% from model file (.mod)" << endl << endl; |
379 | 384 | |
380 | 385 | if (clear_all) |
381 | mOutputFile << "clear all" << endl; | |
386 | { | |
387 | mOutputFile << "clear all" << endl | |
388 | // this is a work-around for a bug in Octave 3.2 | |
389 | << "clear global" << endl; | |
390 | } | |
382 | 391 | |
383 | 392 | mOutputFile << "tic;" << endl |
384 | 393 | << "global M_ oo_ options_ ys0_ ex0_" << endl |
440 | 449 | if (!use_dll) |
441 | 450 | mOutputFile << "erase_compiled_function('" + basename + "_dynamic');" << endl; |
442 | 451 | |
452 | // Erase generated steady state file (see ticket #224) | |
453 | string steadystatefile = basename + "_steadystate.m"; | |
454 | ifstream in(steadystatefile.c_str(), ios::binary); | |
455 | if (!in.fail()) | |
456 | { | |
457 | string line; | |
458 | getline(in, line); | |
459 | if (!line.compare(STEADY_STATE_GENERATED_HEADER)) | |
460 | { | |
461 | in.close(); | |
462 | unlink(steadystatefile.c_str()); | |
463 | } | |
464 | else | |
465 | in.close(); | |
466 | } | |
467 | ||
443 | 468 | #if defined(_WIN32) || defined(__CYGWIN32__) |
444 | 469 | // If using USE_DLL with MSVC, check that the user didn't use a function not supported by MSVC (because MSVC doesn't comply with C99 standard) |
445 | 470 | if (use_dll && msvc) |
848 | 848 | } |
849 | 849 | if (i > 0) |
850 | 850 | { |
851 | if ((prev_Type == EVALUATE_FORWARD && Simulation_Type == EVALUATE_FORWARD) | |
852 | || (prev_Type == EVALUATE_BACKWARD && Simulation_Type == EVALUATE_BACKWARD)) | |
851 | bool is_lead = false, is_lag = false; | |
852 | int c_Size = (block_type_size_mfs[block_type_size_mfs.size()-1]).second.first; | |
853 | int first_equation = (block_type_size_mfs[block_type_size_mfs.size()-1]).first.second; | |
854 | if (c_Size > 0 && ((prev_Type == EVALUATE_FORWARD && Simulation_Type == EVALUATE_FORWARD && !is_lead) | |
855 | || (prev_Type == EVALUATE_BACKWARD && Simulation_Type == EVALUATE_BACKWARD && !is_lag))) | |
856 | { | |
857 | for (int j = first_equation; j < first_equation+c_Size; j++) | |
858 | { | |
859 | dynamic_jacob_map_t::const_iterator it = dynamic_jacobian.find(make_pair(-1, make_pair(equation_reordered[eq], variable_reordered[j]))); | |
860 | if (it != dynamic_jacobian.end()) | |
861 | is_lag = true; | |
862 | it = dynamic_jacobian.find(make_pair(+1, make_pair(equation_reordered[eq], variable_reordered[j]))); | |
863 | if (it != dynamic_jacobian.end()) | |
864 | is_lead = true; | |
865 | } | |
866 | } | |
867 | if ((prev_Type == EVALUATE_FORWARD && Simulation_Type == EVALUATE_FORWARD && !is_lead) | |
868 | || (prev_Type == EVALUATE_BACKWARD && Simulation_Type == EVALUATE_BACKWARD && !is_lag)) | |
853 | 869 | { |
854 | 870 | //merge the current block with the previous one |
855 | 871 | BlockSimulationType c_Type = (block_type_size_mfs[block_type_size_mfs.size()-1]).first.first; |
856 | int c_Size = (block_type_size_mfs[block_type_size_mfs.size()-1]).second.first; | |
857 | int first_equation = (block_type_size_mfs[block_type_size_mfs.size()-1]).first.second; | |
858 | 872 | c_Size++; |
859 | 873 | block_type_size_mfs[block_type_size_mfs.size()-1] = make_pair(make_pair(c_Type, first_equation), make_pair(c_Size, c_Size)); |
860 | 874 | if (block_lag_lead[block_type_size_mfs.size()-1].first > Lag) |
112 | 112 | exit(EXIT_FAILURE); |
113 | 113 | } |
114 | 114 | |
115 | output << "function [ys_, check_] = " << basename << "_steadystate("; | |
115 | /* The following header is used when the preprocessor deletes the old | |
116 | generated steady state file: it distinguishes this file from a hand | |
117 | written one (see ticket #224) */ | |
118 | output << STEADY_STATE_GENERATED_HEADER << endl | |
119 | << "function [ys_, check_] = " << basename << "_steadystate("; | |
116 | 120 | if (ramsey_policy) |
117 | 121 | output << "ys_"; |
118 | 122 | else |
21 | 21 | |
22 | 22 | #include "DataTree.hh" |
23 | 23 | #include "StaticModel.hh" |
24 | ||
25 | #define STEADY_STATE_GENERATED_HEADER "% Generated file, will be deleted at next run of Dynare" | |
24 | 26 | |
25 | 27 | class SteadyStateModel : public DataTree |
26 | 28 | { |
43 | 43 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
44 | 44 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
45 | 45 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
46 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
47 | 47 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
48 | 48 | $(top_srcdir)/configure.ac |
49 | 49 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
132 | 132 | LN_S = @LN_S@ |
133 | 133 | LTLIBOBJS = @LTLIBOBJS@ |
134 | 134 | MAKEINFO = @MAKEINFO@ |
135 | MATLAB = @MATLAB@ | |
135 | 136 | MKDIR_P = @MKDIR_P@ |
136 | 137 | OBJEXT = @OBJEXT@ |
137 | 138 | OCTAVE = @OCTAVE@ |
0 | data = [0.928467646476 11.8716889412 20 0.418037507392 0.227382377518 ... | |
1 | -0.705994063083 11.7522582094 21.25 1.09254424511 -1.29488274994 ... | |
2 | -0.511895351926 9.68144025625 17.25 -1.66150408407 0.331508393098 ... | |
3 | -0.990955971267 10.0890781236 17 1.43016275252 -2.43589670141 ... | |
4 | -0.981233061806 12.1094840679 18.25 2.91293288733 -0.790246576864 ... | |
5 | -0.882182844512 8.54559460406 15 0.419579139481 0.358729719566 ... | |
6 | -0.930893002836 6.19238374422 12.5 -1.48847457959 0.739779938797 ... | |
7 | 1.53158206947 2.76544271886 11.5 -0.336216769682 0.455559918769 ... | |
8 | 2.2659052834 5.47418162513 11 0.306436789767 -0.0707985731221 ... | |
9 | 1.05419803797 6.35698426189 11 0.140700250477 0.620401487202 ... | |
10 | 1.20161076793 3.4253301593 11 0.461296492351 0.14354323987 ... | |
11 | 1.73934077971 4.70926070322 11.5 1.35798282982 0.38564694435 ... | |
12 | 1.71735262584 3.54232079749 12.5 2.9097529155 -0.804308583301 ... | |
13 | 0.426343657844 3.32719108897 13 1.64214862652 -1.18214664701 ... | |
14 | 1.67751812324 2.93444727338 11.25 0.344434910651 -1.6529373719 ... | |
15 | 1.37013301099 4.72303361923 11.75 2.61511526582 0.327684243041 ... | |
16 | 0.281231073781 4.4893853071 10.5 1.17043449257 1.12855106649 ... | |
17 | 1.53638992834 3.7325309699 10.25 -0.683947046728 0.11943538737 ... | |
18 | 1.68081431462 3.34729969129 10 1.41159342106 -1.59065680853 ... | |
19 | -0.343321601133 5.05563513564 12 1.75117366498 -2.40127764642 ... | |
20 | 0.873415608666 3.2779996255 10.25 -1.39895866711 0.0971444398216 ... | |
21 | 0.26399696544 4.78229419828 9.75 0.0914692438124 0.299310457612 ... | |
22 | -0.562233624818 3.88598638237 9.75 -0.0505384765105 0.332826708151 ... | |
23 | 2.15161914936 3.84859710132 8.75 -3.44811080489 0.789138678784 ... | |
24 | 1.2345093726 5.62225030942 9.5 -0.366945407434 2.32974981198 ... | |
25 | 1.62554967459 4.24667132831 10 -0.800958371402 0.0293183770935 ... | |
26 | 1.33035402527 2.75248979249 9.75 -0.855723113225 0.852493939813 ... | |
27 | 1.52078814077 3.53415985826 9.75 -3.37963469203 -1.05133958119 ... | |
28 | 1.16704983697 4.92754079464 10.75 -3.0142303324 0.459907431978 ... | |
29 | 0.277213572101 4.55532133037 11.75 -0.851995599415 2.03242034852 ... | |
30 | 0.842215068977 3.11164509647 12.25 -1.08290421696 0.014323281961 ... | |
31 | 1.05325028606 4.92882647578 13.5 -1.1953883867 0.706764750654 ... | |
32 | 0.453051253568 6.82998950103 13.5 0.111803656462 0.088462593153 ... | |
33 | 0.199885995525 5.82643354662 13.5 -0.920501518421 -0.26504958666 ... | |
34 | 0.137907999624 2.66076369132 13.5 -1.17122929812 -0.995642430514 ... | |
35 | 0.721949686709 5.70497876823 14.25 1.19378169018 -1.10644839651 ... | |
36 | -0.418465249225 3.75861110232 14.75 -1.03131674824 0.188507675831 ... | |
37 | -0.644028342116 4.15104788154 13.75 -1.48911756546 0.204560913792 ... | |
38 | -0.848213852668 5.65580324027 12.75 0.677011703877 -0.849628054542 ... | |
39 | -1.51954076928 11.4866911266 11.25 -0.446024680774 -0.456342350765 ... | |
40 | 0.265275055215 2.85472749592 9.75 -0.598778202436 -0.907311640831 ... | |
41 | 0.356162529063 2.29614015658 9.5 -0.46820788432 -1.22130883441 ... | |
42 | 0.368308864363 -0.539083504685 8 -0.781333991956 0.374007246518 ... | |
43 | -0.145751412732 1.61507621789 8.25 3.68291932628 1.32438399845 ... | |
44 | 0.285457283664 2.14334055993 7 1.42819405379 -0.00818660844123 ... | |
45 | 0.372390129412 1.60000213334 6.25 0.626106424052 -0.10136772765 ... | |
46 | 0.382720203063 1.72614243263 7.25 4.89631941021 -1.10060711916 ... | |
47 | 0.737957515573 2.90430582851 6 -0.0422721010314 0.4178952497 ... | |
48 | 0.649532581668 0.657135682543 6 0.692066153971 0.422299120276 ... | |
49 | 0.627159201987 1.70352689913 5.75 2.62066711305 -1.29237304034 ... | |
50 | 0.905441299817 1.95663197267 5.5 1.5949697565 -0.27115830703 ... | |
51 | 1.49322577898 -2.08741765309 6.25 1.23027694802 0.418336889527 ... | |
52 | 1.48750731567 -1.57274121871 8 3.01660550994 -0.893958254365 ... | |
53 | 1.39783858087 2.22623066426 7 -0.80842319214 1.47625453886 ... | |
54 | 0.89274836317 1.30378081742 8 -0.249485058661 0.159871204185 ... | |
55 | 0.920652246088 4.1437741965 9.75 2.8204453623 0.178149239655 ... | |
56 | -0.00264276644799 3.07989972052 8.75 -2.56342461535 2.105998353 ... | |
57 | 0.0198190461681 0.766283759256 8 -1.15838865989 1.56888883418 ... | |
58 | 0.440050515311 0.127570085801 7.5 0.0400753569995 0.028914333532 ... | |
59 | 0.129536637901 1.78174141526 6.75 0.959943962785 0.307781224401 ... | |
60 | 0.398549827172 3.03606770667 6.5 -0.340209794742 0.100979469478 ... | |
61 | 1.17174775425 0.629625188037 5.75 0.403003686814 0.902394579377 ... | |
62 | 0.991163981251 2.50862910684 4.75 -1.44963996982 1.16150986945 ... | |
63 | 0.967603566096 2.12003739013 4.75 0.610846030775 -0.889994896068 ... | |
64 | 1.14689383604 1.24185011459 4.75 2.01098091308 -1.73846431001 ... | |
65 | 1.32593824054 0.990713820685 4.75 -0.0955142989332 -0.0369257308362 ... | |
66 | 0.861135002644 -0.24744943605 6 1.72793107135 -0.691506789639 ... | |
67 | 1.26870850151 2.09844764887 6.5 1.50720217572 -1.31399187077 ... | |
68 | 0.260364987715 1.10650139716 6.5 1.13659047496 0.0720441664643 ... | |
69 | 1.09731242214 0.490796381346 7.25 4.59123894147 -2.14073070763 ... | |
70 | 1.63792841781 0.612652594286 6.75 1.79604605035 -0.644363995357 ... | |
71 | 1.48465576034 0.978295808687 6.75 -2.00753620902 1.39437534964 ... | |
72 | 1.0987608663 4.25212569087 6.25 -2.58901196498 2.56054320803 ... | |
73 | 1.42592178132 2.76984518311 6.25 0.888195752358 1.03114549274 ... | |
74 | 1.52958239462 1.31795955491 6.5 -0.902907564082 -0.0952198893776 ... | |
75 | 1.0170168994 2.14733589918 7 -1.3054866978 2.68803738466 ... | |
76 | 0.723253652257 3.43552889347 7.5 1.8213700853 0.592593586195 ... | |
77 | 1.24720806008 3.87383806577 7.5 0.0522300654168 0.988871238698 ... | |
78 | 0.482531471239 2.67793287032 7.5 2.9693944293 -0.108591166081 ... | |
79 | 0.154056100439 0.927269031704 6.75 0.119222057561 3.30489209451 ... | |
80 | 0.0694865769274 6.65916526788 6.25 0.889014476084 -2.83976849035 ... | |
81 | -0.121267434867 0.341442615696 5.25 0.323053239216 -3.49289229012 ... | |
82 | 0.726473690375 -3.5423730964 4 2.19149290449 -3.20855054004 ... | |
83 | 1.39271709108 2.63121085718 3.75 0.88406577736 0.75622580197 ... | |
84 | 1.07502077727 5.88578836799 4.25 -2.55088273352 2.89018116374 ... | |
85 | 0.759049251607 4.24703604223 4.5 0.575687665685 -0.388292506167 ... | |
86 | ]; | |
87 | ||
88 | data = reshape(data,5,86)'; | |
89 | y_obs = data(:,1); | |
90 | pie_obs = data(:,2); | |
91 | R_obs = data(:,3); | |
92 | de = data(:,4); | |
93 | dq = data(:,5); | |
94 | ||
95 | %Country: Canada | |
96 | %Sample Range: 1981:2 to 2002:3 | |
97 | %Observations: 86 | |
98 | %Variables: Real GDP Growth [%], Inflation [annualized %], Nom Rate [%], | |
99 | % Exchange Rate Change [%], Terms of Trade Change [%] |
0 | data_q = [ | |
1 | 18.02 1474.5 150.2 | |
2 | 17.94 1538.2 150.9 | |
3 | 18.01 1584.5 151.4 | |
4 | 18.42 1644.1 152 | |
5 | 18.73 1678.6 152.7 | |
6 | 19.46 1693.1 153.3 | |
7 | 19.55 1724 153.9 | |
8 | 19.56 1758.2 154.7 | |
9 | 19.79 1760.6 155.4 | |
10 | 19.77 1779.2 156 | |
11 | 19.82 1778.8 156.6 | |
12 | 20.03 1790.9 157.3 | |
13 | 20.12 1846 158 | |
14 | 20.1 1882.6 158.6 | |
15 | 20.14 1897.3 159.2 | |
16 | 20.22 1887.4 160 | |
17 | 20.27 1858.2 160.7 | |
18 | 20.34 1849.9 161.4 | |
19 | 20.39 1848.5 162 | |
20 | 20.42 1868.9 162.8 | |
21 | 20.47 1905.6 163.6 | |
22 | 20.56 1959.6 164.3 | |
23 | 20.62 1994.4 164.9 | |
24 | 20.78 2020.1 165.7 | |
25 | 21 2030.5 166.5 | |
26 | 21.2 2023.6 167.2 | |
27 | 21.33 2037.7 167.9 | |
28 | 21.62 2033.4 168.7 | |
29 | 21.71 2066.2 169.5 | |
30 | 22.01 2077.5 170.2 | |
31 | 22.15 2071.9 170.9 | |
32 | 22.27 2094 171.7 | |
33 | 22.29 2070.8 172.5 | |
34 | 22.56 2012.6 173.1 | |
35 | 22.64 2024.7 173.8 | |
36 | 22.77 2072.3 174.5 | |
37 | 22.88 2120.6 175.3 | |
38 | 22.92 2165 176.045 | |
39 | 22.91 2223.3 176.727 | |
40 | 22.94 2221.4 177.481 | |
41 | 23.03 2230.95 178.268 | |
42 | 23.13 2279.22 179.694 | |
43 | 23.22 2265.48 180.335 | |
44 | 23.32 2268.29 181.094 | |
45 | 23.4 2238.57 181.915 | |
46 | 23.45 2251.68 182.634 | |
47 | 23.51 2292.02 183.337 | |
48 | 23.56 2332.61 184.103 | |
49 | 23.63 2381.01 184.894 | |
50 | 23.75 2422.59 185.553 | |
51 | 23.81 2448.01 186.203 | |
52 | 23.87 2471.86 186.926 | |
53 | 23.94 2476.67 187.68 | |
54 | 24 2508.7 188.299 | |
55 | 24.07 2538.05 188.906 | |
56 | 24.12 2586.26 189.631 | |
57 | 24.29 2604.62 190.362 | |
58 | 24.35 2666.69 190.954 | |
59 | 24.41 2697.54 191.56 | |
60 | 24.52 2729.63 192.256 | |
61 | 24.64 2739.75 192.938 | |
62 | 24.77 2808.88 193.467 | |
63 | 24.88 2846.34 193.994 | |
64 | 25.01 2898.79 194.647 | |
65 | 25.17 2970.48 195.279 | |
66 | 25.32 3042.35 195.763 | |
67 | 25.53 3055.53 196.277 | |
68 | 25.79 3076.51 196.877 | |
69 | 26.02 3102.36 197.481 | |
70 | 26.14 3127.15 197.967 | |
71 | 26.31 3129.53 198.455 | |
72 | 26.6 3154.19 199.012 | |
73 | 26.9 3177.98 199.572 | |
74 | 27.21 3236.18 199.995 | |
75 | 27.49 3292.07 200.452 | |
76 | 27.75 3316.11 200.997 | |
77 | 28.12 3331.22 201.538 | |
78 | 28.39 3381.86 201.955 | |
79 | 28.73 3390.23 202.419 | |
80 | 29.14 3409.65 202.986 | |
81 | 29.51 3392.6 203.584 | |
82 | 29.94 3386.49 204.086 | |
83 | 30.36 3391.61 204.721 | |
84 | 30.61 3422.95 205.419 | |
85 | 31.02 3389.36 206.13 | |
86 | 31.5 3481.4 206.763 | |
87 | 31.93 3500.95 207.362 | |
88 | 32.27 3523.8 208 | |
89 | 32.54 3533.79 208.642 | |
90 | 33.02 3604.73 209.142 | |
91 | 33.2 3687.9 209.637 | |
92 | 33.49 3726.18 210.181 | |
93 | 33.95 3790.44 210.737 | |
94 | 34.36 3892.22 211.192 | |
95 | 34.94 3919.01 211.663 | |
96 | 35.61 3907.08 212.191 | |
97 | 36.29 3947.11 212.708 | |
98 | 37.01 3908.15 213.144 | |
99 | 37.79 3922.57 213.602 | |
100 | 38.96 3879.98 214.147 | |
101 | 40.13 3854.13 214.7 | |
102 | 41.05 3800.93 215.135 | |
103 | 41.66 3835.21 215.652 | |
104 | 42.41 3907.02 216.289 | |
105 | 43.19 3952.48 216.848 | |
106 | 43.69 4044.59 217.314 | |
107 | 44.15 4072.19 217.776 | |
108 | 44.77 4088.49 218.338 | |
109 | 45.57 4126.39 218.917 | |
110 | 46.32 4176.28 219.427 | |
111 | 47.07 4260.08 219.956 | |
112 | 47.66 4329.46 220.573 | |
113 | 48.63 4328.33 221.201 | |
114 | 49.42 4345.51 221.719 | |
115 | 50.41 4510.73 222.281 | |
116 | 51.27 4552.14 222.933 | |
117 | 52.35 4603.65 223.583 | |
118 | 53.51 4605.65 224.152 | |
119 | 54.65 4615.64 224.737 | |
120 | 55.82 4644.93 225.418 | |
121 | 56.92 4656.23 226.117 | |
122 | 58.18 4678.96 226.754 | |
123 | 59.55 4566.62 227.389 | |
124 | 61.01 4562.25 228.07 | |
125 | 62.59 4651.86 228.689 | |
126 | 64.15 4739.16 229.155 | |
127 | 65.37 4696.82 229.674 | |
128 | 66.65 4753.02 230.301 | |
129 | 67.87 4693.76 230.903 | |
130 | 68.86 4615.89 231.395 | |
131 | 69.72 4634.88 231.906 | |
132 | 70.66 4612.08 232.498 | |
133 | 71.44 4618.26 233.074 | |
134 | 72.08 4662.97 233.546 | |
135 | 72.83 4763.57 234.028 | |
136 | 73.48 4849 234.603 | |
137 | 74.19 4939.23 235.153 | |
138 | 75.02 5053.56 235.605 | |
139 | 75.58 5132.87 236.082 | |
140 | 76.25 5170.34 236.657 | |
141 | 76.81 5203.68 237.232 | |
142 | 77.63 5257.26 237.673 | |
143 | 78.25 5283.73 238.176 | |
144 | 78.76 5359.6 238.789 | |
145 | 79.45 5393.57 239.387 | |
146 | 79.81 5460.83 239.861 | |
147 | 80.22 5466.95 240.368 | |
148 | 80.84 5496.29 240.962 | |
149 | 81.45 5526.77 241.539 | |
150 | 82.09 5561.8 242.009 | |
151 | 82.68 5618 242.52 | |
152 | 83.33 5667.39 243.12 | |
153 | 84.09 5750.57 243.721 | |
154 | 84.67 5785.29 244.208 | |
155 | 85.56 5844.05 244.716 | |
156 | 86.66 5878.7 245.354 | |
157 | 87.44 5952.83 245.966 | |
158 | 88.45 6010.96 246.46 | |
159 | 89.39 6055.61 247.017 | |
160 | 90.13 6087.96 247.698 | |
161 | 90.88 6093.51 248.374 | |
162 | 92 6152.59 248.928 | |
163 | 93.18 6171.57 249.564 | |
164 | 94.14 6142.1 250.299 | |
165 | 95.11 6078.96 251.031 | |
166 | 96.27 6047.49 251.65 | |
167 | 97 6074.66 252.295 | |
168 | 97.7 6090.14 253.033 | |
169 | 98.31 6105.25 253.743 | |
170 | 99.13 6175.69 254.338 | |
171 | 99.79 6214.22 255.032 | |
172 | 100.17 6260.74 255.815 | |
173 | 100.88 6327.12 256.543 | |
174 | 101.84 6327.93 257.151 | |
175 | 102.35 6359.9 257.785 | |
176 | 102.83 6393.5 258.516 | |
177 | 103.51 6476.86 259.191 | |
178 | 104.13 6524.5 259.738 | |
179 | 104.71 6600.31 260.351 | |
180 | 105.39 6629.47 261.04 | |
181 | 106.09 6688.61 261.692 | |
182 | 106.75 6717.46 262.236 | |
183 | 107.24 6724.2 262.847 | |
184 | 107.75 6779.53 263.527 | |
185 | 108.29 6825.8 264.169 | |
186 | 108.91 6882 264.681 | |
187 | 109.24 6983.91 265.258 | |
188 | 109.74 7020 265.887 | |
189 | 110.23 7093.12 266.491 | |
190 | 111 7166.68 266.987 | |
191 | 111.43 7236.5 267.545 | |
192 | 111.76 7311.24 268.171 | |
193 | 112.08 7364.63 268.815 | |
194 | ]; | |
195 | %GDPD GDPQ GPOP | |
196 | ||
197 | series = zeros(193,2); | |
198 | series(:,2) = data_q(:,1); | |
199 | series(:,1) = 1000*data_q(:,2)./data_q(:,3); | |
200 | ||
201 | Y_obs = series(:,1); | |
202 | P_obs = series(:,2); | |
203 | ||
204 | series = series(2:193,:)./series(1:192,:); | |
205 | ||
206 | gy_obs = series(:,1); | |
207 | gp_obs = series(:,2); | |
208 | ||
209 | ti = [1950:0.25:1997.75];⏎ |
0 | DYNARE_ROOT = $(abs_top_srcdir)/matlab | |
1 | ||
2 | MODS = \ | |
0 | MODFILES = \ | |
3 | 1 | ramst.mod \ |
4 | 2 | ramst_a.mod \ |
5 | 3 | example1.mod \ |
6 | 4 | example2.mod \ |
7 | 5 | example1_use_dll.mod \ |
8 | example1_with_tags.mod\ | |
6 | example1_with_tags.mod \ | |
9 | 7 | t_sgu_ex1.mod \ |
10 | 8 | osr_example.mod \ |
11 | 9 | optimal_policy/ramsey.mod \ |
19 | 17 | comments.mod \ |
20 | 18 | histval_sto.mod \ |
21 | 19 | histval_det.mod \ |
22 | expectation.mod \ | |
20 | auxiliary_variables/test1.mod \ | |
21 | expectations/expectation.mod \ | |
22 | expectations/expectation_ss.mod \ | |
23 | expectations/expectation_ss_old.mod \ | |
24 | expectations/expectation_nested.mod \ | |
25 | steady_state/walsh1_initval.mod \ | |
26 | steady_state/walsh1_old_ss.mod \ | |
27 | steady_state/walsh1_ssm.mod \ | |
28 | steady_state/walsh1_ssm_block.mod \ | |
29 | steady_state/multi_leads.mod \ | |
23 | 30 | steady_state_operator/standard.mod \ |
24 | 31 | steady_state_operator/use_dll.mod \ |
25 | 32 | steady_state_operator/block.mod \ |
46 | 53 | fs2000/fs2000.mod \ |
47 | 54 | fs2000/fs2000a.mod \ |
48 | 55 | fs2000/fs2000c.mod \ |
56 | fs2000/fs2000d.mod \ | |
49 | 57 | homotopy/homotopy1_test.mod \ |
50 | 58 | homotopy/homotopy2_test.mod \ |
51 | 59 | homotopy/homotopy3_test.mod \ |
72 | 80 | external_function/example1_no_deriv_functions_provided.mod \ |
73 | 81 | external_function/example1_no_deriv_functions_provided_dll.mod \ |
74 | 82 | seeds.mod \ |
75 | simul/example1.mod | |
76 | ||
77 | EXTRA_DIST = $(MODS) \ | |
83 | identification/kim/kim2.mod \ | |
84 | identification/as2007/as2007.mod \ | |
85 | simul/example1.mod \ | |
86 | conditional_forecasts/fs2000_est.mod \ | |
87 | recursive/ls2003.mod \ | |
88 | recursive/ls2003_bayesian.mod \ | |
89 | kalman_filter_smoother/gen_data.mod \ | |
90 | kalman_filter_smoother/algo1.mod \ | |
91 | kalman_filter_smoother/algo2.mod \ | |
92 | kalman_filter_smoother/algo3.mod \ | |
93 | kalman_filter_smoother/algo4.mod \ | |
94 | kalman_filter_smoother/algo4a.mod \ | |
95 | kalman_filter_smoother/algo4b.mod \ | |
96 | kalman_filter_smoother/algoH1.mod \ | |
97 | kalman_filter_smoother/algoH2.mod \ | |
98 | kalman_filter_smoother/algoH3.mod \ | |
99 | kalman_filter_smoother/fs2000.mod \ | |
100 | kalman_filter_smoother/fs2000_1.mod \ | |
101 | kalman_filter_smoother/fs2000_2.mod \ | |
102 | kalman_filter_smoother/fs2000a.mod \ | |
103 | second_order/burnside_1.mod \ | |
104 | second_order/ds1.mod \ | |
105 | second_order/ds2.mod | |
106 | ||
107 | EXTRA_DIST = \ | |
108 | $(MODFILES) \ | |
109 | homotopy/common.mod \ | |
110 | block_bytecode/ls2003.mod \ | |
111 | fs2000_ssfile_aux.m \ | |
112 | printMakeCheckMatlabErrMsg.m \ | |
113 | printMakeCheckOctaveErrMsg.m \ | |
114 | ramst_initval_file_data.m \ | |
115 | run_test.m \ | |
116 | run_test_matlab.m \ | |
78 | 117 | run_test_octave.m \ |
79 | block_bytecode/run_block_bytecode_tests.m \ | |
118 | test.m \ | |
119 | AIM/data_ca1.m \ | |
120 | AIM/fs2000_b1L1L_AIM_steadystate.m \ | |
121 | AIM/fs2000_b1L1L_steadystate.m \ | |
122 | AIM/fsdat.m \ | |
80 | 123 | block_bytecode/run_ls2003.m \ |
81 | block_bytecode/ls2003.mod \ | |
124 | bvar_a_la_sims/bvar_sample.m \ | |
82 | 125 | external_function/extFunDeriv.m \ |
83 | 126 | external_function/extFunNoDerivs.m \ |
84 | 127 | external_function/extFunWithFirstAndSecondDerivs.m \ |
128 | expectations/expectation_ss_old_steadystate.m \ | |
129 | steady_state/walsh1_old_ss_steadystate.m \ | |
130 | fs2000/fs2000a_steadystate.m \ | |
85 | 131 | fs2000/fsdat_simul.m \ |
86 | fs2000/fs2000a_steadystate.m \ | |
87 | identification/kim/kim2_steadystate.m \ | |
88 | identification/as2007/as2007_steadystate.m \ | |
89 | AIM/fs2000_b1L1L_steadystate.m \ | |
90 | AIM/fs2000_b1L1L_AIM_steadystate.m \ | |
91 | test.m \ | |
92 | objectives \ | |
93 | ramst_initval_file_data.m \ | |
94 | homotopy/common.mod \ | |
95 | bvar_a_la_sims/bvar_sample.m \ | |
96 | fs2000_ssfile_aux.m | |
97 | ||
98 | TARGETS = check-matlab | |
132 | k_order_perturbation/run_fs2000kplusplus.m \ | |
133 | ls2003/data_ca1.m \ | |
134 | measurement_errors/data_ca1.m \ | |
135 | missing/simulate_data_with_missing_observations.m \ | |
136 | objectives/sgu_ex1.mat \ | |
137 | conditional_forecasts/fsdat_simul.m \ | |
138 | recursive/data_ca1.m \ | |
139 | kalman_filter_smoother/fsdat_simul.m \ | |
140 | kalman_filter_smoother/fs2000a_steadystate.m \ | |
141 | identification/kim/kim2_steadystate.m | |
142 | ||
143 | TARGETS = | |
144 | ||
145 | if HAVE_CMD_LINE_MATLAB | |
146 | TARGETS += check-matlab | |
147 | endif | |
99 | 148 | |
100 | 149 | if HAVE_OCTAVE |
101 | TARGETS += check-octave check-block-bytecode | |
150 | TARGETS += check-octave | |
102 | 151 | endif |
103 | 152 | |
104 | 153 | check-local: $(TARGETS) |
105 | 154 | |
106 | check-octave: $(MODS) | |
107 | @set -e; \ | |
108 | for modfile in $(MODS); do \ | |
109 | $(OCTAVE) --norc --silent --no-history run_test_octave.m $$modfile $(DYNARE_ROOT) $(PACKAGE_VERSION); \ | |
110 | done | |
111 | .PHONY: check-octave | |
112 | ||
113 | check-block-bytecode: | |
114 | cd block_bytecode && $(OCTAVE) --norc --silent --no-history run_block_bytecode_tests.m $(DYNARE_ROOT) $(PACKAGE_VERSION) | |
115 | .PHONY: check-block-bytecode | |
116 | ||
117 | check-matlab: $(MODS) | |
118 | # MATLAB stuff to be added here | |
119 | .PHONY: check-matlab | |
155 | check-matlab: | |
156 | DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(MATLAB)/bin/matlab -nodesktop -nosplash -r run_test_matlab | |
157 | ||
158 | check-octave: | |
159 | DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(OCTAVE) --norc --silent --no-history run_test_octave.m | |
120 | 160 | |
121 | 161 | clean-local: |
122 | rm -f $(patsubst %.mod, %.m, $(MODS)) \ | |
123 | $(patsubst %.mod, %_static.*, $(MODS)) \ | |
124 | $(patsubst %.mod, %_objective_static.m, $(MODS)) \ | |
125 | $(patsubst %.mod, %_dynamic.*, $(MODS)) | |
126 | ||
127 | rm -f $(patsubst %.mod, %_results.mat, $(MODS)) \ | |
128 | $(patsubst %.mod, %_mode.mat, $(MODS)) \ | |
129 | $(patsubst %.mod, %_mh_mode.mat, $(MODS)) \ | |
130 | $(patsubst %.mod, %_mean.mat, $(MODS)) \ | |
131 | $(patsubst %.mod, %_pindx.mat, $(MODS)) \ | |
132 | $(patsubst %.mod, %_params.mat, $(MODS)) \ | |
133 | $(patsubst %.mod, %_simul, $(MODS)) \ | |
134 | $(patsubst %.mod, %.log, $(MODS)) | |
135 | ||
136 | rm -rf $(patsubst %.mod, %, $(MODS)) | |
137 | ||
138 | rm -f $(patsubst %.mod, %*.pdf, $(MODS)) \ | |
139 | $(patsubst %.mod, %*.eps, $(MODS)) \ | |
140 | $(patsubst %.mod, %*.fig, $(MODS)) | |
162 | rm -f $(patsubst %.mod, %.m, $(MODFILES)) \ | |
163 | $(patsubst %.mod, %_static.*, $(MODFILES)) \ | |
164 | $(patsubst %.mod, %_objective_static.m, $(MODFILES)) \ | |
165 | $(patsubst %.mod, %_dynamic.*, $(MODFILES)) | |
166 | ||
167 | rm -f $(patsubst %.mod, %_results.mat, $(MODFILES)) \ | |
168 | $(patsubst %.mod, %_mode.mat, $(MODFILES)) \ | |
169 | $(patsubst %.mod, %_mh_mode.mat, $(MODFILES)) \ | |
170 | $(patsubst %.mod, %_mean.mat, $(MODFILES)) \ | |
171 | $(patsubst %.mod, %_pindx.mat, $(MODFILES)) \ | |
172 | $(patsubst %.mod, %_params.mat, $(MODFILES)) \ | |
173 | $(patsubst %.mod, %_simul, $(MODFILES)) \ | |
174 | $(patsubst %.mod, %.log, $(MODFILES)) | |
175 | ||
176 | rm -rf $(patsubst %.mod, %, $(MODFILES)) | |
177 | ||
178 | rm -f $(patsubst %.mod, %*.pdf, $(MODFILES)) \ | |
179 | $(patsubst %.mod, %*.eps, $(MODFILES)) \ | |
180 | $(patsubst %.mod, %*.fig, $(MODFILES)) | |
141 | 181 | |
142 | 182 | rm -f $(shell find -name g1.mat) \ |
143 | 183 | $(shell find -name g2.mat) \ |
158 | 198 | |
159 | 199 | rm -rf partial_information/PItest3aHc0PCLsimModPiYrVarobsAll_PCL* partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR_PCL* |
160 | 200 | |
161 | rm -rf block_bytecode/ws block_bytecode/ls2003_tmp* | |
201 | rm -rf block_bytecode/ls2003_tmp* | |
202 | ||
203 | rm -f $(shell find -name wsOct) \ | |
204 | $(shell find -name wsMat.mat) | |
205 | ||
206 | rm -f run_test_matlab_output.txt run_test_octave_output.txt |
32 | 32 | POST_UNINSTALL = : |
33 | 33 | build_triplet = @build@ |
34 | 34 | host_triplet = @host@ |
35 | @HAVE_OCTAVE_TRUE@am__append_1 = check-octave check-block-bytecode | |
35 | @HAVE_CMD_LINE_MATLAB_TRUE@am__append_1 = check-matlab | |
36 | @HAVE_OCTAVE_TRUE@am__append_2 = check-octave | |
36 | 37 | subdir = tests |
37 | 38 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
38 | 39 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
42 | 43 | $(top_srcdir)/m4/ax_latex_bibtex_test.m4 \ |
43 | 44 | $(top_srcdir)/m4/ax_latex_class.m4 \ |
44 | 45 | $(top_srcdir)/m4/ax_latex_test.m4 \ |
45 | $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | $(top_srcdir)/m4/ax_matlab.m4 $(top_srcdir)/m4/ax_prog_ln_s.m4 \ | |
46 | 47 | $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/ax_tex_test.m4 \ |
47 | 48 | $(top_srcdir)/configure.ac |
48 | 49 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
104 | 105 | LN_S = @LN_S@ |
105 | 106 | LTLIBOBJS = @LTLIBOBJS@ |
106 | 107 | MAKEINFO = @MAKEINFO@ |
108 | MATLAB = @MATLAB@ | |
107 | 109 | MKDIR_P = @MKDIR_P@ |
108 | 110 | OBJEXT = @OBJEXT@ |
109 | 111 | OCTAVE = @OCTAVE@ |
183 | 185 | top_build_prefix = @top_build_prefix@ |
184 | 186 | top_builddir = @top_builddir@ |
185 | 187 | top_srcdir = @top_srcdir@ |
186 | DYNARE_ROOT = $(abs_top_srcdir)/matlab | |
187 | MODS = \ | |
188 | MODFILES = \ | |
188 | 189 | ramst.mod \ |
189 | 190 | ramst_a.mod \ |
190 | 191 | example1.mod \ |
191 | 192 | example2.mod \ |
192 | 193 | example1_use_dll.mod \ |
193 | example1_with_tags.mod\ | |
194 | example1_with_tags.mod \ | |
194 | 195 | t_sgu_ex1.mod \ |
195 | 196 | osr_example.mod \ |
196 | 197 | optimal_policy/ramsey.mod \ |
204 | 205 | comments.mod \ |
205 | 206 | histval_sto.mod \ |
206 | 207 | histval_det.mod \ |
207 | expectation.mod \ | |
208 | auxiliary_variables/test1.mod \ | |
209 | expectations/expectation.mod \ | |
210 | expectations/expectation_ss.mod \ | |
211 | expectations/expectation_ss_old.mod \ | |
212 | expectations/expectation_nested.mod \ | |
213 | steady_state/walsh1_initval.mod \ | |
214 | steady_state/walsh1_old_ss.mod \ | |
215 | steady_state/walsh1_ssm.mod \ | |
216 | steady_state/walsh1_ssm_block.mod \ | |
217 | steady_state/multi_leads.mod \ | |
208 | 218 | steady_state_operator/standard.mod \ |
209 | 219 | steady_state_operator/use_dll.mod \ |
210 | 220 | steady_state_operator/block.mod \ |
231 | 241 | fs2000/fs2000.mod \ |
232 | 242 | fs2000/fs2000a.mod \ |
233 | 243 | fs2000/fs2000c.mod \ |
244 | fs2000/fs2000d.mod \ | |
234 | 245 | homotopy/homotopy1_test.mod \ |
235 | 246 | homotopy/homotopy2_test.mod \ |
236 | 247 | homotopy/homotopy3_test.mod \ |
257 | 268 | external_function/example1_no_deriv_functions_provided.mod \ |
258 | 269 | external_function/example1_no_deriv_functions_provided_dll.mod \ |
259 | 270 | seeds.mod \ |
260 | simul/example1.mod | |
261 | ||
262 | EXTRA_DIST = $(MODS) \ | |
271 | identification/kim/kim2.mod \ | |
272 | identification/as2007/as2007.mod \ | |
273 | simul/example1.mod \ | |
274 | conditional_forecasts/fs2000_est.mod \ | |
275 | recursive/ls2003.mod \ | |
276 | recursive/ls2003_bayesian.mod \ | |
277 | kalman_filter_smoother/gen_data.mod \ | |
278 | kalman_filter_smoother/algo1.mod \ | |
279 | kalman_filter_smoother/algo2.mod \ | |
280 | kalman_filter_smoother/algo3.mod \ | |
281 | kalman_filter_smoother/algo4.mod \ | |
282 | kalman_filter_smoother/algo4a.mod \ | |
283 | kalman_filter_smoother/algo4b.mod \ | |
284 | kalman_filter_smoother/algoH1.mod \ | |
285 | kalman_filter_smoother/algoH2.mod \ | |
286 | kalman_filter_smoother/algoH3.mod \ | |
287 | kalman_filter_smoother/fs2000.mod \ | |
288 | kalman_filter_smoother/fs2000_1.mod \ | |
289 | kalman_filter_smoother/fs2000_2.mod \ | |
290 | kalman_filter_smoother/fs2000a.mod \ | |
291 | second_order/burnside_1.mod \ | |
292 | second_order/ds1.mod \ | |
293 | second_order/ds2.mod | |
294 | ||
295 | EXTRA_DIST = \ | |
296 | $(MODFILES) \ | |
297 | homotopy/common.mod \ | |
298 | block_bytecode/ls2003.mod \ | |
299 | fs2000_ssfile_aux.m \ | |
300 | printMakeCheckMatlabErrMsg.m \ | |
301 | printMakeCheckOctaveErrMsg.m \ | |
302 | ramst_initval_file_data.m \ | |
303 | run_test.m \ | |
304 | run_test_matlab.m \ | |
263 | 305 | run_test_octave.m \ |
264 | block_bytecode/run_block_bytecode_tests.m \ | |
306 | test.m \ | |
307 | AIM/data_ca1.m \ | |
308 | AIM/fs2000_b1L1L_AIM_steadystate.m \ | |
309 | AIM/fs2000_b1L1L_steadystate.m \ | |
310 | AIM/fsdat.m \ | |
265 | 311 | block_bytecode/run_ls2003.m \ |
266 | block_bytecode/ls2003.mod \ | |
312 | bvar_a_la_sims/bvar_sample.m \ | |
267 | 313 | external_function/extFunDeriv.m \ |
268 | 314 | external_function/extFunNoDerivs.m \ |
269 | 315 | external_function/extFunWithFirstAndSecondDerivs.m \ |
316 | expectations/expectation_ss_old_steadystate.m \ | |
317 | steady_state/walsh1_old_ss_steadystate.m \ | |
318 | fs2000/fs2000a_steadystate.m \ | |
270 | 319 | fs2000/fsdat_simul.m \ |
271 | fs2000/fs2000a_steadystate.m \ | |
272 | identification/kim/kim2_steadystate.m \ | |
273 | identification/as2007/as2007_steadystate.m \ | |
274 | AIM/fs2000_b1L1L_steadystate.m \ | |
275 | AIM/fs2000_b1L1L_AIM_steadystate.m \ | |
276 | test.m \ | |
277 | objectives \ | |
278 | ramst_initval_file_data.m \ | |
279 | homotopy/common.mod \ | |
280 | bvar_a_la_sims/bvar_sample.m \ | |
281 | fs2000_ssfile_aux.m | |
282 | ||
283 | TARGETS = check-matlab $(am__append_1) | |
320 | k_order_perturbation/run_fs2000kplusplus.m \ | |
321 | ls2003/data_ca1.m \ | |
322 | measurement_errors/data_ca1.m \ | |
323 | missing/simulate_data_with_missing_observations.m \ | |
324 | objectives/sgu_ex1.mat \ | |
325 | conditional_forecasts/fsdat_simul.m \ | |
326 | recursive/data_ca1.m \ | |
327 | kalman_filter_smoother/fsdat_simul.m \ | |
328 | kalman_filter_smoother/fs2000a_steadystate.m \ | |
329 | identification/kim/kim2_steadystate.m | |
330 | ||
331 | TARGETS = $(am__append_1) $(am__append_2) | |
284 | 332 | all: all-am |
285 | 333 | |
286 | 334 | .SUFFIXES: |
463 | 511 | |
464 | 512 | check-local: $(TARGETS) |
465 | 513 | |
466 | check-octave: $(MODS) | |
467 | @set -e; \ | |
468 | for modfile in $(MODS); do \ | |
469 | $(OCTAVE) --norc --silent --no-history run_test_octave.m $$modfile $(DYNARE_ROOT) $(PACKAGE_VERSION); \ | |
470 | done | |
471 | .PHONY: check-octave | |
472 | ||
473 | check-block-bytecode: | |
474 | cd block_bytecode && $(OCTAVE) --norc --silent --no-history run_block_bytecode_tests.m $(DYNARE_ROOT) $(PACKAGE_VERSION) | |
475 | .PHONY: check-block-bytecode | |
476 | ||
477 | check-matlab: $(MODS) | |
478 | # MATLAB stuff to be added here | |
479 | .PHONY: check-matlab | |
514 | check-matlab: | |
515 | DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(MATLAB)/bin/matlab -nodesktop -nosplash -r run_test_matlab | |
516 | ||
517 | check-octave: | |
518 | DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(OCTAVE) --norc --silent --no-history run_test_octave.m | |
480 | 519 | |
481 | 520 | clean-local: |
482 | rm -f $(patsubst %.mod, %.m, $(MODS)) \ | |
483 | $(patsubst %.mod, %_static.*, $(MODS)) \ | |
484 | $(patsubst %.mod, %_objective_static.m, $(MODS)) \ | |
485 | $(patsubst %.mod, %_dynamic.*, $(MODS)) | |
486 | ||
487 | rm -f $(patsubst %.mod, %_results.mat, $(MODS)) \ | |
488 | $(patsubst %.mod, %_mode.mat, $(MODS)) \ | |
489 | $(patsubst %.mod, %_mh_mode.mat, $(MODS)) \ | |
490 | $(patsubst %.mod, %_mean.mat, $(MODS)) \ | |
491 | $(patsubst %.mod, %_pindx.mat, $(MODS)) \ | |
492 | $(patsubst %.mod, %_params.mat, $(MODS)) \ | |
493 | $(patsubst %.mod, %_simul, $(MODS)) \ | |
494 | $(patsubst %.mod, %.log, $(MODS)) | |
495 | ||
496 | rm -rf $(patsubst %.mod, %, $(MODS)) | |
497 | ||
498 | rm -f $(patsubst %.mod, %*.pdf, $(MODS)) \ | |
499 | $(patsubst %.mod, %*.eps, $(MODS)) \ | |
500 | $(patsubst %.mod, %*.fig, $(MODS)) | |
521 | rm -f $(patsubst %.mod, %.m, $(MODFILES)) \ | |
522 | $(patsubst %.mod, %_static.*, $(MODFILES)) \ | |
523 | $(patsubst %.mod, %_objective_static.m, $(MODFILES)) \ | |
524 | $(patsubst %.mod, %_dynamic.*, $(MODFILES)) | |
525 | ||
526 | rm -f $(patsubst %.mod, %_results.mat, $(MODFILES)) \ | |
527 | $(patsubst %.mod, %_mode.mat, $(MODFILES)) \ | |
528 | $(patsubst %.mod, %_mh_mode.mat, $(MODFILES)) \ | |
529 | $(patsubst %.mod, %_mean.mat, $(MODFILES)) \ | |
530 | $(patsubst %.mod, %_pindx.mat, $(MODFILES)) \ | |
531 | $(patsubst %.mod, %_params.mat, $(MODFILES)) \ | |
532 | $(patsubst %.mod, %_simul, $(MODFILES)) \ | |
533 | $(patsubst %.mod, %.log, $(MODFILES)) | |
534 | ||
535 | rm -rf $(patsubst %.mod, %, $(MODFILES)) | |
536 | ||
537 | rm -f $(patsubst %.mod, %*.pdf, $(MODFILES)) \ | |
538 | $(patsubst %.mod, %*.eps, $(MODFILES)) \ | |
539 | $(patsubst %.mod, %*.fig, $(MODFILES)) | |
501 | 540 | |
502 | 541 | rm -f $(shell find -name g1.mat) \ |
503 | 542 | $(shell find -name g2.mat) \ |
518 | 557 | |
519 | 558 | rm -rf partial_information/PItest3aHc0PCLsimModPiYrVarobsAll_PCL* partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR_PCL* |
520 | 559 | |
521 | rm -rf block_bytecode/ws block_bytecode/ls2003_tmp* | |
560 | rm -rf block_bytecode/ls2003_tmp* | |
561 | ||
562 | rm -f $(shell find -name wsOct) \ | |
563 | $(shell find -name wsMat.mat) | |
564 | ||
565 | rm -f run_test_matlab_output.txt run_test_octave_output.txt | |
522 | 566 | |
523 | 567 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
524 | 568 | # Otherwise a system limit (for SysV at least) may be exceeded. |
0 | var x, y; | |
1 | varexo e; | |
2 | ||
3 | model; | |
4 | expectation(-2)(x(+4)*y(+1)) = 1; | |
5 | y = exp(e); | |
6 | end; | |
7 | ||
8 | initval; | |
9 | y = 1; | |
10 | x = 1; | |
11 | end; | |
12 | ||
13 | steady; |
0 | ## Copyright (C) 2010 Dynare Team | |
1 | ## | |
2 | ## This file is part of Dynare. | |
3 | ## | |
4 | ## Dynare is free software: you can redistribute it and/or modify | |
5 | ## it under the terms of the GNU General Public License as published by | |
6 | ## the Free Software Foundation, either version 3 of the License, or | |
7 | ## (at your option) any later version. | |
8 | ## | |
9 | ## Dynare is distributed in the hope that it will be useful, | |
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | ## GNU General Public License for more details. | |
13 | ## | |
14 | ## You should have received a copy of the GNU General Public License | |
15 | ## along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | addpath(argv(){1}) | |
18 | ||
19 | if !strcmp(dynare_version(), argv(){2}) | |
20 | error("Incorrect version of Dynare is being tested") | |
21 | endif | |
22 | ||
23 | ## Ask gnuplot to create graphics in text mode | |
24 | ## Note that setenv() was introduced in Octave 3.0.2, for compatibility | |
25 | ## with MATLAB | |
26 | putenv("GNUTERM", "dumb") | |
27 | ||
28 | for block = 0:1 | |
29 | for bytecode = 0:1 | |
30 | ## Recall that solve_algo=7 and stack_solve_algo=2 are not supported | |
31 | ## under Octave | |
32 | default_solve_algo = 2; | |
33 | default_stack_solve_algo = 0; | |
34 | if !block && !bytecode | |
35 | solve_algos = 0:4; | |
36 | stack_solve_algos = 0; | |
37 | elseif block && !bytecode | |
38 | solve_algos = [0:4 6 8]; | |
39 | stack_solve_algos = [0 1 3 4]; | |
40 | else | |
41 | solve_algos = [0:6 8]; | |
42 | stack_solve_algos = [0 1 3:5]; | |
43 | endif | |
44 | ||
45 | for i = 1:length(solve_algos) | |
46 | save ws | |
47 | run_ls2003(block, bytecode, solve_algos(i), default_stack_solve_algo) | |
48 | load ws | |
49 | endfor | |
50 | for i = 1:length(stack_solve_algos) | |
51 | save ws | |
52 | run_ls2003(block, bytecode, default_solve_algo, stack_solve_algos(i)) | |
53 | load ws | |
54 | endfor | |
55 | endfor | |
56 | endfor | |
57 | ||
58 | ## Local variables: | |
59 | ## mode: Octave | |
60 | ## End: |
0 | ## Copyright (C) 2010 Dynare Team | |
1 | ## | |
2 | ## This file is part of Dynare. | |
3 | ## | |
4 | ## Dynare is free software: you can redistribute it and/or modify | |
5 | ## it under the terms of the GNU General Public License as published by | |
6 | ## the Free Software Foundation, either version 3 of the License, or | |
7 | ## (at your option) any later version. | |
8 | ## | |
9 | ## Dynare is distributed in the hope that it will be useful, | |
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | ## GNU General Public License for more details. | |
13 | ## | |
14 | ## You should have received a copy of the GNU General Public License | |
15 | ## along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
0 | function run_ls2003(block, bytecode, solve_algo, stack_solve_algo) | |
16 | 1 | |
17 | function run_ls2003(block, bytecode, solve_algo, stack_solve_algo) | |
18 | printf("\nTEST: ls2003 (block=%d, bytecode=%d, solve_algo=%d, stack_solve_algo=%d)...\n", block, bytecode, solve_algo, stack_solve_algo); | |
19 | fid = fopen("ls2003_tmp.mod", "w"); | |
2 | % Copyright (C) 2010-2011 Dynare Team | |
3 | % | |
4 | % This file is part of Dynare. | |
5 | % | |
6 | % Dynare is free software: you can redistribute it and/or modify | |
7 | % it under the terms of the GNU General Public License as published by | |
8 | % the Free Software Foundation, either version 3 of the License, or | |
9 | % (at your option) any later version. | |
10 | % | |
11 | % Dynare is distributed in the hope that it will be useful, | |
12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | % GNU General Public License for more details. | |
15 | % | |
16 | % You should have received a copy of the GNU General Public License | |
17 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | disp(['TEST: ls2003 (block=' num2str(block) ', bytecode=' ... | |
20 | num2str(bytecode) ', solve_algo=' num2str(solve_algo) ... | |
21 | ', stack_solve_algo=' num2str(stack_solve_algo) ')...']); | |
22 | fid = fopen('ls2003_tmp.mod', 'w'); | |
20 | 23 | assert(fid > 0); |
21 | fprintf(fid, "@#define block = %d\n@#define bytecode = %d\n@#define solve_algo = %d\n@#define stack_solve_algo = %d\n@#include \"ls2003.mod\"\n", block, bytecode, solve_algo, stack_solve_algo) | |
24 | fprintf(fid, ['@#define block = %d\n@#define bytecode = %d\n' ... | |
25 | '@#define solve_algo = %d\n@#define stack_solve_algo = %d\n' ... | |
26 | '@#include \"ls2003.mod\"\n'], block, bytecode, ... | |
27 | solve_algo, stack_solve_algo); | |
22 | 28 | fclose(fid); |
23 | dynare("ls2003_tmp.mod") | |
24 | endfunction | |
25 | ||
26 | ## Local variables: | |
27 | ## mode: Octave | |
28 | ## End: | |
29 | dynare('ls2003_tmp.mod','console') | |
30 | end |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | ||
2 | var m P c e W R k d n l gy_obs gp_obs y dA; | |
3 | varexo e_a e_m; | |
4 | ||
5 | parameters alp bet gam mst rho psi del; | |
6 | ||
7 | alp = 0.33; | |
8 | bet = 0.99; | |
9 | gam = 0.003; | |
10 | mst = 1.011; | |
11 | rho = 0.7; | |
12 | psi = 0.787; | |
13 | del = 0.02; | |
14 | ||
15 | model; | |
16 | dA = exp(gam+e_a); | |
17 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
18 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
19 | W = l/n; | |
20 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
21 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
22 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
23 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
24 | P*c = m; | |
25 | m-1+d = l; | |
26 | e = exp(e_a); | |
27 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
28 | gy_obs = dA*y/y(-1); | |
29 | gp_obs = (P/P(-1))*m(-1)/dA; | |
30 | end; | |
31 | ||
32 | initval; | |
33 | k = 6; | |
34 | m = mst; | |
35 | P = 2.25; | |
36 | c = 0.45; | |
37 | e = 1; | |
38 | W = 4; | |
39 | R = 1.02; | |
40 | d = 0.85; | |
41 | n = 0.19; | |
42 | l = 0.86; | |
43 | y = 0.6; | |
44 | gy_obs = exp(gam); | |
45 | gp_obs = exp(-gam); | |
46 | dA = exp(gam); | |
47 | end; | |
48 | ||
49 | shocks; | |
50 | var e_a; stderr 0.014; | |
51 | var e_m; stderr 0.005; | |
52 | end; | |
53 | ||
54 | steady_state_model; | |
55 | dA = exp(gam); | |
56 | gst = 1/dA; | |
57 | m = mst; | |
58 | ||
59 | khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1)); | |
60 | xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1); | |
61 | nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp ); | |
62 | n = xist/(nust+xist); | |
63 | P = xist + nust; | |
64 | k = khst*n; | |
65 | ||
66 | l = psi*mst*n/( (1-psi)*(1-n) ); | |
67 | c = mst/P; | |
68 | d = l - mst + 1; | |
69 | y = k^alp*n^(1-alp)*gst^alp; | |
70 | R = mst/bet; | |
71 | ||
72 | W = l/n; | |
73 | e = 1; | |
74 | ||
75 | gp_obs = m/dA; | |
76 | gy_obs = dA; | |
77 | end; | |
78 | ||
79 | steady; | |
80 | ||
81 | check; | |
82 | ||
83 | estimated_params; | |
84 | alp, beta_pdf, 0.356, 0.02; | |
85 | bet, beta_pdf, 0.993, 0.002; | |
86 | gam, normal_pdf, 0.0085, 0.003; | |
87 | mst, normal_pdf, 1.0002, 0.007; | |
88 | rho, beta_pdf, 0.129, 0.223; | |
89 | psi, beta_pdf, 0.65, 0.05; | |
90 | del, beta_pdf, 0.01, 0.005; | |
91 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
92 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
93 | end; | |
94 | ||
95 | varobs gp_obs gy_obs; | |
96 | ||
97 | options_.solve_tolf = 1e-12; | |
98 | ||
99 | // Metropolis replications are too few, this is only for testing purpose | |
100 | estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=10000,mh_nblocks=1,mh_jscale=0.8); | |
101 | ||
102 | conditional_forecast_paths; | |
103 | var gy_obs; | |
104 | periods 1 2 3:5; | |
105 | values 0.01 -0.02 0; | |
106 | var gp_obs; | |
107 | periods 1:5; | |
108 | values 0.05; | |
109 | end; | |
110 | ||
111 | conditional_forecast(parameter_set=prior_mode, controlled_varexo=(e_a,e_m)); | |
112 | ||
113 | if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')) | |
114 | plot_conditional_forecast(periods=10) gy_obs gp_obs; | |
115 | end | |
116 | ||
117 | conditional_forecast(parameter_set=posterior_mode, controlled_varexo=(e_a,e_m)); | |
118 | ||
119 | if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')) | |
120 | plot_conditional_forecast(periods=10) gy_obs gp_obs; | |
121 | end | |
122 | ||
123 | conditional_forecast(parameter_set=posterior_mean, controlled_varexo=(e_a,e_m)); | |
124 | ||
125 | if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')) | |
126 | plot_conditional_forecast(periods=10) gy_obs gp_obs; | |
127 | end | |
128 | ||
129 | conditional_forecast(parameter_set=posterior_median, controlled_varexo=(e_a,e_m)); | |
130 | ||
131 | if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0')) | |
132 | plot_conditional_forecast(periods=10) gy_obs gp_obs; | |
133 | end | |
134 |
0 | gy_obs =[ | |
1 | 1.0030045 | |
2 | 0.99990934 | |
3 | 1.0172778 | |
4 | 0.99464043 | |
5 | 1.0253423 | |
6 | 1.0150215 | |
7 | 0.97772557 | |
8 | 0.97832186 | |
9 | 1.0159561 | |
10 | 1.0085937 | |
11 | 1.0102649 | |
12 | 1.0007604 | |
13 | 1.0112596 | |
14 | 1.0163279 | |
15 | 1.0173204 | |
16 | 1.0103896 | |
17 | 1.0006493 | |
18 | 0.99447124 | |
19 | 1.0196405 | |
20 | 1.0089304 | |
21 | 0.99650737 | |
22 | 1.0139707 | |
23 | 0.97865842 | |
24 | 1.0192225 | |
25 | 0.99139628 | |
26 | 1.0141362 | |
27 | 1.0196612 | |
28 | 0.97483476 | |
29 | 0.99686151 | |
30 | 0.99594464 | |
31 | 1.0000642 | |
32 | 1.0172243 | |
33 | 1.0025773 | |
34 | 0.97199728 | |
35 | 1.0217815 | |
36 | 1.0219949 | |
37 | 0.99490252 | |
38 | 1.0190728 | |
39 | 1.0111337 | |
40 | 1.0003792 | |
41 | 0.98969164 | |
42 | 1.010438 | |
43 | 1.0216309 | |
44 | 1.0016671 | |
45 | 1.0357588 | |
46 | 0.98803787 | |
47 | 1.0093457 | |
48 | 1.0177035 | |
49 | 0.98548204 | |
50 | 1.0274294 | |
51 | 1.0141377 | |
52 | 1.0091174 | |
53 | 0.96427632 | |
54 | 1.0083272 | |
55 | 1.0007882 | |
56 | 0.99038262 | |
57 | 1.0031336 | |
58 | 0.99500213 | |
59 | 0.98203716 | |
60 | 0.9889452 | |
61 | 1.011632 | |
62 | 0.99451949 | |
63 | 0.97291047 | |
64 | 0.98750871 | |
65 | 0.99992418 | |
66 | 0.97657318 | |
67 | 0.99930448 | |
68 | 1.0008515 | |
69 | 1.0044064 | |
70 | 0.98133792 | |
71 | 1.0091702 | |
72 | 1.0087023 | |
73 | 1.0119876 | |
74 | 1.0143019 | |
75 | 1.0311061 | |
76 | 0.99340471 | |
77 | 1.0057428 | |
78 | 0.99197259 | |
79 | 1.0071019 | |
80 | 0.99448853 | |
81 | 1.0061819 | |
82 | 1.0070088 | |
83 | 0.9950913 | |
84 | 1.0302318 | |
85 | 0.9817693 | |
86 | 1.0072885 | |
87 | 0.97355282 | |
88 | 0.98782586 | |
89 | 1.0136674 | |
90 | 0.99863956 | |
91 | 1.0205668 | |
92 | 0.99611384 | |
93 | 1.0073805 | |
94 | 0.99691529 | |
95 | 1.0089194 | |
96 | 1.0030467 | |
97 | 1.0112006 | |
98 | 1.0260523 | |
99 | 0.97803331 | |
100 | 0.99423374 | |
101 | 1.0043727 | |
102 | 1.0140173 | |
103 | 1.0111473 | |
104 | 0.99524348 | |
105 | 0.99775943 | |
106 | 0.9958619 | |
107 | 0.9982344 | |
108 | 1.0210212 | |
109 | 1.0022288 | |
110 | 1.0014801 | |
111 | 1.011456 | |
112 | 1.0124871 | |
113 | 0.99843599 | |
114 | 0.99324886 | |
115 | 0.99912838 | |
116 | 1.003327 | |
117 | 1.0072071 | |
118 | 1.0115223 | |
119 | 1.009266 | |
120 | 1.0070554 | |
121 | 1.0129916 | |
122 | 1.0053413 | |
123 | 1.0051638 | |
124 | 0.99212952 | |
125 | 1.0214422 | |
126 | 0.98716707 | |
127 | 0.99905788 | |
128 | 0.98877357 | |
129 | 0.98568476 | |
130 | 0.99767393 | |
131 | 1.0061791 | |
132 | 0.98423439 | |
133 | 0.99492949 | |
134 | 0.98786999 | |
135 | 0.99754239 | |
136 | 1.0168619 | |
137 | 0.99472384 | |
138 | 1.0041658 | |
139 | 0.98123181 | |
140 | 1.0112882 | |
141 | 0.99245422 | |
142 | 1.0010255 | |
143 | 1.0017799 | |
144 | 1.0089968 | |
145 | 1.0072824 | |
146 | 0.99768475 | |
147 | 1.0044726 | |
148 | 1.0118678 | |
149 | 1.0056385 | |
150 | 1.0276965 | |
151 | 1.0025122 | |
152 | 1.0065161 | |
153 | 1.0234338 | |
154 | 0.99760167 | |
155 | 0.98922272 | |
156 | 1.0101918 | |
157 | 1.011615 | |
158 | 1.0085286 | |
159 | 1.0074455 | |
160 | 0.98866757 | |
161 | 0.99959012 | |
162 | 1.0129881 | |
163 | 0.99127881 | |
164 | 0.97971901 | |
165 | 1.0185314 | |
166 | 1.020054 | |
167 | 1.0132605 | |
168 | 0.98063643 | |
169 | 0.99490253 | |
170 | 1.0101531 | |
171 | 1.0004526 | |
172 | 1.0059109 | |
173 | 0.98974491 | |
174 | 1.0062391 | |
175 | 1.0216488 | |
176 | 0.99398446 | |
177 | 0.97786609 | |
178 | 1.0019274 | |
179 | 0.99587153 | |
180 | 1.0095881 | |
181 | 1.0111887 | |
182 | 0.99457649 | |
183 | 0.97896734 | |
184 | 1.000172 | |
185 | 1.0142951 | |
186 | 1.0034224 | |
187 | 1.0037242 | |
188 | 1.0016059 | |
189 | 1.016556 | |
190 | 0.99687023 | |
191 | 1.0117844 | |
192 | 1.0059212 | |
193 | 0.98083159 | |
194 | 0.98638851 | |
195 | 1.0128713 | |
196 | 1.0096232 | |
197 | 1.0115891 | |
198 | 1.0011213 | |
199 | 1.0147105 | |
200 | 1.0066344 | |
201 | 1.0164429 | |
202 | 0.99825038 | |
203 | 0.99403411 | |
204 | ||
205 | ]; | |
206 | ||
207 | gp_obs =[ | |
208 | 1.0079715 | |
209 | 1.0074573 | |
210 | 1.0153107 | |
211 | 1.0152677 | |
212 | 1.0011653 | |
213 | 0.99950061 | |
214 | 1.0328311 | |
215 | 1.0192317 | |
216 | 1.009827 | |
217 | 0.99588916 | |
218 | 1.007474 | |
219 | 1.0113061 | |
220 | 0.98696624 | |
221 | 0.99978663 | |
222 | 0.98240542 | |
223 | 0.98861723 | |
224 | 0.99008763 | |
225 | 1.0185076 | |
226 | 1.0052452 | |
227 | 0.99447194 | |
228 | 1.0092685 | |
229 | 1.01208 | |
230 | 1.0105237 | |
231 | 0.98513875 | |
232 | 1.0165628 | |
233 | 0.99485934 | |
234 | 1.0050255 | |
235 | 1.0140756 | |
236 | 1.0093128 | |
237 | 1.0155868 | |
238 | 1.0107023 | |
239 | 0.99212762 | |
240 | 1.0095465 | |
241 | 1.0028435 | |
242 | 1.0069437 | |
243 | 1.0070473 | |
244 | 1.0145902 | |
245 | 1.0186922 | |
246 | 1.0059917 | |
247 | 1.0113072 | |
248 | 1.0107386 | |
249 | 0.99769196 | |
250 | 0.99793444 | |
251 | 1.0050791 | |
252 | 0.98307821 | |
253 | 1.0107594 | |
254 | 0.99689982 | |
255 | 0.98667064 | |
256 | 0.9991662 | |
257 | 0.98274722 | |
258 | 0.98422032 | |
259 | 0.99393016 | |
260 | 1.0118567 | |
261 | 0.99912781 | |
262 | 1.0023744 | |
263 | 1.0086662 | |
264 | 1.0164773 | |
265 | 1.0169327 | |
266 | 1.0372478 | |
267 | 1.0314242 | |
268 | 1.0004256 | |
269 | 1.0110541 | |
270 | 1.0076575 | |
271 | 1.0119851 | |
272 | 1.0055188 | |
273 | 1.0213959 | |
274 | 1.0234416 | |
275 | 1.0264917 | |
276 | 1.0292725 | |
277 | 1.0385184 | |
278 | 1.0200999 | |
279 | 1.0107697 | |
280 | 1.008583 | |
281 | 1.0200332 | |
282 | 1.0030413 | |
283 | 1.0108659 | |
284 | 1.0185145 | |
285 | 1.0168619 | |
286 | 1.0180462 | |
287 | 1.0239657 | |
288 | 1.0205509 | |
289 | 1.0189973 | |
290 | 1.0246446 | |
291 | 1.0135089 | |
292 | 1.0352973 | |
293 | 1.0099289 | |
294 | 1.0266474 | |
295 | 1.0279829 | |
296 | 1.0101653 | |
297 | 1.041216 | |
298 | 1.0103861 | |
299 | 1.0114727 | |
300 | 1.0054605 | |
301 | 1.0190722 | |
302 | 1.0114837 | |
303 | 1.0179213 | |
304 | 1.006082 | |
305 | 1.0049696 | |
306 | 1.0143629 | |
307 | 0.9971036 | |
308 | 1.0005602 | |
309 | 1.0078403 | |
310 | 1.0240222 | |
311 | 1.0195063 | |
312 | 1.0355136 | |
313 | 1.0218743 | |
314 | 1.0171331 | |
315 | 1.0049817 | |
316 | 1.0140974 | |
317 | 1.0168431 | |
318 | 1.0049966 | |
319 | 1.0045568 | |
320 | 1.0156414 | |
321 | 1.0273055 | |
322 | 1.0197653 | |
323 | 1.0030624 | |
324 | 1.0154993 | |
325 | 0.99782084 | |
326 | 0.99711648 | |
327 | 1.014408 | |
328 | 1.0057417 | |
329 | 0.99936837 | |
330 | 1.0096934 | |
331 | 1.0095138 | |
332 | 1.0057734 | |
333 | 1.0114497 | |
334 | 1.0059784 | |
335 | 1.0328889 | |
336 | 1.0098032 | |
337 | 1.0041114 | |
338 | 1.0101247 | |
339 | 1.0181588 | |
340 | 1.0115712 | |
341 | 1.0227509 | |
342 | 1.0065104 | |
343 | 1.0110902 | |
344 | 1.0298169 | |
345 | 1.0089532 | |
346 | 1.0368733 | |
347 | 1.0123033 | |
348 | 1.0060763 | |
349 | 1.0150937 | |
350 | 1.0239325 | |
351 | 0.99555536 | |
352 | 0.99861271 | |
353 | 1.0076201 | |
354 | 0.99941535 | |
355 | 1.0119522 | |
356 | 1.0129183 | |
357 | 0.99288924 | |
358 | 1.0260784 | |
359 | 1.0144982 | |
360 | 1.0121985 | |
361 | 1.0234916 | |
362 | 1.02215 | |
363 | 1.0190118 | |
364 | 1.0172679 | |
365 | 1.0118398 | |
366 | 1.0002123 | |
367 | 1.0092124 | |
368 | 1.0071943 | |
369 | 0.99508468 | |
370 | 1.0019303 | |
371 | 1.0030733 | |
372 | 0.9964198 | |
373 | 1.0027298 | |
374 | 0.99797614 | |
375 | 1.006942 | |
376 | 0.99793928 | |
377 | 1.0083214 | |
378 | 1.0283732 | |
379 | 1.0111102 | |
380 | 1.016936 | |
381 | 1.0229061 | |
382 | 0.98846454 | |
383 | 1.0015387 | |
384 | 1.0201769 | |
385 | 1.0079822 | |
386 | 1.0064007 | |
387 | 1.0095543 | |
388 | 1.0092207 | |
389 | 1.0135485 | |
390 | 1.0198974 | |
391 | 1.0140252 | |
392 | 1.0128686 | |
393 | 1.0092903 | |
394 | 1.0141974 | |
395 | 1.0023492 | |
396 | 0.99731455 | |
397 | 1.0026598 | |
398 | 0.99303643 | |
399 | 1.0036469 | |
400 | 1.0160975 | |
401 | 1.0368378 | |
402 | 1.0139625 | |
403 | 1.01493 | |
404 | 1.0113531 | |
405 | 1.0114548 | |
406 | 0.99833441 | |
407 | 0.99648401 | |
408 | 0.97645361 | |
409 | 1.0154053 | |
410 | 1.01703 | |
411 | ||
412 | ]; | |
413 | ||
414 | Y_obs =[ | |
415 | 1 | |
416 | 0.99690484 | |
417 | 1.0111781 | |
418 | 1.0028141 | |
419 | 1.0251518 | |
420 | 1.0371688 | |
421 | 1.0118899 | |
422 | 0.98720726 | |
423 | 1.0001589 | |
424 | 1.0057481 | |
425 | 1.0130085 | |
426 | 1.0107643 | |
427 | 1.0190194 | |
428 | 1.0323428 | |
429 | 1.0466587 | |
430 | 1.0540438 | |
431 | 1.0516886 | |
432 | 1.0431553 | |
433 | 1.0597913 | |
434 | 1.0657172 | |
435 | 1.0592201 | |
436 | 1.0701863 | |
437 | 1.0458402 | |
438 | 1.0620582 | |
439 | 1.0504499 | |
440 | 1.0615817 | |
441 | 1.0782384 | |
442 | 1.0500687 | |
443 | 1.0439257 | |
444 | 1.0368658 | |
445 | 1.0339255 | |
446 | 1.0481453 | |
447 | 1.0477181 | |
448 | 1.0167109 | |
449 | 1.0354878 | |
450 | 1.0544782 | |
451 | 1.0463762 | |
452 | 1.0624445 | |
453 | 1.0705737 | |
454 | 1.0679484 | |
455 | 1.0546356 | |
456 | 1.0620691 | |
457 | 1.0806955 | |
458 | 1.0793581 | |
459 | 1.1121124 | |
460 | 1.0971458 | |
461 | 1.1034869 | |
462 | 1.1181859 | |
463 | 1.1006634 | |
464 | 1.1250883 | |
465 | 1.1362214 | |
466 | 1.1423343 | |
467 | 1.1036061 | |
468 | 1.1089288 | |
469 | 1.1067125 | |
470 | 1.0940906 | |
471 | 1.0942197 | |
472 | 1.0862174 | |
473 | 1.06525 | |
474 | 1.0511907 | |
475 | 1.0598182 | |
476 | 1.0513331 | |
477 | 1.0212391 | |
478 | 1.0057433 | |
479 | 1.002663 | |
480 | 0.97623167 | |
481 | 0.97253165 | |
482 | 0.97037865 | |
483 | 0.97178055 | |
484 | 0.95011397 | |
485 | 0.95627969 | |
486 | 0.96197747 | |
487 | 0.97096053 | |
488 | 0.98225794 | |
489 | 1.0103595 | |
490 | 1.0007597 | |
491 | 1.003498 | |
492 | 0.99246608 | |
493 | 0.99656347 | |
494 | 0.98804749 | |
495 | 0.99122491 | |
496 | 0.99522926 | |
497 | 0.98731605 | |
498 | 1.0145434 | |
499 | 0.99330816 | |
500 | 0.99759216 | |
501 | 0.96814048 | |
502 | 0.95296183 | |
503 | 0.96362471 | |
504 | 0.95925977 | |
505 | 0.97682205 | |
506 | 0.96993138 | |
507 | 0.9743074 | |
508 | 0.96821818 | |
509 | 0.97413308 | |
510 | 0.9741753 | |
511 | 0.98237142 | |
512 | 1.0054193 | |
513 | 0.98044807 | |
514 | 0.9716773 | |
515 | 0.9730455 | |
516 | 0.98405828 | |
517 | 0.99220103 | |
518 | 0.98444001 | |
519 | 0.97919493 | |
520 | 0.97205233 | |
521 | 0.96728223 | |
522 | 0.98529893 | |
523 | 0.98452324 | |
524 | 0.98299888 | |
525 | 0.99145042 | |
526 | 1.000933 | |
527 | 0.99636447 | |
528 | 0.98660883 | |
529 | 0.98273271 | |
530 | 0.98305518 | |
531 | 0.98725774 | |
532 | 0.99577549 | |
533 | 1.002037 | |
534 | 1.0060879 | |
535 | 1.016075 | |
536 | 1.0184118 | |
537 | 1.0205711 | |
538 | 1.0096961 | |
539 | 1.0281337 | |
540 | 1.0122963 | |
541 | 1.0083497 | |
542 | 0.99411874 | |
543 | 0.976799 | |
544 | 0.97146842 | |
545 | 0.97464304 | |
546 | 0.95587292 | |
547 | 0.94779791 | |
548 | 0.93266339 | |
549 | 0.92720128 | |
550 | 0.94105864 | |
551 | 0.93277798 | |
552 | 0.93393927 | |
553 | 0.91216657 | |
554 | 0.92045028 | |
555 | 0.9099 | |
556 | 0.90792098 | |
557 | 0.90669634 | |
558 | 0.91268867 | |
559 | 0.91696661 | |
560 | 0.91164685 | |
561 | 0.91311495 | |
562 | 0.92197825 | |
563 | 0.92461222 | |
564 | 0.94930422 | |
565 | 0.9488119 | |
566 | 0.95232353 | |
567 | 0.97275278 | |
568 | 0.96734995 | |
569 | 0.95356817 | |
570 | 0.96075548 | |
571 | 0.96936594 | |
572 | 0.97489002 | |
573 | 0.97933106 | |
574 | 0.96499412 | |
575 | 0.96157973 | |
576 | 0.97156334 | |
577 | 0.95983765 | |
578 | 0.93655215 | |
579 | 0.95207909 | |
580 | 0.96912862 | |
581 | 0.97938462 | |
582 | 0.95701655 | |
583 | 0.94891457 | |
584 | 0.95606317 | |
585 | 0.95351125 | |
586 | 0.95641767 | |
587 | 0.94315807 | |
588 | 0.94639265 | |
589 | 0.96503697 | |
590 | 0.95601693 | |
591 | 0.93087851 | |
592 | 0.92980141 | |
593 | 0.92266844 | |
594 | 0.92925206 | |
595 | 0.93743628 | |
596 | 0.92900826 | |
597 | 0.9049711 | |
598 | 0.90213859 | |
599 | 0.91342916 | |
600 | 0.91384707 | |
601 | 0.91456681 | |
602 | 0.91316822 | |
603 | 0.92671976 | |
604 | 0.92058549 | |
605 | 0.92936541 | |
606 | 0.93228212 | |
607 | 0.91010921 | |
608 | 0.89349322 | |
609 | 0.90336005 | |
610 | 0.90997873 | |
611 | 0.91856328 | |
612 | 0.91668007 | |
613 | 0.92838606 | |
614 | 0.932016 | |
615 | 0.94545438 | |
616 | 0.94070026 | |
617 | 0.93172987 | |
618 | ||
619 | ]; | |
620 | ||
621 | P_obs =[ | |
622 | 1 | |
623 | 0.99948573 | |
624 | 1.0068249 | |
625 | 1.0141211 | |
626 | 1.0073149 | |
627 | 0.99884398 | |
628 | 1.0237035 | |
629 | 1.0349636 | |
630 | 1.036819 | |
631 | 1.0247366 | |
632 | 1.0242391 | |
633 | 1.0275737 | |
634 | 1.0065684 | |
635 | 0.99838346 | |
636 | 0.97281734 | |
637 | 0.95346302 | |
638 | 0.9355791 | |
639 | 0.9461152 | |
640 | 0.94338882 | |
641 | 0.92988921 | |
642 | 0.9311862 | |
643 | 0.93529467 | |
644 | 0.93784681 | |
645 | 0.91501401 | |
646 | 0.92360522 | |
647 | 0.91049302 | |
648 | 0.90754698 | |
649 | 0.91365103 | |
650 | 0.91499228 | |
651 | 0.92260749 | |
652 | 0.92533824 | |
653 | 0.90949431 | |
654 | 0.91106924 | |
655 | 0.90594116 | |
656 | 0.90491334 | |
657 | 0.9039891 | |
658 | 0.91060772 | |
659 | 0.92132842 | |
660 | 0.91934854 | |
661 | 0.92268418 | |
662 | 0.92545127 | |
663 | 0.91517169 | |
664 | 0.90513459 | |
665 | 0.90224212 | |
666 | 0.87734878 | |
667 | 0.88013667 | |
668 | 0.86906494 | |
669 | 0.84776403 | |
670 | 0.83895869 | |
671 | 0.81373437 | |
672 | 0.78998314 | |
673 | 0.77594176 | |
674 | 0.77982695 | |
675 | 0.77098321 | |
676 | 0.76538611 | |
677 | 0.76608075 | |
678 | 0.77458654 | |
679 | 0.78354767 | |
680 | 0.81282389 | |
681 | 0.83627649 | |
682 | 0.82873051 | |
683 | 0.83181309 | |
684 | 0.83149903 | |
685 | 0.83551261 | |
686 | 0.83305985 | |
687 | 0.84648418 | |
688 | 0.86195421 | |
689 | 0.88047436 | |
690 | 0.90177533 | |
691 | 0.93232215 | |
692 | 0.94445051 | |
693 | 0.9472487 | |
694 | 0.94786015 | |
695 | 0.95992178 | |
696 | 0.95499149 | |
697 | 0.95788581 | |
698 | 0.9684288 | |
699 | 0.97731917 | |
700 | 0.98739379 | |
701 | 1.0033879 | |
702 | 1.0159673 | |
703 | 1.0269931 | |
704 | 1.0436661 | |
705 | 1.0492034 | |
706 | 1.0765292 | |
707 | 1.0784865 | |
708 | 1.0971624 | |
709 | 1.1171737 | |
710 | 1.1193675 | |
711 | 1.1526119 | |
712 | 1.1550265 | |
713 | 1.1585277 | |
714 | 1.1560166 | |
715 | 1.1671172 | |
716 | 1.1706294 | |
717 | 1.1805791 | |
718 | 1.1786896 | |
719 | 1.1756876 | |
720 | 1.1820789 | |
721 | 1.171211 | |
722 | 1.1637997 | |
723 | 1.1636684 | |
724 | 1.179719 | |
725 | 1.1912538 | |
726 | 1.2187959 | |
727 | 1.2326986 | |
728 | 1.2418602 | |
729 | 1.2388704 | |
730 | 1.2449963 | |
731 | 1.2538678 | |
732 | 1.2508929 | |
733 | 1.2474781 | |
734 | 1.255148 | |
735 | 1.274482 | |
736 | 1.2862757 | |
737 | 1.2813665 | |
738 | 1.2888943 | |
739 | 1.2787436 | |
740 | 1.2678886 | |
741 | 1.274325 | |
742 | 1.2720952 | |
743 | 1.263492 | |
744 | 1.2652139 | |
745 | 1.2667561 | |
746 | 1.264558 | |
747 | 1.2680362 | |
748 | 1.2660431 | |
749 | 1.2909605 | |
750 | 1.2927921 | |
751 | 1.288932 | |
752 | 1.2910852 | |
753 | 1.3012725 | |
754 | 1.3048721 | |
755 | 1.3196515 | |
756 | 1.3181903 | |
757 | 1.321309 | |
758 | 1.3431543 | |
759 | 1.344136 | |
760 | 1.3730377 | |
761 | 1.3773695 | |
762 | 1.3754742 | |
763 | 1.3825964 | |
764 | 1.3985574 | |
765 | 1.3861412 | |
766 | 1.3767823 | |
767 | 1.3764309 | |
768 | 1.3678747 | |
769 | 1.3718554 | |
770 | 1.3768022 | |
771 | 1.3617199 | |
772 | 1.3798267 | |
773 | 1.3863533 | |
774 | 1.3905803 | |
775 | 1.4061004 | |
776 | 1.4202788 | |
777 | 1.4313191 | |
778 | 1.4406155 | |
779 | 1.4444837 | |
780 | 1.4367244 | |
781 | 1.4379653 | |
782 | 1.4371881 | |
783 | 1.4243012 | |
784 | 1.41826 | |
785 | 1.4133617 | |
786 | 1.40181 | |
787 | 1.3965683 | |
788 | 1.3865729 | |
789 | 1.3855433 | |
790 | 1.3755111 | |
791 | 1.3758609 | |
792 | 1.3962625 | |
793 | 1.3994012 | |
794 | 1.4083656 | |
795 | 1.4233002 | |
796 | 1.4037932 | |
797 | 1.3973604 | |
798 | 1.4095657 | |
799 | 1.4095764 | |
800 | 1.4080055 | |
801 | 1.4095882 | |
802 | 1.4108374 | |
803 | 1.4164143 | |
804 | 1.4283402 | |
805 | 1.4343939 | |
806 | 1.4392909 | |
807 | 1.4406097 | |
808 | 1.4468355 | |
809 | 1.4412132 | |
810 | 1.4305562 | |
811 | 1.4252445 | |
812 | 1.4103094 | |
813 | 1.4059847 | |
814 | 1.4141106 | |
815 | 1.4429769 | |
816 | 1.4489679 | |
817 | 1.4559263 | |
818 | 1.4593079 | |
819 | 1.4627911 | |
820 | 1.453154 | |
821 | 1.4416665 | |
822 | 1.4101485 | |
823 | 1.4175823 | |
824 | 1.4266407 | |
825 | ||
826 | ]; | |
827 |
0 | // Example 1 from Collard's guide to Dynare | |
1 | var y, c, k, a, h, b; | |
2 | varexo e, u; | |
3 | ||
4 | parameters beta, rho, alpha, delta, theta, psi, tau; | |
5 | ||
6 | alpha = 0.36; | |
7 | rho = 0.95; | |
8 | tau = 0.025; | |
9 | beta = 0.99; | |
10 | delta = 0.025; | |
11 | psi = 0; | |
12 | theta = 2.95; | |
13 | ||
14 | phi = 0.1; | |
15 | ||
16 | model; | |
17 | c*theta*h^(1+psi)=expectation(1)((1-alpha)*y)+expectation(-2)((1-alpha)*y); | |
18 | k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) | |
19 | *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); | |
20 | y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); | |
21 | k = exp(b)*(y-c)+(1-delta)*k(-1); | |
22 | a = rho*a(-1)+tau*b(-1) + e; | |
23 | b = tau*a(-1)+rho*b(-1) + u; | |
24 | end; | |
25 | ||
26 | initval; | |
27 | y = 1.08068253095672; | |
28 | c = 0.80359242014163; | |
29 | h = 0.29175631001732; | |
30 | k = 11.08360443260358; | |
31 | a = 0; | |
32 | b = 0; | |
33 | e = 0; | |
34 | u = 0; | |
35 | end; | |
36 | ||
37 | shocks; | |
38 | var e; stderr 0.009; | |
39 | var u; stderr 0.009; | |
40 | var e, u = phi*0.009*0.009; | |
41 | end; | |
42 | ||
43 | stoch_simul; |
0 | // Example 1 from Collard's guide to Dynare | |
1 | var y, c, k, a, h, b; | |
2 | varexo e, u; | |
3 | ||
4 | parameters beta, rho, alpha, delta, theta, psi, tau; | |
5 | ||
6 | alpha = 0.36; | |
7 | rho = 0.95; | |
8 | tau = 0.025; | |
9 | beta = 0.99; | |
10 | delta = 0.025; | |
11 | psi = 0; | |
12 | theta = 2.95; | |
13 | ||
14 | phi = 0.1; | |
15 | ||
16 | model; | |
17 | c*theta*h^(1+psi)=expectation(1)((1-alpha)*y)+expectation(-2)((1-alpha)*y); | |
18 | k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) | |
19 | *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); | |
20 | y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); | |
21 | k = exp(b)*(y-c)+(1-delta)*k(-1); | |
22 | a = rho*a(-1)+tau*b(-1) + e; | |
23 | b = tau*a(-1)+rho*b(-1) + u; | |
24 | end; | |
25 | ||
26 | initval; | |
27 | y = 1.08068253095672; | |
28 | c = 0.80359242014163; | |
29 | h = 0.29175631001732; | |
30 | k = 11.08360443260358; | |
31 | a = 0; | |
32 | b = 0; | |
33 | e = 0; | |
34 | u = 0; | |
35 | end; | |
36 | ||
37 | shocks; | |
38 | var e; stderr 0.009; | |
39 | var u; stderr 0.009; | |
40 | var e, u = phi*0.009*0.009; | |
41 | end; | |
42 | ||
43 | stoch_simul(order=1,irf=0); |
0 | // Example 1 from Collard's guide to Dynare | |
1 | var y, c, k, a, h, b; | |
2 | varexo e, u; | |
3 | ||
4 | parameters beta, rho, alpha, delta, theta, psi, tau; | |
5 | ||
6 | alpha = 0.36; | |
7 | rho = 0.95; | |
8 | tau = 0.025; | |
9 | beta = 0.99; | |
10 | delta = 0.025; | |
11 | psi = 0; | |
12 | theta = 2.95; | |
13 | ||
14 | phi = 0.1; | |
15 | ||
16 | model; | |
17 | c*theta*h^(1+psi)=expectation(1)(((1-alpha)*y)+expectation(3)((1-alpha)*y)); | |
18 | k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) | |
19 | *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); | |
20 | y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); | |
21 | k = exp(b)*(y-c)+(1-delta)*k(-1); | |
22 | a = rho*a(-1)+tau*b(-1) + e; | |
23 | b = tau*a(-1)+rho*b(-1) + u; | |
24 | end; | |
25 | ||
26 | initval; | |
27 | y = 1.08068253095672; | |
28 | c = 0.80359242014163; | |
29 | h = 0.29175631001732; | |
30 | k = 11.08360443260358; | |
31 | a = 0; | |
32 | b = 0; | |
33 | e = 0; | |
34 | u = 0; | |
35 | end; | |
36 | ||
37 | shocks; | |
38 | var e; stderr 0.009; | |
39 | var u; stderr 0.009; | |
40 | var e, u = phi*0.009*0.009; | |
41 | end; | |
42 | ||
43 | stoch_simul(order=1,irf=0); |
0 | // Example 1 from Collard's guide to Dynare | |
1 | var y, c, k, a, h, b; | |
2 | varexo e, u; | |
3 | ||
4 | parameters beta, rho, alpha, delta, theta, psi, tau; | |
5 | ||
6 | alpha = 0.36; | |
7 | rho = 0.95; | |
8 | tau = 0.025; | |
9 | beta = 0.99; | |
10 | ||
11 | delta = 0.025; | |
12 | psi = 0; | |
13 | theta = 2.95; | |
14 | ||
15 | phi = 0.1; | |
16 | ||
17 | model; | |
18 | c*theta*h^(1+psi)=(expectation(1)((1-alpha)*y)+expectation(-2)((1-alpha)*y))/2; | |
19 | k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) | |
20 | *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); | |
21 | y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); | |
22 | k = exp(b)*(y-c)+(1-delta)*k(-1); | |
23 | a = rho*a(-1)+tau*b(-1) + e; | |
24 | b = tau*a(-1)+rho*b(-1) + u; | |
25 | end; | |
26 | ||
27 | steady_state_model; | |
28 | a = 0; | |
29 | b = 0; | |
30 | h = 1/3; | |
31 | k = ((1/beta-(1-delta))/(alpha*h^(1-alpha)))^(1/(alpha-1)); | |
32 | y = k^alpha*h^(1-alpha); | |
33 | c = y - delta*k; | |
34 | theta = (1-alpha)*y/(c*h^(1+psi)); | |
35 | end; | |
36 | ||
37 | steady; | |
38 | ||
39 | shocks; | |
40 | var e; stderr 0.009; | |
41 | var u; stderr 0.009; | |
42 | var e, u = phi*0.009*0.009; | |
43 | end; | |
44 | ||
45 | stoch_simul(order=1,irf=0); |
0 | // Example 1 from Collard's guide to Dynare | |
1 | var y, c, k, a, h, b; | |
2 | varexo e, u; | |
3 | ||
4 | parameters beta, rho, alpha, delta, theta, psi, tau; | |
5 | ||
6 | alpha = 0.36; | |
7 | rho = 0.95; | |
8 | tau = 0.025; | |
9 | beta = 0.99; | |
10 | ||
11 | delta = 0.025; | |
12 | psi = 0; | |
13 | theta = 2.95; | |
14 | ||
15 | phi = 0.1; | |
16 | ||
17 | model; | |
18 | c*theta*h^(1+psi)=(expectation(1)((1-alpha)*y)+expectation(-2)((1-alpha)*y))/2; | |
19 | k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) | |
20 | *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); | |
21 | y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); | |
22 | k = exp(b)*(y-c)+(1-delta)*k(-1); | |
23 | a = rho*a(-1)+tau*b(-1) + e; | |
24 | b = tau*a(-1)+rho*b(-1) + u; | |
25 | end; | |
26 | ||
27 | steady; | |
28 | ||
29 | shocks; | |
30 | var e; stderr 0.009; | |
31 | var u; stderr 0.009; | |
32 | var e, u = phi*0.009*0.009; | |
33 | end; | |
34 | ||
35 | stoch_simul(order=1,irf=0); |
0 | function [ys_, check_] = expectation_ss_old_steadystate(ys_orig_, exo_) | |
1 | ys_=zeros(6,1); | |
2 | global M_ | |
3 | ys_(4)=0; | |
4 | ys_(6)=0; | |
5 | ys_(5)=0.3333333333333333; | |
6 | ys_(3)=((1/M_.params(1)-(1-M_.params(4)))/(M_.params(3)*ys_(5)^(1-M_.params(3))))^(1/(M_.params(3)-1)); | |
7 | ys_(1)=ys_(5)^(1-M_.params(3))*ys_(3)^M_.params(3); | |
8 | ys_(2)=ys_(1)-M_.params(4)*ys_(3); | |
9 | M_.params(5)=(1-M_.params(3))*ys_(1)/(ys_(2)*ys_(5)^(1+M_.params(6))); | |
10 | check_=0; | |
11 | end |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | ||
2 | var m P c e W R k d n l gy_obs gp_obs y dA; | |
3 | varexo e_a e_m; | |
4 | ||
5 | parameters alp bet gam mst rho psi del; | |
6 | ||
7 | alp = 0.33; | |
8 | bet = 0.99; | |
9 | gam = 0.003; | |
10 | mst = 1.011; | |
11 | rho = 0.7; | |
12 | psi = 0.787; | |
13 | del = 0.02; | |
14 | ||
15 | model; | |
16 | dA = exp(gam+e_a); | |
17 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
18 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
19 | W = l/n; | |
20 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
21 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
22 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
23 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
24 | P*c = m; | |
25 | m-1+d = l; | |
26 | e = exp(e_a); | |
27 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
28 | gy_obs = dA*y/y(-1); | |
29 | gp_obs = (P/P(-1))*m(-1)/dA; | |
30 | end; | |
31 | ||
32 | initval; | |
33 | k = 6; | |
34 | m = mst; | |
35 | P = 2.25; | |
36 | c = 0.45; | |
37 | e = 1; | |
38 | W = 4; | |
39 | R = 1.02; | |
40 | d = 0.85; | |
41 | n = 0.19; | |
42 | l = 0.86; | |
43 | y = 0.6; | |
44 | gy_obs = exp(gam); | |
45 | gp_obs = exp(-gam); | |
46 | dA = exp(gam); | |
47 | end; | |
48 | ||
49 | shocks; | |
50 | var e_a; stderr 0.014; | |
51 | var e_m; stderr 0.005; | |
52 | end; | |
53 | ||
54 | steady; | |
55 | ||
56 | check; | |
57 | ||
58 | estimated_params; | |
59 | alp, beta_pdf, 0.356, 0.02; | |
60 | bet, beta_pdf, 0.993, 0.002; | |
61 | gam, normal_pdf, 0.0085, 0.003; | |
62 | mst, normal_pdf, 1.0002, 0.007; | |
63 | rho, beta_pdf, 0.129, 0.223; | |
64 | psi, beta_pdf, 0.65, 0.05; | |
65 | del, beta_pdf, 0.01, 0.005; | |
66 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
67 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
68 | end; | |
69 | ||
70 | varobs gp_obs gy_obs; | |
71 | ||
72 | options_.solve_tolf = 1e-12; | |
73 | ||
74 | estimation(order=1,datafile=fsdat_simul,nobs=192,mode_compute=5,loglinear,mh_replic=0); |
0 | var pie y R g z YGR INFL INT; | |
1 | varexo e_R e_g e_z; | |
2 | parameters tau kap psi1 psi2 rhoR rhog rhoz rr_steady pi_steady gam_steady std_R std_g std_z; | |
3 | ||
4 | tau = 2; | |
5 | kap = 0.15; | |
6 | ||
7 | psi1 = 1.5; | |
8 | psi2 = 1; | |
9 | ||
10 | rhoR = 0.96; | |
11 | rhog = 0.95; | |
12 | rhoz = 0.65; | |
13 | ||
14 | rr_steady = 0.4; | |
15 | pi_steady = 4.0; | |
16 | gam_steady = 0.5; | |
17 | std_R = 0.2; | |
18 | std_g = 0.8; | |
19 | std_z = 0.45; | |
20 | ||
21 | model; | |
22 | y = y(+1) + g - g(+1) - 1/tau*(R-pie(+1)-z(+1)); | |
23 | pie = 1/(1+rr_steady/400)*pie(+1)+kap*(y-g); | |
24 | R = rhoR*R(-1)+(1-rhoR)*psi1*pie+(1-rhoR)*psi2*(y-y(-1)+z)+e_R*std_R; | |
25 | g = rhog*g(-1)+e_g*std_g; | |
26 | z = rhoz*z(-1)+e_z*std_z; | |
27 | YGR = gam_steady+100*(y-y(-1)+z); | |
28 | INFL = pi_steady+400*pie; | |
29 | INT = pi_steady+rr_steady+4*gam_steady+400*R; | |
30 | end; | |
31 | ||
32 | estimated_params; | |
33 | tau, gamma_pdf, 2, 0.5; | |
34 | kap, beta_pdf, 0.2, 0.1; | |
35 | psi1, gamma_pdf, 1.5, 0.25; | |
36 | psi2, gamma_pdf, 0.5, 0.25; | |
37 | rhoR, beta_pdf, 0.5, 0.2; | |
38 | rhog, beta_pdf, 0.8, 0.1; | |
39 | rhoz, beta_pdf, 0.66, 0.15; | |
40 | rr_steady, gamma_pdf, 0.8, 0.5; | |
41 | pi_steady, gamma_pdf, 0.8, 0.5; | |
42 | gam_steady, gamma_pdf, 0.8, 0.5; | |
43 | std_R, inv_gamma_pdf, 0.05, inf; | |
44 | std_g, inv_gamma_pdf, 0.05, inf; | |
45 | std_z, inv_gamma_pdf, 0.05, inf; | |
46 | end; | |
47 | ||
48 | steady; | |
49 | check; | |
50 | ||
51 | varobs YGR INFL INT; | |
52 | ||
53 | shocks; | |
54 | var e_g; | |
55 | stderr 1; | |
56 | var e_R; | |
57 | stderr 1; | |
58 | var e_z; | |
59 | stderr 1; | |
60 | end; | |
61 | ||
62 | identification; |
0 | function [ys,check1]=as2007_steadystate(junk, ys) | |
1 | ||
2 | global M_ options_ | |
3 | ||
4 | for j=1:size(M_.param_names,1) | |
5 | eval([deblank(M_.param_names(j,:)),' = M_.params(j);']) | |
6 | assignin('base',deblank(M_.param_names(j,:)),M_.params(j)); | |
7 | end | |
8 | for j=1:size(M_.endo_names,1) | |
9 | eval([deblank(M_.endo_names(j,:)),' = NaN;']) | |
10 | end | |
11 | ||
12 | check1=0; | |
13 | ||
14 | pie=0; | |
15 | y=0; | |
16 | R=0; | |
17 | g=0; | |
18 | z=0; | |
19 | YGR=gam_steady; | |
20 | INFL = pi_steady; | |
21 | INT = pi_steady+rr_steady+4*gam_steady; | |
22 | ||
23 | ys=[ | |
24 | pie | |
25 | y | |
26 | R | |
27 | g | |
28 | z | |
29 | YGR | |
30 | INFL | |
31 | INT];⏎ |
0 | var c k i a lam; | |
1 | varexo ea; | |
2 | ||
3 | parameters | |
4 | alph | |
5 | betae | |
6 | delta | |
7 | as | |
8 | s | |
9 | theta | |
10 | phi | |
11 | ; | |
12 | ||
13 | ||
14 | alph=0.6; | |
15 | betae=0.99; | |
16 | delta=0.0125; | |
17 | as=0.1; | |
18 | phi=2; | |
19 | s=betae*delta*alph/(1-betae+delta*betae); | |
20 | theta=1; | |
21 | ||
22 | model; | |
23 | //(1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c^(1+theta)/(1+theta)*(1+theta)*(i/(betae*delta*alph/(1-betae+delta*betae)))^theta*(i/k/delta)^phi=betae*(1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c(+1)^(1+theta)/(1+theta)*(alph*(1+theta)*a(+1)^(1+theta)*k^(alph*(1+theta)-1)+(1-delta)*(i(+1)/k/delta)^phi*(1+theta)*(i(+1)/(betae*delta*alph/(1-betae+delta*betae)))^theta); | |
24 | lam*(1+theta)*(i/(betae*delta*alph/(1-betae+delta*betae)))^theta*(i/k/delta)^phi=betae*lam(+1)*(alph*(1+theta)*a(+1)^(1+theta)*k^(alph*(1+theta)-1)+(1-delta)*(i(+1)/k/delta)^phi*(1+theta)*(i(+1)/(betae*delta*alph/(1-betae+delta*betae)))^theta); | |
25 | k=(delta*(i/delta)^(1-phi)+(1-delta)*k(-1)^(1-phi))^(1/(1-phi)); | |
26 | ((1-(betae*delta*alph/(1-betae+delta*betae)))*(c/(1-(betae*delta*alph/(1-betae+delta*betae))))^(1+theta) + | |
27 | (betae*delta*alph/(1-betae+delta*betae))*(i/(betae*delta*alph/(1-betae+delta*betae)))^(1+theta))^(1/(1+theta))= | |
28 | (a*k(-1)^alph); | |
29 | a = as+ea; | |
30 | lam = (1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c^(1+theta)/(1+theta); | |
31 | end; | |
32 | ||
33 | steady; | |
34 | check; | |
35 | ||
36 | shocks; | |
37 | var ea = 1; | |
38 | end; | |
39 | ||
40 | estimated_params; | |
41 | alph ,uniform_pdf,0.6,0.04,0.5,0.7; | |
42 | //betae ,uniform_pdf,0.99,0.004,0.98,1; | |
43 | //delta ,uniform_pdf,0.0125,0.001,0.01,0.015; | |
44 | phi ,uniform_pdf,0.5,0.2,0,10; | |
45 | theta ,uniform_pdf,0.3,0.1,0,10; | |
46 | end; | |
47 | ||
48 | varobs c i; | |
49 | //varobs c i lam; //to check if observing lam identifies phi and theta | |
50 | //identification(ar=1); | |
51 | identification(prior_mc=100); |
63 | 63 | stoch_simul(order=2,k_order_solver,irf=0); |
64 | 64 | |
65 | 65 | if ~exist('fs2000k2_use_dll_results.mat','file'); |
66 | error('fs2000k2 must be run first'); | |
66 | error('fs2000k2_use_dll must be run first'); | |
67 | 67 | end; |
68 | 68 | |
69 | 69 | oo1 = load('fs2000k2_use_dll_results','oo_'); |
0 | system('../../dynare++/src/dynare++ --order 3 --no-centralize fs2000k++.mod') |
0 | var z dw dx dy dc1 dc2; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | end; | |
13 | ||
14 | estimated_params; | |
15 | rho_w, normal_pdf, 0.5,0.2; | |
16 | rho_x, normal_pdf, 0.5,0.2; | |
17 | rho_y, normal_pdf, 0.5,0.2; | |
18 | rho_z, normal_pdf, 0.8,0.2; | |
19 | ||
20 | a1, normal_pdf, 0.1,0.2; | |
21 | a2, normal_pdf, -0.1,0.2; | |
22 | a3, normal_pdf, 0.1,0.2; | |
23 | b , normal_pdf, 1,0.2; | |
24 | c , normal_pdf, 1,0.2; | |
25 | ||
26 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
27 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
30 | end; | |
31 | ||
32 | varobs dw dx dy z; | |
33 | ||
34 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,filtered_vars); | |
35 | ||
36 | //checking smoother consistency | |
37 | X = oo_.SmoothedVariables; | |
38 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2]; | |
39 | X = oo_.SmoothedShocks; | |
40 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
41 | A = oo_.dr.ghx; | |
42 | B = oo_.dr.ghu; | |
43 | err = zeros(6,200); | |
44 | for t=2:200; | |
45 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
46 | end; | |
47 | if max(max(abs(err))) > 1e-10; | |
48 | error('Test fails') | |
49 | end; | |
50 | ||
51 | d=load('data'); | |
52 | dat = [d.dw d.dx d.dy d.z]; | |
53 | if max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])))) > 1e-10; | |
54 | error('Test fails'); | |
55 | end;⏎ |
0 | var z dw dx dy dc1 dc2; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | end; | |
13 | ||
14 | estimated_params; | |
15 | rho_w, normal_pdf, 0.5,0.2; | |
16 | rho_x, normal_pdf, 0.5,0.2; | |
17 | rho_y, normal_pdf, 0.5,0.2; | |
18 | rho_z, normal_pdf, 0.8,0.2; | |
19 | ||
20 | a1, normal_pdf, 0.1,0.2; | |
21 | a2, normal_pdf, -0.1,0.2; | |
22 | a3, normal_pdf, 0.1,0.2; | |
23 | b , normal_pdf, 1,0.2; | |
24 | c , normal_pdf, 1,0.2; | |
25 | ||
26 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
27 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
30 | end; | |
31 | ||
32 | varobs dw dx dy z; | |
33 | ||
34 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo1_mode,kalman_algo=2,filtered_vars); | |
35 | ||
36 | //checking smoother consistency | |
37 | X = oo_.SmoothedVariables; | |
38 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2]; | |
39 | X = oo_.SmoothedShocks; | |
40 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
41 | A = oo_.dr.ghx; | |
42 | B = oo_.dr.ghu; | |
43 | err = zeros(6,200); | |
44 | for t=2:200; | |
45 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
46 | end; | |
47 | if max(max(abs(err))) > 1e-10; | |
48 | error('Test fails'); | |
49 | end; | |
50 | ||
51 | d=load('data'); | |
52 | dat = [d.dw d.dx d.dy d.z]; | |
53 | if max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])))) > 1e-10; | |
54 | error('Test fails'); | |
55 | end; | |
56 | ||
57 | o1 = load('algo1_results'); | |
58 | obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'}; | |
59 | obj_exo = {'SmoothedShocks';}; | |
60 | nobj_endo = size(obj_endo,1); | |
61 | nobj_exo = size(obj_exo,1); | |
62 | for i=1:nobj_endo; | |
63 | err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr); | |
64 | for j=1:M_.endo_nbr; | |
65 | var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
66 | var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
67 | err_endo(:,j) = var1-var2; | |
68 | end; | |
69 | if max(max(abs(err_endo))) > 1e-10; | |
70 | error('Test fails'); | |
71 | end; | |
72 | end; | |
73 | ||
74 | ||
75 | err_exo = zeros(200,M_.exo_nbr,nobj_exo); | |
76 | for i=1:nobj_exo; | |
77 | err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr); | |
78 | for j=1:M_.exo_nbr; | |
79 | var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
80 | var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
81 | err_exo(:,j,i) = var1 - var2; | |
82 | end; | |
83 | if max(max(abs(err_exo))) > 1e-10; | |
84 | error('Test fails') | |
85 | end; | |
86 | end; |
0 | var z dw dx dy dc1 dc2 w x y; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | w = w(-1) + dw; | |
13 | x = x(-1) + dx; | |
14 | y = y(-1) + dy; | |
15 | end; | |
16 | ||
17 | estimated_params; | |
18 | rho_w, normal_pdf, 0.5,0.2; | |
19 | rho_x, normal_pdf, 0.5,0.2; | |
20 | rho_y, normal_pdf, 0.5,0.2; | |
21 | rho_z, normal_pdf, 0.8,0.2; | |
22 | ||
23 | a1, normal_pdf, 0.1,0.2; | |
24 | a2, normal_pdf, -0.1,0.2; | |
25 | a3, normal_pdf, 0.1,0.2; | |
26 | b , normal_pdf, 1,0.2; | |
27 | c , normal_pdf, 1,0.2; | |
28 | ||
29 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
30 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
31 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
32 | stderr e_z, inv_gamma_pdf,0.01, inf; | |
33 | end; | |
34 | ||
35 | varobs w x y; | |
36 | ||
37 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter,filtered_vars); | |
38 | ||
39 | //checking smoother consistency | |
40 | X = oo_.SmoothedVariables; | |
41 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y]; | |
42 | X = oo_.SmoothedShocks; | |
43 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
44 | A = oo_.dr.ghx; | |
45 | B = oo_.dr.ghu; | |
46 | err = zeros(M_.endo_nbr,200); | |
47 | for t=2:200; | |
48 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
49 | end; | |
50 | if max(max(abs(err))) > 1e-10; | |
51 | error('Test fails'); | |
52 | end; | |
53 | ||
54 | d=load('data'); | |
55 | dat = [d.w d.x d.y]; | |
56 | if max(max(abs(dat(1000:1199,:)-S(:,[7:9])))) > 1e-10; | |
57 | error('Test fails'); | |
58 | end; |
0 | var z dw dx dy dc1 dc2 w x y; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | w = w(-1) + dw; | |
13 | x = x(-1) + dx; | |
14 | y = y(-1) + dy; | |
15 | end; | |
16 | ||
17 | estimated_params; | |
18 | rho_w, normal_pdf, 0.5,0.2; | |
19 | rho_x, normal_pdf, 0.5,0.2; | |
20 | rho_y, normal_pdf, 0.5,0.2; | |
21 | rho_z, normal_pdf, 0.8,0.2; | |
22 | ||
23 | a1, normal_pdf, 0.1,0.2; | |
24 | a2, normal_pdf, -0.1,0.2; | |
25 | a3, normal_pdf, 0.1,0.2; | |
26 | b , normal_pdf, 1,0.2; | |
27 | c , normal_pdf, 1,0.2; | |
28 | ||
29 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
30 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
31 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
32 | stderr e_z, inv_gamma_pdf,0.01, inf; | |
33 | end; | |
34 | ||
35 | varobs w x y; | |
36 | ||
37 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter,kalman_algo=4,filtered_vars); | |
38 | ||
39 | //checking smoother consistency | |
40 | X = oo_.SmoothedVariables; | |
41 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y]; | |
42 | X = oo_.SmoothedShocks; | |
43 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
44 | A = oo_.dr.ghx; | |
45 | B = oo_.dr.ghu; | |
46 | err = zeros(M_.endo_nbr,200); | |
47 | for t=2:200; | |
48 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
49 | end; | |
50 | if max(max(abs(err))) > 1e-10; | |
51 | error('Test fails'); | |
52 | end; | |
53 | ||
54 | d=load('data'); | |
55 | dat = [d.w d.x d.y]; | |
56 | if max(max(abs(dat(1000:1199,:)-S(:,[7:9])))) > 1e-10; | |
57 | error('Test fails'); | |
58 | end; | |
59 | ||
60 | o1 = load('algo3_results'); | |
61 | obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'}; | |
62 | obj_exo = {'SmoothedShocks';}; | |
63 | nobj_endo = size(obj_endo,1); | |
64 | nobj_exo = size(obj_exo,1); | |
65 | for i=1:nobj_endo; | |
66 | err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr); | |
67 | for j=1:M_.endo_nbr; | |
68 | var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
69 | var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
70 | err_endo(:,j) = var1-var2; | |
71 | end; | |
72 | if max(max(abs(err_endo))) > 1e-10; | |
73 | error('Test fails'); | |
74 | end; | |
75 | end; | |
76 | ||
77 | ||
78 | err_exo = zeros(200,M_.exo_nbr,nobj_exo); | |
79 | for i=1:nobj_exo; | |
80 | err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr); | |
81 | for j=1:M_.exo_nbr; | |
82 | var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
83 | var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
84 | err_exo(:,j,i) = var1 - var2; | |
85 | end; | |
86 | if max(max(abs(err_exo))) > 1e-10; | |
87 | error('Test fails'); | |
88 | end; | |
89 | end; | |
90 |
0 | var z dw dx dy dc1 dc2 y; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | y = y(-1) + dy; | |
13 | end; | |
14 | ||
15 | estimated_params; | |
16 | rho_w, normal_pdf, 0.5,0.2; | |
17 | rho_x, normal_pdf, 0.5,0.2; | |
18 | rho_y, normal_pdf, 0.5,0.2; | |
19 | rho_z, normal_pdf, 0.8,0.2; | |
20 | ||
21 | a1, normal_pdf, 0.1,0.2; | |
22 | a2, normal_pdf, -0.1,0.2; | |
23 | a3, normal_pdf, 0.1,0.2; | |
24 | b , normal_pdf, 1,0.2; | |
25 | c , normal_pdf, 1,0.2; | |
26 | ||
27 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
30 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
31 | end; | |
32 | ||
33 | varobs dw dx y z; | |
34 | ||
35 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter); | |
36 | //estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter); | |
37 | ||
38 | //checking smoother consistency | |
39 | X = oo_.SmoothedVariables; | |
40 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.y]; | |
41 | X = oo_.SmoothedShocks; | |
42 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
43 | A = oo_.dr.ghx; | |
44 | B = oo_.dr.ghu; | |
45 | err = zeros(M_.endo_nbr,200); | |
46 | for t=2:200; | |
47 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
48 | end; | |
49 | if max(max(abs(err))) > 1e-10; | |
50 | error('Test fails'); | |
51 | end; | |
52 | ||
53 | d=load('data'); | |
54 | dat = [d.dw d.dx d.y d.z]; | |
55 | if max(max(abs(dat(1000:1199,:)-S(:,[2 3 7 1])))) > 1e-10; | |
56 | error('Test fails'); | |
57 | end; |
0 | var z dw dx dy dc1 dc2 y; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | y = y(-1) + dy; | |
13 | end; | |
14 | ||
15 | estimated_params; | |
16 | rho_w, normal_pdf, 0.5,0.2; | |
17 | rho_x, normal_pdf, 0.5,0.2; | |
18 | rho_y, normal_pdf, 0.5,0.2; | |
19 | rho_z, normal_pdf, 0.8,0.2; | |
20 | ||
21 | a1, normal_pdf, 0.1,0.2; | |
22 | a2, normal_pdf, -0.1,0.2; | |
23 | a3, normal_pdf, 0.1,0.2; | |
24 | b , normal_pdf, 1,0.2; | |
25 | c , normal_pdf, 1,0.2; | |
26 | ||
27 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
30 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
31 | end; | |
32 | ||
33 | varobs dw dx y z; | |
34 | ||
35 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter); | |
36 | //estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algo3_mode,diffuse_filter); | |
37 | ||
38 | //checking smoother consistency | |
39 | X = oo_.SmoothedVariables; | |
40 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.y]; | |
41 | X = oo_.SmoothedShocks; | |
42 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
43 | A = oo_.dr.ghx; | |
44 | B = oo_.dr.ghu; | |
45 | err = zeros(M_.endo_nbr,200); | |
46 | for t=2:200; | |
47 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
48 | end; | |
49 | if max(max(abs(err))) > 1e-10; | |
50 | error('Test fails'); | |
51 | end; | |
52 | ||
53 | d=load('data'); | |
54 | dat = [d.dw d.dx d.y d.z]; | |
55 | if max(max(abs(dat(1000:1199,:)-S(:,[2 3 7 1])))) > 1e-10; | |
56 | error('Test fails'); | |
57 | end; |
0 | var z dw dx dy dc1 dc2; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | end; | |
13 | ||
14 | estimated_params; | |
15 | rho_w, normal_pdf, 0.5,0.2; | |
16 | rho_x, normal_pdf, 0.5,0.2; | |
17 | rho_y, normal_pdf, 0.5,0.2; | |
18 | rho_z, normal_pdf, 0.8,0.2; | |
19 | ||
20 | a1, normal_pdf, 0.1,0.2; | |
21 | a2, normal_pdf, -0.1,0.2; | |
22 | a3, normal_pdf, 0.1,0.2; | |
23 | b , normal_pdf, 1,0.2; | |
24 | c , normal_pdf, 1,0.2; | |
25 | ||
26 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
27 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
30 | ||
31 | stderr z, normal_pdf, 0, 0.1; | |
32 | end; | |
33 | ||
34 | varobs dw dx dy z; | |
35 | ||
36 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0); | |
37 | ||
38 | //checking smoother consistency | |
39 | X = oo_.SmoothedVariables; | |
40 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2]; | |
41 | X = oo_.SmoothedShocks; | |
42 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
43 | A = oo_.dr.ghx; | |
44 | B = oo_.dr.ghu; | |
45 | err = zeros(6,200); | |
46 | for t=2:200; | |
47 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
48 | end; | |
49 | if max(max(abs(err))) > 1e-10; | |
50 | error('Test fails'); | |
51 | end; | |
52 | ||
53 | d=load('data'); | |
54 | dat = [d.dw d.dx d.dy d.z]; | |
55 | X = oo_.SmoothedMeasurementErrors; | |
56 | ME = [X.dw X.dx X.dy X.z]; | |
57 | if max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))) > 1e-10; | |
58 | error('Test fails'); | |
59 | end; |
0 | var z dw dx dy dc1 dc2; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | end; | |
13 | ||
14 | estimated_params; | |
15 | rho_w, normal_pdf, 0.5,0.2; | |
16 | rho_x, normal_pdf, 0.5,0.2; | |
17 | rho_y, normal_pdf, 0.5,0.2; | |
18 | rho_z, normal_pdf, 0.8,0.2; | |
19 | ||
20 | a1, normal_pdf, 0.1,0.2; | |
21 | a2, normal_pdf, -0.1,0.2; | |
22 | a3, normal_pdf, 0.1,0.2; | |
23 | b , normal_pdf, 1,0.2; | |
24 | c , normal_pdf, 1,0.2; | |
25 | ||
26 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
27 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
28 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
29 | stderr e_z, uniform_pdf,,, 0.01, 0.1; | |
30 | ||
31 | stderr z, normal_pdf, 0, 0.1; | |
32 | end; | |
33 | ||
34 | varobs dw dx dy z; | |
35 | ||
36 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,mode_compute=0,mode_file=algoH1_mode,kalman_algo=2,filtered_vars); | |
37 | ||
38 | //checking smoother consistency | |
39 | X = oo_.SmoothedVariables; | |
40 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2]; | |
41 | X = oo_.SmoothedShocks; | |
42 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
43 | A = oo_.dr.ghx; | |
44 | B = oo_.dr.ghu; | |
45 | err = zeros(6,200); | |
46 | for t=2:200; | |
47 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
48 | end; | |
49 | if max(max(abs(err))) > 1e-10; | |
50 | error('Test fails'); | |
51 | end; | |
52 | ||
53 | d=load('data'); | |
54 | dat = [d.dw d.dx d.dy d.z]; | |
55 | X = oo_.SmoothedMeasurementErrors; | |
56 | ME = [X.dw X.dx X.dy X.z]; | |
57 | if max(max(abs(dat(1000:1199,:)-S(:,[2:4 1])-ME))) > 1e-10; | |
58 | error('Test fails'); | |
59 | end; | |
60 | ||
61 | o1 = load('algoH1_results'); | |
62 | obj_endo={'SmoothedVariables'; 'FilteredVariables'; 'UpdatedVariables'}; | |
63 | obj_exo = {'SmoothedShocks';}; | |
64 | nobj_endo = size(obj_endo,1); | |
65 | nobj_exo = size(obj_exo,1); | |
66 | for i=1:nobj_endo; | |
67 | err_endo = zeros(eval(['size(oo_.' obj_endo{i} '.' M_.endo_names(1,:) ',1);']),M_.endo_nbr); | |
68 | for j=1:M_.endo_nbr; | |
69 | var1 = eval(['o1.oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
70 | var2 = eval(['oo_.' obj_endo{i} '.' M_.endo_names(j,:)]); | |
71 | err_endo(:,j) = var1-var2; | |
72 | end; | |
73 | if max(max(abs(err_endo))) > 1e-10; | |
74 | error('Test fails'); | |
75 | end; | |
76 | end; | |
77 | ||
78 | ||
79 | err_exo = zeros(200,M_.exo_nbr,nobj_exo); | |
80 | for i=1:nobj_exo; | |
81 | err_exo = zeros(size(eval(['oo_.' obj_exo{i} '.' M_.exo_names(1,:)]),1),M_.exo_nbr); | |
82 | for j=1:M_.exo_nbr; | |
83 | var1 = eval(['o1.oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
84 | var2 = eval(['oo_.' obj_exo{i} '.' M_.exo_names(j,:)]); | |
85 | err_exo(:,j,i) = var1 - var2; | |
86 | end; | |
87 | if max(max(abs(err_exo))) > 1e-10; | |
88 | error('Test fails'); | |
89 | end; | |
90 | end; | |
91 | ||
92 | if max(max(abs(o1.oo_.SmoothedMeasurementErrors.z - oo_.SmoothedMeasurementErrors.z))) > 1e-10; | |
93 | error('Test fails'); | |
94 | end; |
0 | var z dw dx dy dc1 dc2 w x y; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | model(linear); | |
6 | dw = rho_w*dw(-1)+a1*(dc1(-1))+e_w; | |
7 | dx = rho_x*dx(-1)+a2*(dc1(-1))+e_x; | |
8 | dy = rho_y*dy(-1)+a3*(dc2(-1))+e_y; | |
9 | z = rho_z*z(-1)+dw-dx+e_z; | |
10 | dc1 = dc1(-1)+dx-b*dy-c*dw; | |
11 | dc2 = dc2(-1)+dx-b*dy; | |
12 | w = w(-1) + dw; | |
13 | x = x(-1) + dx; | |
14 | y = y(-1) + dy; | |
15 | end; | |
16 | ||
17 | estimated_params; | |
18 | rho_w, normal_pdf, 0.5,0.2; | |
19 | rho_x, normal_pdf, 0.5,0.2; | |
20 | rho_y, normal_pdf, 0.5,0.2; | |
21 | rho_z, normal_pdf, 0.8,0.2; | |
22 | ||
23 | a1, normal_pdf, 0.1,0.2; | |
24 | a2, normal_pdf, -0.1,0.2; | |
25 | a3, normal_pdf, 0.1,0.2; | |
26 | b , normal_pdf, 1,0.2; | |
27 | c , normal_pdf, 1,0.2; | |
28 | ||
29 | stderr e_w, uniform_pdf,,, 0.01, 0.1; | |
30 | stderr e_x, uniform_pdf,,, 0.01, 0.1; | |
31 | stderr e_y, uniform_pdf,,, 0.01, 0.1; | |
32 | stderr e_z, inv_gamma_pdf,0.01, inf; | |
33 | ||
34 | stderr w, inv_gamma_pdf, 0.01,inf; | |
35 | end; | |
36 | ||
37 | varobs w x y; | |
38 | ||
39 | estimation(datafile=data,first_obs=1000,nobs=200,mh_replic=0,diffuse_filter); | |
40 | ||
41 | stoch_simul(irf=0); | |
42 | ||
43 | //checking smoother consistency | |
44 | X = oo_.SmoothedVariables; | |
45 | S = [X.z X.dw X.dx X.dy X.dc1 X.dc2 X.w X.x X.y]; | |
46 | X = oo_.SmoothedShocks; | |
47 | E = [X.e_w X.e_x X.e_y X.e_z]; | |
48 | A = oo_.dr.ghx; | |
49 | B = oo_.dr.ghu; | |
50 | err = zeros(M_.endo_nbr,200); | |
51 | for t=2:200; | |
52 | err(:,t) = S(t,:)'-A*S(t-1,:)'-B*E(t,:)'; | |
53 | end; | |
54 | if max(max(abs(err))) > 1e-10; | |
55 | error('Test fails'); | |
56 | end; | |
57 | ||
58 | d=load('data'); | |
59 | dat = [d.w d.x d.y]; | |
60 | X = oo_.SmoothedMeasurementErrors; | |
61 | ME = [X.w X.x X.y]; | |
62 | if max(max(abs(dat(1000:1199,:)-S(:,[7:9])-ME))) > 1E-10; | |
63 | error('Test fails'); | |
64 | end; |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | ||
2 | var m P c e W R k d n l gy_obs gp_obs y dA; | |
3 | varexo e_a e_m; | |
4 | ||
5 | parameters alp bet gam mst rho psi del; | |
6 | ||
7 | alp = 0.33; | |
8 | bet = 0.99; | |
9 | gam = 0.003; | |
10 | mst = 1.011; | |
11 | rho = 0.7; | |
12 | psi = 0.787; | |
13 | del = 0.02; | |
14 | ||
15 | model; | |
16 | dA = exp(gam+e_a); | |
17 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
18 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
19 | W = l/n; | |
20 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
21 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
22 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
23 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
24 | P*c = m; | |
25 | m-1+d = l; | |
26 | e = exp(e_a); | |
27 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
28 | gy_obs = dA*y/y(-1); | |
29 | gp_obs = (P/P(-1))*m(-1)/dA; | |
30 | end; | |
31 | ||
32 | initval; | |
33 | k = 6; | |
34 | m = mst; | |
35 | P = 2.25; | |
36 | c = 0.45; | |
37 | e = 1; | |
38 | W = 4; | |
39 | R = 1.02; | |
40 | d = 0.85; | |
41 | n = 0.19; | |
42 | l = 0.86; | |
43 | y = 0.6; | |
44 | gy_obs = exp(gam); | |
45 | gp_obs = exp(-gam); | |
46 | dA = exp(gam); | |
47 | end; | |
48 | ||
49 | shocks; | |
50 | var e_a; stderr 0.014; | |
51 | var e_m; stderr 0.005; | |
52 | end; | |
53 | ||
54 | steady; | |
55 | ||
56 | check; | |
57 | ||
58 | estimated_params; | |
59 | alp, beta_pdf, 0.356, 0.02; | |
60 | bet, beta_pdf, 0.993, 0.002; | |
61 | gam, normal_pdf, 0.0085, 0.003; | |
62 | mst, normal_pdf, 1.0002, 0.007; | |
63 | rho, beta_pdf, 0.129, 0.223; | |
64 | psi, beta_pdf, 0.65, 0.05; | |
65 | del, beta_pdf, 0.01, 0.005; | |
66 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
67 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
68 | end; | |
69 | ||
70 | varobs gp_obs gy_obs; | |
71 | ||
72 | //estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=2000,mh_nblocks=2,mh_jscale=0.8,mode_check); | |
73 | estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=0,mode_compute=0); |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | // For initial value of the parameter, the filter reaches steady state at period 137 | |
2 | ||
3 | var m P c e W R k d n l gy_obs gp_obs y dA; | |
4 | varexo e_a e_m; | |
5 | ||
6 | parameters alp bet gam mst rho psi del; | |
7 | ||
8 | alp = 0.33; | |
9 | bet = 0.99; | |
10 | gam = 0.003; | |
11 | mst = 1.011; | |
12 | rho = 0.7; | |
13 | psi = 0.787; | |
14 | del = 0.02; | |
15 | ||
16 | model; | |
17 | dA = exp(gam+e_a); | |
18 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
19 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
20 | W = l/n; | |
21 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
22 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
23 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
24 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
25 | P*c = m; | |
26 | m-1+d = l; | |
27 | e = exp(e_a); | |
28 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
29 | gy_obs = dA*y/y(-1); | |
30 | gp_obs = (P/P(-1))*m(-1)/dA; | |
31 | end; | |
32 | ||
33 | initval; | |
34 | k = 6; | |
35 | m = mst; | |
36 | P = 2.25; | |
37 | c = 0.45; | |
38 | e = 1; | |
39 | W = 4; | |
40 | R = 1.02; | |
41 | d = 0.85; | |
42 | n = 0.19; | |
43 | l = 0.86; | |
44 | y = 0.6; | |
45 | gy_obs = exp(gam); | |
46 | gp_obs = exp(-gam); | |
47 | dA = exp(gam); | |
48 | end; | |
49 | ||
50 | shocks; | |
51 | var e_a; stderr 0.014; | |
52 | var e_m; stderr 0.005; | |
53 | end; | |
54 | ||
55 | steady; | |
56 | ||
57 | check; | |
58 | ||
59 | estimated_params; | |
60 | alp, beta_pdf, 0.356, 0.02; | |
61 | bet, beta_pdf, 0.993, 0.002; | |
62 | gam, normal_pdf, 0.0085, 0.003; | |
63 | mst, normal_pdf, 1.0002, 0.007; | |
64 | rho, beta_pdf, 0.129, 0.223; | |
65 | psi, beta_pdf, 0.65, 0.05; | |
66 | del, beta_pdf, 0.01, 0.005; | |
67 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
68 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
69 | end; | |
70 | ||
71 | varobs gp_obs gy_obs; | |
72 | ||
73 | estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=0,mode_compute=0); |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | // For initial value of the parameter, the filter reaches steady state at period 137 | |
2 | ||
3 | var m P c e W R k d n l gy_obs gp_obs y dA; | |
4 | varexo e_a e_m; | |
5 | ||
6 | parameters alp bet gam mst rho psi del; | |
7 | ||
8 | alp = 0.33; | |
9 | bet = 0.99; | |
10 | gam = 0.003; | |
11 | mst = 1.011; | |
12 | rho = 0.7; | |
13 | psi = 0.787; | |
14 | del = 0.02; | |
15 | ||
16 | model; | |
17 | dA = exp(gam+e_a); | |
18 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
19 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
20 | W = l/n; | |
21 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
22 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
23 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
24 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
25 | P*c = m; | |
26 | m-1+d = l; | |
27 | e = exp(e_a); | |
28 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
29 | gy_obs = dA*y/y(-1); | |
30 | gp_obs = (P/P(-1))*m(-1)/dA; | |
31 | end; | |
32 | ||
33 | initval; | |
34 | k = 6; | |
35 | m = mst; | |
36 | P = 2.25; | |
37 | c = 0.45; | |
38 | e = 1; | |
39 | W = 4; | |
40 | R = 1.02; | |
41 | d = 0.85; | |
42 | n = 0.19; | |
43 | l = 0.86; | |
44 | y = 0.6; | |
45 | gy_obs = exp(gam); | |
46 | gp_obs = exp(-gam); | |
47 | dA = exp(gam); | |
48 | end; | |
49 | ||
50 | shocks; | |
51 | var e_a; stderr 0.014; | |
52 | var e_m; stderr 0.005; | |
53 | end; | |
54 | ||
55 | steady; | |
56 | ||
57 | check; | |
58 | ||
59 | estimated_params; | |
60 | alp, beta_pdf, 0.356, 0.02; | |
61 | bet, beta_pdf, 0.993, 0.002; | |
62 | gam, normal_pdf, 0.0085, 0.003; | |
63 | mst, normal_pdf, 1.0002, 0.007; | |
64 | rho, beta_pdf, 0.129, 0.223; | |
65 | psi, beta_pdf, 0.65, 0.05; | |
66 | del, beta_pdf, 0.01, 0.005; | |
67 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
68 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
69 | end; | |
70 | ||
71 | varobs gp_obs gy_obs; | |
72 | ||
73 | estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=0,mode_compute=0,kalman_algo=2); |
0 | // See fs2000.mod in the examples/ directory for details on the model | |
1 | // This version estimates the model in level rather than in growth rates | |
2 | ||
3 | var m P c e W R k d n l gy_obs gp_obs Y_obs P_obs y dA; | |
4 | varexo e_a e_m; | |
5 | ||
6 | parameters alp bet gam mst rho psi del; | |
7 | ||
8 | alp = 0.33; | |
9 | bet = 0.99; | |
10 | gam = 0.003; | |
11 | mst = 1.011; | |
12 | rho = 0.7; | |
13 | psi = 0.787; | |
14 | del = 0.02; | |
15 | ||
16 | model; | |
17 | dA = exp(gam+e_a); | |
18 | log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; | |
19 | -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; | |
20 | W = l/n; | |
21 | -(psi/(1-psi))*(c*P/(1-n))+l/n = 0; | |
22 | R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; | |
23 | 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; | |
24 | c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); | |
25 | P*c = m; | |
26 | m-1+d = l; | |
27 | e = exp(e_a); | |
28 | y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); | |
29 | gy_obs = dA*y/y(-1); | |
30 | gp_obs = (P/P(-1))*m(-1)/dA; | |
31 | Y_obs/Y_obs(-1) = gy_obs; | |
32 | P_obs/P_obs(-1) = gp_obs; | |
33 | end; | |
34 | ||
35 | initval; | |
36 | k = 6; | |
37 | m = mst; | |
38 | P = 2.25; | |
39 | c = 0.45; | |
40 | e = 1; | |
41 | W = 4; | |
42 | R = 1.02; | |
43 | d = 0.85; | |
44 | n = 0.19; | |
45 | l = 0.86; | |
46 | y = 0.6; | |
47 | gy_obs = exp(gam); | |
48 | gp_obs = exp(-gam); | |
49 | dA = exp(gam); | |
50 | end; | |
51 | ||
52 | shocks; | |
53 | var e_a; stderr 0.014; | |
54 | var e_m; stderr 0.005; | |
55 | end; | |
56 | ||
57 | estimated_params; | |
58 | alp, beta_pdf, 0.356, 0.02; | |
59 | bet, beta_pdf, 0.993, 0.002; | |
60 | gam, normal_pdf, 0.0085, 0.003; | |
61 | mst, normal_pdf, 1.0002, 0.007; | |
62 | rho, beta_pdf, 0.129, 0.223; | |
63 | psi, beta_pdf, 0.65, 0.05; | |
64 | del, beta_pdf, 0.01, 0.005; | |
65 | stderr e_a, inv_gamma_pdf, 0.035449, inf; | |
66 | stderr e_m, inv_gamma_pdf, 0.008862, inf; | |
67 | end; | |
68 | ||
69 | varobs P_obs Y_obs; | |
70 | ||
71 | observation_trends; | |
72 | P_obs (log(mst)-gam); | |
73 | Y_obs (gam); | |
74 | end; | |
75 | ||
76 | estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=0, | |
77 | mode_compute=0,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65,diffuse_filter,smoother) P_obs gp_obs gy_obs; | |
78 |
0 | % computes the steady state of fs2000 analyticaly | |
1 | % largely inspired by the program of F. Schorfheide | |
2 | function [ys,check] = fs2000a_steadystate(ys,exe) | |
3 | global M_ | |
4 | ||
5 | alp = M_.params(1); | |
6 | bet = M_.params(2); | |
7 | gam = M_.params(3); | |
8 | mst = M_.params(4); | |
9 | rho = M_.params(5); | |
10 | psi = M_.params(6); | |
11 | del = M_.params(7); | |
12 | ||
13 | check = 0; | |
14 | ||
15 | dA = exp(gam); | |
16 | gst = 1/dA; | |
17 | m = mst; | |
18 | ||
19 | khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1)); | |
20 | xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1); | |
21 | nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp ); | |
22 | n = xist/(nust+xist); | |
23 | P = xist + nust; | |
24 | k = khst*n; | |
25 | ||
26 | l = psi*mst*n/( (1-psi)*(1-n) ); | |
27 | c = mst/P; | |
28 | d = l - mst + 1; | |
29 | y = k^alp*n^(1-alp)*gst^alp; | |
30 | R = mst/bet; | |
31 | W = l/n; | |
32 | ist = y-c; | |
33 | q = 1 - d; | |
34 | ||
35 | e = 1; | |
36 | ||
37 | gp_obs = m/dA; | |
38 | gy_obs = dA; | |
39 | ||
40 | P_obs = 1; | |
41 | Y_obs = 1; | |
42 | ||
43 | ys =[ | |
44 | m | |
45 | P | |
46 | c | |
47 | e | |
48 | W | |
49 | R | |
50 | k | |
51 | d | |
52 | n | |
53 | l | |
54 | gy_obs | |
55 | gp_obs | |
56 | Y_obs | |
57 | P_obs | |
58 | y | |
59 | dA ];⏎ |
0 | gy_obs =[ | |
1 | 1.0030045 | |
2 | 0.99990934 | |
3 | 1.0172778 | |
4 | 0.99464043 | |
5 | 1.0253423 | |
6 | 1.0150215 | |
7 | 0.97772557 | |
8 | 0.97832186 | |
9 | 1.0159561 | |
10 | 1.0085937 | |
11 | 1.0102649 | |
12 | 1.0007604 | |
13 | 1.0112596 | |
14 | 1.0163279 | |
15 | 1.0173204 | |
16 | 1.0103896 | |
17 | 1.0006493 | |
18 | 0.99447124 | |
19 | 1.0196405 | |
20 | 1.0089304 | |
21 | 0.99650737 | |
22 | 1.0139707 | |
23 | 0.97865842 | |
24 | 1.0192225 | |
25 | 0.99139628 | |
26 | 1.0141362 | |
27 | 1.0196612 | |
28 | 0.97483476 | |
29 | 0.99686151 | |
30 | 0.99594464 | |
31 | 1.0000642 | |
32 | 1.0172243 | |
33 | 1.0025773 | |
34 | 0.97199728 | |
35 | 1.0217815 | |
36 | 1.0219949 | |
37 | 0.99490252 | |
38 | 1.0190728 | |
39 | 1.0111337 | |
40 | 1.0003792 | |
41 | 0.98969164 | |
42 | 1.010438 | |
43 | 1.0216309 | |
44 | 1.0016671 | |
45 | 1.0357588 | |
46 | 0.98803787 | |
47 | 1.0093457 | |
48 | 1.0177035 | |
49 | 0.98548204 | |
50 | 1.0274294 | |
51 | 1.0141377 | |
52 | 1.0091174 | |
53 | 0.96427632 | |
54 | 1.0083272 | |
55 | 1.0007882 | |
56 | 0.99038262 | |
57 | 1.0031336 | |
58 | 0.99500213 | |
59 | 0.98203716 | |
60 | 0.9889452 | |
61 | 1.011632 | |
62 | 0.99451949 | |
63 | 0.97291047 | |
64 | 0.98750871 | |
65 | 0.99992418 | |
66 | 0.97657318 | |
67 | 0.99930448 | |
68 | 1.0008515 | |
69 | 1.0044064 | |
70 | 0.98133792 | |
71 | 1.0091702 | |
72 | 1.0087023 | |
73 | 1.0119876 | |
74 | 1.0143019 | |
75 | 1.0311061 | |
76 | 0.99340471 | |
77 | 1.0057428 | |
78 | 0.99197259 | |
79 | 1.0071019 | |
80 | 0.99448853 | |
81 | 1.0061819 | |
82 | 1.0070088 | |
83 | 0.9950913 | |
84 | 1.0302318 | |
85 | 0.9817693 | |
86 | 1.0072885 | |
87 | 0.97355282 | |
88 | 0.98782586 | |
89 | 1.0136674 | |
90 | 0.99863956 | |
91 | 1.0205668 | |
92 | 0.99611384 | |
93 | 1.0073805 | |
94 | 0.99691529 | |
95 | 1.0089194 | |
96 | 1.0030467 | |
97 | 1.0112006 | |
98 | 1.0260523 | |
99 | 0.97803331 | |
100 | 0.99423374 | |
101 | 1.0043727 | |
102 | 1.0140173 | |
103 | 1.0111473 | |
104 | 0.99524348 | |
105 | 0.99775943 | |
106 | 0.9958619 | |
107 | 0.9982344 | |
108 | 1.0210212 | |
109 | 1.0022288 | |
110 | 1.0014801 | |
111 | 1.011456 | |
112 | 1.0124871 | |
113 | 0.99843599 | |
114 | 0.99324886 | |
115 | 0.99912838 | |
116 | 1.003327 | |
117 | 1.0072071 | |
118 | 1.0115223 | |
119 | 1.009266 | |
120 | 1.0070554 | |
121 | 1.0129916 | |
122 | 1.0053413 | |
123 | 1.0051638 | |
124 | 0.99212952 | |
125 | 1.0214422 | |
126 | 0.98716707 | |
127 | 0.99905788 | |
128 | 0.98877357 | |
129 | 0.98568476 | |
130 | 0.99767393 | |
131 | 1.0061791 | |
132 | 0.98423439 | |
133 | 0.99492949 | |
134 | 0.98786999 | |
135 | 0.99754239 | |
136 | 1.0168619 | |
137 | 0.99472384 | |
138 | 1.0041658 | |
139 | 0.98123181 | |
140 | 1.0112882 | |
141 | 0.99245422 | |
142 | 1.0010255 | |
143 | 1.0017799 | |
144 | 1.0089968 | |
145 | 1.0072824 | |
146 | 0.99768475 | |
147 | 1.0044726 | |
148 | 1.0118678 | |
149 | 1.0056385 | |
150 | 1.0276965 | |
151 | 1.0025122 | |
152 | 1.0065161 | |
153 | 1.0234338 | |
154 | 0.99760167 | |
155 | 0.98922272 | |
156 | 1.0101918 | |
157 | 1.011615 | |
158 | 1.0085286 | |
159 | 1.0074455 | |
160 | 0.98866757 | |
161 | 0.99959012 | |
162 | 1.0129881 | |
163 | 0.99127881 | |
164 | 0.97971901 | |
165 | 1.0185314 | |
166 | 1.020054 | |
167 | 1.0132605 | |
168 | 0.98063643 | |
169 | 0.99490253 | |
170 | 1.0101531 | |
171 | 1.0004526 | |
172 | 1.0059109 | |
173 | 0.98974491 | |
174 | 1.0062391 | |
175 | 1.0216488 | |
176 | 0.99398446 | |
177 | 0.97786609 | |
178 | 1.0019274 | |
179 | 0.99587153 | |
180 | 1.0095881 | |
181 | 1.0111887 | |
182 | 0.99457649 | |
183 | 0.97896734 | |
184 | 1.000172 | |
185 | 1.0142951 | |
186 | 1.0034224 | |
187 | 1.0037242 | |
188 | 1.0016059 | |
189 | 1.016556 | |
190 | 0.99687023 | |
191 | 1.0117844 | |
192 | 1.0059212 | |
193 | 0.98083159 | |
194 | 0.98638851 | |
195 | 1.0128713 | |
196 | 1.0096232 | |
197 | 1.0115891 | |
198 | 1.0011213 | |
199 | 1.0147105 | |
200 | 1.0066344 | |
201 | 1.0164429 | |
202 | 0.99825038 | |
203 | 0.99403411 | |
204 | ||
205 | ]; | |
206 | ||
207 | gp_obs =[ | |
208 | 1.0079715 | |
209 | 1.0074573 | |
210 | 1.0153107 | |
211 | 1.0152677 | |
212 | 1.0011653 | |
213 | 0.99950061 | |
214 | 1.0328311 | |
215 | 1.0192317 | |
216 | 1.009827 | |
217 | 0.99588916 | |
218 | 1.007474 | |
219 | 1.0113061 | |
220 | 0.98696624 | |
221 | 0.99978663 | |
222 | 0.98240542 | |
223 | 0.98861723 | |
224 | 0.99008763 | |
225 | 1.0185076 | |
226 | 1.0052452 | |
227 | 0.99447194 | |
228 | 1.0092685 | |
229 | 1.01208 | |
230 | 1.0105237 | |
231 | 0.98513875 | |
232 | 1.0165628 | |
233 | 0.99485934 | |
234 | 1.0050255 | |
235 | 1.0140756 | |
236 | 1.0093128 | |
237 | 1.0155868 | |
238 | 1.0107023 | |
239 | 0.99212762 | |
240 | 1.0095465 | |
241 | 1.0028435 | |
242 | 1.0069437 | |
243 | 1.0070473 | |
244 | 1.0145902 | |
245 | 1.0186922 | |
246 | 1.0059917 | |
247 | 1.0113072 | |
248 | 1.0107386 | |
249 | 0.99769196 | |
250 | 0.99793444 | |
251 | 1.0050791 | |
252 | 0.98307821 | |
253 | 1.0107594 | |
254 | 0.99689982 | |
255 | 0.98667064 | |
256 | 0.9991662 | |
257 | 0.98274722 | |
258 | 0.98422032 | |
259 | 0.99393016 | |
260 | 1.0118567 | |
261 | 0.99912781 | |
262 | 1.0023744 | |
263 | 1.0086662 | |
264 | 1.0164773 | |
265 | 1.0169327 | |
266 | 1.0372478 | |
267 | 1.0314242 | |
268 | 1.0004256 | |
269 | 1.0110541 | |
270 | 1.0076575 | |
271 | 1.0119851 | |
272 | 1.0055188 | |
273 | 1.0213959 | |
274 | 1.0234416 | |
275 | 1.0264917 | |
276 | 1.0292725 | |
277 | 1.0385184 | |
278 | 1.0200999 | |
279 | 1.0107697 | |
280 | 1.008583 | |
281 | 1.0200332 | |
282 | 1.0030413 | |
283 | 1.0108659 | |
284 | 1.0185145 | |
285 | 1.0168619 | |
286 | 1.0180462 | |
287 | 1.0239657 | |
288 | 1.0205509 | |
289 | 1.0189973 | |
290 | 1.0246446 | |
291 | 1.0135089 | |
292 | 1.0352973 | |
293 | 1.0099289 | |
294 | 1.0266474 | |
295 | 1.0279829 | |
296 | 1.0101653 | |
297 | 1.041216 | |
298 | 1.0103861 | |
299 | 1.0114727 | |
300 | 1.0054605 | |
301 | 1.0190722 | |
302 | 1.0114837 | |
303 | 1.0179213 | |
304 | 1.006082 | |
305 | 1.0049696 | |
306 | 1.0143629 | |
307 | 0.9971036 | |
308 | 1.0005602 | |
309 | 1.0078403 | |
310 | 1.0240222 | |
311 | 1.0195063 | |
312 | 1.0355136 | |
313 | 1.0218743 | |
314 | 1.0171331 | |
315 | 1.0049817 | |
316 | 1.0140974 | |
317 | 1.0168431 | |
318 | 1.0049966 | |
319 | 1.0045568 | |
320 | 1.0156414 | |
321 | 1.0273055 | |
322 | 1.0197653 | |
323 | 1.0030624 | |
324 | 1.0154993 | |
325 | 0.99782084 | |
326 | 0.99711648 | |
327 | 1.014408 | |
328 | 1.0057417 | |
329 | 0.99936837 | |
330 | 1.0096934 | |
331 | 1.0095138 | |
332 | 1.0057734 | |
333 | 1.0114497 | |
334 | 1.0059784 | |
335 | 1.0328889 | |
336 | 1.0098032 | |
337 | 1.0041114 | |
338 | 1.0101247 | |
339 | 1.0181588 | |
340 | 1.0115712 | |
341 | 1.0227509 | |
342 | 1.0065104 | |
343 | 1.0110902 | |
344 | 1.0298169 | |
345 | 1.0089532 | |
346 | 1.0368733 | |
347 | 1.0123033 | |
348 | 1.0060763 | |
349 | 1.0150937 | |
350 | 1.0239325 | |
351 | 0.99555536 | |
352 | 0.99861271 | |
353 | 1.0076201 | |
354 | 0.99941535 | |
355 | 1.0119522 | |
356 | 1.0129183 | |
357 | 0.99288924 | |
358 | 1.0260784 | |
359 | 1.0144982 | |
360 | 1.0121985 | |
361 | 1.0234916 | |
362 | 1.02215 | |
363 | 1.0190118 | |
364 | 1.0172679 | |
365 | 1.0118398 | |
366 | 1.0002123 | |
367 | 1.0092124 | |
368 | 1.0071943 | |
369 | 0.99508468 | |
370 | 1.0019303 | |
371 | 1.0030733 | |
372 | 0.9964198 | |
373 | 1.0027298 | |
374 | 0.99797614 | |
375 | 1.006942 | |
376 | 0.99793928 | |
377 | 1.0083214 | |
378 | 1.0283732 | |
379 | 1.0111102 | |
380 | 1.016936 | |
381 | 1.0229061 | |
382 | 0.98846454 | |
383 | 1.0015387 | |
384 | 1.0201769 | |
385 | 1.0079822 | |
386 | 1.0064007 | |
387 | 1.0095543 | |
388 | 1.0092207 | |
389 | 1.0135485 | |
390 | 1.0198974 | |
391 | 1.0140252 | |
392 | 1.0128686 | |
393 | 1.0092903 | |
394 | 1.0141974 | |
395 | 1.0023492 | |
396 | 0.99731455 | |
397 | 1.0026598 | |
398 | 0.99303643 | |
399 | 1.0036469 | |
400 | 1.0160975 | |
401 | 1.0368378 | |
402 | 1.0139625 | |
403 | 1.01493 | |
404 | 1.0113531 | |
405 | 1.0114548 | |
406 | 0.99833441 | |
407 | 0.99648401 | |
408 | 0.97645361 | |
409 | 1.0154053 | |
410 | 1.01703 | |
411 | ||
412 | ]; | |
413 | ||
414 | Y_obs =[ | |
415 | 1 | |
416 | 0.99690484 | |
417 | 1.0111781 | |
418 | 1.0028141 | |
419 | 1.0251518 | |
420 | 1.0371688 | |
421 | 1.0118899 | |
422 | 0.98720726 | |
423 | 1.0001589 | |
424 | 1.0057481 | |
425 | 1.0130085 | |
426 | 1.0107643 | |
427 | 1.0190194 | |
428 | 1.0323428 | |
429 | 1.0466587 | |
430 | 1.0540438 | |
431 | 1.0516886 | |
432 | 1.0431553 | |
433 | 1.0597913 | |
434 | 1.0657172 | |
435 | 1.0592201 | |
436 | 1.0701863 | |
437 | 1.0458402 | |
438 | 1.0620582 | |
439 | 1.0504499 | |
440 | 1.0615817 | |
441 | 1.0782384 | |
442 | 1.0500687 | |
443 | 1.0439257 | |
444 | 1.0368658 | |
445 | 1.0339255 | |
446 | 1.0481453 | |
447 | 1.0477181 | |
448 | 1.0167109 | |
449 | 1.0354878 | |
450 | 1.0544782 | |
451 | 1.0463762 | |
452 | 1.0624445 | |
453 | 1.0705737 | |
454 | 1.0679484 | |
455 | 1.0546356 | |
456 | 1.0620691 | |
457 | 1.0806955 | |
458 | 1.0793581 | |
459 | 1.1121124 | |
460 | 1.0971458 | |
461 | 1.1034869 | |
462 | 1.1181859 | |
463 | 1.1006634 | |
464 | 1.1250883 | |
465 | 1.1362214 | |
466 | 1.1423343 | |
467 | 1.1036061 | |
468 | 1.1089288 | |
469 | 1.1067125 | |
470 | 1.0940906 | |
471 | 1.0942197 | |
472 | 1.0862174 | |
473 | 1.06525 | |
474 | 1.0511907 | |
475 | 1.0598182 | |
476 | 1.0513331 | |
477 | 1.0212391 | |
478 | 1.0057433 | |
479 | 1.002663 | |
480 | 0.97623167 | |
481 | 0.97253165 | |
482 | 0.97037865 | |
483 | 0.97178055 | |
484 | 0.95011397 | |
485 | 0.95627969 | |
486 | 0.96197747 | |
487 | 0.97096053 | |
488 | 0.98225794 | |
489 | 1.0103595 | |
490 | 1.0007597 | |
491 | 1.003498 | |
492 | 0.99246608 | |
493 | 0.99656347 | |
494 | 0.98804749 | |
495 | 0.99122491 | |
496 | 0.99522926 | |
497 | 0.98731605 | |
498 | 1.0145434 | |
499 | 0.99330816 | |
500 | 0.99759216 | |
501 | 0.96814048 | |
502 | 0.95296183 | |
503 | 0.96362471 | |
504 | 0.95925977 | |
505 | 0.97682205 | |
506 | 0.96993138 | |
507 | 0.9743074 | |
508 | 0.96821818 | |
509 | 0.97413308 | |
510 | 0.9741753 | |
511 | 0.98237142 | |
512 | 1.0054193 | |
513 | 0.98044807 | |
514 | 0.9716773 | |
515 | 0.9730455 | |
516 | 0.98405828 | |
517 | 0.99220103 | |
518 | 0.98444001 | |
519 | 0.97919493 | |
520 | 0.97205233 | |
521 | 0.96728223 | |
522 | 0.98529893 | |
523 | 0.98452324 | |
524 | 0.98299888 | |
525 | 0.99145042 | |
526 | 1.000933 | |
527 | 0.99636447 | |
528 | 0.98660883 | |
529 | 0.98273271 | |
530 | 0.98305518 | |
531 | 0.98725774 | |
532 | 0.99577549 | |
533 | 1.002037 | |
534 | 1.0060879 | |
535 | 1.016075 | |
536 | 1.0184118 | |
537 | 1.0205711 | |
538 | 1.0096961 | |
539 | 1.0281337 | |
540 | 1.0122963 | |
541 | 1.0083497 | |
542 | 0.99411874 | |
543 | 0.976799 | |
544 | 0.97146842 | |
545 | 0.97464304 | |
546 | 0.95587292 | |
547 | 0.94779791 | |
548 | 0.93266339 | |
549 | 0.92720128 | |
550 | 0.94105864 | |
551 | 0.93277798 | |
552 | 0.93393927 | |
553 | 0.91216657 | |
554 | 0.92045028 | |
555 | 0.9099 | |
556 | 0.90792098 | |
557 | 0.90669634 | |
558 | 0.91268867 | |
559 | 0.91696661 | |
560 | 0.91164685 | |
561 | 0.91311495 | |
562 | 0.92197825 | |
563 | 0.92461222 | |
564 | 0.94930422 | |
565 | 0.9488119 | |
566 | 0.95232353 | |
567 | 0.97275278 | |
568 | 0.96734995 | |
569 | 0.95356817 | |
570 | 0.96075548 | |
571 | 0.96936594 | |
572 | 0.97489002 | |
573 | 0.97933106 | |
574 | 0.96499412 | |
575 | 0.96157973 | |
576 | 0.97156334 | |
577 | 0.95983765 | |
578 | 0.93655215 | |
579 | 0.95207909 | |
580 | 0.96912862 | |
581 | 0.97938462 | |
582 | 0.95701655 | |
583 | 0.94891457 | |
584 | 0.95606317 | |
585 | 0.95351125 | |
586 | 0.95641767 | |
587 | 0.94315807 | |
588 | 0.94639265 | |
589 | 0.96503697 | |
590 | 0.95601693 | |
591 | 0.93087851 | |
592 | 0.92980141 | |
593 | 0.92266844 | |
594 | 0.92925206 | |
595 | 0.93743628 | |
596 | 0.92900826 | |
597 | 0.9049711 | |
598 | 0.90213859 | |
599 | 0.91342916 | |
600 | 0.91384707 | |
601 | 0.91456681 | |
602 | 0.91316822 | |
603 | 0.92671976 | |
604 | 0.92058549 | |
605 | 0.92936541 | |
606 | 0.93228212 | |
607 | 0.91010921 | |
608 | 0.89349322 | |
609 | 0.90336005 | |
610 | 0.90997873 | |
611 | 0.91856328 | |
612 | 0.91668007 | |
613 | 0.92838606 | |
614 | 0.932016 | |
615 | 0.94545438 | |
616 | 0.94070026 | |
617 | 0.93172987 | |
618 | ||
619 | ]; | |
620 | ||
621 | P_obs =[ | |
622 | 1 | |
623 | 0.99948573 | |
624 | 1.0068249 | |
625 | 1.0141211 | |
626 | 1.0073149 | |
627 | 0.99884398 | |
628 | 1.0237035 | |
629 | 1.0349636 | |
630 | 1.036819 | |
631 | 1.0247366 | |
632 | 1.0242391 | |
633 | 1.0275737 | |
634 | 1.0065684 | |
635 | 0.99838346 | |
636 | 0.97281734 | |
637 | 0.95346302 | |
638 | 0.9355791 | |
639 | 0.9461152 | |
640 | 0.94338882 | |
641 | 0.92988921 | |
642 | 0.9311862 | |
643 | 0.93529467 | |
644 | 0.93784681 | |
645 | 0.91501401 | |
646 | 0.92360522 | |
647 | 0.91049302 | |
648 | 0.90754698 | |
649 | 0.91365103 | |
650 | 0.91499228 | |
651 | 0.92260749 | |
652 | 0.92533824 | |
653 | 0.90949431 | |
654 | 0.91106924 | |
655 | 0.90594116 | |
656 | 0.90491334 | |
657 | 0.9039891 | |
658 | 0.91060772 | |
659 | 0.92132842 | |
660 | 0.91934854 | |
661 | 0.92268418 | |
662 | 0.92545127 | |
663 | 0.91517169 | |
664 | 0.90513459 | |
665 | 0.90224212 | |
666 | 0.87734878 | |
667 | 0.88013667 | |
668 | 0.86906494 | |
669 | 0.84776403 | |
670 | 0.83895869 | |
671 | 0.81373437 | |
672 | 0.78998314 | |
673 | 0.77594176 | |
674 | 0.77982695 | |
675 | 0.77098321 | |
676 | 0.76538611 | |
677 | 0.76608075 | |
678 | 0.77458654 | |
679 | 0.78354767 | |
680 | 0.81282389 | |
681 | 0.83627649 | |
682 | 0.82873051 | |
683 | 0.83181309 | |
684 | 0.83149903 | |
685 | 0.83551261 | |
686 | 0.83305985 | |
687 | 0.84648418 | |
688 | 0.86195421 | |
689 | 0.88047436 | |
690 | 0.90177533 | |
691 | 0.93232215 | |
692 | 0.94445051 | |
693 | 0.9472487 | |
694 | 0.94786015 | |
695 | 0.95992178 | |
696 | 0.95499149 | |
697 | 0.95788581 | |
698 | 0.9684288 | |
699 | 0.97731917 | |
700 | 0.98739379 | |
701 | 1.0033879 | |
702 | 1.0159673 | |
703 | 1.0269931 | |
704 | 1.0436661 | |
705 | 1.0492034 | |
706 | 1.0765292 | |
707 | 1.0784865 | |
708 | 1.0971624 | |
709 | 1.1171737 | |
710 | 1.1193675 | |
711 | 1.1526119 | |
712 | 1.1550265 | |
713 | 1.1585277 | |
714 | 1.1560166 | |
715 | 1.1671172 | |
716 | 1.1706294 | |
717 | 1.1805791 | |
718 | 1.1786896 | |
719 | 1.1756876 | |
720 | 1.1820789 | |
721 | 1.171211 | |
722 | 1.1637997 | |
723 | 1.1636684 | |
724 | 1.179719 | |
725 | 1.1912538 | |
726 | 1.2187959 | |
727 | 1.2326986 | |
728 | 1.2418602 | |
729 | 1.2388704 | |
730 | 1.2449963 | |
731 | 1.2538678 | |
732 | 1.2508929 | |
733 | 1.2474781 | |
734 | 1.255148 | |
735 | 1.274482 | |
736 | 1.2862757 | |
737 | 1.2813665 | |
738 | 1.2888943 | |
739 | 1.2787436 | |
740 | 1.2678886 | |
741 | 1.274325 | |
742 | 1.2720952 | |
743 | 1.263492 | |
744 | 1.2652139 | |
745 | 1.2667561 | |
746 | 1.264558 | |
747 | 1.2680362 | |
748 | 1.2660431 | |
749 | 1.2909605 | |
750 | 1.2927921 | |
751 | 1.288932 | |
752 | 1.2910852 | |
753 | 1.3012725 | |
754 | 1.3048721 | |
755 | 1.3196515 | |
756 | 1.3181903 | |
757 | 1.321309 | |
758 | 1.3431543 | |
759 | 1.344136 | |
760 | 1.3730377 | |
761 | 1.3773695 | |
762 | 1.3754742 | |
763 | 1.3825964 | |
764 | 1.3985574 | |
765 | 1.3861412 | |
766 | 1.3767823 | |
767 | 1.3764309 | |
768 | 1.3678747 | |
769 | 1.3718554 | |
770 | 1.3768022 | |
771 | 1.3617199 | |
772 | 1.3798267 | |
773 | 1.3863533 | |
774 | 1.3905803 | |
775 | 1.4061004 | |
776 | 1.4202788 | |
777 | 1.4313191 | |
778 | 1.4406155 | |
779 | 1.4444837 | |
780 | 1.4367244 | |
781 | 1.4379653 | |
782 | 1.4371881 | |
783 | 1.4243012 | |
784 | 1.41826 | |
785 | 1.4133617 | |
786 | 1.40181 | |
787 | 1.3965683 | |
788 | 1.3865729 | |
789 | 1.3855433 | |
790 | 1.3755111 | |
791 | 1.3758609 | |
792 | 1.3962625 | |
793 | 1.3994012 | |
794 | 1.4083656 | |
795 | 1.4233002 | |
796 | 1.4037932 | |
797 | 1.3973604 | |
798 | 1.4095657 | |
799 | 1.4095764 | |
800 | 1.4080055 | |
801 | 1.4095882 | |
802 | 1.4108374 | |
803 | 1.4164143 | |
804 | 1.4283402 | |
805 | 1.4343939 | |
806 | 1.4392909 | |
807 | 1.4406097 | |
808 | 1.4468355 | |
809 | 1.4412132 | |
810 | 1.4305562 | |
811 | 1.4252445 | |
812 | 1.4103094 | |
813 | 1.4059847 | |
814 | 1.4141106 | |
815 | 1.4429769 | |
816 | 1.4489679 | |
817 | 1.4559263 | |
818 | 1.4593079 | |
819 | 1.4627911 | |
820 | 1.453154 | |
821 | 1.4416665 | |
822 | 1.4101485 | |
823 | 1.4175823 | |
824 | 1.4266407 | |
825 | ||
826 | ]; | |
827 |
0 | var w x y z dw dx dy; | |
1 | varexo e_w e_x e_y e_z; | |
2 | ||
3 | parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c; | |
4 | ||
5 | rho_w = 0.5; | |
6 | rho_x = 0.5; | |
7 | rho_y = 0.5; | |
8 | rho_z = 0.8; | |
9 | ||
10 | a1 = 0.1; | |
11 | a2 = -0.1; | |
12 | a3 = 0.1; | |
13 | b = 1; | |
14 | c = 1; | |
15 | ||
16 | model(linear); | |
17 | dw = rho_w*dw(-1)+a1*(x(-1)-b*y(-1)-c*w(-1))+e_w; | |
18 | dx = rho_x*dx(-1)+a2*(x(-1)-b*y(-1)-c*w(-1))+e_x; | |
19 | dy = rho_y*dy(-1)+a3*(x(-1)-b*y(-1))+e_y; | |
20 | z = rho_z*z(-1)+dw-dx+e_z; | |
21 | w = w(-1)+dw; | |
22 | x = x(-1)+dx; | |
23 | y = y(-1)+dy; | |
24 | end; | |
25 | ||
26 | shocks; | |
27 | var e_w; stderr 0.05; | |
28 | var e_x; stderr 0.05; | |
29 | var e_y; stderr 0.05; | |
30 | var e_z; stderr 0.05; | |
31 | end; | |
32 | ||
33 | stoch_simul(periods=2000,irf=0); | |
34 | ||
35 | plot([w x y z]); | |
36 | ||
37 | save data.mat w x y z dw dx dy;⏎ |
0 | data = [0.928467646476 11.8716889412 20 0.418037507392 0.227382377518 ... | |
1 | -0.705994063083 11.7522582094 21.25 1.09254424511 -1.29488274994 ... | |
2 | -0.511895351926 9.68144025625 17.25 -1.66150408407 0.331508393098 ... | |
3 | -0.990955971267 10.0890781236 17 1.43016275252 -2.43589670141 ... | |
4 | -0.981233061806 12.1094840679 18.25 2.91293288733 -0.790246576864 ... | |
5 | -0.882182844512 8.54559460406 15 0.419579139481 0.358729719566 ... | |
6 | -0.930893002836 6.19238374422 12.5 -1.48847457959 0.739779938797 ... | |
7 | 1.53158206947 2.76544271886 11.5 -0.336216769682 0.455559918769 ... | |
8 | 2.2659052834 5.47418162513 11 0.306436789767 -0.0707985731221 ... | |
9 | 1.05419803797 6.35698426189 11 0.140700250477 0.620401487202 ... | |
10 | 1.20161076793 3.4253301593 11 0.461296492351 0.14354323987 ... | |
11 | 1.73934077971 4.70926070322 11.5 1.35798282982 0.38564694435 ... | |
12 | 1.71735262584 3.54232079749 12.5 2.9097529155 -0.804308583301 ... | |
13 | 0.426343657844 3.32719108897 13 1.64214862652 -1.18214664701 ... | |
14 | 1.67751812324 2.93444727338 11.25 0.344434910651 -1.6529373719 ... | |
15 | 1.37013301099 4.72303361923 11.75 2.61511526582 0.327684243041 ... | |
16 | 0.281231073781 4.4893853071 10.5 1.17043449257 1.12855106649 ... | |
17 | 1.53638992834 3.7325309699 10.25 -0.683947046728 0.11943538737 ... | |
18 | 1.68081431462 3.34729969129 10 1.41159342106 -1.59065680853 ... | |
19 | -0.343321601133 5.05563513564 12 1.75117366498 -2.40127764642 ... | |
20 | 0.873415608666 3.2779996255 10.25 -1.39895866711 0.0971444398216 ... | |
21 | 0.26399696544 4.78229419828 9.75 0.0914692438124 0.299310457612 ... | |
22 | -0.562233624818 3.88598638237 9.75 -0.0505384765105 0.332826708151 ... | |
23 | 2.15161914936 3.84859710132 8.75 -3.44811080489 0.789138678784 ... | |
24 | 1.2345093726 5.62225030942 9.5 -0.366945407434 2.32974981198 ... | |
25 | 1.62554967459 4.24667132831 10 -0.800958371402 0.0293183770935 ... | |
26 | 1.33035402527 2.75248979249 9.75 -0.855723113225 0.852493939813 ... | |
27 | 1.52078814077 3.53415985826 9.75 -3.37963469203 -1.05133958119 ... | |
28 | 1.16704983697 4.92754079464 10.75 -3.0142303324 0.459907431978 ... | |
29 | 0.277213572101 4.55532133037 11.75 -0.851995599415 2.03242034852 ... | |
30 | 0.842215068977 3.11164509647 12.25 -1.08290421696 0.014323281961 ... | |
31 | 1.05325028606 4.92882647578 13.5 -1.1953883867 0.706764750654 ... | |
32 | 0.453051253568 6.82998950103 13.5 0.111803656462 0.088462593153 ... | |
33 | 0.199885995525 5.82643354662 13.5 -0.920501518421 -0.26504958666 ... | |
34 | 0.137907999624 2.66076369132 13.5 -1.17122929812 -0.995642430514 ... | |
35 | 0.721949686709 5.70497876823 14.25 1.19378169018 -1.10644839651 ... | |
36 | -0.418465249225 3.75861110232 14.75 -1.03131674824 0.188507675831 ... | |
37 | -0.644028342116 4.15104788154 13.75 -1.48911756546 0.204560913792 ... | |
38 | -0.848213852668 5.65580324027 12.75 0.677011703877 -0.849628054542 ... | |
39 | -1.51954076928 11.4866911266 11.25 -0.446024680774 -0.456342350765 ... | |
40 | 0.265275055215 2.85472749592 9.75 -0.598778202436 -0.907311640831 ... | |
41 | 0.356162529063 2.29614015658 9.5 -0.46820788432 -1.22130883441 ... | |
42 | 0.368308864363 -0.539083504685 8 -0.781333991956 0.374007246518 ... | |
43 | -0.145751412732 1.61507621789 8.25 3.68291932628 1.32438399845 ... | |
44 | 0.285457283664 2.14334055993 7 1.42819405379 -0.00818660844123 ... | |
45 | 0.372390129412 1.60000213334 6.25 0.626106424052 -0.10136772765 ... | |
46 | 0.382720203063 1.72614243263 7.25 4.89631941021 -1.10060711916 ... | |
47 | 0.737957515573 2.90430582851 6 -0.0422721010314 0.4178952497 ... | |
48 | 0.649532581668 0.657135682543 6 0.692066153971 0.422299120276 ... | |
49 | 0.627159201987 1.70352689913 5.75 2.62066711305 -1.29237304034 ... | |
50 | 0.905441299817 1.95663197267 5.5 1.5949697565 -0.27115830703 ... | |
51 | 1.49322577898 -2.08741765309 6.25 1.23027694802 0.418336889527 ... | |
52 | 1.48750731567 -1.57274121871 8 3.01660550994 -0.893958254365 ... | |
53 | 1.39783858087 2.22623066426 7 -0.80842319214 1.47625453886 ... | |
54 | 0.89274836317 1.30378081742 8 -0.249485058661 0.159871204185 ... | |
55 | 0.920652246088 4.1437741965 9.75 2.8204453623 0.178149239655 ... | |
56 | -0.00264276644799 3.07989972052 8.75 -2.56342461535 2.105998353 ... | |
57 | 0.0198190461681 0.766283759256 8 -1.15838865989 1.56888883418 ... | |
58 | 0.440050515311 0.127570085801 7.5 0.0400753569995 0.028914333532 ... | |
59 | 0.129536637901 1.78174141526 6.75 0.959943962785 0.307781224401 ... | |
60 | 0.398549827172 3.03606770667 6.5 -0.340209794742 0.100979469478 ... | |
61 | 1.17174775425 0.629625188037 5.75 0.403003686814 0.902394579377 ... | |
62 | 0.991163981251 2.50862910684 4.75 -1.44963996982 1.16150986945 ... | |
63 | 0.967603566096 2.12003739013 4.75 0.610846030775 -0.889994896068 ... | |
64 | 1.14689383604 1.24185011459 4.75 2.01098091308 -1.73846431001 ... | |
65 | 1.32593824054 0.990713820685 4.75 -0.0955142989332 -0.0369257308362 ... | |
66 | 0.861135002644 -0.24744943605 6 1.72793107135 -0.691506789639 ... | |
67 | 1.26870850151 2.09844764887 6.5 1.50720217572 -1.31399187077 ... | |
68 | 0.260364987715 1.10650139716 6.5 1.13659047496 0.0720441664643 ... | |
69 | 1.09731242214 0.490796381346 7.25 4.59123894147 -2.14073070763 ... | |
70 | 1.63792841781 0.612652594286 6.75 1.79604605035 -0.644363995357 ... | |
71 | 1.48465576034 0.978295808687 6.75 -2.00753620902 1.39437534964 ... | |
72 | 1.0987608663 4.25212569087 6.25 -2.58901196498 2.56054320803 ... | |
73 | 1.42592178132 2.76984518311 6.25 0.888195752358 1.03114549274 ... | |
74 | 1.52958239462 1.31795955491 6.5 -0.902907564082 -0.0952198893776 ... | |
75 | 1.0170168994 2.14733589918 7 -1.3054866978 2.68803738466 ... | |
76 | 0.723253652257 3.43552889347 7.5 1.8213700853 0.592593586195 ... | |
77 | 1.24720806008 3.87383806577 7.5 0.0522300654168 0.988871238698 ... | |
78 | 0.482531471239 2.67793287032 7.5 2.9693944293 -0.108591166081 ... | |
79 | 0.154056100439 0.927269031704 6.75 0.119222057561 3.30489209451 ... | |
80 | 0.0694865769274 6.65916526788 6.25 0.889014476084 -2.83976849035 ... | |
81 | -0.121267434867 0.341442615696 5.25 0.323053239216 -3.49289229012 ... | |
82 | 0.726473690375 -3.5423730964 4 2.19149290449 -3.20855054004 ... | |
83 | 1.39271709108 2.63121085718 3.75 0.88406577736 0.75622580197 ... | |
84 | 1.07502077727 5.88578836799 4.25 -2.55088273352 2.89018116374 ... | |
85 | 0.759049251607 4.24703604223 4.5 0.575687665685 -0.388292506167 ... | |
86 | ]; | |
87 | ||
88 | data = reshape(data,5,86)'; | |
89 | y_obs = data(:,1); | |
90 | pie_obs = data(:,2); | |
91 | R_obs = data(:,3); | |
92 | de = data(:,4); | |
93 | dq = data(:,5); | |
94 | ||
95 | %Country: Canada | |
96 | %Sample Range: 1981:2 to 2002:3 | |
97 | %Observations: 86 | |
98 | %Variables: Real GDP Growth [%], Inflation [annualized %], Nom Rate [%], | |
99 | % Exchange Rate Change [%], Terms of Trade Change [%] |
0 | data = [0.928467646476 11.8716889412 20 0.418037507392 0.227382377518 ... | |
1 | -0.705994063083 11.7522582094 21.25 1.09254424511 -1.29488274994 ... | |
2 | -0.511895351926 9.68144025625 17.25 -1.66150408407 0.331508393098 ... | |
3 | -0.990955971267 10.0890781236 17 1.43016275252 -2.43589670141 ... | |
4 | -0.981233061806 12.1094840679 18.25 2.91293288733 -0.790246576864 ... | |
5 | -0.882182844512 8.54559460406 15 0.419579139481 0.358729719566 ... | |
6 | -0.930893002836 6.19238374422 12.5 -1.48847457959 0.739779938797 ... | |
7 | 1.53158206947 2.76544271886 11.5 -0.336216769682 0.455559918769 ... | |
8 | 2.2659052834 5.47418162513 11 0.306436789767 -0.0707985731221 ... | |
9 | 1.05419803797 6.35698426189 11 0.140700250477 0.620401487202 ... | |
10 | 1.20161076793 3.4253301593 11 0.461296492351 0.14354323987 ... | |
11 | 1.73934077971 4.70926070322 11.5 1.35798282982 0.38564694435 ... | |
12 | 1.71735262584 3.54232079749 12.5 2.9097529155 -0.804308583301 ... | |
13 | 0.426343657844 3.32719108897 13 1.64214862652 -1.18214664701 ... | |
14 | 1.67751812324 2.93444727338 11.25 0.344434910651 -1.6529373719 ... | |
15 | 1.37013301099 4.72303361923 11.75 2.61511526582 0.327684243041 ... | |
16 | 0.281231073781 4.4893853071 10.5 1.17043449257 1.12855106649 ... | |
17 | 1.53638992834 3.7325309699 10.25 -0.683947046728 0.11943538737 ... | |
18 | 1.68081431462 3.34729969129 10 1.41159342106 -1.59065680853 ... | |
19 | -0.343321601133 5.05563513564 12 1.75117366498 -2.40127764642 ... | |
20 | 0.873415608666 3.2779996255 10.25 -1.39895866711 0.0971444398216 ... | |
21 | 0.26399696544 4.78229419828 9.75 0.0914692438124 0.299310457612 ... | |
22 | -0.562233624818 3.88598638237 9.75 -0.0505384765105 0.332826708151 ... | |
23 | 2.15161914936 3.84859710132 8.75 -3.44811080489 0.789138678784 ... | |
24 | 1.2345093726 5.62225030942 9.5 -0.366945407434 2.32974981198 ... | |
25 | 1.62554967459 4.24667132831 10 -0.800958371402 0.0293183770935 ... | |
26 | 1.33035402527 2.75248979249 9.75 -0.855723113225 0.852493939813 ... | |
27 | 1.52078814077 3.53415985826 9.75 -3.37963469203 -1.05133958119 ... | |
28 | 1.16704983697 4.92754079464 10.75 -3.0142303324 0.459907431978 ... | |
29 | 0.277213572101 4.55532133037 11.75 -0.851995599415 2.03242034852 ... | |
30 | 0.842215068977 3.11164509647 12.25 -1.08290421696 0.014323281961 ... | |
31 | 1.05325028606 4.92882647578 13.5 -1.1953883867 0.706764750654 ... | |
32 | 0.453051253568 6.82998950103 13.5 0.111803656462 0.088462593153 ... | |
33 | 0.199885995525 5.82643354662 13.5 -0.920501518421 -0.26504958666 ... | |
34 | 0.137907999624 2.66076369132 13.5 -1.17122929812 -0.995642430514 ... | |
35 | 0.721949686709 5.70497876823 14.25 1.19378169018 -1.10644839651 ... | |
36 | -0.418465249225 3.75861110232 14.75 -1.03131674824 0.188507675831 ... | |
37 | -0.644028342116 4.15104788154 13.75 -1.48911756546 0.204560913792 ... | |
38 | -0.848213852668 5.65580324027 12.75 0.677011703877 -0.849628054542 ... | |
39 | -1.51954076928 11.4866911266 11.25 -0.446024680774 -0.456342350765 ... | |
40 | 0.265275055215 2.85472749592 9.75 -0.598778202436 -0.907311640831 ... | |
41 | 0.356162529063 2.29614015658 9.5 -0.46820788432 -1.22130883441 ... | |
42 | 0.368308864363 -0.539083504685 8 -0.781333991956 0.374007246518 ... | |
43 | -0.145751412732 1.61507621789 8.25 3.68291932628 1.32438399845 ... | |
44 | 0.285457283664 2.14334055993 7 1.42819405379 -0.00818660844123 ... | |
45 | 0.372390129412 1.60000213334 6.25 0.626106424052 -0.10136772765 ... | |
46 | 0.382720203063 1.72614243263 7.25 4.89631941021 -1.10060711916 ... | |
47 | 0.737957515573 2.90430582851 6 -0.0422721010314 0.4178952497 ... | |
48 | 0.649532581668 0.657135682543 6 0.692066153971 0.422299120276 ... | |
49 | 0.627159201987 1.70352689913 5.75 2.62066711305 -1.29237304034 ... | |
50 | 0.905441299817 1.95663197267 5.5 1.5949697565 -0.27115830703 ... | |
51 | 1.49322577898 -2.08741765309 6.25 1.23027694802 0.418336889527 ... | |
52 | 1.48750731567 -1.57274121871 8 3.01660550994 -0.893958254365 ... | |
53 | 1.39783858087 2.22623066426 7 -0.80842319214 1.47625453886 ... | |
54 | 0.89274836317 1.30378081742 8 -0.249485058661 0.159871204185 ... | |
55 | 0.920652246088 4.1437741965 9.75 2.8204453623 0.178149239655 ... | |
56 | -0.00264276644799 3.07989972052 8.75 -2.56342461535 2.105998353 ... | |
57 | 0.0198190461681 0.766283759256 8 -1.15838865989 1.56888883418 ... | |
58 | 0.440050515311 0.127570085801 7.5 0.0400753569995 0.028914333532 ... | |
59 | 0.129536637901 1.78174141526 6.75 0.959943962785 0.307781224401 ... | |
60 | 0.398549827172 3.03606770667 6.5 -0.340209794742 0.100979469478 ... | |
61 | 1.17174775425 0.629625188037 5.75 0.403003686814 0.902394579377 ... | |
62 | 0.991163981251 2.50862910684 4.75 -1.44963996982 1.16150986945 ... | |
63 | 0.967603566096 2.12003739013 4.75 0.610846030775 -0.889994896068 ... | |
64 | 1.14689383604 1.24185011459 4.75 2.01098091308 -1.73846431001 ... | |
65 | 1.32593824054 0.990713820685 4.75 -0.0955142989332 -0.0369257308362 ... | |
66 | 0.861135002644 -0.24744943605 6 1.72793107135 -0.691506789639 ... | |
67 | 1.26870850151 2.09844764887 6.5 1.50720217572 -1.31399187077 ... | |
68 | 0.260364987715 1.10650139716 6.5 1.13659047496 0.0720441664643 ... | |
69 | 1.09731242214 0.490796381346 7.25 4.59123894147 -2.14073070763 ... | |
70 | 1.63792841781 0.612652594286 6.75 1.79604605035 -0.644363995357 ... | |
71 | 1.48465576034 0.978295808687 6.75 -2.00753620902 1.39437534964 ... | |
72 | 1.0987608663 4.25212569087 6.25 -2.58901196498 2.56054320803 ... | |
73 | 1.42592178132 2.76984518311 6.25 0.888195752358 1.03114549274 ... | |
74 | 1.52958239462 1.31795955491 6.5 -0.902907564082 -0.0952198893776 ... | |
75 | 1.0170168994 2.14733589918 7 -1.3054866978 2.68803738466 ... | |
76 | 0.723253652257 3.43552889347 7.5 1.8213700853 0.592593586195 ... | |
77 | 1.24720806008 3.87383806577 7.5 0.0522300654168 0.988871238698 ... | |
78 | 0.482531471239 2.67793287032 7.5 2.9693944293 -0.108591166081 ... | |
79 | 0.154056100439 0.927269031704 6.75 0.119222057561 3.30489209451 ... | |
80 | 0.0694865769274 6.65916526788 6.25 0.889014476084 -2.83976849035 ... | |
81 | -0.121267434867 0.341442615696 5.25 0.323053239216 -3.49289229012 ... | |
82 | 0.726473690375 -3.5423730964 4 2.19149290449 -3.20855054004 ... | |
83 | 1.39271709108 2.63121085718 3.75 0.88406577736 0.75622580197 ... | |
84 | 1.07502077727 5.88578836799 4.25 -2.55088273352 2.89018116374 ... | |
85 | 0.759049251607 4.24703604223 4.5 0.575687665685 -0.388292506167 ... | |
86 | ]; | |
87 | ||
88 | data = reshape(data,5,86)'; | |
89 | y_obs = data(:,1); | |
90 | pie_obs = data(:,2); | |
91 | R_obs = data(:,3); | |
92 | de = data(:,4); | |
93 | dq = data(:,5); | |
94 | ||
95 | %Country: Canada | |
96 | %Sample Range: 1981:2 to 2002:3 | |
97 | %Observations: 86 | |
98 | %Variables: Real GDP Growth [%], Inflation [annualized %], Nom Rate [%], | |
99 | % Exchange Rate Change [%], Terms of Trade Change [%] |
0 | function data = simulate_data_with_missing_observations(n,m,S,options) | |
1 | % Simulates data with missing observations. | |
2 | % | |
3 | % We simulate data using a n-dimensional VAR(1) model. | |
4 | % | |
5 | % INPUTS | |
6 | % n [integer] scalar, number of variables. | |
7 | % m [integer] scalar, number of observed variables. | |
8 | % S [integer] scalar, maximum number of observations per observed variable. | |
9 | % options [struct] structure of options: | |
10 | % * if options.missing_info{1} = 1 the missing variables are at the beginning of the sample. | |
11 | % * if options.missing_info{1} = 2 the missing observations are at the end of the sample. | |
12 | % * if options.missing_info{1} = 3 the missing observations are randomly distributed. | |
13 | % * options.missing_info{2} is a vector of integer designing the observed variables for which observations are missing. | |
14 | % * if options.missing_info{3} is an integer scalar then it defines the number of missing observations per variable. | |
15 | % * if options.missing_info{3} is a double scalar (in [0,1]) it defines the frequency of missing observations per variable. | |
16 | % * options.unit_root_info is a scalar integer specifying the number of unit roots in the model. | |
17 | % | |
18 | % OUTPUTS | |
19 | % none | |
20 | % | |
21 | % SPECIAL REQUIREMENTS | |
22 | % none | |
23 | ||
24 | % Copyright (C) 2010 Dynare Team | |
25 | % | |
26 | % This file is part of Dynare. | |
27 | % | |
28 | % Dynare is free software: you can redistribute it and/or modify | |
29 | % it under the terms of the GNU General Public License as published miy | |
30 | % the Free Software Foundation, either version 3 of the License, or | |
31 | % (at your option) any later version. | |
32 | % | |
33 | % Dynare is distributed in the hope that it will be useful, | |
34 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
35 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
36 | % GNU General Public License for more details. | |
37 | % | |
38 | % You should have received a copy of the GNU General Public License | |
39 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
40 | ||
41 | if n<=m | |
42 | error('n must be greater than m!') | |
43 | end | |
44 | ||
45 | % Build the autoregressive matrix. | |
46 | T_eigenvalues = rand(n,1)*2-1; | |
47 | if options.unit_root_info | |
48 | T_eigenvalues(1:options.unit_root_info) = ones(options.unit_root_info,1); | |
49 | end | |
50 | T_eigenvectors = randn(n,n); | |
51 | T = T_eigenvectors*diag(T_eigenvalues)*inv(T_eigenvectors); | |
52 | ||
53 | ||
54 | % Simulate the VAR(1) model. | |
55 | data = zeros(n,S+100); | |
56 | for t=2:size(data,2) | |
57 | data(:,t) = T*data(:,t-1)+.01*randn(n,1); | |
58 | end | |
59 | ||
60 | % Select the observed variables. | |
61 | data = transpose(data(1:m,100+1:end)); | |
62 | ||
63 | % Remove observations. | |
64 | if options.missing_info{1}==1 | |
65 | data(1:options.missing_info{3},options.missing_info{2}) = NaN ; | |
66 | elseif options.missing_info{1}==2 | |
67 | data(S:S-options.missing_info{3},options.missing_info{2}) = NaN ; | |
68 | elseif options.missing_info{1}==3 | |
69 | for i=1:length(options.missing_info{2}) | |
70 | idx = randi(T,ceil(options.missing_info{3}),1); | |
71 | data(idx,i) = NaN; | |
72 | end | |
73 | else | |
74 | error('Unknown option!') | |
75 | end⏎ |
0 | periods 20000; | |
1 | var c k a; | |
2 | varexo e; | |
3 | parameters alpha beta delta gamma rho; | |
4 | ||
5 | beta = 0.95; | |
6 | delta = 1; | |
7 | alpha = 0.3; | |
8 | rho = 0; | |
9 | gamma = 2; | |
10 | ||
11 | model; | |
12 | exp(c) + exp(k) = (1-delta) * exp(k(-1)) + exp(a) * exp(k(-1))^alpha; | |
13 | exp(c)^(-gamma) = beta * exp(c(+1))^(-gamma) * (exp(a(+1)) * alpha * exp(k)^(alpha-1) + 1 - delta); | |
14 | a = rho * a(-1) + e; | |
15 | end; | |
16 | ||
17 | initval; | |
18 | k=0; | |
19 | c=0; | |
20 | a=0; | |
21 | e=0; | |
22 | end; | |
23 | ||
24 | Sigma_e_ = 1; | |
25 | ||
26 | stoch_simul(nomoments,irf=0,nocorr,ar=0); | |
27 | ||
28 | global dr_ | |
29 | dr_obj_ = dr_; | |
30 | ||
31 | save sgu_ex1 dr_obj_; | |
32 |
5 | 5 | var A de dq dR pie pie_obs pie_s R R_obs y y_obs y_s ; |
6 | 6 | varexo e_A e_pies e_q e_ys ; |
7 | 7 | |
8 | parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies ls1_r s1 s2 s3 s4 s5; | |
8 | parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies; | |
9 | 9 | |
10 | 10 | psi1 = 1.54; |
11 | 11 | psi2 = 0.25; |
2 | 2 | var y inflation r; |
3 | 3 | varexo y_ inf_; |
4 | 4 | |
5 | parameters delta sigma alpha kappa gammarr gammax0 gammac0 rbar lambda1 lambda2; | |
5 | parameters delta sigma alpha kappa lambda1 lambda2; | |
6 | 6 | |
7 | 7 | delta = 0.44; |
8 | 8 | kappa = 0.18; |
0 | function printMakeCheckMatlabErrMsg(modfilename, exception) | |
1 | fprintf('\n********************************************\n'); | |
2 | disp('*** DYNARE-TEST-MATLAB ERROR ENCOUNTERED ***'); | |
3 | disp('********************************************'); | |
4 | disp([' WHILE RUNNING MODFILE: ' modfilename]); | |
5 | fprintf('\n'); | |
6 | disp(getReport(exception)); | |
7 | fprintf('*************************************\n\n\n'); | |
8 | end |
0 | function printMakeCheckOctaveErrMsg(modfilename, err) | |
1 | printf("\n"); | |
2 | printf("********************************************\n"); | |
3 | printf("*** DYNARE-TEST-OCTAVE ERROR ENCOUNTERED ***\n"); | |
4 | printf("********************************************\n"); | |
5 | printf(" WHILE RUNNING MODFILE: %s\n", modfilename); | |
6 | printf(" MSG: %s\n", err.message); | |
7 | if (isfield(err, 'stack')) | |
8 | printf(" IN FILE: %s\n", err.stack(1).file); | |
9 | printf(" IN FUNCTION: %s\n", err.stack(1).name); | |
10 | printf(" ON LINE and COLUMN: %d and %d\n",err.stack(1).line,err.stack(1).column); | |
11 | end | |
12 | printf("*************************************\n\n\n"); | |
13 | end |
0 | data = [0.928467646476 11.8716889412 20 0.418037507392 0.227382377518 ... | |
1 | -0.705994063083 11.7522582094 21.25 1.09254424511 -1.29488274994 ... | |
2 | -0.511895351926 9.68144025625 17.25 -1.66150408407 0.331508393098 ... | |
3 | -0.990955971267 10.0890781236 17 1.43016275252 -2.43589670141 ... | |
4 | -0.981233061806 12.1094840679 18.25 2.91293288733 -0.790246576864 ... | |
5 | -0.882182844512 8.54559460406 15 0.419579139481 0.358729719566 ... | |
6 | -0.930893002836 6.19238374422 12.5 -1.48847457959 0.739779938797 ... | |
7 | 1.53158206947 2.76544271886 11.5 -0.336216769682 0.455559918769 ... | |
8 | 2.2659052834 5.47418162513 11 0.306436789767 -0.0707985731221 ... | |
9 | 1.05419803797 6.35698426189 11 0.140700250477 0.620401487202 ... | |
10 | 1.20161076793 3.4253301593 11 0.461296492351 0.14354323987 ... | |
11 | 1.73934077971 4.70926070322 11.5 1.35798282982 0.38564694435 ... | |
12 | 1.71735262584 3.54232079749 12.5 2.9097529155 -0.804308583301 ... | |
13 | 0.426343657844 3.32719108897 13 1.64214862652 -1.18214664701 ... | |
14 | 1.67751812324 2.93444727338 11.25 0.344434910651 -1.6529373719 ... | |
15 | 1.37013301099 4.72303361923 11.75 2.61511526582 0.327684243041 ... | |
16 | 0.281231073781 4.4893853071 10.5 1.17043449257 1.12855106649 ... | |
17 | 1.53638992834 3.7325309699 10.25 -0.683947046728 0.11943538737 ... | |
18 | 1.68081431462 3.34729969129 10 1.41159342106 -1.59065680853 ... | |
19 | -0.343321601133 5.05563513564 12 1.75117366498 -2.40127764642 ... | |
20 | 0.873415608666 3.2779996255 10.25 -1.39895866711 0.0971444398216 ... | |
21 | 0.26399696544 4.78229419828 9.75 0.0914692438124 0.299310457612 ... | |
22 | -0.562233624818 3.88598638237 9.75 -0.0505384765105 0.332826708151 ... | |
23 | 2.15161914936 3.84859710132 8.75 -3.44811080489 0.789138678784 ... | |
24 | 1.2345093726 5.62225030942 9.5 -0.366945407434 2.32974981198 ... | |
25 | 1.62554967459 4.24667132831 10 -0.800958371402 0.0293183770935 ... | |
26 | 1.33035402527 2.75248979249 9.75 -0.855723113225 0.852493939813 ... | |
27 | 1.52078814077 3.53415985826 9.75 -3.37963469203 -1.05133958119 ... | |
28 | 1.16704983697 4.92754079464 10.75 -3.0142303324 0.459907431978 ... | |
29 | 0.277213572101 4.55532133037 11.75 -0.851995599415 2.03242034852 ... | |
30 | 0.842215068977 3.11164509647 12.25 -1.08290421696 0.014323281961 ... | |
31 | 1.05325028606 4.92882647578 13.5 -1.1953883867 0.706764750654 ... | |
32 | 0.453051253568 6.82998950103 13.5 0.111803656462 0.088462593153 ... | |
33 | 0.199885995525 5.82643354662 13.5 -0.920501518421 -0.26504958666 ... | |
34 | 0.137907999624 2.66076369132 13.5 -1.17122929812 -0.995642430514 ... | |
35 | 0.721949686709 5.70497876823 14.25 1.19378169018 -1.10644839651 ... | |
36 | -0.418465249225 3.75861110232 14.75 -1.03131674824 0.188507675831 ... | |
37 | -0.644028342116 4.15104788154 13.75 -1.48911756546 0.204560913792 ... | |
38 | -0.848213852668 5.65580324027 12.75 0.677011703877 -0.849628054542 ... | |
39 | -1.51954076928 11.4866911266 11.25 -0.446024680774 -0.456342350765 ... | |
40 | 0.265275055215 2.85472749592 9.75 -0.598778202436 -0.907311640831 ... | |
41 | 0.356162529063 2.29614015658 9.5 -0.46820788432 -1.22130883441 ... | |
42 | 0.368308864363 -0.539083504685 8 -0.781333991956 0.374007246518 ... | |
43 | -0.145751412732 1.61507621789 8.25 3.68291932628 1.32438399845 ... | |
44 | 0.285457283664 2.14334055993 7 1.42819405379 -0.00818660844123 ... | |
45 | 0.372390129412 1.60000213334 6.25 0.626106424052 -0.10136772765 ... | |
46 | 0.382720203063 1.72614243263 7.25 4.89631941021 -1.10060711916 ... | |
47 | 0.737957515573 2.90430582851 6 -0.0422721010314 0.4178952497 ... | |
48 | 0.649532581668 0.657135682543 6 0.692066153971 0.422299120276 ... | |
49 | 0.627159201987 1.70352689913 5.75 2.62066711305 -1.29237304034 ... | |
50 | 0.905441299817 1.95663197267 5.5 1.5949697565 -0.27115830703 ... | |
51 | 1.49322577898 -2.08741765309 6.25 1.23027694802 0.418336889527 ... | |
52 | 1.48750731567 -1.57274121871 8 3.01660550994 -0.893958254365 ... | |
53 | 1.39783858087 2.22623066426 7 -0.80842319214 1.47625453886 ... | |
54 | 0.89274836317 1.30378081742 8 -0.249485058661 0.159871204185 ... | |
55 | 0.920652246088 4.1437741965 9.75 2.8204453623 0.178149239655 ... | |
56 | -0.00264276644799 3.07989972052 8.75 -2.56342461535 2.105998353 ... | |
57 | 0.0198190461681 0.766283759256 8 -1.15838865989 1.56888883418 ... | |
58 | 0.440050515311 0.127570085801 7.5 0.0400753569995 0.028914333532 ... | |
59 | 0.129536637901 1.78174141526 6.75 0.959943962785 0.307781224401 ... | |
60 | 0.398549827172 3.03606770667 6.5 -0.340209794742 0.100979469478 ... | |
61 | 1.17174775425 0.629625188037 5.75 0.403003686814 0.902394579377 ... | |
62 | 0.991163981251 2.50862910684 4.75 -1.44963996982 1.16150986945 ... | |
63 | 0.967603566096 2.12003739013 4.75 0.610846030775 -0.889994896068 ... | |
64 | 1.14689383604 1.24185011459 4.75 2.01098091308 -1.73846431001 ... | |
65 | 1.32593824054 0.990713820685 4.75 -0.0955142989332 -0.0369257308362 ... | |
66 | 0.861135002644 -0.24744943605 6 1.72793107135 -0.691506789639 ... | |
67 | 1.26870850151 2.09844764887 6.5 1.50720217572 -1.31399187077 ... | |
68 | 0.260364987715 1.10650139716 6.5 1.13659047496 0.0720441664643 ... | |
69 | 1.09731242214 0.490796381346 7.25 4.59123894147 -2.14073070763 ... | |
70 | 1.63792841781 0.612652594286 6.75 1.79604605035 -0.644363995357 ... | |
71 | 1.48465576034 0.978295808687 6.75 -2.00753620902 1.39437534964 ... | |
72 | 1.0987608663 4.25212569087 6.25 -2.58901196498 2.56054320803 ... | |
73 | 1.42592178132 2.76984518311 6.25 0.888195752358 1.03114549274 ... | |
74 | 1.52958239462 1.31795955491 6.5 -0.902907564082 -0.0952198893776 ... | |
75 | 1.0170168994 2.14733589918 7 -1.3054866978 2.68803738466 ... | |
76 | 0.723253652257 3.43552889347 7.5 1.8213700853 0.592593586195 ... | |
77 | 1.24720806008 3.87383806577 7.5 0.0522300654168 0.988871238698 ... | |
78 | 0.482531471239 2.67793287032 7.5 2.9693944293 -0.108591166081 ... | |
79 | 0.154056100439 0.927269031704 6.75 0.119222057561 3.30489209451 ... | |
80 | 0.0694865769274 6.65916526788 6.25 0.889014476084 -2.83976849035 ... | |
81 | -0.121267434867 0.341442615696 5.25 0.323053239216 -3.49289229012 ... | |
82 | 0.726473690375 -3.5423730964 4 2.19149290449 -3.20855054004 ... | |
83 | 1.39271709108 2.63121085718 3.75 0.88406577736 0.75622580197 ... | |
84 | 1.07502077727 5.88578836799 4.25 -2.55088273352 2.89018116374 ... | |
85 | 0.759049251607 4.24703604223 4.5 0.575687665685 -0.388292506167 ... | |
86 | ]; | |
87 | ||
88 | data = reshape(data,5,86)'; | |
89 | y_obs = data(:,1); | |
90 | pie_obs = data(:,2); | |
91 | R_obs = data(:,3); | |
92 | de = data(:,4); | |
93 | dq = data(:,5); | |
94 | ||
95 | %Country: Canada | |
96 | %Sample Range: 1981:2 to 2002:3 | |
97 | %Observations: 86 | |
98 | %Variables: Real GDP Growth [%], Inflation [annualized %], Nom Rate [%], | |
99 | % Exchange Rate Change [%], Terms of Trade Change [%] |
0 | var y y_s R pie dq pie_s de A y_obs pie_obs R_obs; | |
1 | varexo e_R e_q e_ys e_pies e_A; | |
2 | ||
3 | parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies; | |
4 | ||
5 | psi1 = 1.54; | |
6 | psi2 = 0.25; | |
7 | psi3 = 0.25; | |
8 | rho_R = 0.5; | |
9 | alpha = 0.3; | |
10 | rr = 2.51; | |
11 | k = 0.5; | |
12 | tau = 0.5; | |
13 | rho_q = 0.4; | |
14 | rho_A = 0.2; | |
15 | rho_ys = 0.9; | |
16 | rho_pies = 0.7; | |
17 | ||
18 | ||
19 | model(linear); | |
20 | y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1); | |
21 | pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s; | |
22 | pie = de+(1-alpha)*dq+pie_s; | |
23 | R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R; | |
24 | dq = rho_q*dq(-1)+e_q; | |
25 | y_s = rho_ys*y_s(-1)+e_ys; | |
26 | pie_s = rho_pies*pie_s(-1)+e_pies; | |
27 | A = rho_A*A(-1)+e_A; | |
28 | y_obs = y-y(-1)+A; | |
29 | pie_obs = 4*pie; | |
30 | R_obs = 4*R; | |
31 | end; | |
32 | ||
33 | shocks; | |
34 | var e_R = 1.25^2; | |
35 | var e_q = 2.5^2; | |
36 | var e_A = 1.89; | |
37 | var e_ys = 1.89; | |
38 | var e_pies = 1.89; | |
39 | end; | |
40 | ||
41 | varobs y_obs R_obs pie_obs dq de; | |
42 | ||
43 | estimated_params; | |
44 | psi1 , gamma_pdf,1.5,0.5; | |
45 | psi2 , gamma_pdf,0.25,0.125; | |
46 | psi3 , gamma_pdf,0.25,0.125; | |
47 | rho_R ,beta_pdf,0.5,0.2; | |
48 | alpha ,beta_pdf,0.3,0.1; | |
49 | rr ,gamma_pdf,2.5,1; | |
50 | k , gamma_pdf,0.5,0.25; | |
51 | tau ,gamma_pdf,0.5,0.2; | |
52 | rho_q ,beta_pdf,0.4,0.2; | |
53 | rho_A ,beta_pdf,0.5,0.2; | |
54 | rho_ys ,beta_pdf,0.8,0.1; | |
55 | rho_pies,beta_pdf,0.7,0.15; | |
56 | stderr e_R,inv_gamma_pdf,1.2533,0.6551; | |
57 | stderr e_q,inv_gamma_pdf,2.5066,1.3103; | |
58 | stderr e_A,inv_gamma_pdf,1.2533,0.6551; | |
59 | stderr e_ys,inv_gamma_pdf,1.2533,0.6551; | |
60 | stderr e_pies,inv_gamma_pdf,1.88,0.9827; | |
61 | end; | |
62 | ||
63 | estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0,forecast=8) y_obs R_obs pie_obs dq de; | |
64 |
0 | var y y_s R pie dq pie_s de A y_obs pie_obs R_obs; | |
1 | varexo e_R e_q e_ys e_pies e_A; | |
2 | ||
3 | parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies; | |
4 | ||
5 | psi1 = 1.54; | |
6 | psi2 = 0.25; | |
7 | psi3 = 0.25; | |
8 | rho_R = 0.5; | |
9 | alpha = 0.3; | |
10 | rr = 2.51; | |
11 | k = 0.5; | |
12 | tau = 0.5; | |
13 | rho_q = 0.4; | |
14 | rho_A = 0.2; | |
15 | rho_ys = 0.9; | |
16 | rho_pies = 0.7; | |
17 | ||
18 | ||
19 | model(linear); | |
20 | y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1); | |
21 | pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s; | |
22 | pie = de+(1-alpha)*dq+pie_s; | |
23 | R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R; | |
24 | dq = rho_q*dq(-1)+e_q; | |
25 | y_s = rho_ys*y_s(-1)+e_ys; | |
26 | pie_s = rho_pies*pie_s(-1)+e_pies; | |
27 | A = rho_A*A(-1)+e_A; | |
28 | y_obs = y-y(-1)+A; | |
29 | pie_obs = 4*pie; | |
30 | R_obs = 4*R; | |
31 | end; | |
32 | ||
33 | shocks; | |
34 | var e_R = 1.25^2; | |
35 | var e_q = 2.5^2; | |
36 | var e_A = 1.89; | |
37 | var e_ys = 1.89; | |
38 | var e_pies = 1.89; | |
39 | end; | |
40 | ||
41 | varobs y_obs R_obs pie_obs dq de; | |
42 | ||
43 | estimated_params; | |
44 | psi1 , gamma_pdf,1.5,0.5; | |
45 | psi2 , gamma_pdf,0.25,0.125; | |
46 | psi3 , gamma_pdf,0.25,0.125; | |
47 | rho_R ,beta_pdf,0.5,0.2; | |
48 | alpha ,beta_pdf,0.3,0.1; | |
49 | rr ,gamma_pdf,2.5,1; | |
50 | k , gamma_pdf,0.5,0.25; | |
51 | tau ,gamma_pdf,0.5,0.2; | |
52 | rho_q ,beta_pdf,0.4,0.2; | |
53 | rho_A ,beta_pdf,0.5,0.2; | |
54 | rho_ys ,beta_pdf,0.8,0.1; | |
55 | rho_pies,beta_pdf,0.7,0.15; | |
56 | stderr e_R,inv_gamma_pdf,1.2533,0.6551; | |
57 | stderr e_q,inv_gamma_pdf,2.5066,1.3103; | |
58 | stderr e_A,inv_gamma_pdf,1.2533,0.6551; | |
59 | stderr e_ys,inv_gamma_pdf,1.2533,0.6551; | |
60 | stderr e_pies,inv_gamma_pdf,1.88,0.9827; | |
61 | end; | |
62 | ||
63 | estimation(datafile=data_ca1,first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de; | |
64 |
0 | function run_test() | |
1 | test_files = { | |
2 | '.' 'ramst'; | |
3 | '.' 'ramst_a'; | |
4 | '.' 'example1'; | |
5 | '.' 'example2'; | |
6 | '.' 't_sgu_ex1'; | |
7 | 'arima' 'mod1'; | |
8 | 'arima' 'mod1a'; | |
9 | 'arima' 'mod1b'; | |
10 | 'arima' 'mod1c'; | |
11 | 'arima' 'mod2'; | |
12 | 'arima' 'mod2a'; | |
13 | 'arima' 'mod2b'; | |
14 | 'arima' 'mod2c'; | |
15 | 'fs2000' 'fs2000'; | |
16 | 'fs2000' 'fs2000a'; | |
17 | } | |
18 | ||
19 | results = cell(length(test_files),1); | |
20 | ||
21 | for i=1:length(test_files) | |
22 | results{i}= run_test1(test_files{i,1},test_files{i,2}); | |
23 | end | |
24 | ||
25 | for i=1:length(test_files) | |
26 | disp(test_files{i,2}) | |
27 | disp(results{i}) | |
28 | end | |
29 | function msg=run_test1(path1,mod_file) | |
30 | global options_ | |
31 | clear options_ | |
32 | old_path = pwd; | |
33 | cd(path1); | |
34 | msg = 'OK'; | |
35 | expr = ['disp(''error in ' mod_file ''');msg=lasterr;disp(msg)']; | |
36 | eval(['dynare ' mod_file ' noclearall'],'eval(expr)'); | |
37 | cd(old_path) | |
38 |
0 | % Copyright (C) 2011 Dynare Team | |
1 | % | |
2 | % This file is part of Dynare. | |
3 | % | |
4 | % Dynare is free software: you can redistribute it and/or modify | |
5 | % it under the terms of the GNU General Public License as published by | |
6 | % the Free Software Foundation, either version 3 of the License, or | |
7 | % (at your option) any later version. | |
8 | % | |
9 | % Dynare is distributed in the hope that it will be useful, | |
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | % GNU General Public License for more details. | |
13 | % | |
14 | % You should have received a copy of the GNU General Public License | |
15 | % along with Dynare. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | % Implementation notes: | |
18 | % | |
19 | % Before every call to Dynare, the contents of the workspace is saved in | |
20 | % 'wsMat.mat', and reloaded after Dynare has finished (this is necessary since | |
21 | % Dynare does a 'clear -all'). Also note that we take care of clearing the | |
22 | % 'exception' variable in all 'catch' block, because otherwise the next 'load | |
23 | % wsMat' within a 'catch' block will overwrite the last exception. | |
24 | ||
25 | top_test_dir = pwd; | |
26 | addpath(top_test_dir); | |
27 | addpath([top_test_dir '/../matlab']); | |
28 | ||
29 | % Test Dynare Version | |
30 | if ~strcmp(dynare_version(), getenv('DYNARE_VERSION')) | |
31 | error('Incorrect version of Dynare is being tested') | |
32 | end | |
33 | ||
34 | % Test MOD files listed in Makefile.am | |
35 | name=getenv('MODFILES'); | |
36 | num_modfiles = 0; | |
37 | ||
38 | failedBase = {}; | |
39 | ||
40 | while ~isempty(name) | |
41 | [modfile, name] = strtok(name); | |
42 | num_modfiles = num_modfiles + 1; | |
43 | [directory, testfile, ext] = fileparts([top_test_dir '/' modfile]); | |
44 | cd(directory); | |
45 | disp(''); | |
46 | disp(['*** TESTING: ' modfile ' ***']); | |
47 | try | |
48 | old_path = path; | |
49 | save wsMat | |
50 | dynare([testfile ext],'console') | |
51 | clear -all | |
52 | load wsMat | |
53 | path(old_path); | |
54 | catch exception | |
55 | clear -all | |
56 | load wsMat | |
57 | path(old_path); | |
58 | failedBase{size(failedBase,2)+1} = modfile; | |
59 | printMakeCheckMatlabErrMsg(modfile, exception); | |
60 | clear exception | |
61 | end | |
62 | close all | |
63 | delete('wsMat.mat') | |
64 | ||
65 | cd(top_test_dir); | |
66 | end | |
67 | ||
68 | % Test block_bytecode/ls2003.mod with various combinations of | |
69 | % block/bytecode/solve_algo/stack_solve_algo | |
70 | failedBlock = {}; | |
71 | num_block_tests = 0; | |
72 | cd([top_test_dir '/block_bytecode']); | |
73 | for blockFlag = 0:1 | |
74 | for bytecodeFlag = 0:1 | |
75 | default_solve_algo = 2; | |
76 | default_stack_solve_algo = 0; | |
77 | if ~blockFlag && ~bytecodeFlag | |
78 | solve_algos = 1:4; | |
79 | stack_solve_algos = 0; | |
80 | elseif blockFlag && ~bytecodeFlag | |
81 | solve_algos = [1:4 6:8]; | |
82 | stack_solve_algos = 0:4; | |
83 | else | |
84 | solve_algos = 1:8; | |
85 | stack_solve_algos = 0:5; | |
86 | end | |
87 | if license('test', 'optimization_toolbox') | |
88 | solve_algos = [ solve_algos 0 ]; | |
89 | end | |
90 | ||
91 | for i = 1:length(solve_algos) | |
92 | num_block_tests = num_block_tests + 1; | |
93 | if ~blockFlag && ~bytecodeFlag && (i == 1) | |
94 | % This is the reference simulation path against which all | |
95 | % other simulations will be tested | |
96 | try | |
97 | old_path = path; | |
98 | save wsMat | |
99 | run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo) | |
100 | load wsMat | |
101 | path(old_path); | |
102 | y_ref = oo_.endo_simul; | |
103 | save('test.mat','y_ref'); | |
104 | catch exception | |
105 | load wsMat | |
106 | path(old_path); | |
107 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
108 | printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], exception); | |
109 | clear exception | |
110 | end | |
111 | else | |
112 | try | |
113 | old_path = path; | |
114 | save wsMat | |
115 | run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo) | |
116 | load wsMat | |
117 | path(old_path); | |
118 | % Test against the reference simulation path | |
119 | load('test.mat','y_ref'); | |
120 | diff = oo_.endo_simul - y_ref; | |
121 | if(abs(diff) > options_.dynatol) | |
122 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
123 | exception = MException('ERROR: simulation path differs from the reference path'); | |
124 | printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], exception); | |
125 | clear exception | |
126 | end | |
127 | catch exception | |
128 | load wsMat | |
129 | path(old_path); | |
130 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
131 | printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], exception); | |
132 | clear exception | |
133 | end | |
134 | end | |
135 | end | |
136 | for i = 1:length(stack_solve_algos) | |
137 | num_block_tests = num_block_tests + 1; | |
138 | try | |
139 | old_path = path; | |
140 | save wsMat | |
141 | run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i)) | |
142 | load wsMat | |
143 | path(old_path); | |
144 | % Test against the reference simulation path | |
145 | load('test.mat','y_ref'); | |
146 | diff = oo_.endo_simul - y_ref; | |
147 | if(abs(diff) > options_.dynatol) | |
148 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')']; | |
149 | exception = MException('ERROR: simulation path difers from the reference path'); | |
150 | printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'], exception); | |
151 | clear exception | |
152 | end | |
153 | catch exception | |
154 | load wsMat | |
155 | path(old_path); | |
156 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
157 | printMakeCheckMatlabErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], exception); | |
158 | clear exception | |
159 | end | |
160 | end | |
161 | end | |
162 | end | |
163 | delete('wsMat.mat') | |
164 | ||
165 | cd(top_test_dir); | |
166 | ||
167 | total_tests = num_modfiles+num_block_tests; | |
168 | ||
169 | % print output to screen and to file | |
170 | fid = fopen('run_test_matlab_output.txt', 'w'); | |
171 | ||
172 | fprintf('\n\n\n'); | |
173 | fprintf(fid,'\n\n\n'); | |
174 | disp('***************************************'); | |
175 | fprintf(fid,'***************************************\n'); | |
176 | disp('* DYNARE TEST RESULTS *'); | |
177 | fprintf(fid,'* DYNARE TEST RESULTS *\n'); | |
178 | disp('* for make check-matlab *'); | |
179 | fprintf(fid,'* for make check-matlab *\n'); | |
180 | disp('***************************************'); | |
181 | fprintf(fid,'***************************************\n'); | |
182 | disp([' ' num2str(total_tests-size(failedBase,2)-size(failedBlock,2)) ' tests PASSED out of ' num2str(total_tests) ' tests run']); | |
183 | fprintf(fid,' %d tests PASSED out of %d tests run\n', total_tests-size(failedBase,2)-size(failedBlock,2), total_tests); | |
184 | disp('***************************************'); | |
185 | fprintf(fid,'***************************************\n'); | |
186 | if size(failedBase,2) > 0 || size(failedBlock,2) > 0 | |
187 | disp(['List of ' num2str(size(failedBase,2)+size(failedBlock,2)) ' tests FAILED:']); | |
188 | fprintf(fid,'List of %d tests FAILED:\n', size(failedBase,2)+size(failedBlock,2)); | |
189 | for i=1:size(failedBase,2) | |
190 | disp([' * ' failedBase{i}]); | |
191 | fprintf(fid,' * %s\n', failedBase{i}); | |
192 | end | |
193 | for i=1:size(failedBlock,2) | |
194 | disp([' * ' failedBlock{i}]); | |
195 | fprintf(fid,' * %s\n', failedBlock{i}); | |
196 | end | |
197 | fprintf('***************************************\n\n'); | |
198 | fprintf(fid,'***************************************\n\n'); | |
199 | end | |
200 | fclose(fid); | |
201 | exit; |
0 | ## Copyright (C) 2009 Dynare Team | |
0 | ## Copyright (C) 2009-2011 Dynare Team | |
1 | 1 | ## |
2 | 2 | ## This file is part of Dynare. |
3 | 3 | ## |
14 | 14 | ## You should have received a copy of the GNU General Public License |
15 | 15 | ## along with Dynare. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 | ## First argument is MOD file (possibly with a path prefix) | |
18 | ## Second argument is path to Dynare installation to be checked | |
19 | ## Third argument is Dynare version to be checked | |
17 | ## Implementation notes: | |
18 | ## | |
19 | ## Before every call to Dynare, the contents of the workspace is saved in | |
20 | ## 'wsOct', and reloaded after Dynare has finished (this is necessary since | |
21 | ## Dynare does a 'clear -all'). | |
22 | ||
23 | top_test_dir = pwd; | |
24 | addpath(top_test_dir); | |
25 | addpath([top_test_dir '/../matlab']); | |
26 | ||
27 | ## Test Dynare Version | |
28 | if !strcmp(dynare_version(), getenv("DYNARE_VERSION")) | |
29 | error("Incorrect version of Dynare is being tested") | |
30 | endif | |
20 | 31 | |
21 | 32 | ## Ask gnuplot to create graphics in text mode |
22 | 33 | ## Note that setenv() was introduced in Octave 3.0.2, for compatibility |
23 | 34 | ## with MATLAB |
24 | 35 | putenv("GNUTERM", "dumb") |
25 | 36 | |
26 | [directory, name, ext] = fileparts(argv(){1}); | |
37 | ## Test MOD files listed in Makefile.am | |
38 | name = strsplit(getenv("MODFILES"), " "); | |
27 | 39 | |
28 | printf("TEST: %s...\n", name) | |
40 | failedBase = {}; | |
29 | 41 | |
30 | addpath(argv(){2}) | |
42 | for i=1:size(name,2) | |
43 | [directory, testfile, ext] = fileparts([top_test_dir '/' name{i}]); | |
44 | cd(directory); | |
45 | printf("\n*** TESTING: %s ***\n", name{i}); | |
46 | try | |
47 | old_path = path; | |
48 | save wsOct | |
49 | dynare([testfile ext]) | |
50 | clear -all | |
51 | load wsOct | |
52 | path(old_path); | |
53 | catch | |
54 | clear -all | |
55 | load wsOct | |
56 | path(old_path); | |
57 | failedBase{size(failedBase,2)+1} = name{i}; | |
58 | printMakeCheckOctaveErrMsg(name{i}, lasterror); | |
59 | end_try_catch | |
60 | delete('wsOct'); | |
61 | cd(top_test_dir); | |
62 | end | |
31 | 63 | |
32 | if !strcmp(dynare_version(), argv(){3}) | |
33 | error("Incorrect version of Dynare is being tested") | |
64 | ## Test block_bytecode/ls2003.mod with various combinations of | |
65 | ## block/bytecode/solve_algo/stack_solve_algo | |
66 | failedBlock = {}; | |
67 | num_block_tests = 0; | |
68 | cd([top_test_dir '/block_bytecode']); | |
69 | for blockFlag = 0:1 | |
70 | for bytecodeFlag = 0:1 | |
71 | ## Recall that solve_algo=7 and stack_solve_algo=2 are not supported | |
72 | ## under Octave | |
73 | default_solve_algo = 2; | |
74 | default_stack_solve_algo = 0; | |
75 | if !blockFlag && !bytecodeFlag | |
76 | solve_algos = 0:4; | |
77 | stack_solve_algos = 0; | |
78 | elseif blockFlag && !bytecodeFlag | |
79 | solve_algos = [0:4 6 8]; | |
80 | stack_solve_algos = [0 1 3 4]; | |
81 | else | |
82 | solve_algos = [0:6 8]; | |
83 | stack_solve_algos = [0 1 3:5]; | |
84 | endif | |
85 | ||
86 | for i = 1:length(solve_algos) | |
87 | num_block_tests = num_block_tests + 1; | |
88 | if !blockFlag && !bytecodeFlag && (i == 1) | |
89 | ## This is the reference simulation path against which all | |
90 | ## other simulations will be tested | |
91 | try | |
92 | old_path = path; | |
93 | save wsOct | |
94 | run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo) | |
95 | load wsOct | |
96 | path(old_path); | |
97 | y_ref = oo_.endo_simul; | |
98 | save('test.mat','y_ref'); | |
99 | catch | |
100 | load wsOct | |
101 | path(old_path); | |
102 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
103 | printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], lasterror); | |
104 | end_try_catch | |
105 | else | |
106 | try | |
107 | old_path = path; | |
108 | save wsOct | |
109 | run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo) | |
110 | load wsOct | |
111 | path(old_path); | |
112 | ## Test against the reference simulation path | |
113 | load('test.mat','y_ref'); | |
114 | diff = oo_.endo_simul - y_ref; | |
115 | if(abs(diff) > options_.dynatol) | |
116 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
117 | differr.message = ["ERROR: simulation path differs from the reference path" ]; | |
118 | printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], differr); | |
119 | endif | |
120 | catch | |
121 | load wsOct | |
122 | path(old_path); | |
123 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
124 | printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], lasterror); | |
125 | end_try_catch | |
126 | endif | |
127 | endfor | |
128 | for i = 1:length(stack_solve_algos) | |
129 | num_block_tests = num_block_tests + 1; | |
130 | try | |
131 | old_path = path; | |
132 | save wsOct | |
133 | run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i)) | |
134 | load wsOct | |
135 | path(old_path); | |
136 | ## Test against the reference simulation path | |
137 | load('test.mat','y_ref'); | |
138 | diff = oo_.endo_simul - y_ref; | |
139 | if(abs(diff) > options_.dynatol) | |
140 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')']; | |
141 | differr.message = ["ERROR: simulation path differs from the reference path" ]; | |
142 | printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(default_solve_algo) ', ' num2str(stack_solve_algos(i)) ')'], differr); | |
143 | endif | |
144 | catch | |
145 | load wsOct | |
146 | path(old_path); | |
147 | failedBlock{size(failedBlock,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')']; | |
148 | printMakeCheckOctaveErrMsg(['block_bytecode/run_ls2003.m(' num2str(blockFlag) ', ' num2str(bytecodeFlag) ', ' num2str(solve_algos(i)) ', ' num2str(default_stack_solve_algo) ')'], lasterror); | |
149 | end_try_catch | |
150 | endfor | |
151 | endfor | |
152 | endfor | |
153 | ||
154 | delete('wsOct'); | |
155 | ||
156 | cd(top_test_dir); | |
157 | ||
158 | total_tests = size(name,2)+num_block_tests; | |
159 | ||
160 | % print output to screen and to file | |
161 | fid = fopen("run_test_octave_output.txt", "w"); | |
162 | ||
163 | printf("\n\n\n"); | |
164 | fprintf(fid,'\n\n\n'); | |
165 | printf("***************************************\n"); | |
166 | fprintf(fid,"***************************************\n"); | |
167 | printf("* DYNARE TEST RESULTS *\n"); | |
168 | fprintf(fid,"* DYNARE TEST RESULTS *\n"); | |
169 | printf("* for make check-octave *\n"); | |
170 | fprintf(fid,"* for make check-octave *\n"); | |
171 | printf("***************************************\n"); | |
172 | fprintf(fid,"***************************************\n"); | |
173 | printf(" %d tests PASSED out of %d tests run\n", total_tests-size(failedBase,2)-size(failedBlock,2), total_tests); | |
174 | fprintf(fid," %d tests PASSED out of %d tests run\n", total_tests-size(failedBase,2)-size(failedBlock,2), total_tests); | |
175 | printf("***************************************\n"); | |
176 | fprintf(fid,"***************************************\n"); | |
177 | if size(failedBase,2) > 0 || size(failedBlock,2) > 0 | |
178 | printf("List of %d tests FAILED:\n", size(failedBase,2)+size(failedBlock,2)); | |
179 | fprintf(fid,"List of %d tests FAILED:\n", size(failedBase,2)+size(failedBlock,2)); | |
180 | for i=1:size(failedBase,2) | |
181 | printf(" * %s\n",failedBase{i}); | |
182 | fprintf(fid," * %s\n", failedBase{i}); | |
183 | end | |
184 | for i=1:size(failedBlock,2) | |
185 | printf(" * %s\n",failedBlock{i}); | |
186 | fprintf(fid," * %s\n", failedBlock{i}); | |
187 | end | |
188 | printf("***************************************\n\n"); | |
189 | fprintf(fid,"***************************************\n\n"); | |
190 | fclose(fid); | |
191 | error("make check-octave FAILED"); | |
192 | else | |
193 | fclose(fid); | |
34 | 194 | endif |
35 | ||
36 | cd(directory) | |
37 | ||
38 | dynare(name) | |
39 | 195 | |
40 | 196 | ## Local variables: |
41 | 197 | ## mode: Octave |
0 | var y x; | |
1 | varexo e; | |
2 | ||
3 | parameters beta theta rho xbar; | |
4 | xbar = 0.0179; | |
5 | rho = -0.139; | |
6 | theta = -1.5; | |
7 | theta = -10; | |
8 | beta = 0.95; | |
9 | ||
10 | model; | |
11 | y = beta*exp(theta*x(+1))*(1+y(+1)); | |
12 | x = (1-rho)*xbar + rho*x(-1)+e; | |
13 | end; | |
14 | ||
15 | shocks; | |
16 | var e; stderr 0.0348; | |
17 | end; | |
18 | ||
19 | initval; | |
20 | x = xbar; | |
21 | y = beta*exp(theta*xbar)/(1-beta*exp(theta*xbar)); | |
22 | end; | |
23 | ||
24 | resid(1); | |
25 | ||
26 | steady; | |
27 | ||
28 | stoch_simul(order=2,irf=0); | |
29 | ||
30 | sigma2=M_.Sigma_e; | |
31 | i = linspace(1,800,800); | |
32 | a = theta*xbar*i+(theta^2*sigma2)/(2*(1-rho)^2)*(i-2*rho*(1-rho.^i)/(1-rho)+rho^2*(1-rho.^(2*i))/(1-rho^2)); | |
33 | a1 = theta^2*sigma2/(2*(1-rho)^2)*(i-2*rho*(1-rho.^i)/(1-rho)+rho^2*(1-rho.^(2*i))/(1-rho^2)); | |
34 | b = theta*rho*(1-rho.^i)/(1-rho); | |
35 | ||
36 | dr = oo_.dr; | |
37 | x1 = [dr.ghx(2); dr.ghu(2); dr.ghxx(2); dr.ghuu(2); dr.ghxu(2); dr.ghs2(2)]; | |
38 | x2 = [ | |
39 | sum(beta.^i.*exp(theta*xbar*i).*b*rho) | |
40 | sum(beta.^i.*exp(theta*xbar*i).*b) | |
41 | sum(beta.^i.*exp(theta*xbar*i).*(b*rho).^2) | |
42 | sum(beta.^i.*exp(theta*xbar*i).*b.^2) | |
43 | sum(beta.^i.*exp(theta*xbar*i).*b.^2*rho) | |
44 | sum(beta.^i.*exp(theta*xbar*i).*a1*2) | |
45 | ]; | |
46 | if any(abs(x1-x2) > 1e-14); | |
47 | error('burnside_1 doesn''t reproduce the analytical solution'); | |
48 | end;⏎ |
0 | @#define countries = 1:2 | |
1 | @#define assets = 1:2 | |
2 | var | |
3 | @#for c in countries | |
4 | yk_@{c} yl_@{c} c_@{c} | |
5 | @#endfor | |
6 | a ze_1 r_1 | |
7 | ; | |
8 | ||
9 | varexo | |
10 | @#for c in countries | |
11 | ek_@{c} el_@{c} | |
12 | @#endfor | |
13 | ; | |
14 | ||
15 | parameters rho eta omega sig_k sig_l ykbar ylbar; | |
16 | ||
17 | rho = 1; | |
18 | psi = 0.7; | |
19 | eta = 0.9; | |
20 | g = 0.25; | |
21 | ykbar = 1; | |
22 | ylbar = 1; | |
23 | cbar = ykbar+ylbar; | |
24 | nu = 0.5; | |
25 | omega = 0.75; | |
26 | sig_k = 0.02; | |
27 | sig_l = 0.01; | |
28 | sig_m = 0; | |
29 | betabar = omega*cbar^(-eta); | |
30 | ||
31 | ||
32 | model; | |
33 | @#for c in countries | |
34 | yk_@{c} = log(ykbar) + sig_k*ek_@{c}; | |
35 | yl_@{c} = log(ylbar) + sig_l*el_@{c}; | |
36 | exp(c_@{c})^(eta-rho) = omega*exp(c_@{c}(+1))^(-rho)*r_1(+1); | |
37 | @#endfor | |
38 | ||
39 | a = a(-1)*r_1 + exp(yk_1) + exp(yl_1) - exp(c_1); | |
40 | -a = -a(-1)*r_1 + exp(yk_2) + exp(yl_2) - exp(c_2); | |
41 | // r_1+ze_1 = ze_1+exp(yk_1-ze_1(-1)); | |
42 | r_1 = exp(yk_1-ze_1(-1)); | |
43 | ||
44 | ||
45 | end; | |
46 | ||
47 | shocks; | |
48 | @#for c in countries | |
49 | var ek_@{c} = 1; | |
50 | var el_@{c} = 1; | |
51 | @#endfor | |
52 | end; | |
53 | ||
54 | initval; | |
55 | @#for c in countries | |
56 | yk_@{c} = log(ykbar); | |
57 | yl_@{c} = log(ylbar); | |
58 | c_@{c} = log(ykbar+ylbar); | |
59 | @#endfor | |
60 | r_1 = 1/betabar; | |
61 | ze_1 = log(betabar)+yk_1; | |
62 | end; | |
63 | ||
64 | resid(1); | |
65 | steady; | |
66 | model_diagnostics(M_,options_,oo_); | |
67 | check; | |
68 | stoch_simul(order=2,irf=0); |
0 | @#define countries = 1:2 | |
1 | @#define assets = 1:2 | |
2 | var | |
3 | @#for c in countries | |
4 | yk_@{c} yl_@{c} c_@{c} | |
5 | @#endfor | |
6 | a ze_1 r_1 | |
7 | ; | |
8 | ||
9 | varexo | |
10 | @#for c in countries | |
11 | ek_@{c} el_@{c} | |
12 | @#endfor | |
13 | ; | |
14 | ||
15 | parameters rho eta omega sig_k sig_l ykbar ylbar; | |
16 | ||
17 | rho = 1; | |
18 | psi = 0.7; | |
19 | eta = 0.9; | |
20 | g = 0.25; | |
21 | ykbar = 1; | |
22 | ylbar = 1; | |
23 | cbar = ykbar+ylbar; | |
24 | nu = 0.5; | |
25 | omega = 0.75; | |
26 | sig_k = 0.02; | |
27 | sig_l = 0.01; | |
28 | sig_m = 0; | |
29 | betabar = omega*cbar^(-eta); | |
30 | ||
31 | ||
32 | model; | |
33 | @#for c in countries | |
34 | yk_@{c} = log(ykbar) + sig_k*ek_@{c}; | |
35 | yl_@{c} = log(ylbar) + sig_l*el_@{c}; | |
36 | exp(c_@{c})^(eta-rho) = omega*exp(c_@{c}(+1))^(-rho)*r_1(+1); | |
37 | @#endfor | |
38 | ||
39 | a = a(-1)*r_1 + exp(yk_1) + exp(yl_1) - exp(c_1); | |
40 | -a = -a(-1)*r_1 + exp(yk_2) + exp(yl_2) - exp(c_2); | |
41 | // r_1+ze_1 = ze_1+exp(yk_1-ze_1(-1)); | |
42 | r_1 = exp(yk_1-ze_1(-1))+ze_1-ze_1; | |
43 | ||
44 | ||
45 | end; | |
46 | ||
47 | shocks; | |
48 | @#for c in countries | |
49 | var ek_@{c} = 1; | |
50 | var el_@{c} = 1; | |
51 | @#endfor | |
52 | end; | |
53 | ||
54 | initval; | |
55 | @#for c in countries | |
56 | yk_@{c} = log(ykbar); | |
57 | yl_@{c} = log(ylbar); | |
58 | c_@{c} = log(ykbar+ylbar); | |
59 | @#endfor | |
60 | r_1 = 1/betabar; | |
61 | ze_1 = log(betabar)+yk_1; | |
62 | end; | |
63 | ||
64 | resid(1); | |
65 | steady; | |
66 | model_diagnostics(M_,options_,oo_); | |
67 | check; | |
68 | stoch_simul(order=2,irf=0); | |
69 | ||
70 | o1 = load('ds1_results','oo_'); | |
71 | oo1 = o1.oo_.dr; | |
72 | oo2 = oo_.dr; | |
73 | if any(abs(oo1.ghxx-oo2.ghxx) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end; | |
74 | if any(abs(oo1.ghuu-oo2.ghuu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end; | |
75 | if any(abs(oo1.ghxu-oo2.ghxu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end; | |
76 | if any(abs(oo1.ghs2-oo2.ghs2) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;⏎ |
0 | @#define N = 4 | |
1 | var A B; | |
2 | varexo eB; | |
3 | parameters Bss rho; | |
4 | ||
5 | Bss=1; | |
6 | rho=0.9; | |
7 | ||
8 | model; | |
9 | A = B(@{N}); | |
10 | B = (1-rho)*Bss +rho*B(-1) +eB; | |
11 | end; | |
12 | ||
13 | steady_state_model; | |
14 | A = Bss; | |
15 | B = Bss; | |
16 | end; | |
17 | ||
18 | resid; | |
19 | steady; | |
20 | check; | |
21 | ||
22 | shocks; | |
23 | var eB ; stderr 1 ; | |
24 | end; | |
25 | ||
26 | stoch_simul(order=1,irf=0) ; |
0 | var y c k m n R pi z u; | |
1 | varexo e sigma; | |
2 | // sigma stands for phi in the eq 2.37 p.69 | |
3 | ||
4 | parameters alpha beta delta gamm phi1 eta a b rho phi2 Psi thetass; | |
5 | //phi1 stands for capital phi in eq.2.68 and 2.69 | |
6 | //phi2 stands for lowercase phi in eq. 2.66 | |
7 | ||
8 | change_type(var) Psi; | |
9 | change_type(parameters) n; | |
10 | ||
11 | alpha = 0.36; | |
12 | beta = 0.989; | |
13 | gamm = 0.5; | |
14 | delta = 0.019; | |
15 | phi1 = 2; | |
16 | phi2 = 0; | |
17 | eta = 1; | |
18 | a = 0.95; | |
19 | b = 2.56; | |
20 | rho = 0.95; | |
21 | //Psi = 1.47630583; | |
22 | thetass = 1.0125; | |
23 | ||
24 | model; | |
25 | ||
26 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*(1-a)*exp(m)^(-b)+beta*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b)/(1+pi(+1)); | |
27 | ||
28 | Psi*(1-exp(n))^(-eta)/(a*exp(c)^(-b)*(a*exp(c)^(1-b) + (1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))) = (1-alpha)*exp(y)/exp(n); | |
29 | ||
30 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = beta*exp(R(+1))*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b); | |
31 | ||
32 | exp(R) = alpha*exp(y)/exp(k(-1)) + 1-delta; | |
33 | ||
34 | exp(k) = (1-delta)*exp(k(-1))+exp(y)-exp(c); | |
35 | ||
36 | exp(y) = exp(z)*exp(k(-1))^alpha*exp(n)^(1-alpha); | |
37 | ||
38 | exp(m) = exp(m(-1))*(u+thetass)/(1+pi); | |
39 | ||
40 | z = rho*z(-1) + e; | |
41 | ||
42 | u = gamm*u(-1) + phi2*z(-1) + sigma; | |
43 | ||
44 | end; | |
45 | ||
46 | shocks; | |
47 | var e; stderr 0.007; | |
48 | var sigma;stderr 0.0089; | |
49 | end; | |
50 | ||
51 | n=log(1/3); | |
52 | ||
53 | initval; | |
54 | y = 0.2; | |
55 | c = 0.03; | |
56 | k = 2.7; | |
57 | m = 0.3; | |
58 | Psi = 1.5; | |
59 | R = 0.01; | |
60 | pi = 0.01; | |
61 | z = 0; | |
62 | u = 0; | |
63 | end; | |
64 | ||
65 | ||
66 | steady; | |
67 |
0 | var y c k m n R pi z u; | |
1 | varexo e sigma; | |
2 | // sigma stands for phi in the eq 2.37 p.69 | |
3 | ||
4 | parameters alpha beta delta gamm phi1 eta a b rho phi2 Psi thetass; | |
5 | //phi1 stands for capital phi in eq.2.68 and 2.69 | |
6 | //phi2 stands for lowercase phi in eq. 2.66 | |
7 | ||
8 | alpha = 0.36; | |
9 | beta = 0.989; | |
10 | gamm = 0.5; | |
11 | delta = 0.019; | |
12 | phi1 = 2; | |
13 | phi2 = 0; | |
14 | eta = 1; | |
15 | a = 0.95; | |
16 | b = 2.56; | |
17 | rho = 0.95; | |
18 | Psi = 1.47630583; | |
19 | thetass = 1.0125; | |
20 | ||
21 | model; | |
22 | ||
23 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*(1-a)*exp(m)^(-b)+beta*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b)/(1+pi(+1)); | |
24 | ||
25 | Psi*(1-exp(n))^(-eta)/(a*exp(c)^(-b)*(a*exp(c)^(1-b) + (1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))) = (1-alpha)*exp(y)/exp(n); | |
26 | ||
27 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = beta*exp(R(+1))*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b); | |
28 | ||
29 | exp(R) = alpha*exp(y)/exp(k(-1)) + 1-delta; | |
30 | ||
31 | exp(k) = (1-delta)*exp(k(-1))+exp(y)-exp(c); | |
32 | ||
33 | exp(y) = exp(z)*exp(k(-1))^alpha*exp(n)^(1-alpha); | |
34 | ||
35 | exp(m) = exp(m(-1))*(u+thetass)/(1+pi); | |
36 | ||
37 | z = rho*z(-1) + e; | |
38 | ||
39 | u = gamm*u(-1) + phi2*z(-1) + sigma; | |
40 | ||
41 | end; | |
42 | ||
43 | shocks; | |
44 | var e; stderr 0.007; | |
45 | var sigma;stderr 0.0089; | |
46 | end; | |
47 | ||
48 | ||
49 | steady; | |
50 |
0 | function [ys,check] = wlash1_old_ss_steadystate(ys0,exo) | |
1 | global M_ | |
2 | ||
3 | check = 0; | |
4 | ||
5 | params = M_.params; | |
6 | alpha = params(1); | |
7 | beta = params(2); | |
8 | delta = params(3); | |
9 | gamm = params(4); | |
10 | phi1 = params(5); | |
11 | eta = params(6); | |
12 | a = params(7); | |
13 | b = params(8); | |
14 | rho = params(9); | |
15 | phi2 = params(10); | |
16 | Psi = params(11); | |
17 | thetass = params(12); | |
18 | ||
19 | pi = thetass-1; | |
20 | en = 1/3; | |
21 | eR = 1/beta; | |
22 | y_k = (1/alpha)*(1/beta-1+delta); | |
23 | ek = en*y_k^(-1/(1-alpha)); | |
24 | ec = ek*(y_k-delta); | |
25 | em = ec*(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^(-1/b); | |
26 | ey = ek*y_k; | |
27 | Xss = a*ec^(1-b)*(1+(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^((b-1)/b)); | |
28 | Psi = (1-alpha)*(ey/en)*Xss^((b-phi1)/(1-b))*a*ec^(-b)*(1-en)^eta; | |
29 | n = log(en); | |
30 | k = log(ek); | |
31 | m = log(em); | |
32 | c = log(ec); | |
33 | y = log(ey); | |
34 | R = log(eR); | |
35 | z = 0; | |
36 | u = 0; | |
37 | ||
38 | ys = [y c k m n R pi z u]'; | |
39 | M_.params(11) = Psi; | |
40 |
0 | var y c k m n R pi z u; | |
1 | varexo e sigma; | |
2 | // sigma stands for phi in the eq 2.37 p.69 | |
3 | ||
4 | parameters alpha beta delta gamm phi1 eta a b rho phi2 Psi thetass; | |
5 | //phi1 stands for capital phi in eq.2.68 and 2.69 | |
6 | //phi2 stands for lowercase phi in eq. 2.66 | |
7 | ||
8 | alpha = 0.36; | |
9 | beta = 0.989; | |
10 | gamm = 0.5; | |
11 | delta = 0.019; | |
12 | phi1 = 2; | |
13 | phi2 = 0; | |
14 | eta = 1; | |
15 | a = 0.95; | |
16 | b = 2.56; | |
17 | rho = 0.95; | |
18 | Psi = 1.47630583; | |
19 | thetass = 1.0125; | |
20 | ||
21 | model; | |
22 | ||
23 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*(1-a)*exp(m)^(-b)+beta*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b)/(1+pi(+1)); | |
24 | ||
25 | Psi*(1-exp(n))^(-eta)/(a*exp(c)^(-b)*(a*exp(c)^(1-b) + (1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))) = (1-alpha)*exp(y)/exp(n); | |
26 | ||
27 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = beta*exp(R(+1))*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b); | |
28 | ||
29 | exp(R) = alpha*exp(y)/exp(k(-1)) + 1-delta; | |
30 | ||
31 | exp(k) = (1-delta)*exp(k(-1))+exp(y)-exp(c); | |
32 | ||
33 | exp(y) = exp(z)*exp(k(-1))^alpha*exp(n)^(1-alpha); | |
34 | ||
35 | exp(m) = exp(m(-1))*(u+thetass)/(1+pi); | |
36 | ||
37 | z = rho*z(-1) + e; | |
38 | ||
39 | u = gamm*u(-1) + phi2*z(-1) + sigma; | |
40 | ||
41 | end; | |
42 | ||
43 | shocks; | |
44 | var e; stderr 0.007; | |
45 | var sigma;stderr 0.0089; | |
46 | end; | |
47 | ||
48 | steady_state_model; | |
49 | // solving in levels | |
50 | // calibrating n = 1/3 and recovering the value of Psi | |
51 | // adapting solution Walsh (2003) p. 84 | |
52 | pi = thetass-1; | |
53 | en = 1/3; | |
54 | eR = 1/beta; | |
55 | y_k = (1/alpha)*(1/beta-1+delta); | |
56 | ek = en*y_k^(-1/(1-alpha)); | |
57 | ec = ek*(y_k-delta); | |
58 | em = ec*(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^(-1/b); | |
59 | ey = ek*y_k; | |
60 | Xss = a*ec^(1-b)*(1+(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^((b-1)/b)); | |
61 | Psi = (1-alpha)*(ey/en)*Xss^((b-phi1)/(1-b))*a*ec^(-b)*(1-en)^eta; | |
62 | n = log(en); | |
63 | k = log(ek); | |
64 | m = log(em); | |
65 | c = log(ec); | |
66 | y = log(ey); | |
67 | R = log(eR); | |
68 | end; | |
69 | ||
70 | steady; | |
71 |
0 | var y c k m n R pi z u; | |
1 | varexo e sigma; | |
2 | // sigma stands for phi in the eq 2.37 p.69 | |
3 | ||
4 | parameters alpha beta delta gamm phi1 eta a b rho phi2 Psi thetass; | |
5 | //phi1 stands for capital phi in eq.2.68 and 2.69 | |
6 | //phi2 stands for lowercase phi in eq. 2.66 | |
7 | ||
8 | alpha = 0.36; | |
9 | beta = 0.989; | |
10 | gamm = 0.5; | |
11 | delta = 0.019; | |
12 | phi1 = 2; | |
13 | phi2 = 0; | |
14 | eta = 1; | |
15 | a = 0.95; | |
16 | b = 2.56; | |
17 | rho = 0.95; | |
18 | Psi = 1.47630583; | |
19 | thetass = 1.0125; | |
20 | ||
21 | model(block); | |
22 | ||
23 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*(1-a)*exp(m)^(-b)+beta*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b)/(1+pi(+1)); | |
24 | ||
25 | Psi*(1-exp(n))^(-eta)/(a*exp(c)^(-b)*(a*exp(c)^(1-b) + (1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))) = (1-alpha)*exp(y)/exp(n); | |
26 | ||
27 | (a*exp(c)^(1-b)+(1-a)*exp(m)^(1-b))^((b-phi1)/(1-b))*a*exp(c)^(-b) = beta*exp(R(+1))*(a*exp(c(+1))^(1-b)+(1-a)*exp(m(+1))^(1-b))^((b-phi1)/(1-b))*a*exp(c(+1))^(-b); | |
28 | ||
29 | exp(R) = alpha*exp(y)/exp(k(-1)) + 1-delta; | |
30 | ||
31 | exp(k) = (1-delta)*exp(k(-1))+exp(y)-exp(c); | |
32 | ||
33 | exp(y) = exp(z)*exp(k(-1))^alpha*exp(n)^(1-alpha); | |
34 | ||
35 | exp(m) = exp(m(-1))*(u+thetass)/(1+pi); | |
36 | ||
37 | z = rho*z(-1) + e; | |
38 | ||
39 | u = gamm*u(-1) + phi2*z(-1) + sigma; | |
40 | ||
41 | end; | |
42 | ||
43 | shocks; | |
44 | var e; stderr 0.007; | |
45 | var sigma;stderr 0.0089; | |
46 | end; | |
47 | ||
48 | steady_state_model; | |
49 | // solving in levels | |
50 | // calibrating n = 1/3 and recovering the value of Psi | |
51 | // adapting solution Walsh (2003) p. 84 | |
52 | pi = thetass-1; | |
53 | en = 1/3; | |
54 | eR = 1/beta; | |
55 | y_k = (1/alpha)*(1/beta-1+delta); | |
56 | ek = en*y_k^(-1/(1-alpha)); | |
57 | ec = ek*(y_k-delta); | |
58 | em = ec*(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^(-1/b); | |
59 | ey = ek*y_k; | |
60 | Xss = a*ec^(1-b)*(1+(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^((b-1)/b)); | |
61 | Psi = (1-alpha)*(ey/en)*Xss^((b-phi1)/(1-b))*a*ec^(-b)*(1-en)^eta; | |
62 | n = log(en); | |
63 | k = log(ek); | |
64 | m = log(em); | |
65 | c = log(ec); | |
66 | y = log(ey); | |
67 | R = log(eR); | |
68 | end; | |
69 | ||
70 | steady; | |
71 |
51 | 51 | SectionIn RO |
52 | 52 | !insertmacro DETERMINE_CONTEXT |
53 | 53 | SetOutPath $INSTDIR |
54 | File README.txt mexopts-win32.bat mexopts-win64.bat ..\license.txt ..\dynare.el | |
54 | File README.txt ..\NEWS mexopts-win32.bat mexopts-win64.bat ..\license.txt ..\dynare.el | |
55 | 55 | |
56 | 56 | SetOutPath $INSTDIR\matlab |
57 | 57 | File /r ..\matlab\*.m |
142 | 142 | # First delete the uninstaller |
143 | 143 | Delete $INSTDIR\uninstall.exe |
144 | 144 | Delete $INSTDIR\README.txt |
145 | Delete $INSTDIR\NEWS | |
145 | 146 | Delete $INSTDIR\license.txt |
146 | 147 | Delete $INSTDIR\mexopts-win32.bat |
147 | 148 | Delete $INSTDIR\mexopts-win64.bat |