Merge branch 'master' into ecb-master

time-shift
Stéphane Adjemian (Charybdis) 2017-06-03 14:51:28 +02:00
commit 7d373f0d7e
741 changed files with 8340 additions and 7707 deletions

4
.gitignore vendored
View File

@ -60,6 +60,7 @@ checksum
/doc/dynare.info
/doc/dynare.info-1
/doc/dynare.info-2
/doc/dynare.info-3
/doc/dynare.cp
/doc/dynare.fn
/doc/dynare.fns
@ -212,3 +213,6 @@ tests/julia/rbc/rbc*.jl
# Octave variables saved when Octave crashes
octave-workspace
# VERSION generated file
VERSION

797
NEWS
View File

@ -1,3 +1,800 @@
Announcement for Dynare 4.5.0 (on 2013-12-16)
=============================================
We are pleased to announce the release of Dynare 4.5.0.
This major release adds new features and fixes various bugs.
The Windows packages are already available for download at:
http://www.dynare.org/download/dynare-stable
The Mac and Debian/Ubuntu packages should follow soon.
All users are strongly encouraged to upgrade.
This release is compatible with MATLAB versions ranging from 7.3 (R2006b) to
9.2 (R2017a) and with GNU Octave version 4.2.
Here is the list of major user-visible changes:
Dynare 4.5
==========
- Ramsey policy
+ Added command `ramsey_model` that builds the expanded model with
FOC conditions for the planner's problem but doesn't perform any
computation. Usefull to compute Ramsey policy in a perfect
foresight model,
+ `ramsey_policy` accepts multipliers in its variable list and
displays results for them.
- Perfect foresight models
+ New commands `perfect_foresight_setup` (for preparing the
simulation) and `perfect_foresight_solver` (for computing it). The
old `simul` command still exist and is now an alias for
`perfect_foresight_setup` + `perfect_foresight_solver`. It is no
longer possible to manipulate by hand the contents of
`oo_.exo_simul` when using `simul`. People who want to do
it must first call `perfect_foresight_setup`, then do the
manipulations, then call `perfect_foresight_solver`,
+ By default, the perfect foresight solver will try a homotopy
method if it fails to converge at the first try. The old behavior
can be restored with the `no_homotopy` option,
+ New option `stack_solve_algo=7` that allows specifying a
`solve_algo` solver for solving the model,
+ New option `solve_algo` that allows specifying a solver for
solving the model when using `stack_solve_algo=7`,
+ New option `lmmcp` that solves the model via a Levenberg-Marquardt
mixed complementarity problem (LMMCP) solver,
+ New option `robust_lin_solve` that triggers the use of a robust
linear solver for the default `solve_algo=4`,
+ New options `tolf` and `tolx` to control termination criteria of
solvers,
+ New option `endogenous_terminal_period` to `simul`,
+ Added the possibility to set the initial condition of the
(stochastic) extended path simulations with the histval block.
- Optimal simple rules
+ Saves the optimal value of parameters to `oo_.osr.optim_params`,
+ New block `osr_params_bounds` allows specifying bounds for the
estimated parameters,
+ New option `opt_algo` allows selecting different optimizers while
the new option `optim` allows specifying the optimizer options,
+ The `osr` command now saves the names, bounds, and indices for the
estimated parameters as well as the indices and weights of the
variables entering the objective function into `M_.osr`.
- Forecasts and Smoothing
+ The smoother and forecasts take uncertainty about trends and means
into account,
+ Forecasts accounting for measurement error are now saved in fields
of the form `HPDinf_ME` and `HPDsup_ME`,
+ New fields `oo_.Smoother.Trend` and `oo_.Smoother.Constant` that
save the trend and constant parts of the smoothed variables,
+ new field `oo_.Smoother.TrendCoeffs` that stores the trend
coefficients.
+ Rolling window forecasts allowed in `estimation` command by
passing a vector to `first_obs`,
+ The `calib_smoother` command now accepts the `loglinear`,
`prefilter`, `first_obs` and `filter_decomposition` options.
- Estimation
+ New options: `logdata`, `consider_all_endogenous`,
`consider_only_observed`, `posterior_max_subsample_draws`,
`mh_conf_sig`, `diffuse_kalman_tol`, `dirname`, `nodecomposition`
+ `load_mh_file` and `mh_recover` now try to load chain's proposal density,
+ New option `load_results_after_load_mh` that allows loading some
posterior results from a previous run if no new MCMC draws are
added,
+ New option `posterior_nograph` that suppresses the generation of
graphs associated with Bayesian IRFs, posterior smoothed objects,
and posterior forecasts,
+ Saves the posterior density at the mode in
`oo_.posterior.optimization.log_density`,
+ The `filter_covariance` option now also works with posterior
sampling like Metropolis-Hastings,
+ New option `no_posterior_kernel_density` to suppress computation
of kernel density of posterior objects,
+ Recursive estimation and forecasting now provides the individual
`oo_` structures for each sample in `oo_recursive_`,
+ The `trace_plot` command can now plot the posterior density,
+ New command `generate_trace_plots` allows generating all trace
plots for one chain,
+ New commands `prior_function` and `posterior_function` that
execute a user-defined function on parameter draws from the
prior/posterior distribution,
+ New option `huge_number` for replacement of infinite bounds with
large number during `mode_compute`,
+ New option `posterior_sampling_method` allows selecting the new
posterior sampling options:
`tailored_random_block_metropolis_hastings` (Tailored randomized
block (TaRB) Metropolis-Hastings), `slice` (Slice sampler),
`independent_metropolis_hastings` (Independent
Metropolis-Hastings),
+ New option `posterior_sampler_options` that allow controlling the
options of the `posterior_sampling_method`, its `scale_file`-option
pair allows loading the `_mh_scale.mat`-file storing the tuned
scale factor from a previous run of `mode_compute=6`,
+ New option `raftery_lewis_diagnostics` that computes Raftery/Lewis
(1992) convergence diagnostics,
+ New option `fast_kalman_filter` that provides fast Kalman filter
using Chandrasekhar recursions as described in Ed Herbst (2015),
+ The `dsge_var` option now saves results at the posterior mode into
`oo_.dsge_var`,
+ New option `smoothed_state_uncertainty` to provide the uncertainty
estimate for the smoothed state estimate from the Kalman smoother,
+ New prior density: generalized Weibull distribution,
+ Option `mh_recover` now allows continuing a crashed chain at the
last save mh-file,
+ New option `nonlinear_filter_initialization` for the
`estimation` command. Controls the initial covariance matrix
of the state variables in nonlinear filters.
+ The `conditional_variance_decomposition` option now displays
output and stores it as a LaTeX-table when the `TeX` option is
invoked,
+ The `use_calibration` to `estimated_params_init` now also works
with ML,
+ Improved initial estimation checks.
- Steady state
+ The default solver for finding the steady state is now a
trust-region solver (can be triggered explicitly with option
`solve_algo=4`),
+ New options `tolf` and `tolx` to control termination criteria of
solver,
+ The debugging mode now provides the termination values in steady
state finding.
- Stochastic simulations
+ New options `nodecomposition`,
+ New option `bandpass_filter` to compute bandpass-filtered
theoretical and simulated moments,
+ New option `one_sided_hp_filter` to compute one-sided HP-filtered
simulated moments,
+ `stoch_simul` displays a simulated variance decomposition when
simulated moments are requested,
+ `stoch_simul` saves skewness and kurtosis into respective fields
of `oo_` when simulated moments have been requested,
+ `stoch_simul` saves the unconditional variance decomposition in
`oo_.variance_decomposition`,
+ New option `dr_display_tol` that governs omission of small terms
in display of decision rules,
+ The `stoch_simul` command now prints the displayed tables as LaTeX
code when the new `TeX` option is enabled,
+ The `loglinear` option now works with lagged and leaded exogenous
variables like news shocks,
+ New option `spectral_density` that allows displaying the spectral
density of (filtered) endogenous variables,
+ New option `contemporaneous_correlation` that allows saving
contemporaneous correlations in addition to the covariances.
- Identification
+ New options `diffuse_filter` and `prior_trunc`,
+ The `identification` command now supports correlations via
simulated moments,
- Sensitivity analysis
+ New blocks `irf_calibration` and `moment_calibration`,
+ Outputs LaTeX tables if the new `TeX` option is used,
+ New option `relative_irf` to `irf_calibration` block.
- Conditional forecast
+ Command `conditional_forecast` now takes into account `histval`
block if present.
- Shock decomposition
+ New option `colormap` to `shocks_decomposition` for controlling
the color map used in the shocks decomposition graphs,
+ `shocks_decomposition` now accepts the `nograph` option,
+ New command `realtime_shock_decomposition` that for each period `T= [presample,...,nobs]`
allows computing the:
* realtime historical shock decomposition `Y(t|T)`, i.e. without observing data in `[T+1,...,nobs]`
* forecast shock decomposition `Y(T+k|T)`
* realtime conditional shock decomposition `Y(T+k|T+k)-Y(T+k|T)`
+ New block `shock_groups` that allows grouping shocks for the
`shock_decomposition` and `realtime_shock_decomposition` commands,
+ New command `plot_shock_decomposition` that allows plotting the
results from `shock_decomposition` and
`realtime_shock_decomposition` for different vintages and shock
groupings.
- Macroprocessor
+ Can now pass a macro-variable to the `@#include` macro directive,
+ New preprocessor flag `-I`, macro directive `@#includepath`, and
dynare config file block `[paths]` to pass a search path to the
macroprocessor to be used for file inclusion via `@#include`.
- Command line
+ New option `onlyclearglobals` (do not clear JIT compiled functions
with recent versions of Matlab),
+ New option `minimal_workspace` to use fewer variables in the
current workspace,
+ New option `params_derivs_order` allows limiting the order of the
derivatives with respect to the parameters that are calculated by
the preprocessor,
+ New command line option `mingw` to support the MinGW-w64 C/C++
Compiler from TDM-GCC for `use_dll`.
- dates/dseries/reporting classes
+ New methods `abs`, `cumprod` and `chain`,
+ New option `tableRowIndent` to `addTable`,
+ Reporting system revamped and made more efficient, dependency on
matlab2tikz has been dropped.
- Optimization algorithms
+ `mode_compute=2` Uses the simulated annealing as described by
Corana et al. (1987),
+ `mode_compute=101` Uses SOLVEOPT as described by Kuntsevich and
Kappel (1997),
+ `mode_compute=102` Uses `simulannealbnd` from Matlab's Global
Optimization Toolbox (if available),
+ New option `silent_optimizer` to shut off output from mode
computing/optimization,
+ New options `verbosity` and `SaveFiles` to control output and
saving of files during mode computing/optimization.
- LaTeX output
+ New command `write_latex_original_model`,
+ New option `write_equation_tags` to `write_latex_dynamic_model`
that allows printing the specified equation tags to the generate
LaTeX code,
+ New command `write_latex_parameter_table` that writes the names and
values of model parameters to a LaTeX table,
+ New command `write_latex_prior_table` that writes the descriptive
statistics about the prior distribution to a LaTeX table,
+ New command `collect_latex_files` that creates one compilable LaTeX
file containing all TeX-output.
- Misc.
+ Provides 64bit preprocessor,
+ Introduces new path management to avoid conflicts with other
toolboxes,
+ Full compatibility with Matlab 2014b's new graphic interface,
+ When using `model(linear)`, Dynare automatically checks
whether the model is truly linear,
+ `usedll`, the `msvc` option now supports `normcdf`, `acosh`,
`asinh`, and `atanh`,
+ New parallel option `NumberOfThreadsPerJob` for Windows nodes that
sets the number of threads assigned to each remote MATLAB/Octave
run,
+ Improved numerical performance of
`schur_statespace_transformation` for very large models,
+ The `all_values_required` option now also works with `histval`,
+ Add missing `horizon` option to `ms_forecast`,
+ BVAR now saves the marginal data density in
`oo_.bvar.log_marginal_data_density` and stores prior and
posterior information in `oo_.bvar.prior` and
`oo_.bvar.posterior`.
* Bugs and problems identified in version 4.4.3 and that have been fixed in version 4.5.0:
- BVAR models
+ `bvar_irf` could display IRFs in an unreadable way when they moved from
negative to positive values,
+ In contrast to what is stated in the documentation, the confidence interval
size `conf_sig` was 0.6 by default instead of 0.9.
- Conditional forecasts
+ The `conditional_forecast` command produced wrong results in calibrated
models when used at initial values outside of the steady state (given with
`initval`),
+ The `plot_conditional_forecast` option could produce unreadable figures if
the areas overlap,
+ The `conditional_forecast` command after MLE crashed,
+ In contrast to what is stated in the manual, the confidence interval size
`conf_sig` was 0.6 by default instead of 0.8.
+ Conditional forecasts were wrong when the declaration of endogenous
variables was not preceeding the declaration of the exogenous
variables and parameters.
- Discretionary policy
+ Dynare allowed running models where the number of instruments did not match
the number of omitted equations,
+ Dynare could crash in some cases when trying to display the solution,
+ Parameter dependence embedded via a `steady_state` was not taken into
account, typically resulting in crashes.
- dseries class
+ When subtracting a dseries object from a number, the number was instead
subtracted from the dseries object.
- DSGE-VAR models
+ Dynare crashed when estimation encountered non-finite values in the Jacobian
at the steady state,
+ The presence of a constant was not considered for degrees of freedom
computation of the Gamma function used during the posterior computation; due
to only affecting the constant term, results should be be unaffected, except
for model_comparison when comparing models with and without.
- Estimation command
+ In contrast to what was stated in the manual, the confidence interval size
`conf_sig` for `forecast` without MCMC was 0.6 by default instead of 0.9,
+ Calling estimation after identification could lead to crashes,
+ When using recursive estimation/forecasting and setting some elements of
`nobs` to be larger than the number of observations T in the data,
`oo_recursive_` contained additional cell entries that simply repeated the
results obtained for `oo_recursive_T`,
+ Computation of Bayesian smoother could crash for larger models when
requesting `forecast` or `filtered_variables`,
+ Geweke convergence diagnostics were not computed on the full MCMC chain when
the `load_mh_file` option was used,
+ The Geweke convergence diagnostics always used the default `taper_steps` and
`geweke_interval`,
+ Bayesian IRFs (`bayesian_irfs` option) could be displayed in an unreadable
way when they move from negative to positive values,
+ If `bayesian_irfs` was requested when `mh_replic` was too low to compute
HPDIs, plotting was crashing,
+ The x-axis value in `oo_.prior_density` for the standard deviation and
correlation of measurement errors was written into a field
`mearsurement_errors_*` instead of `measurement_errors_*`,
+ Using a user-defined `mode_compute` crashed estimation,
+ Option `mode_compute=10` did not work with infinite prior bounds,
+ The posterior variances and covariances computed by `moments_varendo` were
wrong for very large models due to a matrix erroneously being filled up with
zeros,
+ Using the `forecast` option with `loglinear` erroneously added the unlogged
steady state,
+ When using the `loglinear` option the check for the presence of a constant
was erroneously based on the unlogged steady state,
+ Estimation of `observation_trends` was broken as the trends specified as a
function of deep parameters were not correctly updated during estimation,
+ When using `analytic_derivation`, the parameter values were not set before
testing whether the steady state file changes parameter values, leading to
subsequent crashes,
+ If the steady state of an initial parameterization did not solve, the
observation equation could erroneously feature no constant when the
`use_calibration` option was used,
+ When computing posterior moments, Dynare falsely displayed that moment
computations are skipped, although the computation was performed correctly,
+ If `conditional_variance_decomposition` was requested, although all
variables contain unit roots, Dynare crashed instead of providing an error
message,
+ Computation of the posterior parameter distribution was erroneously based
on more draws than specified (there was one additional draw for every Markov
chain),
+ The estimation option `lyapunov=fixed_point` was broken,
+ Computation of `filtered_vars` with only one requested step crashed Dynare,
+ Option `kalman_algo=3` was broken with non-diagonal measurement error,
+ When using the diffuse Kalman filter with missing observations, an additive
factor log(2*pi) was missing in the last iteration step,
+ Passing of the `MaxFunEvals` and `InitialSimplexSize` options to
`mode_compute=8` was broken,
+ Bayesian forecasts contained initial conditions and had the wrong length in
both plots and stored variables,
+ Filtered variables obtained with `mh_replic=0`, ML, or
`calibrated_smoother` were padded with zeros at the beginning and end and
had the wrong length in stored variables,
+ Computation of smoothed measurement errors in Bayesian estimation was broken,
+ The `selected_variables_only` option (`mh_replic=0`, ML, or
`calibrated_smoother`) returned wrong results for smoothed, updated, and
filtered variables,
+ Combining the `selected_variables_only` option with forecasts obtained
using `mh_replic=0`, ML, or `calibrated_smoother` leaded to crashes,
+ `oo_.UpdatedVariables` was only filled when the `filtered_vars` option was specified,
+ When using Bayesian estimation with `filtered_vars`, but without
`smoother`, then `oo_.FilteredVariables` erroneously also contained filtered
variables at the posterior mean as with `mh_replic=0`,
+ Running an MCMC a second time in the same folder with a different number of
iterations could result in crashes due to the loading of stale files,
+ Results displayed after Bayesian estimation when not specifying
the `smoother` option were based on the parameters at the mode
from mode finding instead of the mean parameters from the
posterior draws. This affected the smoother results displayed, but
also calls to subsequent command relying on the parameters stored
in `M_.params` like `stoch_simul`,
+ The content of `oo_.posterior_std` after Bayesian estimation was based on
the standard deviation at the posterior mode, not the one from the MCMC, this
was not consistent with the reference manual,
+ When the initialization of an MCMC run failed, the metropolis.log file was
locked, requiring a restart of Matlab to restart estimation,
+ If the posterior mode was right at the corner of the prior bounds, the
initialization of the MCMC erroneously crashed,
+ If the number of dropped draws via `mh_drop` coincided with the number of
draws in a `_mh'-file`, `oo_.posterior.metropolis.mean` and
`oo_.posterior.metropolis.Variance` were NaN.
- Estimation and calibrated smoother
+ When using `observation_trends` with the `prefilter` option, the mean shift
due to the trend was not accounted for,
+ When using `first_obs`>1, the higher trend starting point of
`observation_trends` was not taken into account, leading, among other things,
to problems in recursive forecasting,
+ The diffuse Kalman smoother was crashing if the forecast error variance
matrix becomes singular,
+ The multivariate Kalman smoother provided incorrect state estimates when
all data for one observation are missing,
+ The multivariate diffuse Kalman smoother provided incorrect state estimates
when the `Finf` matrix becomes singular,
+ The univariate diffuse Kalman filter was crashing if the initial covariance
matrix of the nonstationary state vector is singular,
- Forecats
+ In contrast to what is stated in the manual, the confidence interval size
`conf_sig` was 0.6 by default instead of 0.9.
+ Forecasting with exogenous deterministic variables provided wrong decision
rules, yielding wrong forecasts.
+ Forecasting with exogenous deterministic variables crashed when the
`periods` option was not explicitly specified,
+ Option `forecast` when used with `initval` was using the initial values in
the `initval` block and not the steady state computed from these initial
values as the starting point of forecasts.
- Global Sensitivity Analysis
+ Sensitivity with ML estimation could result in crashes,
+ Option `mc` must be forced if `neighborhood_width` is used,
+ Fixed dimension of `stock_logpo` and `stock_ys`,
+ Incomplete variable initialization could lead to crashes with `prior_range=1`.
- Indentification
+ Identification did not correctly pass the `lik_init` option,
requiring the manual setting of `options_.diffuse_filter=1` in
case of unit roots,
+ Testing identification of standard deviations as the only
parameters to be estimated with ML leaded to crashes,
+ Automatic increase of the lag number for autocovariances when the
number of parameters is bigger than the number of non-zero moments
was broken,
+ When using ML, the asymptotic Hessian was not computed,
+ Checking for singular values when the eigenvectors contained only
one column did not work correctly,
- Model comparison
+ Selection of the `modifiedharmonicmean` estimator was broken,
- Optimal Simple Rules
+ When covariances were specified, variables that only entered with
their variance and no covariance term obtained a wrong weight,
resulting in wrong results,
+ Results reported for stochastic simulations after `osr` were based
on the last parameter vector encountered during optimization,
which does not necessarily coincide with the optimal parameter
vector,
+ Using only one (co)variance in the objective function resulted in crashes,
+ For models with non-stationary variables the objective function was computed wrongly.
- Ramsey policy
+ If a Lagrange multiplier appeared in the model with a lead or a lag
of more than one period, the steady state could be wrong.
+ When using an external steady state file, incorrect steady states
could be accepted,
+ When using an external steady state file with more than one
instrument, Dynare crashed,
+ When using an external steady state file and running `stoch_simul`
after `ramsey_planner`, an incorrect steady state was used,
+ When the number of instruments was not equal to the number of
omitted equations, Dynare crashed with a cryptic message,
+ The `planner_objective` accepted `varexo`, but ignored them for computations,
- Shock decomposition
+ Did not work with the `parameter_set=calibration` option if an
`estimated_params` block is present,
+ Crashed after MLE.
- Perfect foresight models
+ The perfect foresight solver could accept a complex solution
instead of continuing to look for a real-valued one,
+ The `initval_file` command only accepted column and not row vectors,
+ The `initval_file` command did not work with Excel files,
+ Deterministic simulations with one boundary condition crashed in
`solve_one_boundary` due to a missing underscore when passing
`options_.simul.maxit`,
+ Deterministic simulation with exogenous variables lagged by more
than one period crashed,
+ Termination criterion `maxit` was hard-coded for `solve_algo=0`
and could no be changed,
+ When using `block`/`bytecode`, relational operators could not be enforced,
+ When using `block` some exceptions were not properly handled,
leading to code crashes,
+ Using `periods=1` crashed the solver (bug only partially fixed).
- Smoothing
+ The univariate Kalman smoother returned wrong results when used
with correlated measurement error,
+ The diffuse smoother sometimes returned linear combinations of the
smoothed stochastic trend estimates instead of the original trend
estimates.
- Perturbation reduced form
+ In contrast to what is stated in the manual, the results of the
unconditional variance decomposition were only stored in
`oo_.gamma_y(nar+2)`, not in `oo_.variance_decomposition`,
+ Dynare could crash when the steady state could not be computed
when using the `loglinear` option,
+ Using `bytcode` when declared exogenous variables were not
used in the model leaded to crashes in stochastic simulations,
+ Displaying decision rules involving lags of auxiliary variables of
type 0 (leads>1) crashed.
+ The `relative_irf` option resulted in wrong output at `order>1` as
it implicitly relies on linearity.
- Displaying of the MH-history with the `internals` command crashed
if parameter names did not have same length.
- Dynare crashed when the user-defined steady state file returned an
error code, but not an conformable-sized steady state vector.
- Due to a bug in `mjdgges.mex` unstable parameter draws with
eigenvalues up to 1+1e-6 could be accepted as stable for the
purpose of the Blanchard-Kahn conditions, even if `qz_criterium<1`.
- The `use_dll` option on Octave for Windows required to pass a
compiler flag at the command line, despite the manual stating this
was not necessary.
- Dynare crashed for models with `block` option if the Blanchard-Kahn
conditions were not satisfied instead of generating an error
message.
- The `verbose` option did not work with `model(block)`.
- When falsely specifying the `model(linear)` for nonlinear models,
incorrect steady states were accepted instead of aborting.
- The `STEADY_STATE` operator called on model local variables
(so-called pound variables) did not work as expected.
- The substring operator in macro-processor was broken. The
characters of the substring could be mixed with random characters
from the memory space.
- Block decomposition could sometimes cause the preprocessor to crash.
- A bug when external functions were used in model local variables
that were contained in equations that required auxiliary
variable/equations led to crashes of Matlab.
- Sampling from the prior distribution for an inverse gamma II
distribution when `prior_trunc>0` could result in incorrect
sampling.
- Sampling from the prior distribution for a uniform distribution
when `prior_trunc>0` was ignoring the prior truncation.
- Conditional forecasts were wrong when the declaration of endogenous
variables was not preceeding the declaration of the exogenous
variables and parameters.
Announcement for Dynare 4.4.3 (on 2014-07-31)
=============================================

View File

@ -303,7 +303,7 @@ After this, prepare the source and configure the build tree as described for Lin
- **NB**: If not compiling Dynare mex files for Octave, add ```--without-octave``` to the installation command
- **NB**: To compile the latest stable version of dynare, follow the same instructions as above, omitting the ```--HEAD``` argument
- **NB**: To update a ```--HEAD``` install of dynare you need to uninstall it then install it again: ```brew uninstall dynare; brew install dynare --HEAD```.
- **NB**: If you want to maintain a separate git directory of dynare, you can do a ```--HEAD``` install of dynare, then uninstall it. This will have the effect of bringing in all the dependencies you will need to then compile dynare from your git directory. Then, change to the git directory and type:
- **NB**: If you want to maintain a separate git directory of dynare, you can do a ```--HEAD``` install of dynare, then uninstall it. This will have the effect of bringing in all the dependencies you will need to then compile dynare from your git directory. (For `flex` and `bison` it may be necessary to symlink them via `brew link bison --force` and `brew link flex --force` as they are keg-only). Then, change to the git directory and type:
- ```autoreconf -si; ./configure --with-matlab=/Applications/MATLAB_R2015a.app MATLAB_VERSION=R2015a```, adjusting the Matlab path and version to accord with your version
- Once compilation is done, open Matlab and type the last line shown when you type ```brew info dynare``` in the Terminal window. With the typical Homebrew setup, this is:
- ```addpath /usr/local/opt/dynare/lib/dynare/matlab```

1
VERSION.in Normal file
View File

@ -0,0 +1 @@
@PACKAGE_VERSION@

View File

@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.62])
AC_INIT([dynare], [4.5-unstable])
AC_INIT([dynare], [4.6-unstable])
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
@ -172,6 +172,7 @@ esac
AX_PTHREAD
AC_CONFIG_FILES([Makefile
VERSION
preprocessor/macro/Makefile
preprocessor/Makefile
doc/Makefile

View File

@ -12,7 +12,7 @@
\begin{document}
\title{BVAR models ``\`a la Sims'' in Dynare\thanks{Copyright \copyright~2007--2015 S\'ebastien
Villemot; \copyright~2016 S\'ebastien
Villemot; \copyright~2016--2017 S\'ebastien
Villemot and Johannes Pfeifer. Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free Documentation
License, Version 1.3 or any later version published by the Free
@ -27,7 +27,7 @@
\author{S\'ebastien Villemot\thanks{Paris School of Economics and
CEPREMAP.} \and Johannes Pfeifer\thanks{University of Cologne. E-mail: \href{mailto:jpfeifer@uni-koeln.de}{\texttt{jpfeifer@uni-koeln.de}}.}}
\date{First version: September 2007 \hspace{1cm} This version: October 2016}
\date{First version: September 2007 \hspace{1cm} This version: May 2017}
\maketitle
@ -545,7 +545,7 @@ Most results are stored for future use:
The syntax for computing impulse response functions is:
\medskip
\texttt{bvar\_irf(}\textit{number\_of\_periods},\textit{identification\_scheme}\texttt{);}
\texttt{bvar\_irf(}\textit{number\_of\_lags},\textit{identification\_scheme}\texttt{);}
\medskip
The \textit{identification\_scheme} option has two potential values
@ -556,7 +556,25 @@ The \textit{identification\_scheme} option has two potential values
Keep in mind that the first factorization of the covariance matrix is sensible to the ordering of the variables (as declared in the mod file with \verb+var+). This is not the case of the second factorization, but its structural interpretation is, at best, unclear (the Matrix square root of a covariance matrix, $\Sigma$, is the unique symmetric matrix $A$ such that $\Sigma = AA$).\newline
The mean, median, variance and confidence intervals for IRFs are saved in \texttt{oo\_.bvar.irf}
If you want to change the length of the IRFs plotted by the command, you can put\\
\medskip
\texttt{options\_.irf=40;}\\
\medskip
before the \texttt{bvar\_irf}-command. Similarly, to change the coverage of the highest posterior density intervals to e.g. 60\% you can put the command\\
\medskip
\texttt{options\_.bvar.conf\_sig=0.6;}\\
\medskip
there.\newline
The mean, median, variance, and confidence intervals for IRFs are saved in \texttt{oo\_.bvar.irf}
\section{Examples}

View File

@ -6114,7 +6114,7 @@ singularity is encountered, Dynare by default automatically switches to the univ
recursions as described by @cite{Herbst, 2015}. This setting is only used with
@code{kalman_algo=1} or @code{kalman_algo=3}. In case of using the diffuse Kalman
filter (@code{kalman_algo=3/lik_init=3}), the observables must be stationary. This option
is not yet compatible with @code{analytical_derivation}.
is not yet compatible with @ref{analytic_derivation}.
@item kalman_tol = @var{DOUBLE}
@anchor{kalman_tol} Numerical tolerance for determining the singularity of the covariance matrix of the prediction errors during the Kalman filter (minimum allowed reciprocal of the matrix condition number). Default value is @code{1e-10}
@ -6260,9 +6260,10 @@ where the model is ill-behaved. By default the original objective function is
used.
@item analytic_derivation
@anchor{analytic_derivation}
Triggers estimation with analytic gradient. The final hessian is also
computed analytically. Only works for stationary models without
missing observations.
missing observations, i.e. for @code{kalman_algo<3}.
@item ar = @var{INTEGER}
@xref{ar}. Only useful in conjunction with option @code{moments_varendo}.

View File

@ -101,7 +101,11 @@ void SystemResources::getRUS(double& load_avg, long int& pg_avail,
majflt = -1;
#endif
#if !defined(__MINGW32__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) && !defined(__MINGW64__) && !defined(__CYGWIN64__)
#define MINGCYGTMP (!defined(__MINGW32__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__))
#define MINGCYG (MINGCYGTMP && !defined(__MINGW64__) && !defined(__CYGWIN64__))
#if MINGCYG
getloadavg(&load_avg, 1);
#else
load_avg = -1.0;

View File

@ -1,16 +1,15 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dynare
Upstream-Contact: Dynare Team, whose members in 2016 are:
Upstream-Contact: Dynare Team, whose members in 2017 are:
Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
Houtan Bastani <houtan@dynare.org>
Michel Juillard <michel.juillard@mjui.fr>
Frédéric Karamé <frederic.karame@univ-lemans.fr>
Junior Maih <junior.maih@gmail.com>
Ferhat Mihoubi <fmihoubi@univ-evry.fr>
George Perendia <george@perendia.orangehome.co.uk>
Johannes Pfeifer <jpfeifer@gmx.de>
Marco Ratto <marco.ratto@jrc.ec.europa.eu>
Sébastien Villemot <sebastien@dynare.org>
Marco Ratto <marco.ratto@ec.europa.eu>
Sébastien Villemot <sebastien.villemot@sciencespo.fr>
Source: http://www.dynare.org
Files: *
@ -205,7 +204,7 @@ License: permissive
Unlimited permission is granted to everyone to use, copy, modify or
distribute this software.
Files: matlab/utilities\graphics\distinguishable_colors.m
Files: matlab/utilities/graphics/distinguishable_colors.m
Copyright 2010-2011 by Timothy E. Holy
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -228,7 +227,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Files: matlab/utilities\graphics\colorspace.m
Files: matlab/utilities/graphics/colorspace.m
Pascal Getreuer 2005-2010
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,20 +0,0 @@
function display(t)
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
fprintf('%s = <dynTimeIndex: %s>\n', inputname(1), int2str(t.index));

View File

@ -1,61 +0,0 @@
function t = dynTimeIndex() % --*-- Unitary tests --*--
% t = dynTimeIndex()
%
% Constructor for the dynTimeIndex class.
%
% INPUTS:
% None.
%
% OUTPUTS:
% * t, dynTimeIndex object.
%
% DESCRIPTION:
% The dynTimeIndex object is used to shift backward or forward dseries objects. For instance, if ts
% is a dseries object and t is a dynTimeIndex object then the following expressions are equivalent:
%
% us = ts.lag()
% us = ts.lag(1)
% us = lag(ts,1)
% us = ts(t-1)
%
% This class has only one member: t = int8(0) when instantiated.
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
t = struct();
t.index = int8(0);
t = class(t,'dynTimeIndex');
%@test:1
%$ % Instantiate a dynTimeIndex object
%$ try
%$ u = dynTimeIndex();
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ if t(1)
%$ t(2) = isa(u,'dynTimeIndex');
%$ end
%$
%$ T = all(t);
%@eof:1

View File

@ -1,62 +0,0 @@
function C = minus(A,B) % --*-- Unitary tests --*--
% C = minus(A,B)
%
% Overloads binary minus operator.
%
% INPUTS:
% * A, dynTimeIndex object.
% * B, integer scalar.
%
% OUTPUTS:
% * C, dynTimeIndex object.
%
% EXAMPLE:
%
% >> t = dynTimeIndex();
% >> t.index
%
% ans =
%
% 0
%
% >> s = t-1;
% >> s.index
%
% ans =
%
% -1
%
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~(isa(A,'dynTimeIndex') || isint(B))
error(['dynTimeIndex::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be a dynTimeIndex object and an integer!'])
end
C = struct();
C.index = A.index-B;
C = class(C,'dynTimeIndex');
%@test:1
%$ a = dynTimeIndex();
%$ b = a-1;
%$ t(1) = isa(b,'dynTimeIndex');
%$ t(2) = isequal(b.index,-int8(1));
%$ T = all(t);
%@eof:1

View File

@ -1,74 +0,0 @@
function C = mpower(A,B) % --*-- Unitary tests --*--
% C = mpower(A,B)
%
% Overloads binary mpower operator (^).
%
% INPUTS :
% * A, dynTimeIndex object.
% * B, integer scalar.
%
% OUTPUTS :
% * C, dynTimeIndex object.
%
% EXAMPLE 1 :
%
% >> B = dynTimeIndex()-1;
% >> B
% B = <dynTimeIndex: -1>
% >> B^4
% ans = <dynTimeIndex: -4>
% >>
%
% EXAMPLE 2 :
% This method can be used to apply the lead and lag methods an arbitrary number of times to a dseries object. For instance, if
% ts is a dseries object, and if we define
%
% >> B = dynTimeIndex()-1;
% >> F = dynTimeIndex()+1;
%
% B and F can be used as lag and lead operators and the following syntax:
%
% >> us = ts(F^2);
%
% is equivalent to
%
% >> us = ts.lead(2)
%
% or
%
% >> us = ts.lead.lead
%
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~(isa(A,'dynTimeIndex') || isint(B))
error(['dynTimeIndex::mpower: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be a dynTimeIndex object and an integer!'])
end
C = struct();
C.index = A.index*B;
C = class(C,'dynTimeIndex');
%@test:1
%$ a = dynTimeIndex()+1;
%$ b = a^2;
%$ t(1) = isa(b,'dynTimeIndex');
%$ t(2) = isequal(b.index,int8(2));
%$ T = all(t);
%@eof:1

View File

@ -1,62 +0,0 @@
function C = plus(A,B) % --*-- Unitary tests --*--
% C = plus(A,B)
%
% Overloads binary plus operator.
%
% INPUTS:
% * A, dynTimeIndex object.
% * B, integer scalar.
%
% OUTPUTS:
% * C, dynTimeIndex object.
%
% EXAMPLE:
%
% >> t = dynTimeIndex();
% >> t.index
%
% ans =
%
% 0
%
% >> s = t+1;
% >> s.index
%
% ans =
%
% 1
%
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~(isa(A,'dynTimeIndex') || isint(B))
error(['dynTimeIndex::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be a dynTimeIndex object and an integer!'])
end
C = struct();
C.index = A.index+B;
C = class(C,'dynTimeIndex');
%@test:1
%$ a = dynTimeIndex();
%$ b = a+1;
%$ t(1) = isa(b,'dynTimeIndex');
%$ t(2) = isequal(b.index,int8(1));
%$ T = all(t);
%@eof:1

View File

@ -1,20 +0,0 @@
function val = subsasgn(val, idx, rhs)
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
error('dynTimeIndex::subsasgn: Members of dynTimeIndex class are private!')

View File

@ -1,54 +0,0 @@
function B = subsref(A,S) % --*-- Unitary tests --*--
% B = subsref(A,S)
%
% Overloads the subsref method for dynTimeIndex class. This method only allows to get
% the value of the field `index`.
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if length(S)>1
error('dynTimeIndex::subsref: Something is wrong in your syntax!')
end
if isequal(S.type,'.')
if isequal(S.subs,'index')
B = builtin('subsref', A, S(1));
else
error(['dynTimeIndex::subsref: ' S.subs ' is not a known member!'])
end
else
error('dynTimeIndex::subsref: Something is wrong in your syntax!')
end
%@test:1
%$ % Instantiate a dynTimeIndex object
%$ u = dynTimeIndex();
%$ try
%$ v = u.index;
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ if t(1)
%$ t(2) = isequal(v,int8(0));
%$ end
%$
%$ T = all(t);
%@eof:1

View File

@ -8,7 +8,7 @@ function [AHess, DLIK, LIK] = AHessian(T,R,Q,H,P,Y,DT,DYss,DOm,DH,DP,start,mf,ka
% NOTE: the derivative matrices (DT,DR ...) are 3-dim. arrays with last
% dimension equal to the number of structural parameters
% Copyright (C) 2011-2016 Dynare Team
% Copyright (C) 2011-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -39,7 +39,7 @@ F_singular = 1;
lik = zeros(smpl,1); % Initialization of the vector gathering the densities.
LIK = Inf; % Default value of the log likelihood.
if nargout > 1,
if nargout > 1
DLIK = zeros(k,1); % Initialization of the score.
end
AHess = zeros(k,k); % Initialization of the Hessian
@ -66,9 +66,7 @@ while notsteady && t<smpl
iF = inv(F);
K = P(:,mf)*iF;
lik(t) = log(det(F))+transpose(v)*iF*v;
[DK,DF,DP1] = computeDKalman(T,DT,DOm,P,DP,DH,mf,iF,K);
for ii = 1:k
Dv(:,ii) = -Da(mf,ii) - DYss(mf,ii);
Da(:,ii) = DT(:,:,ii)*(a+K*v) + T*(Da(:,ii)+DK(:,:,ii)*v + K*Dv(:,ii));
@ -127,7 +125,7 @@ if t < smpl
end
AHess = -AHess;
if nargout > 1,
if nargout > 1
DLIK = DLIK/2;
end
% adding log-likelihhod constants
@ -150,5 +148,3 @@ for ii = 1:k
end
% end of computeDKalman

View File

@ -1,4 +1,4 @@
function e = SPAimerr(c);
function e = SPAimerr(c)
% e = aimerr(c);
%
% Interpret the return codes generated by the aim routines.

View File

@ -66,12 +66,12 @@ bcols=neq*nlag;q=zeros(qrows,qcols);rts=zeros(qcols,1);
[h,q,iq,nexact]=SPExact_shift(h,q,iq,qrows,qcols,neq);
if (iq>qrows)
aimcode = 61;
return;
return
end
[h,q,iq,nnumeric]=SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn);
if (iq>qrows)
aimcode = 62;
return;
return
end
[a,ia,js] = SPBuild_a(h,qcols,neq);
if (ia ~= 0)
@ -81,7 +81,7 @@ if (ia ~= 0)
return
end
[w,rts,lgroots,flag_trouble]=SPEigensystem(a,uprbnd,min(length(js),qrows-iq+1));
if flag_trouble==1;
if flag_trouble==1
disp('Problem in SPEIG');
aimcode=64;
return

View File

@ -44,4 +44,3 @@ while( any(zerorows) && iq <= qrows )
zerorows = find( sum(abs( hs(:,right)' ))==0 );
end
h=full(hs);

View File

@ -1,4 +1,4 @@
function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn)
% [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,b,condn);
%
% Compute reduced-form coefficient matrix, b.
@ -48,4 +48,3 @@ else %rescale by dividing row by maximal qr element
b = full(b);
end
end

View File

@ -3,12 +3,12 @@ function [dr,aimcode,rts]=dynAIMsolver1(jacobia_,M_,dr)
% Maps Dynare jacobia to AIM 1st order model solver designed and developed by Gary ANderson
% and derives the solution for gy=dr.hgx and gu=dr.hgu from the AIM outputs
% AIM System is given as a sum:
% i.e. for i=-$...+& SUM(Hi*xt+i)= £*zt, t = 0, . . . ,?
% i.e. for i=-$...+& SUM(Hi*xt+i)= £*zt, t = 0, . . . ,?
% and its input as single array of matrices: [H-$... Hi ... H+&]
% and its solution as xt=SUM( Bi*xt+i) + @*£*zt for i=-$...-1
% and its solution as xt=SUM( Bi*xt+i) + @*£*zt for i=-$...-1
% with the output in form bb=[B-$... Bi ... B-1] and @=inv(Ho+H1*B-1)
% Dynare jacobian = [fy'-$... fy'i ... fy'+& fu']
% where [fy'-$... fy'i ... fy'+&]=[H-$... Hi ... H+&] and fu'= £
% where [fy'-$... fy'i ... fy'+&]=[H-$... Hi ... H+&] and fu'= £
%
% INPUTS
% jacobia_ [matrix] 1st order derivative of the model
@ -46,7 +46,7 @@ function [dr,aimcode,rts]=dynAIMsolver1(jacobia_,M_,dr)
%
% GP July 2008
% Copyright (C) 2008-2012 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -51,7 +51,7 @@ function [dr,info]=AIM_first_order_solver(jacobia,M,dr,qz_criterium)
%! @end deftypefn
%@eod:
% Copyright (C) 2001-2016 Dynare Team
% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -91,11 +91,10 @@ if nba ~= nsfwrd
if nba > nsfwrd
temp = temp(nd-nba+1:nd-nsfwrd)-1-qz_criterium;
info(1) = 3;
elseif nba < nsfwrd;
elseif nba < nsfwrd
temp = temp(nd-nsfwrd+1:nd-nba)-1-qz_criterium;
info(1) = 4;
end
info(2) = temp'*temp;
return
end

View File

@ -12,7 +12,7 @@ function [DirectoryName, info] = CheckPath(type,dname)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2013 Dynare Team
% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -16,7 +16,7 @@ function CutSample(M_, options_, estim_params_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2015 Dynare Team
% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -58,7 +58,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,de
% SPECIAL REQUIREMENTS
% None
% Copyright (C) 2006-2016 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -16,7 +16,7 @@ function Draws = GetAllPosteriorDraws(column, FirstMhFile, FirstLine, TotalNumbe
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2011 Dynare Team
% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -13,7 +13,7 @@ function [xparams, logpost] = GetOneDraw(type)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2015 Dynare Team
% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function [mean,variance] = GetPosteriorMeanVariance(M,drop)
% Copyright (C) 2012-2016 Dynare Team
% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -16,7 +16,7 @@ function oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bay
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2006-2016 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -163,7 +163,7 @@ if nvx
end
disp(sprintf(pformat,header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval,...
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
if TeX,
if TeX
name = deblank(M_.exo_names_tex(k,:));
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);
@ -311,7 +311,7 @@ if ncn
end
disp(sprintf(pformat, header_width,name,bayestopt_.p1(ip),post_mean,hpd_interval, ...
pnames(bayestopt_.pshape(ip)+1,:),bayestopt_.p2(ip)));
if TeX,
if TeX
name = ['(',deblank(M_.endo_names_tex(k1,:)) ',' deblank(M_.endo_names_tex(k2,:)),')'];
TeXCore(fid,name,deblank(pnames(bayestopt_.pshape(ip)+1,:)),bayestopt_.p1(ip),...
bayestopt_.p2(ip),post_mean,sqrt(post_var),hpd_interval);

View File

@ -1,6 +1,6 @@
function MakeAllFigures(NumberOfPlots,Caption,FigureProperties,Info)
% Copyright (C) 2005-2009 Dynare Team
% Copyright (C) 2005-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -151,7 +151,7 @@ for i=1:npar
title(nam,'Interpreter','none');
hold off;
drawnow
if subplotnum == MaxNumberOfPlotPerFigure || i == npar;
if subplotnum == MaxNumberOfPlotPerFigure || i == npar
dyn_saveas(hfig,[OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');

View File

@ -16,7 +16,7 @@ function PosteriorIRF(type)
% functions associated with it(the _core1 and _core2).
% See also the comments posterior_sampler.m funtion.
% Copyright (C) 2006-2016 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -178,7 +178,7 @@ if strcmpi(type,'posterior')
end
end
if ~strcmpi(type,'prior'),
if ~strcmpi(type,'prior')
localVars.x=x;
end
@ -202,16 +202,16 @@ localVars.ifil2=ifil2;
localVars.MhDirectoryName=MhDirectoryName;
% Like sequential execution!
if isnumeric(options_.parallel),
if isnumeric(options_.parallel)
[fout] = PosteriorIRF_core1(localVars,1,B,0);
nosaddle = fout.nosaddle;
else
% Parallel execution!
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
for j=1:totCPU-1,
for j=1:totCPU-1
nfiles = ceil(nBlockPerCPU(j)/MAX_nirfs_dsge);
NumberOfIRFfiles_dsge(j+1) =NumberOfIRFfiles_dsge(j)+nfiles;
if MAX_nirfs_dsgevar,
if MAX_nirfs_dsgevar
nfiles = ceil(nBlockPerCPU(j)/MAX_nirfs_dsgevar);
else
nfiles=0;
@ -236,8 +236,8 @@ else
NamFileInput(1,:) = {'',[M_.fname '_static.m']};
NamFileInput(2,:) = {'',[M_.fname '_dynamic.m']};
NamFileInput(3,:) = {'',[M_.fname '_set_auxiliary_variables.m']};
if options_.steadystate_flag,
if options_.steadystate_flag == 1,
if options_.steadystate_flag
if options_.steadystate_flag == 1
NamFileInput(length(NamFileInput)+1,:)={'',[M_.fname '_steadystate.m']};
else
NamFileInput(length(NamFileInput)+1,:)={'',[M_.fname '_steadystate2.m']};
@ -245,7 +245,7 @@ else
end
[fout] = masterParallel(options_.parallel, 1, B,NamFileInput,'PosteriorIRF_core1', localVars, globalVars, options_.parallel_info);
nosaddle=0;
for j=1:length(fout),
for j=1:length(fout)
nosaddle = nosaddle + fout(j).nosaddle;
end
@ -443,11 +443,11 @@ if ~options_.nograph && ~options_.no_graph.posterior
% Comment for testing!
if ~isoctave
if isnumeric(options_.parallel) || (M_.exo_nbr*ceil(size(varlist,1)/MaxNumberOfPlotPerFigure))<8,
if isnumeric(options_.parallel) || (M_.exo_nbr*ceil(size(varlist,1)/MaxNumberOfPlotPerFigure))<8
[fout] = PosteriorIRF_core2(localVars,1,M_.exo_nbr,0);
else
isRemoteOctave = 0;
for indPC=1:length(options_.parallel),
for indPC=1:length(options_.parallel)
isRemoteOctave = isRemoteOctave + (findstr(options_.parallel(indPC).MatlabOctavePath, 'octave'));
end
if isRemoteOctave

View File

@ -23,7 +23,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab)
% SPECIAL REQUIREMENTS.
% None.
%
% Copyright (C) 2006-2016 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -43,7 +43,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab)
global options_ estim_params_ oo_ M_ bayestopt_ dataset_ dataset_info
if nargin<4,
if nargin<4
whoiam=0;
end
@ -55,7 +55,7 @@ irun =myinputs.irun;
irun2=myinputs.irun2;
npar=myinputs.npar;
type=myinputs.type;
if ~strcmpi(type,'prior'),
if ~strcmpi(type,'prior')
x=myinputs.x;
end
@ -102,7 +102,7 @@ end
RemoteFlag = 0;
if whoiam
if Parallel(ThisMatlab).Local==0,
if Parallel(ThisMatlab).Local==0
RemoteFlag =1;
end
prct0={0,whoiam,Parallel(ThisMatlab)};
@ -165,7 +165,7 @@ while fpar<B
elseif info(1) == 5
errordef = 'Rank condition is not satisfied';
end
if strcmpi(type,'prior'),
if strcmpi(type,'prior')
disp(['PosteriorIRF :: Dynare is unable to solve the model (' errordef ')'])
continue
else
@ -240,9 +240,9 @@ while fpar<B
else
stock_irf_bvardsge(:,:,:,IRUN) = reshape(tmp_dsgevar,options_.irf,dataset_.vobs,M_.exo_nbr);
instr = [MhDirectoryName '/' M_.fname '_irf_bvardsge' ...
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];,
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];
eval(['save ' instr]);
if RemoteFlag==1,
if RemoteFlag==1
OutputFileName_bvardsge = [OutputFileName_bvardsge; {[MhDirectoryName filesep], [M_.fname '_irf_bvardsge' int2str(NumberOfIRFfiles_dsgevar) '.mat']}];
end
NumberOfIRFfiles_dsgevar = NumberOfIRFfiles_dsgevar+1;
@ -259,14 +259,14 @@ while fpar<B
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];
eval(['save ' instr]);
NumberOfIRFfiles_dsgevar = NumberOfIRFfiles_dsgevar+1;
if RemoteFlag==1,
if RemoteFlag==1
OutputFileName_bvardsge = [OutputFileName_bvardsge; {[MhDirectoryName filesep], [M_.fname '_irf_bvardsge' int2str(NumberOfIRFfiles_dsgevar) '.mat']}];
end
irun = 0;
end
end
save([MhDirectoryName '/' M_.fname '_irf_dsge' int2str(NumberOfIRFfiles_dsge) '.mat'],'stock_irf_dsge');
if RemoteFlag==1,
if RemoteFlag==1
OutputFileName_dsge = [OutputFileName_dsge; {[MhDirectoryName filesep], [M_.fname '_irf_dsge' int2str(NumberOfIRFfiles_dsge) '.mat']}];
end
NumberOfIRFfiles_dsge = NumberOfIRFfiles_dsge+1;
@ -278,7 +278,7 @@ while fpar<B
end
stock = stock_param;
save([MhDirectoryName '/' M_.fname '_param_irf' int2str(ifil2) '.mat'],'stock');
if RemoteFlag==1,
if RemoteFlag==1
OutputFileName_param = [OutputFileName_param; {[MhDirectoryName filesep], [M_.fname '_param_irf' int2str(ifil2) '.mat']}];
end
ifil2 = ifil2 + 1;

View File

@ -49,7 +49,7 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam,ThisMatlab)
global options_ M_
if nargin<4,
if nargin<4
whoiam=0;
end
@ -85,8 +85,8 @@ end
DirectoryName = CheckPath('Output',M_.dname);
RemoteFlag = 0;
if whoiam,
if Parallel(ThisMatlab).Local==0,
if whoiam
if Parallel(ThisMatlab).Local==0
RemoteFlag =1;
end
prct0={0,whoiam,Parallel(ThisMatlab)};
@ -96,7 +96,7 @@ end
OutputFileName={};
subplotnum = 0;
for i=fpar:npar,
for i=fpar:npar
figunumber = 0;
for j=1:nvar
@ -153,13 +153,13 @@ for i=fpar:npar,
if subplotnum == MaxNumberOfPlotPerFigure || (j == nvar && subplotnum> 0)
figunumber = figunumber+1;
dyn_saveas(hh,[DirectoryName '/' M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)],options_.nodisplay,options_.graph_format);
if RemoteFlag==1,
if RemoteFlag==1
OutputFileName = [OutputFileName; {[DirectoryName,filesep], [M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.*']}];
end
subplotnum = 0;
end
end% loop over selected endo_var
if whoiam,
if whoiam
fprintf('Done! \n');
waitbarString = [ 'Exog. shocks ' int2str(i) '/' int2str(npar) ' done.'];
% fMessageStatus((i-fpar+1)/(npar-fpar+1),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));

View File

@ -25,7 +25,7 @@ function ReshapeMatFiles(type, type2)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2011 Dynare Team
% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -44,15 +44,15 @@ function ReshapeMatFiles(type, type2)
global M_ options_
if nargin==1,
if nargin==1
MhDirectoryName = [ CheckPath('metropolis',M_.dname) filesep ];
else
if strcmpi(type2,'posterior')
MhDirectoryName = [CheckPath('metropolis',M_.dname) filesep ];
elseif strcmpi(type2,'gsa')
if options_.opt_gsa.morris==1,
if options_.opt_gsa.morris==1
MhDirectoryName = [CheckPath('gsa/screen',M_.dname) filesep ];
elseif options_.opt_gsa.morris==2,
elseif options_.opt_gsa.morris==2
MhDirectoryName = [CheckPath('gsa/identif',M_.dname) filesep ];
elseif options_.opt_gsa.pprior
MhDirectoryName = [CheckPath(['gsa' filesep 'prior'],M_.dname) filesep ];

View File

@ -21,7 +21,8 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff] = TaRB_optimiz
% o SteadyState [double] Vector of doubles, steady state level for the endogenous variables.
% o trend_coeff [double] Matrix of doubles, coefficients of the deterministic trend in the measurement equation
%
% Copyright (C) 2015-16 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -40,4 +41,3 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff] = TaRB_optimiz
par_vector(parameterindices,:)=optpar; %reassemble parameter
[fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff] = feval(TargetFun,par_vector,varargin{:}); %call target function

View File

@ -14,7 +14,7 @@ function [] = Tracing()
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2010 Dynare Team
% Copyright (C) 2010-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -134,7 +134,7 @@ for ig = 1:ngrid
g_omega = [aa*tneg(ig) bb]*f_omega*[aa'*tpos(ig); bb']; % selected variables
f_hp = filter_gain(ig)^2*g_omega; % spectral density of selected filtered series
mathp_col(ig,:) = (f_hp(:))'; % store as matrix row
end;
end
f = zeros(nvar,ngrid);
for i=1:nvar

View File

@ -42,7 +42,7 @@ end
% number of components equals number of shocks + 1 (initial conditions)
comp_nbr = size(z,2)-1;
if nargin==8 ,
if nargin==8
if isfield(opts_decomp,'steady_state')
SteadyState = opts_decomp.steady_state;
end
@ -84,7 +84,7 @@ end
nvar = length(i_var);
labels = char(char(shock_names),'Initial values');
if ~(screen_shocks && comp_nbr>18),
if ~(screen_shocks && comp_nbr>18)
screen_shocks=0;
end
comp_nbr0=comp_nbr;
@ -92,7 +92,7 @@ comp_nbr0=comp_nbr;
for j=1:nvar
d0={};
z1 = squeeze(z(i_var(j),:,:));
if screen_shocks,
if screen_shocks
[junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
labels = char(char(shock_names(isort(1:16),:)),'Others', 'Initial values');
zres = sum(z1(isort(17:end),:),1);
@ -107,7 +107,7 @@ for j=1:nvar
d0(LastRow+2,1)={'Legend.'};
d0(LastRow+2,2)={'Shocks include:'};
d0(LastRow+3:LastRow+3+comp_nbr-1,1)=cellstr(labels(1:comp_nbr,:));
for ic=1:comp_nbr,
for ic=1:comp_nbr
group_members = shock_groups.(shock_ind{ic}).shocks;
d0(LastRow+2+ic,2:1+length(group_members))=group_members;
end
@ -124,4 +124,3 @@ for j=1:nvar
clear d0
end

View File

@ -1,5 +1,22 @@
function title=add_filter_subtitle(title,options_)
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~options_.hp_filter && ~options_.one_sided_hp_filter && ~options_.bandpass.indicator %do not filter
%nothing to add here
elseif ~options_.hp_filter && ~options_.one_sided_hp_filter && options_.bandpass.indicator

View File

@ -75,7 +75,7 @@ if isfield(q2a,'name')
if isfield(q2a,'tex_name')
mytex = q2a.tex_name;
end
if mytype==2,
if mytype==2
gtxt = ['PHI' mytxt]; % inflation rate
gtex = ['{\pi(' mytex ')}'];
elseif mytype
@ -101,7 +101,7 @@ if isstruct(aux)
end
yaux=aux.y;
end
if mytype==2,
if mytype==2
gtxt = 'PHI'; % inflation rate
gtex = '\pi';
elseif mytype
@ -115,7 +115,7 @@ nterms = size(z,2);
nfrcst = opts.forecast/4;
for j=1:nvar
if j>1,
if j>1
endo_names = char(endo_names,[deblank(M_.endo_names(i_var(j),:)) '_A']);
endo_names_tex = char(endo_names_tex,['{' deblank(M_.endo_names_tex(i_var(j),:)) '}^A']);
gendo_names = char(gendo_names,[gtxt endo_names(j,:)]);
@ -133,15 +133,15 @@ for j=1:nvar
gendo_names_tex = [gtex '(' deblank(endo_names_tex(j,:)) ')'];
end
end
for k =1:nterms,
if isstruct(aux),
for k =1:nterms
if isstruct(aux)
aux.y = squeeze(yaux(j,k,min((t0-3):-4:1):end));
end
[za(j,k,:), steady_state_a(j,1), gza(j,k,:), steady_state_ga(j,1)] = ...
quarterly2annual(squeeze(z(j,k,min((t0-3):-4:1):end)),steady_state(j),GYTREND0,var_type,islog,aux);
end
ztmp=squeeze(za(j,:,:));
if cumfix==0,
if cumfix==0
zscale = sum(ztmp(1:end-1,:))./ztmp(end,:);
ztmp(1:end-1,:) = ztmp(1:end-1,:)./repmat(zscale,[nterms-1,1]);
else
@ -149,7 +149,7 @@ for j=1:nvar
ztmp(end-1,:) = ztmp(end-1,:) + zres;
end
gztmp=squeeze(gza(j,:,:));
if cumfix==0,
if cumfix==0
gscale = sum(gztmp(1:end-1,:))./ gztmp(end,:);
gztmp(1:end-1,:) = gztmp(1:end-1,:)./repmat(gscale,[nterms-1,1]);
else
@ -160,7 +160,7 @@ for j=1:nvar
gza(j,:,:) = gztmp;
end
if q2a.plot ==1,
if q2a.plot ==1
z=gza;
endo_names = gendo_names;
endo_names_tex = gendo_names_tex;
@ -176,9 +176,9 @@ end
% end
% realtime
if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition')
init=1;
for i=t0:4:t1,
for i=t0:4:t1
yr=floor(i/4);
za=[];
gza=[];
@ -202,13 +202,13 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
% z = z(i_var,:,:);
for j=1:nvar
for k =nterms:-1:1,
for k =nterms:-1:1
% if k<nterms
% ztmp = squeeze(sum(z(j,[1:k-1,k+1:end-1],t0-4:end)));
% else
ztmp = squeeze(z(j,k,min((t0-3):-4:1):end));
% end
if isstruct(aux),
if isstruct(aux)
aux.y = squeeze(yaux(j,k,min((t0-3):-4:1):end));
end
[za(j,k,:), steady_state_a(j,1), gza(j,k,:), steady_state_ga(j,1)] = ...
@ -222,7 +222,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
ztmp=squeeze(za(j,:,:));
if cumfix==0,
if cumfix==0
zscale = sum(ztmp(1:end-1,:))./ztmp(end,:);
ztmp(1:end-1,:) = ztmp(1:end-1,:)./repmat(zscale,[nterms-1,1]);
else
@ -231,7 +231,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
end
gztmp=squeeze(gza(j,:,:));
if cumfix==0,
if cumfix==0
gscale = sum(gztmp(1:end-1,:))./ gztmp(end,:);
gztmp(1:end-1,:) = gztmp(1:end-1,:)./repmat(gscale,[nterms-1,1]);
else
@ -243,7 +243,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
gza(j,:,:) = gztmp;
end
if q2a.plot ==1,
if q2a.plot ==1
z=gza;
elseif q2a.plot == 2
z=za;
@ -251,7 +251,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
z=cat(1,za,gza);
end
if init==1,
if init==1
oo_.annualized_realtime_shock_decomposition.pool = z;
else
oo_.annualized_realtime_shock_decomposition.pool(:,:,yr) = z(:,:,end-nfrcst);
@ -272,7 +272,7 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-nfrcst)])(:,end,:) = ...
oo_.annualized_realtime_shock_decomposition.pool(:,end,yr-nfrcst:end);
if i==t1
for my_forecast_=(nfrcst-1):-1:1,
for my_forecast_=(nfrcst-1):-1:1
oo_.annualized_realtime_conditional_shock_decomposition.(['yr_' int2str(yr-my_forecast_)]) = ...
oo_.annualized_realtime_shock_decomposition.pool(:,:,yr-my_forecast_:yr) - ...
oo_.annualized_realtime_forecast_shock_decomposition.(['yr_' int2str(yr-my_forecast_)])(:,:,1:my_forecast_+1);
@ -320,15 +320,14 @@ if realtime_ && isstruct(oo_) && isfield(oo_, 'realtime_shock_decomposition'),
end
end
if q2a.plot ==0,
if q2a.plot ==0
i_var=1:2*nvar;
steady_state = [steady_state_a;steady_state_ga];
else
i_var=1:nvar;
if q2a.plot ==1,
if q2a.plot ==1
steady_state = steady_state_ga;
else
steady_state = steady_state_a;
end
end

View File

@ -43,7 +43,7 @@ function [InnovationVariance,AutoregressiveParameters] = autoregressive_process_
%
% \sigma^2 = \gamma(0)*(1-PHI'*v)
% Copyright (C) 2009 Dynare Team
% Copyright (C) 2009-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -34,7 +34,7 @@ function DynareOutput = simul_backward_linear_model(initial_conditions, sample_s
%! @end deftypefn
%@eod:
% Copyright (C) 2012-2016 Dynare Team
% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -34,7 +34,7 @@ function DynareOutput = simul_backward_model(initial_conditions, sample_size, Dy
%! @end deftypefn
%@eod:
% Copyright (C) 2012-2016 Dynare Team
% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -14,7 +14,7 @@ function plan = basic_plan(plan, exogenous, expectation_type, date, value)
% plan [structure] Returns a structure containing the updated forecast scenario.
%
%
% Copyright (C) 2013-2014 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -38,7 +38,7 @@ exogenous = strtrim(exogenous);
ix = find(strcmp(exogenous, plan.exo_names));
if isempty(ix)
error(['in basic_plan the second argument ' exogenous ' is not an exogenous variable']);
end;
end
sdate = length(date);
if sdate > 1
if date(1) < plan.date(1) || date(end) > plan.date(end)

View File

@ -11,7 +11,7 @@ function d = bksup0(c,ny,jcf,iyf,icf,periods)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2009 Dynare Team
% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -12,7 +12,7 @@ function d = bksup1(c,ny,jcf,iyf,periods)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2010 Dynare Team
% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -40,4 +40,3 @@ for i = 2:periods
end
d = c(:,jcf) ;

View File

@ -15,7 +15,7 @@ function d1 = bksupk(ny,fid,jcf,icc1)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2011 Dynare Team
% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function x = bseastr(s1,s2)
% Copyright (C) 2001-2009 Dynare Team
% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -45,4 +45,3 @@ for im = 1:m
end
end
end

View File

@ -12,7 +12,7 @@ function bvar_density(maxnlags)
% none
% Copyright (C) 2003-2007 Christopher Sims
% Copyright (C) 2007-2016 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -11,7 +11,7 @@ function bvar_irf(nlags,identification)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2007-2012 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -42,7 +42,7 @@ function [ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags)
% - bvar_prior_{tau,decay,lambda,mu,omega,flat,train}
% Copyright (C) 2003-2007 Christopher Sims
% Copyright (C) 2007-2012 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -216,3 +216,108 @@ dimy = size(ydum);
ydum = reshape(permute(ydum,[1 3 2]),dimy(1)*dimy(3),nv);
xdum = reshape(permute(xdum,[1 3 2]),dimy(1)*dimy(3),nx);
breaks = breaks(1:(end-1));
function var=rfvar3(ydata,lags,xdata,breaks,lambda,mu)
%function var=rfvar3(ydata,lags,xdata,breaks,lambda,mu)
% This algorithm goes for accuracy without worrying about memory requirements.
% ydata: dependent variable data matrix
% xdata: exogenous variable data matrix
% lags: number of lags
% breaks: rows in ydata and xdata after which there is a break. This allows for
% discontinuities in the data (e.g. war years) and for the possibility of
% adding dummy observations to implement a prior. This must be a column vector.
% Note that a single dummy observation becomes lags+1 rows of the data matrix,
% with a break separating it from the rest of the data. The function treats the
% first lags observations at the top and after each "break" in ydata and xdata as
% initial conditions.
% lambda: weight on "co-persistence" prior dummy observations. This expresses
% belief that when data on *all* y's are stable at their initial levels, they will
% tend to persist at that level. lambda=5 is a reasonable first try. With lambda<0,
% constant term is not included in the dummy observation, so that stationary models
% with means equal to initial ybar do not fit the prior mean. With lambda>0, the prior
% implies that large constants are unlikely if unit roots are present.
% mu: weight on "own persistence" prior dummy observation. Expresses belief
% that when y_i has been stable at its initial level, it will tend to persist
% at that level, regardless of the values of other variables. There is
% one of these for each variable. A reasonable first guess is mu=2.
% The program assumes that the first lags rows of ydata and xdata are real data, not dummies.
% Dummy observations should go at the end, if any. If pre-sample x's are not available,
% repeating the initial xdata(lags+1,:) row or copying xdata(lags+1:2*lags,:) into
% xdata(1:lags,:) are reasonable subsititutes. These values are used in forming the
% persistence priors.
% Original file downloaded from:
% http://sims.princeton.edu/yftp/VARtools/matlab/rfvar3.m
[T,nvar] = size(ydata);
nox = isempty(xdata);
if ~nox
[T2,nx] = size(xdata);
else
T2 = T;
nx = 0;
xdata = zeros(T2,0);
end
% note that x must be same length as y, even though first part of x will not be used.
% This is so that the lags parameter can be changed without reshaping the xdata matrix.
if T2 ~= T, error('Mismatch of x and y data lengths'),end
if nargin < 4
nbreaks = 0;
breaks = [];
else
nbreaks = length(breaks);
end
breaks = [0;breaks;T];
smpl = [];
for nb = 1:nbreaks+1
smpl = [smpl;[breaks(nb)+lags+1:breaks(nb+1)]'];
end
Tsmpl = size(smpl,1);
X = zeros(Tsmpl,nvar,lags);
for is = 1:length(smpl)
X(is,:,:) = ydata(smpl(is)-(1:lags),:)';
end
X = [X(:,:) xdata(smpl,:)];
y = ydata(smpl,:);
% Everything now set up with input data for y=Xb+e
% Add persistence dummies
if lambda ~= 0 || mu > 0
ybar = mean(ydata(1:lags,:),1);
if ~nox
xbar = mean(xdata(1:lags,:),1);
else
xbar = [];
end
if lambda ~= 0
if lambda>0
xdum = lambda*[repmat(ybar,1,lags) xbar];
else
lambda = -lambda;
xdum = lambda*[repmat(ybar,1,lags) zeros(size(xbar))];
end
ydum = zeros(1,nvar);
ydum(1,:) = lambda*ybar;
y = [y;ydum];
X = [X;xdum];
end
if mu>0
xdum = [repmat(diag(ybar),1,lags) zeros(nvar,nx)]*mu;
ydum = mu*diag(ybar);
X = [X;xdum];
y = [y;ydum];
end
end
% Compute OLS regression and residuals
[vl,d,vr] = svd(X,0);
di = 1./diag(d);
B = (vr.*repmat(di',nvar*lags+nx,1))*vl'*y;
u = y-X*B;
xxi = vr.*repmat(di',nvar*lags+nx,1);
xxi = xxi*xxi';
var.B = B;
var.u = u;
var.xxi = xxi;

View File

@ -31,7 +31,7 @@ function cprod = cartesian_product_of_sets(varargin)
%! @end deftypefn
%@eod:
% Copyright (C) 2011-2012 Dynare Team
% Copyright (C) 2011-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -9,7 +9,7 @@ function cellofchar2mfile(fname, c, cname)
% OUTPUTS
% None.
% Copyright (C) 2015 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -40,7 +40,7 @@ function [eigenvalues_,result,info] = check(M, options, oo)
%! @end deftypefn
%@eod:
% Copyright (C) 2001-2013 Dynare Team
% Copyright (C) 2001-2014 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -2,7 +2,7 @@ function check_dsge_var_model(Model, EstimatedParameters, BayesInfo)
% Check if the dsge model can be estimated with the DSGE-VAR approach.
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2014 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -12,7 +12,7 @@ function estim_params=check_for_calibrated_covariances(xparam1,estim_params,M)
% Notes: M is local to this function and not updated when calling
% set_all_parameters
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -52,4 +52,3 @@ if any(calibrated_covariance_pos_ME)
estim_params.calibrated_covariances_ME.position=[calibrated_covariance_pos_ME;sub2ind(size(M.H),columns,rows)]; %get linear entries of upper triangular parts
estim_params.calibrated_covariances_ME.cov_value=H_calibrated(estim_params.calibrated_covariances_ME.position);
end

View File

@ -14,7 +14,7 @@ function varlist = check_list_of_variables(options_, M_, varlist)
%
% SPECIAL REQUIREMENTS
% Copyright (C) 2003-2014 Dynare Team
% Copyright (C) 2003-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -33,8 +33,8 @@ function varlist = check_list_of_variables(options_, M_, varlist)
%get uniques
[junk1,junk2,index_uniqes] = varlist_indices(varlist,M_.endo_names);
varlist=varlist(index_uniqes,:);
[junk1,junk2,index_uniques] = varlist_indices(varlist,M_.endo_names);
varlist=varlist(index_uniques,:);
msg = 0;
if options_.dsge_var && options_.bayesian_irf

View File

@ -1,6 +1,6 @@
function check_matlab_path(change_path_flag)
% Copyright (C) 2015-2016 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function check_model(DynareModel)
% Copyright (C) 2005-2012 Dynare Team
% Copyright (C) 2005-2013 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -17,7 +17,7 @@ function [info,description] = check_posterior_analysis_data(type,M_)
% info = 6; % Ok (nothing to do ;-)
% description [string] Message corresponding to info
% Copyright (C) 2008-2015 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -13,7 +13,7 @@ function [posterior_sampler_options, options_] = check_posterior_sampler_options
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2015 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -32,11 +32,11 @@ function [posterior_sampler_options, options_] = check_posterior_sampler_options
init=0;
if isempty(posterior_sampler_options),
if isempty(posterior_sampler_options)
init=1;
end
if init,
if init
% set default options and user defined options
posterior_sampler_options.posterior_sampling_method = options_.posterior_sampler_options.posterior_sampling_method;
posterior_sampler_options.bounds = bounds;
@ -253,7 +253,7 @@ if init,
% This will automatically trigger <rotated>
% default = []
tmp_mode = options_list{i,2};
for j=1:size(tmp_mode,2),
for j=1:size(tmp_mode,2)
posterior_sampler_options.mode(j).m = tmp_mode(:,j);
end
@ -328,7 +328,7 @@ if init,
end
end
if any(isinf(bounds.lb)) || any(isinf(bounds.ub)),
if any(isinf(bounds.lb)) || any(isinf(bounds.ub))
skipline()
disp('some priors are unbounded and prior_trunc is set to zero')
error('The option "slice" is inconsistent with prior_trunc=0.')
@ -347,21 +347,21 @@ if init,
posterior_sampler_options.W1=posterior_sampler_options.initial_step_size*(bounds.ub-bounds.lb);
if options_.load_mh_file,
if options_.load_mh_file
posterior_sampler_options.slice_initialize_with_mode = 0;
else
if ~posterior_sampler_options.slice_initialize_with_mode,
if ~posterior_sampler_options.slice_initialize_with_mode
posterior_sampler_options.invhess=[];
end
end
if ~isempty(posterior_sampler_options.mode_files), % multimodal case
if ~isempty(posterior_sampler_options.mode_files) % multimodal case
modes = posterior_sampler_options.mode_files; % these can be also mean files from previous parallel slice chains
load(modes, 'xparams')
if size(xparams,2)<2,
if size(xparams,2)<2
error(['check_posterior_sampler_options:: Variable xparams loaded in file <' modes '> has size [' int2str(size(xparams,1)) 'x' int2str(size(xparams,2)) ']: it must contain at least two columns, to allow multi-modal sampling.'])
end
for j=1:size(xparams,2),
for j=1:size(xparams,2)
mode(j).m=xparams(:,j);
end
posterior_sampler_options.mode = mode;
@ -386,7 +386,7 @@ if ~strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
end
end
if options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix,
if options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix
[junk, invhess] = compute_mh_covariance_matrix;
posterior_sampler_options.invhess = invhess;
end
@ -396,10 +396,8 @@ end
% check specific options for slice sampler
if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
invhess = posterior_sampler_options.invhess;
if posterior_sampler_options.rotated,
if isempty(posterior_sampler_options.mode_files) && isempty(posterior_sampler_options.mode), % rotated unimodal
if posterior_sampler_options.rotated
if isempty(posterior_sampler_options.mode_files) && isempty(posterior_sampler_options.mode) % rotated unimodal
if ~options_.cova_compute && ~(options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix)
skipline()
disp('check_posterior_sampler_options:: I cannot start rotated slice sampler because')
@ -419,19 +417,13 @@ if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
posterior_sampler_options.WR=sqrt(diag(D))*3;
end
else
if ~options_.load_mh_file && ~posterior_sampler_options.slice_initialize_with_mode,
if ~options_.load_mh_file && ~posterior_sampler_options.slice_initialize_with_mode
posterior_sampler_options.invhess=[];
end
end
% needs to be re-set to zero otherwise posterior analysis is filtered
% out in dynare_estimation_1.m
options_.mh_posterior_mode_estimation = 0;
else
end
return
@ -442,6 +434,3 @@ fnam = fieldnames(sampler_options);
for j=1:length(fnam)
posterior_sampler_options.(fnam{j}) = sampler_options.(fnam{j});
end

View File

@ -18,7 +18,7 @@ function [info,description] = check_prior_analysis_data(type,M_)
% description [string] Message corresponding to info
% Copyright (C) 2009-2011 Dynare Team
% Copyright (C) 2009-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -10,7 +10,7 @@ function check_prior_bounds(xparam1,bounds,M_,estim_params_,options_,bayestopt_)
% -options_ [structure] characterizing the options
% -bayestopt_ [structure] characterizing priors
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -28,16 +28,16 @@ function [R,indef, E, P]=chol_SE(A,pivoting)
% the cost of introduding a permutation.
%
%
% Inputs
% A [n*n] Matrix to be factorized
% pivoting [scalar] dummy whether pivoting is used
% INPUTS
% - A [n*n] Matrix to be factorized
% - pivoting [scalar] dummy whether pivoting is used
%
% Outputs
% R [n*n] originally stored in lower triangular portion of A, including the main diagonal
% OUTPUTS
% - R [n*n] originally stored in lower triangular portion of A, including the main diagonal
%
% E [n*1] Elements added to the diagonal of A
% P [n*1] record of how the rows and columns of the matrix were permuted while
% performing the decomposition
% - E [n*1] Elements added to the diagonal of A
% - P [n*1] record of how the rows and columns of the matrix were permuted while
% performing the decomposition
%
% REFERENCES:
% This implementation is based on
@ -51,9 +51,10 @@ function [R,indef, E, P]=chol_SE(A,pivoting)
%
%
% Author: Johannes Pfeifer based on Eskow/Schnabel (1991)
%
% Copyright (C) 2015 Johannes Pfeifer
% Copyright (C) 2015 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
@ -293,17 +294,16 @@ function g=gersh_nested(A,j,n)
g=zeros(n,1);
for ii = j:n
if ii == 1;
if ii == 1
sum_up_to_i = 0;
else
sum_up_to_i = sum(abs(A(ii,j:(ii-1))));
end;
if ii == n;
end
if ii == n
sum_after_i = 0;
else
sum_after_i = sum(abs(A((ii+1):n,ii)));
end;
end
g(ii) = sum_up_to_i + sum_after_i- A(ii,ii);
end
end

View File

@ -2,7 +2,7 @@ function clear_persistent_variables(folder, writelistofroutinestobecleared)
% Clear all the functions with persistent variables in directory folder (and subdirectories).
% Copyright (C) 2015 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -11,7 +11,7 @@ function varargout = prior(varargin)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2015-2016 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -8,7 +8,7 @@ function collect_latex_files
% - The packages loaded enable pdflatex to run
% - The _dynamic and _static TeX-model files are not included as they are standalone TeX-files
% Copyright (C) 2015-16 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -30,7 +30,7 @@ function [Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,qz_criterium, restrict_colum
% SPECIAL REQUIREMENTS
% None
% Copyright (C) 2006-2011 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -112,4 +112,3 @@ end
Pinf = QT*Pinf*QT';
Pstar = QT*Pstar*QT';

View File

@ -15,7 +15,7 @@ function [posterior_mean,posterior_covariance,posterior_mode,posterior_kernel_at
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2006-2011 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -11,7 +11,7 @@ function moments=compute_model_moments(dr,M_,options_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2008-2009 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -16,7 +16,7 @@ function oo_ = compute_moments_varendo(type,options_,M_,oo_,var_list_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2008-2010 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function overallacceptanceratio = compute_overall_acceptance_ratio(MetropolisFolder, ModelName)
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -18,7 +18,7 @@ function [trend_addition, trend_coeff]=compute_trend_coefficients(M_,DynareOptio
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2014 Dynare Team
% Copyright (C) 2014-2016 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -16,7 +16,7 @@ function ConditionalVarianceDecomposition = conditional_variance_decomposition(S
%
% [1] In this version, absence of measurement errors is assumed...
% Copyright (C) 2010-2011 Dynare Team
% Copyright (C) 2010-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -23,7 +23,7 @@ function oo_ = ...
% OUTPUTS
% oo_ [structure] Dynare structure where the results are saved.
% Copyright (C) 2009-2015 Dynare Team
% Copyright (C) 2009-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -101,7 +101,7 @@ end
my_title='MCMC Inefficiency factors per block';
IFAC_header='Parameter';
IFAC_header_tex='Parameter';
for j=1:nblck,
for j=1:nblck
IFAC_header = char(IFAC_header,['Block ' int2str(j)]);
IFAC_header_tex = char(IFAC_header_tex,['Block~' int2str(j)]);
end
@ -220,7 +220,7 @@ if nblck == 1 % Brooks and Gelman tests need more than one block
end
end
return;
return
end
Origin = 1000;
@ -262,7 +262,7 @@ localVars.M_ = M_;
% Like sequential execution!
if isnumeric(options_.parallel),
if isnumeric(options_.parallel)
fout = McMCDiagnostics_core(localVars,1,npar,0);
UDIAG = fout.UDIAG;
clear fout
@ -276,7 +276,7 @@ else
[fout, nBlockPerCPU, totCPU] = masterParallel(options_.parallel, 1, npar,NamFileInput,'McMCDiagnostics_core', localVars, [], options_.parallel_info);
UDIAG = fout(1).UDIAG;
for j=2:totCPU,
for j=2:totCPU
UDIAG = cat(3,UDIAG ,fout(j).UDIAG);
end
end
@ -346,7 +346,7 @@ if reste
if reste == 1
nr = 3;
nc = 1;
elseif reste == 2;
elseif reste == 2
nr = 2;
nc = 3;
end
@ -391,7 +391,7 @@ if reste
dyn_saveas(h,[ OutputFolder '/' ModelName '_udiag' int2str(pages+1)],options_.nodisplay,options_.graph_format);
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:size(NAMES,1);
for jj = 1:size(NAMES,1)
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TEXNAMES(jj,:)));
end
fprintf(fidTeX,'\\centering \n');
@ -512,4 +512,3 @@ if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
fprintf(fidTeX,'%% End Of TeX file.');
fclose(fidTeX);
end

View File

@ -33,7 +33,7 @@ function myoutput = McMCDiagnostics_core(myinputs,fpar,npar,whoiam, ThisMatlab)
% SPECIAL REQUIREMENTS.
% None.
% Copyright (C) 2006-2016 Dynare Team
% Copyright (C) 2006-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -50,7 +50,7 @@ function myoutput = McMCDiagnostics_core(myinputs,fpar,npar,whoiam, ThisMatlab)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin<4,
if nargin<4
whoiam=0;
end
@ -71,7 +71,7 @@ M_=myinputs.M_;
if whoiam
Parallel=myinputs.Parallel;
end
if ~exist('MetropolisFolder'),
if ~exist('MetropolisFolder')
MetropolisFolder = CheckPath('metropolis',M_.dname);
end
@ -81,16 +81,16 @@ UDIAG = zeros(NumberOfLines,6,npar-fpar+1);
if whoiam
waitbarString = ['Please wait... McMCDiagnostics (' int2str(fpar) 'of' int2str(npar) ')...'];
if Parallel(ThisMatlab).Local,
if Parallel(ThisMatlab).Local
waitbarTitle=['Local '];
else
waitbarTitle=[Parallel(ThisMatlab).ComputerName];
end
fMessageStatus(0,whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));
end
for j=fpar:npar,
for j=fpar:npar
if isoctave
if (whoiam==0),
if (whoiam==0)
printf(' Parameter %d... ',j);
end
else
@ -131,13 +131,13 @@ for j=fpar:npar,
end
end
if isoctave
if (whoiam==0),
if (whoiam==0)
printf('Done! \n');
end
else
fprintf('Done! \n');
end
if whoiam,
if whoiam
waitbarString = [ 'Parameter ' int2str(j) '/' int2str(npar) ' done.'];
fMessageStatus((j-fpar+1)/(npar-fpar+1),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab))
end

View File

@ -26,7 +26,7 @@ function results_struct = geweke_chi2_test(results1,results2,results_struct,opti
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -57,18 +57,16 @@ function results_struct = geweke_chi2_test(results1,results2,results_struct,opti
% based on code by James P. LeSage, who in turn
% drew on MATLAB programs written by Siddartha Chib
for k=1:length(options.convergence.geweke.taper_steps)+1;
for k=1:length(options.convergence.geweke.taper_steps)+1
NSE=[results1(:,3+(k-1)*2) results2(:,3+(k-1)*2)];
means=[results1(:,1) results2(:,1)];
diff_Means=means(:,1)-means(:,2);
sum_of_weights=sum(1./(NSE.^2),2);
pooled_mean=sum(means./(NSE.^2),2)./sum_of_weights;
pooled_NSE=1./sqrt(sum_of_weights);
test_stat=diff_Means.^2./sum(NSE.^2,2);
p = 1-chi2cdf(test_stat,1);
results_struct.pooled_mean(:,k) = pooled_mean;
results_struct.pooled_nse(:,k) = pooled_NSE;
results_struct.prob_chi2_test(:,k) = p;
end;
end

View File

@ -22,7 +22,7 @@ function [results_vec, results_struct] = geweke_moments(draws,Dynareoptions)
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -64,10 +64,10 @@ n_draws_used = ns*n_groups; %effective number of draws used after rounding down
window_means= zeros(n_groups,1);
window_uncentered_variances= zeros(n_groups,1);
for ig=1:n_groups;
for ig=1:n_groups
window_means(ig,1)=sum(draws((ig-1)*ns+1:ig*ns,1))/ns;
window_uncentered_variances(ig,1)=sum(draws((ig-1)*ns+1:ig*ns,1).^2)/ns;
end; %for ig
end %for ig
total_mean=mean(window_means);
total_variance=mean(window_uncentered_variances)-total_mean^2;
@ -88,9 +88,9 @@ results_struct.rne_iid = results_vec(1,4);
%get autocovariance of grouped means
centered_window_means=window_means-total_mean;
autocov_grouped_means=zeros(n_groups,1);
for lag=0:n_groups-1;
for lag=0:n_groups-1
autocov_grouped_means(lag+1)=centered_window_means(lag+1:n_groups,1)'*centered_window_means(1:n_groups-lag,1)/100;
end;
end
% numerical standard error with tapered autocovariance functions
for taper_index=1:length(taper_steps)
@ -105,5 +105,4 @@ for taper_index=1:length(taper_steps)
eval(['results_struct.nse_taper_',num2str(taper),'= NSE_taper;']);
eval(['results_struct.rne_taper_',num2str(taper),'= total_variance/(n_draws_used*NSE_taper^2);']);
end; % end of for mm loop
end % end of for mm loop

View File

@ -36,7 +36,7 @@ function Ifac = mcmc_ifac(X, Nc)
% consistent covariance matrix estimation", Econometrica, 59(3), p. 817-858
% Copyright (C) 2015-16 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -54,7 +54,7 @@ function Ifac = mcmc_ifac(X, Nc)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
Nc = floor(min(Nc, length(X)/2));
if mod(Nc,2),
if mod(Nc,2)
Nc=Nc-1;
end
AcorrXSIM = dyn_autocorr(X(:), Nc);

View File

@ -46,7 +46,7 @@ function [raftery_lewis] = raftery_lewis(runs,q,r,s)
% ----------------------------------------------------
% Copyright (C) 2016 Benjamin Born and Johannes Pfeifer
% Copyright (C) 2016 Dynare Team
% Copyright (C) 2016-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -85,7 +85,7 @@ for nv = 1:n_vars % big loop over variables
work = (runs(:,nv) <= quantile(runs(:,nv),q));
else
error('Quantile must be between 0 and 1');
end;
end
k_thin_current_var = 1;
bic = 1;
@ -95,7 +95,7 @@ for nv = 1:n_vars % big loop over variables
thinned_chain=work(1:k_thin_current_var:n_runs,1);
[g2, bic] = first_vs_second_order_MC_test(thinned_chain);
k_thin_current_var = k_thin_current_var+1;
end;
end
k_thin_current_var = k_thin_current_var-1; %undo last step
@ -103,7 +103,7 @@ for nv = 1:n_vars % big loop over variables
transition_matrix = zeros(2,2);
for i1 = 2:size(thinned_chain,1)
transition_matrix(thinned_chain(i1-1)+1,thinned_chain(i1)+1) = transition_matrix(thinned_chain(i1-1)+1,thinned_chain(i1)+1)+1;
end;
end
alpha = transition_matrix(1,2)/(transition_matrix(1,1)+transition_matrix(1,2)); %prob of going from 1 to 2
beta = transition_matrix(2,1)/(transition_matrix(2,1)+transition_matrix(2,2)); %prob of going from 2 to 1
@ -114,7 +114,7 @@ for nv = 1:n_vars % big loop over variables
thinned_chain=work(1:kmind:n_runs,1);
[g2, bic] = independence_chain_test(thinned_chain);
kmind = kmind+1;
end;
end
m_star = log((alpha + beta)*epss/max(alpha,beta))/log(abs(1 - alpha - beta)); %equation bottom page 4
raftery_lewis.M_burn(nv) = fix((m_star+1)*k_thin_current_var);
@ -124,7 +124,7 @@ for nv = 1:n_vars % big loop over variables
raftery_lewis.k_ind(nv) = max(fix(raftery_lewis.I_stat(nv)+1),kmind);
raftery_lewis.k_thin(nv) = k_thin_current_var;
raftery_lewis.N_total(nv)= raftery_lewis.M_burn(nv)+raftery_lewis.N_prec(nv);
end;
end
end
@ -135,7 +135,7 @@ g2 = 0;
tran=zeros(2,2,2);
for t_iter=3:n_obs % count state transitions
tran(d(t_iter-2,1)+1,d(t_iter-1,1)+1,d(t_iter,1)+1)=tran(d(t_iter-2,1)+1,d(t_iter-1,1)+1,d(t_iter,1)+1)+1;
end;
end
% Compute the log likelihood ratio statistic for second-order MC vs first-order MC. G2 statistic of Bishop, Fienberg and Holland (1975)
for ind_1 = 1:2
for ind_2 = 1:2
@ -146,9 +146,9 @@ for ind_1 = 1:2
focus = tran(ind_1,ind_2,ind_3);
g2 = g2 + log(focus/fitted)*focus;
end
end; % end of for i3
end; % end of for i2
end; % end of for i1
end % end of for i3
end % end of for i2
end % end of for i1
g2 = g2*2;
bic = g2 - log(n_obs-2)*2;
@ -161,7 +161,7 @@ n_obs=size(d,1);
trans = zeros(2,2);
for ind_1 = 2:n_obs
trans(d(ind_1-1)+1,d(ind_1)+1)=trans(d(ind_1-1)+1,d(ind_1)+1)+1;
end;
end
dcm1 = n_obs - 1;
g2 = 0;
% Compute the log likelihood ratio statistic for second-order MC vs first-order MC. G2 statistic of Bishop, Fienberg and Holland (1975)
@ -171,9 +171,9 @@ for ind_1 = 1:2
fitted = ((trans(ind_1,1) + trans(ind_1,2))*(trans(1,ind_2) + trans(2,ind_2)))/dcm1;
focus = trans(ind_1,ind_2);
g2 = g2 + log(focus/fitted)*focus;
end;
end;
end;
end
end
end
g2 = g2*2;
bic = g2 - log(dcm1);
end

View File

@ -19,7 +19,7 @@ function [info] = convertAimCodeToInfo(aimCode)
% OUTPUTS
% info [integer] Code to be used to print error in print_info.m
% Copyright (C) 2011-2012 Dynare Team
% Copyright (C) 2011-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -55,7 +55,7 @@ switch aimCode
info = 161;
case 62
info = 162;
case 63;
case 63
info = 163;
case 64
info = 164;

View File

@ -13,7 +13,7 @@ function oo_ = convert_dyn_45_to_44(M_, options_, oo_,bayestopt_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2015-2016 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -15,7 +15,7 @@ function oo_ = convert_oo_(M_, options_, oo_, from_ver, to_ver)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2015 Dynare Team
% Copyright (C) 2015-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -63,7 +63,7 @@ else
end
if strcmp(from_ver, to_ver)
return;
return
end
if ver_greater_than(to_ver, from_ver)

View File

@ -2,7 +2,7 @@ function oo_ = correlation_mc_analysis(SampleSize,type,dname,fname,vartan,nvar,v
% This function analyses the (posterior or prior) distribution of the
% endogenous variables correlation function.
% Copyright (C) 2008-2013 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,4 +1,4 @@
function [co, b, yhat] = cosn(H);
function [co, b, yhat] = cosn(H)
% function co = cosn(H);
% computes the cosine of the angle between the H(:,1) and its
@ -7,7 +7,7 @@ function [co, b, yhat] = cosn(H);
% Not the same as multiple correlation coefficient since the means are not
% zero
%
% Copyright (C) 2008-2012 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -28,15 +28,12 @@ y = H(:,1);
X = H(:,2:end);
b=(X\y);
if any(isnan(b)) || any(isinf(b)),
if any(isnan(b)) || any(isinf(b))
b=0;
end
yhat = X*b;
if rank(yhat),
if rank(yhat)
co = abs(y'*yhat/sqrt((y'*y)*(yhat'*yhat)));
else
co=0;
end

View File

@ -19,7 +19,7 @@ function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,varta
% OUTPUTS
% oo_ [structure] Dynare structure where the results are saved.
% Copyright (C) 2008-2015 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -22,7 +22,7 @@ function [x,rc] = csolve(FUN,x,gradfun,crit,itmax,varargin)
% http://sims.princeton.edu/yftp/optimize/mfiles/csolve.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2007-2011 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -122,7 +122,7 @@ while ~done
factor=factor^.6;
shrink=1;
end
if abs(lambda*(1-factor))*dxSize > .1*delta;
if abs(lambda*(1-factor))*dxSize > .1*delta
lambda = factor*lambda;
elseif (lambda > 0) && (factor==.6) %i.e., we've only been shrinking
lambda=-.3;
@ -162,7 +162,7 @@ while ~done
if itct >= itmax
done=1;
rc=4;
elseif af0<crit;
elseif af0<crit
done=1;
rc=0;
end

View File

@ -34,7 +34,7 @@ function [nodes, weights] = cubature_with_gaussian_weight(d,n,method)
%! @end deftypefn
%@eod:
% Copyright (C) 2012-2013 Dynare Team
% Copyright (C) 2012-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -43,7 +43,7 @@ function [X, info] = cycle_reduction(A0, A1, A2, cvg_tol, ch) % --*-- Unitary te
%! @end deftypefn
%@eod:
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -78,4 +78,3 @@ end
% Close the data file.
fclose(fid) ;

View File

@ -1,6 +1,6 @@
function dcompare(s1)
% Copyright (C) 2001-2011 Dynare Team
% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -52,5 +52,3 @@ z = mean(mean(abs(x(j,i)-y(j,i)))) ;
disp (['The mean absolute difference between set ' s1(1,:) 'and set ' s1(2,:)]) ;
disp (['is : ' num2str(z)]) ;
return ;

View File

@ -1,6 +1,6 @@
function info = delete_mh_history_files(MetropolisFolder, ModelName)
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function info = discretionary_policy(var_list)
% Copyright (C) 2007-2011 Dynare Team
% Copyright (C) 2007-2015 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,6 +1,6 @@
function [dr,ys,info]=discretionary_policy_1(oo_,Instruments)
% Copyright (C) 2007-2016 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -46,9 +46,9 @@ function [H,G,retcode]=discretionary_policy_engine(AAlag,AA0,AAlead,BB,bigw,inst
%
% Algorithm:
% Dennis, Richard (2007): Optimal policy in rational expectations models: new solution algorithms,
% Macroeconomic Dynamics, 11, 3155.
% Macroeconomic Dynamics, 11, 31–55.
% Copyright (C) 2007-2015 Dynare Team
% Copyright (C) 2007-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -239,11 +239,11 @@ function v= SylvesterDoubling (d,g,h,tol,maxit)
% to solve the Sylvester equation v = d + g v h
v = d;
for i =1:maxit,
for i =1:maxit
vadd = g*v*h;
v = v+vadd;
if norm (vadd,1) <= (tol*norm(v,1))
break;
break
end
g = g*g;
h = h*h;
@ -295,8 +295,8 @@ temp = [];
%First handle the i = 1 case outside the loop
if i< n,
if abs(h(i+1,i)) < tol,
if i< n
if abs(h(i+1,i)) < tol
v(:,i)= (w - g*h(i,i))\d(:,i);
i = i+1;
else
@ -312,10 +312,10 @@ end
%Handle the rest of the matrix with the possible exception of i=n
while i<n,
while i<n
b= i-1;
temp = [temp g*v(:,size(temp,2)+1:b)]; %#ok<AGROW>
if abs(h(i+1,i)) < tol,
if abs(h(i+1,i)) < tol
v(:,i) = (w - g*h(i,i))\(d(:,i) + temp*h(1:b,i));
i = i+1;
else
@ -332,7 +332,7 @@ end
%Handle the i = n case if i=n was not in a 2-2 block
if i==n,
if i==n
b = i-1;
temp = [temp g*v(:,size(temp,2)+1:b)];
v(:,i) = (w-g*h(i,i))\(d(:,i) + temp*h(1:b,i));

View File

@ -8,7 +8,7 @@ function disp_dr(dr,order,var_list)
% var_list [char array]: list of endogenous variables for which the
% decision rules should be printed
%
% Copyright (C) 2001-2015 Dynare Team
% Copyright (C) 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -36,7 +36,7 @@ else
k = find(dr.kstate(:,2) <= M_.maximum_lag+1);
klag = dr.kstate(k,[1 2]);
k1 = dr.order_var;
end;
end
if size(var_list,1) == 0
var_list = M_.endo_names(1:M_.orig_endo_nbr, :);

View File

@ -1,6 +1,6 @@
function disp_identification(pdraws, idemodel, idemoments, name, advanced)
% Copyright (C) 2008-2012 Dynare Team
% Copyright (C) 2008-2017 Dynare Team
%
% This file is part of Dynare.
%
@ -19,7 +19,7 @@ function disp_identification(pdraws, idemodel, idemoments, name, advanced)
global options_
if nargin < 5 || isempty(advanced),
if nargin < 5 || isempty(advanced)
advanced=0;
end
@ -84,16 +84,16 @@ end
disp([' ']),
if any(idemodel.ino),
if any(idemodel.ino)
disp('WARNING !!!')
if SampleSize>1,
if SampleSize>1
disp(['The rank of H (model) is deficient for ', num2str(length(find(idemodel.ino))),' out of ',int2str(SampleSize),' MC runs!' ]),
else
disp(['The rank of H (model) is deficient!' ]),
end
skipline()
for j=1:npar,
if any(idemodel.ind0(:,j)==0),
for j=1:npar
if any(idemodel.ind0(:,j)==0)
pno = 100*length(find(idemodel.ind0(:,j)==0))/SampleSize;
if SampleSize>1
disp([' ',name{j},' is not identified in the model for ',num2str(pno),'% of MC runs!' ])
@ -107,9 +107,9 @@ if any(idemodel.ino),
jmap_pair=dyn_unvech(1:npairs);
jstore=[];
skipline()
for j=1:npairs,
for j=1:npairs
iweak = length(find(idemodel.jweak_pair(:,j)));
if iweak,
if iweak
[jx,jy]=find(jmap_pair==j);
jstore=[jstore jx(1) jy(1)];
if SampleSize > 1
@ -121,9 +121,9 @@ if any(idemodel.ino),
end
skipline()
for j=1:npar,
for j=1:npar
iweak = length(find(idemodel.jweak(:,j)));
if iweak && ~ismember(j,jstore),
if iweak && ~ismember(j,jstore)
% disp('WARNING !!!')
% disp(['Model derivatives of parameter ',name{j},' are multi-collinear (with tol = 1.e-10) for ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
if SampleSize>1
@ -157,10 +157,10 @@ if ~any(idemodel.ino) && ~any(any(idemodel.ind0==0))
skipline()
end
if any(idemoments.ino),
if any(idemoments.ino)
skipline()
disp('WARNING !!!')
if SampleSize > 1,
if SampleSize > 1
disp(['The rank of J (moments) is deficient for ', num2str(length(find(idemoments.ino))),' out of ',int2str(SampleSize),' MC runs!' ]),
else
disp(['The rank of J (moments) is deficient!' ]),
@ -173,8 +173,8 @@ if any(idemoments.ino),
% ifreq=find(freqno);
% disp('MOMENT RANK FAILURE DUE TO COLLINEARITY OF PARAMETERS:');
skipline()
for j=1:npar,
if any(idemoments.ind0(:,j)==0),
for j=1:npar
if any(idemoments.ind0(:,j)==0)
pno = 100*length(find(idemoments.ind0(:,j)==0))/SampleSize;
if SampleSize > 1
disp([' ',name{j},' is not identified by J moments for ',num2str(pno),'% of MC runs!' ])
@ -188,9 +188,9 @@ if any(idemoments.ino),
npairs=size(idemoments.jweak_pair,2);
jmap_pair=dyn_unvech(1:npairs);
jstore=[];
for j=1:npairs,
for j=1:npairs
iweak = length(find(idemoments.jweak_pair(:,j)));
if iweak,
if iweak
[jx,jy]=find(jmap_pair==j);
jstore=[jstore' jx(1) jy(1)]';
if SampleSize > 1
@ -202,12 +202,12 @@ if any(idemoments.ino),
end
skipline()
for j=1:npar,
for j=1:npar
iweak = length(find(idemoments.jweak(:,j)));
if iweak && ~ismember(j,jstore),
if iweak && ~ismember(j,jstore)
% disp('WARNING !!!')
% disp(['Moment derivatives of parameter ',name{j},' are multi-collinear (with tol = 1.e-10) for ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
if SampleSize > 1,
if SampleSize > 1
disp([name{j},' is collinear w.r.t. all other params ',num2str(iweak/SampleSize*100),'% of MC runs!' ])
else
disp([name{j},' is collinear w.r.t. all other params!' ])
@ -266,19 +266,19 @@ end
% disp(' ')
% identificaton patterns
if SampleSize==1 && advanced,
if SampleSize==1 && advanced
skipline()
disp('Press ENTER to print advanced diagnostics'), pause(5),
for j=1:size(idemoments.cosnJ,2),
for j=1:size(idemoments.cosnJ,2)
pax=NaN(npar,npar);
fprintf('\n')
disp(['Collinearity patterns with ', int2str(j) ,' parameter(s)'])
fprintf('%-15s [%-*s] %10s\n','Parameter',(15+1)*j,' Expl. params ','cosn')
for i=1:npar,
for i=1:npar
namx='';
for in=1:j,
for in=1:j
dumpindx = idemoments.pars{i,j}(in);
if isnan(dumpindx),
if isnan(dumpindx)
namx=[namx ' ' sprintf('%-15s','--')];
else
namx=[namx ' ' sprintf('%-15s',name{dumpindx})];

Some files were not shown because too many files have changed in this diff Show More