Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • DSMH
  • OneStep2
  • SMC
  • SMCsamplers
  • aux_func
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dynamic-striated
  • eigen
  • error_msg_undeclared_model_vars
  • estim_params
  • exceptions
  • exo_steady_state
  • filter_initial_state
  • gpm-optimal-policy
  • julia
  • master
  • merge-initvalfile-fix
  • mex-GetPowerDeriv
  • new_ep
  • nlf-fixes
  • nonlinear-filter-fixes
  • occbin
  • online-filter-as-a-sampler
  • penalty
  • remove-@dates
  • remove-@dseries
  • remove-utilities-tests
  • rmExtraExo
  • separateM_
  • slice
  • smc-sampler
  • sphinx-doc-experimental
  • static_aux_vars
  • temporary_terms
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
74 results

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • chskcau/dynare-doc-fixes
27 results
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • 4.6
  • 5.x
  • 6.x
  • asm
  • aux_func
  • clang+openmp
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dragonfly
  • dynare_minreal
  • eigen
  • error_msg_undeclared_model_vars
  • estim_params
  • exo_steady_state
  • gpm-optimal-policy
  • julia
  • madysson
  • master
  • mex-GetPowerDeriv
  • penalty
  • separateM_
  • slice
  • sphinx-doc-experimental
  • static_aux_vars
  • time-varying-information-set
  • various_fixes
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
  • 6-beta1
  • 6-beta2
  • 6.0
  • 6.1
  • 6.2
  • 6.3
90 results
Show changes
Commits on Source (3)
Showing
with 6 additions and 775 deletions
......@@ -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.3-unstable])
AC_INIT([dynare], [4.3.0])
AC_CONFIG_SRCDIR([preprocessor/DynareMain.cc])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign no-dist-gzip dist-xz tar-pax])
......@@ -82,10 +82,6 @@ CPPFLAGS="$CPPFLAGS_SAVED"
# Don't use deprecated hash structures
AC_DEFINE([BOOST_NO_HASH], [], [Don't use deprecated STL hash structures])
# Check for dlopen(), needed by tests for estimation DLL
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
AC_SUBST([LIBADD_DLOPEN])
AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
AC_CHECK_PROG([PDFTEX], [pdftex], [pdftex])
......@@ -203,10 +199,6 @@ AC_CONFIG_FILES([Makefile
dynare++/kord/Makefile
dynare++/src/Makefile
mex/sources/Makefile
mex/sources/estimation/Makefile
mex/sources/estimation/tests/Makefile
mex/sources/estimation/libmat/Makefile
mex/sources/estimation/libmat/tests/Makefile
])
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
......
noinst_PROGRAMS = logposterior logMHMCMCposterior
# We use shared flags so that automake does not compile things two times
CPPFLAGS += -I$(top_srcdir)/../../sources/estimation/libmat -I$(top_srcdir)/../../sources/estimation/utils $(BOOST_CPPFLAGS)
LDFLAGS += $(BOOST_LDFLAGS)
LDADD = $(LIBADD_DLOPEN)
TOPDIR = $(top_srcdir)/../../sources/estimation
MAT_SRCS = \
$(TOPDIR)/libmat/Matrix.hh \
$(TOPDIR)/libmat/Matrix.cc \
$(TOPDIR)/libmat/Vector.hh \
$(TOPDIR)/libmat/Vector.cc \
$(TOPDIR)/libmat/BlasBindings.hh \
$(TOPDIR)/libmat/DiscLyapFast.hh \
$(TOPDIR)/libmat/GeneralizedSchurDecomposition.cc \
$(TOPDIR)/libmat/GeneralizedSchurDecomposition.hh \
$(TOPDIR)/libmat/LapackBindings.hh \
$(TOPDIR)/libmat/LUSolver.cc \
$(TOPDIR)/libmat/LUSolver.hh \
$(TOPDIR)/libmat/QRDecomposition.cc \
$(TOPDIR)/libmat/QRDecomposition.hh \
$(TOPDIR)/libmat/VDVEigDecomposition.cc \
$(TOPDIR)/libmat/VDVEigDecomposition.hh
COMMON_SRCS = \
$(MAT_SRCS) \
$(TOPDIR)/DecisionRules.cc \
$(TOPDIR)/DecisionRules.hh \
$(TOPDIR)/DetrendData.cc \
$(TOPDIR)/DetrendData.hh \
$(TOPDIR)/EstimatedParameter.cc \
$(TOPDIR)/EstimatedParameter.hh \
$(TOPDIR)/EstimatedParametersDescription.cc \
$(TOPDIR)/EstimatedParametersDescription.hh \
$(TOPDIR)/EstimationSubsample.cc \
$(TOPDIR)/EstimationSubsample.hh \
$(TOPDIR)/InitializeKalmanFilter.cc \
$(TOPDIR)/InitializeKalmanFilter.hh \
$(TOPDIR)/KalmanFilter.cc \
$(TOPDIR)/KalmanFilter.hh \
$(TOPDIR)/LogLikelihoodSubSample.cc \
$(TOPDIR)/LogLikelihoodSubSample.hh \
$(TOPDIR)/LogLikelihoodMain.hh \
$(TOPDIR)/LogLikelihoodMain.cc \
$(TOPDIR)/LogPosteriorDensity.cc \
$(TOPDIR)/LogPosteriorDensity.hh \
$(TOPDIR)/LogPriorDensity.cc \
$(TOPDIR)/LogPriorDensity.hh \
$(TOPDIR)/ModelSolution.cc \
$(TOPDIR)/ModelSolution.hh \
$(TOPDIR)/Prior.cc \
$(TOPDIR)/Prior.hh \
$(TOPDIR)/utils/dynamic_dll.cc \
$(TOPDIR)/utils/dynamic_dll.hh
nodist_logposterior_SOURCES = \
$(COMMON_SRCS) \
$(TOPDIR)/logposterior.cc
nodist_logMHMCMCposterior_SOURCES = \
$(COMMON_SRCS) \
$(TOPDIR)/Proposal.cc \
$(TOPDIR)/Proposal.hh \
$(TOPDIR)/RandomWalkMetropolisHastings.hh \
$(TOPDIR)/logMHMCMCposterior.cc
......@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I ../../../m4
# libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_
if DO_SOMETHING
SUBDIRS = mjdgges kronecker bytecode libdynare++ gensylv k_order_perturbation dynare_simul_ estimation block_kalman_filter sobol local_state_space_iterations
SUBDIRS = mjdgges kronecker bytecode libdynare++ gensylv k_order_perturbation dynare_simul_ block_kalman_filter sobol local_state_space_iterations
if HAVE_GSL
SUBDIRS += ms_sbvar
......
......@@ -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.61])
AC_INIT([dynare], [4.3-unstable])
AC_INIT([dynare], [4.3.0])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
......@@ -139,7 +139,6 @@ AC_CONFIG_FILES([Makefile
gensylv/Makefile
k_order_perturbation/Makefile
dynare_simul_/Makefile
estimation/Makefile
libslicot/Makefile
kalman_steady_state/Makefile
ms_sbvar/Makefile
......
include ../mex.am
include ../../estimation.am
......@@ -15,7 +15,4 @@ if HAVE_FORT
SUBDIRS += libslicot kalman_steady_state
endif
if HAVE_MATIO
SUBDIRS += estimation
endif
endif
......@@ -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.61])
AC_INIT([dynare], [4.3-unstable])
AC_INIT([dynare], [4.3.0])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
......@@ -124,7 +124,6 @@ AC_CONFIG_FILES([Makefile
gensylv/Makefile
k_order_perturbation/Makefile
dynare_simul_/Makefile
estimation/Makefile
qzcomplex/Makefile
ordschur/Makefile
libslicot/Makefile
......
EXEEXT = .mex
include ../mex.am
include ../../estimation.am
logMHMCMCposterior_LDADD = $(LIBADD_MATIO)
SUBDIRS = estimation
EXTRA_DIST = \
dynblas.h \
dynlapack.h \
......
......@@ -48,7 +48,8 @@ class BlockKalmanFilter
bool notsteady, F_singular, missing_observations;
lapack_int *iw, *ipiv;
double anorm, rcond;
int size_d_index, no_more_missing_observations, number_of_observations;
lapack_int size_d_index;
int no_more_missing_observations, number_of_observations;
const mxArray* pdata_index;
vector<int> d_index;
const mxArray* pd_index;
......
/*
* Copyright (C) 2010-2011 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/>.
*/
#include <cassert>
#include <algorithm>
#include "DecisionRules.hh"
DecisionRules::DecisionRules(size_t n_arg, size_t p_arg,
const std::vector<size_t> &zeta_fwrd_arg,
const std::vector<size_t> &zeta_back_arg,
const std::vector<size_t> &zeta_mixed_arg,
const std::vector<size_t> &zeta_static_arg,
double qz_criterium) :
n(n_arg), p(p_arg), zeta_fwrd(zeta_fwrd_arg), zeta_back(zeta_back_arg),
zeta_mixed(zeta_mixed_arg), zeta_static(zeta_static_arg),
n_fwrd(zeta_fwrd.size()), n_back(zeta_back.size()),
n_mixed(zeta_mixed.size()), n_static(zeta_static.size()),
n_back_mixed(n_back+n_mixed), n_fwrd_mixed(n_fwrd+n_mixed),
n_dynamic(n-n_static),
S(n, n_static),
A(n, n_back_mixed + n + n_fwrd_mixed),
D(n_fwrd + n_back + 2*n_mixed),
E(n_fwrd + n_back + 2*n_mixed),
Z_prime(n_fwrd + n_back + 2*n_mixed),
QR(n, n_static, n_back_mixed + n + n_fwrd_mixed),
GSD(n_fwrd + n_back + 2*n_mixed, qz_criterium),
LU1(n_fwrd_mixed),
LU2(n_back_mixed),
LU3(n_static),
Z21(n_fwrd_mixed, n_back_mixed),
g_y_back(n_back_mixed),
g_y_back_tmp(n_back_mixed),
g_y_static(n_static, n_back_mixed),
A0s(n_static),
A0d(n_static, n_dynamic),
g_y_dynamic(n_dynamic, n_back_mixed),
g_y_static_tmp(n_fwrd_mixed, n_back_mixed),
g_u_tmp1(n, n_back_mixed),
g_u_tmp2(n),
LU4(n)
{
assert(n == n_back + n_fwrd + n_mixed + n_static);
set_union(zeta_fwrd.begin(), zeta_fwrd.end(),
zeta_mixed.begin(), zeta_mixed.end(),
back_inserter(zeta_fwrd_mixed));
set_union(zeta_back.begin(), zeta_back.end(),
zeta_mixed.begin(), zeta_mixed.end(),
back_inserter(zeta_back_mixed));
set_union(zeta_back_mixed.begin(), zeta_back_mixed.end(),
zeta_fwrd.begin(), zeta_fwrd.end(),
back_inserter(zeta_dynamic));
// Compute beta_back and pi_back
for (size_t i = 0; i < n_back_mixed; i++)
if (find(zeta_mixed.begin(), zeta_mixed.end(), zeta_back_mixed[i])
== zeta_mixed.end())
pi_back.push_back(i);
else
beta_back.push_back(i);
// Compute beta_fwrd and pi_fwrd
for (size_t i = 0; i < n_fwrd_mixed; i++)
if (find(zeta_mixed.begin(), zeta_mixed.end(), zeta_fwrd_mixed[i])
== zeta_mixed.end())
pi_fwrd.push_back(i);
else
beta_fwrd.push_back(i);
}
void
DecisionRules::compute(const Matrix &jacobian, Matrix &g_y, Matrix &g_u) throw (BlanchardKahnException, GeneralizedSchurDecomposition::GSDException)
{
assert(jacobian.getRows() == n
&& jacobian.getCols() == (n_back_mixed + n + n_fwrd_mixed + p));
assert(g_y.getRows() == n && g_y.getCols() == n_back_mixed);
assert(g_u.getRows() == n && g_u.getCols() == p);
// Construct S, perform QR decomposition and get A = Q*jacobian
for (size_t i = 0; i < n_static; i++)
mat::col_copy(jacobian, n_back_mixed+zeta_static[i], S, i);
A = MatrixConstView(jacobian, 0, 0, n, n_back_mixed + n + n_fwrd_mixed);
QR.computeAndLeftMultByQ(S, "T", A);
// Construct matrix D
D.setAll(0.0);
for (size_t i = 0; i < n_mixed; i++)
D(n - n_static + i, beta_back[i]) = 1.0;
for (size_t j = 0; j < n_back_mixed; j++)
mat::col_copy(A, n_back_mixed + zeta_back_mixed[j], n_static, n - n_static,
D, j, 0);
MatrixView(D, 0, n_back_mixed, n - n_static, n_fwrd_mixed) = MatrixView(A, n_static, n_back_mixed + n, n - n_static, n_fwrd_mixed);
// Construct matrix E
E.setAll(0.0);
for (size_t i = 0; i < n_mixed; i++)
E(n - n_static + i, n_back_mixed + beta_fwrd[i]) = 1.0;
MatrixView(E, 0, 0, n - n_static, n_back_mixed) = MatrixView(A, n_static, 0, n - n_static, n_back_mixed);
for (size_t j = 0; j < n_fwrd; j++)
mat::col_copy(A, n_back_mixed + zeta_fwrd_mixed[pi_fwrd[j]], n_static, n - n_static,
E, n_back_mixed + pi_fwrd[j], 0);
MatrixView E_tmp(E, 0, 0, n - n_static, n_fwrd + n_back + 2*n_mixed);
mat::negate(E_tmp); // Here we take the opposite of some of the zeros initialized in the constructor, but it is not a problem
// Perform the generalized Schur
size_t sdim;
GSD.compute(E, D, Z_prime, sdim);
if (n_back_mixed != sdim)
throw BlanchardKahnException(true, n_fwrd_mixed, n_fwrd + n_back + 2*n_mixed - sdim);
// Compute DR for forward variables w.r. to endogenous
MatrixView Z21_prime(Z_prime, 0, n_back_mixed, n_back_mixed, n_fwrd_mixed),
Z22_prime(Z_prime, n_back_mixed, n_back_mixed, n_fwrd_mixed, n_fwrd_mixed);
mat::transpose(Z21, Z21_prime);
try
{
LU1.invMult("T", Z22_prime, Z21);
}
catch (LUSolver::LUException &e)
{
throw BlanchardKahnException(false, n_fwrd_mixed, n_fwrd + n_back + 2*n_mixed - sdim);
}
mat::negate(Z21);
const Matrix &g_y_fwrd = Z21;
for (size_t i = 0; i < n_fwrd_mixed; i++)
mat::row_copy(g_y_fwrd, i, g_y, zeta_fwrd_mixed[i]);
// Compute DR for backward variables w.r. to endogenous
MatrixView Z11_prime(Z_prime, 0, 0, n_back_mixed, n_back_mixed),
T11(D, 0, 0, n_back_mixed, n_back_mixed),
S11(E, 0, 0, n_back_mixed, n_back_mixed);
mat::set_identity(g_y_back);
g_y_back_tmp = Z11_prime;
LU2.invMult("N", g_y_back_tmp, g_y_back);
g_y_back_tmp = g_y_back;
blas::gemm("N", "N", 1.0, S11, g_y_back_tmp, 0.0, g_y_back);
LU2.invMult("N", T11, g_y_back);
g_y_back_tmp = g_y_back;
blas::gemm("N", "N", 1.0, Z11_prime, g_y_back_tmp, 0.0, g_y_back);
// TODO: avoid to copy mixed variables again, rather test it...
for (size_t i = 0; i < n_back_mixed; i++)
mat::row_copy(g_y_back, i, g_y, zeta_back_mixed[i]);
// Compute DR for static variables w.r. to endogenous
g_y_static = MatrixView(A, 0, 0, n_static, n_back_mixed);
for (size_t i = 0; i < n_dynamic; i++)
{
mat::row_copy(g_y, zeta_dynamic[i], g_y_dynamic, i);
mat::col_copy(A, n_back_mixed + zeta_dynamic[i], 0, n_static, A0d, i, 0);
}
blas::gemm("N", "N", 1.0, A0d, g_y_dynamic, 1.0, g_y_static);
blas::gemm("N", "N", 1.0, g_y_fwrd, g_y_back, 0.0, g_y_static_tmp);
blas::gemm("N", "N", 1.0, MatrixView(A, 0, n_back_mixed + n, n_static, n_fwrd_mixed),
g_y_static_tmp, 1.0, g_y_static);
for (size_t i = 0; i < n_static; i++)
mat::col_copy(A, n_back_mixed + zeta_static[i], 0, n_static, A0s, i, 0);
LU3.invMult("N", A0s, g_y_static);
mat::negate(g_y_static);
for (size_t i = 0; i < n_static; i++)
mat::row_copy(g_y_static, i, g_y, zeta_static[i]);
// Compute DR for all endogenous w.r. to shocks
blas::gemm("N", "N", 1.0, MatrixConstView(jacobian, 0, n_back_mixed + n, n, n_fwrd_mixed), g_y_fwrd, 0.0, g_u_tmp1);
g_u_tmp2 = MatrixConstView(jacobian, 0, n_back_mixed, n, n);
for (size_t i = 0; i < n_back_mixed; i++)
{
VectorView c1 = mat::get_col(g_u_tmp2, zeta_back_mixed[i]),
c2 = mat::get_col(g_u_tmp1, i);
vec::add(c1, c2);
}
g_u = MatrixConstView(jacobian, 0, n_back_mixed + n + n_fwrd_mixed, n, p);
LU4.invMult("N", g_u_tmp2, g_u);
mat::negate(g_u);
}
std::ostream &
operator<<(std::ostream &out, const DecisionRules::BlanchardKahnException &e)
{
if (e.order)
out << "The Blanchard-Kahn order condition is not satisfied: you have " << e.n_fwrd_vars << " forward variables for " << e.n_explosive_eigenvals << " explosive eigenvalues";
else
out << "The Blanchard Kahn rank condition is not satisfied";
return out;
}
/*
* Copyright (C) 2010 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/>.
*/
#include <cstdlib>
#include <vector>
#include "Vector.hh"
#include "Matrix.hh"
#include "QRDecomposition.hh"
#include "GeneralizedSchurDecomposition.hh"
#include "LUSolver.hh"
class DecisionRules
{
private:
const size_t n, p;
const std::vector<size_t> zeta_fwrd, zeta_back, zeta_mixed, zeta_static;
const size_t n_fwrd, n_back, n_mixed, n_static, n_back_mixed, n_fwrd_mixed, n_dynamic;
std::vector<size_t> zeta_fwrd_mixed, zeta_back_mixed, zeta_dynamic,
beta_back, beta_fwrd, pi_back, pi_fwrd;
Matrix S, A, D, E, Z_prime;
QRDecomposition QR;
GeneralizedSchurDecomposition GSD;
LUSolver LU1, LU2, LU3;
Matrix Z21, g_y_back, g_y_back_tmp;
Matrix g_y_static, A0s, A0d, g_y_dynamic, g_y_static_tmp;
Matrix g_u_tmp1, g_u_tmp2;
LUSolver LU4;
public:
class BlanchardKahnException
{
public:
//! True if the model fails the order condition. False if it fails the rank condition.
const bool order;
const int n_fwrd_vars, n_explosive_eigenvals;
BlanchardKahnException(bool order_arg, int n_fwrd_vars_arg, int n_explosive_eigenvals_arg) : order(order_arg), n_fwrd_vars(n_fwrd_vars_arg), n_explosive_eigenvals(n_explosive_eigenvals_arg) {};
};
/*!
The zetas are supposed to follow C convention (first vector index is zero).
*/
DecisionRules(size_t n_arg, size_t p_arg, const std::vector<size_t> &zeta_fwrd_arg,
const std::vector<size_t> &zeta_back_arg, const std::vector<size_t> &zeta_mixed_arg,
const std::vector<size_t> &zeta_static_arg, double qz_criterium);
virtual ~DecisionRules(){};
/*!
\param jacobian First columns are backetermined vars at t-1 (in the order of zeta_back_mixed), then all vars at t (in the orig order), then forward vars at t+1 (in the order of zeta_fwrd_mixed), then exogenous vars.
*/
void compute(const Matrix &jacobian, Matrix &g_y, Matrix &g_u) throw (BlanchardKahnException, GeneralizedSchurDecomposition::GSDException);
template<class Vec1, class Vec2>
void getGeneralizedEigenvalues(Vec1 &eig_real, Vec2 &eig_cmplx);
};
std::ostream &operator<<(std::ostream &out, const DecisionRules::BlanchardKahnException &e);
template<class Vec1, class Vec2>
void
DecisionRules::getGeneralizedEigenvalues(Vec1 &eig_real, Vec2 &eig_cmplx)
{
GSD.getGeneralizedEigenvalues(eig_real, eig_cmplx);
}
/*
* Copyright (C) 2009-2010 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/>.
*/
///////////////////////////////////////////////////////////
// DetrendData.cpp
// Implementation of the Class DetrendData
// Created on: 02-Feb-2010 13:01:15
///////////////////////////////////////////////////////////
#include "DetrendData.hh"
DetrendData::DetrendData(const bool INlogLinear) //, Vector& INtrendCoeff)
: logLinear(INlogLinear) //trendCoeff(INtrendCoeff)
{
};
void
DetrendData::detrend(const VectorView &SteadyState, const MatrixConstView &dataView,
MatrixView &detrendedDataView)
{
detrendedDataView = dataView;
};
/*
* Copyright (C) 2009-2010 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/>.
*/
///////////////////////////////////////////////////////////
// DetrendData.h
// Implementation of the Class DetrendData
// Created on: 02-Feb-2010 13:01:15
///////////////////////////////////////////////////////////
#if !defined(DetrendData_312823A1_6248_4af0_B204_DB22F1237E9B__INCLUDED_)
#define DetrendData_312823A1_6248_4af0_B204_DB22F1237E9B__INCLUDED_
#include "Matrix.hh"
class DetrendData
{
public:
virtual ~DetrendData(){};
DetrendData(const bool logLinear); // add later Vector& trendCoeff);
void detrend(const VectorView &SteadyState, const MatrixConstView &dataView, MatrixView &detrendedDataView);
private:
const bool logLinear;
//Vector trendCoeff;
};
#endif // !defined(312823A1_6248_4af0_B204_DB22F1237E9B__INCLUDED_)
/*
* Copyright (C) 2009-2011 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/>.
*/
///////////////////////////////////////////////////////////
// EstimatedParameter.cpp
// Implementation of the Class EstimatedParameter
// Created on: 02-Feb-2010 13:06:35
///////////////////////////////////////////////////////////
#include "EstimatedParameter.hh"
EstimatedParameter::EstimatedParameter(const EstimatedParameter::pType type_arg,
size_t ID1_arg, size_t ID2_arg, const std::vector<size_t> &subSampleIDs_arg,
double lower_bound_arg, double upper_bound_arg, Prior *prior_arg) :
ptype(type_arg), ID1(ID1_arg), ID2(ID2_arg),
lower_bound(lower_bound_arg), upper_bound(upper_bound_arg), prior(prior_arg),
subSampleIDs(subSampleIDs_arg)
{
}
EstimatedParameter::~EstimatedParameter()
{
}
/*
* Copyright (C) 2009-2011 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/>.
*/
///////////////////////////////////////////////////////////
// EstimatedParameter.h
// Implementation of the Class EstimatedParameter
// Created on: 02-Feb-2010 13:06:35
///////////////////////////////////////////////////////////
#if !defined(D879C8AE_5B69_4fc3_83BD_FA5A99030ECF__INCLUDED_)
#define D879C8AE_5B69_4fc3_83BD_FA5A99030ECF__INCLUDED_
#include "Prior.hh"
#include <cstdlib>
#include <vector>
struct EstimatedParameter
{
public:
// parameter types
enum pType
{
shock_SD = 1, // standard deviation of a structural shock
measureErr_SD = 2, // standard deviation of a measurement error
shock_Corr = 3, // correlation betwwen two structural shocks
measureErr_Corr = 4, // correlation between two measurement errors
deepPar = 5 // deep parameter
};
EstimatedParameter(const EstimatedParameter::pType type,
size_t ID1, size_t ID2, const std::vector<size_t> &subSampleIDs,
double lower_bound, double upper_bound, Prior *prior
);
virtual ~EstimatedParameter();
enum pType ptype;
size_t ID1;
size_t ID2;
double lower_bound;
double upper_bound;
Prior *prior;
std::vector<size_t> subSampleIDs;
};
#endif // !defined(D879C8AE_5B69_4fc3_83BD_FA5A99030ECF__INCLUDED_)
/*
* Copyright (C) 2010 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/>.
*/
///////////////////////////////////////////////////////////
// EstimatedParametersDescription.cpp
// Implementation of the Class EstimatedParametersDescription
// Created on: 02-Feb-2010 13:06:47
///////////////////////////////////////////////////////////
#include "EstimatedParametersDescription.hh"
EstimatedParametersDescription::~EstimatedParametersDescription()
{
}
EstimatedParametersDescription::EstimatedParametersDescription(std::vector<EstimationSubsample> &INestSubsamples, std::vector<EstimatedParameter> &INestParams) :
estSubsamples(INestSubsamples), estParams(INestParams)
{
}
size_t
EstimatedParametersDescription::getNumberOfPeriods() const
{
size_t r = 0;
for (size_t i = 0; i < estSubsamples.size(); i++)
{
size_t r2 = estSubsamples[i].endPeriod + 1;
if (r2 > r)
r = r2;
}
return r;
}
/*
* Copyright (C) 2009-2010 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/>.
*/
///////////////////////////////////////////////////////////
// EstimatedParametersDescription.h
// Implementation of the Class EstimatedParametersDescription
// Created on: 02-Feb-2010 13:06:46
///////////////////////////////////////////////////////////
#if !defined(E8F2C096_A301_42e8_80FF_A643291BF995__INCLUDED_)
#define E8F2C096_A301_42e8_80FF_A643291BF995__INCLUDED_
#include "EstimationSubsample.hh"
#include "EstimatedParameter.hh"
#include "Prior.hh"
/**
* all estimation periods held in the vectors of EstPeriod-s are held in the
* EstimatedParametersDescription together with the time-invariant attributes (e.g.
* IDs..) for integration..
*
* The EstimatedParametersDescription. structure (or class with protected
* elements) integrates all parametr and time period information and makes it
* available to (friend ?) class LogPosteriorDensity on as needed basis and
* updates all parameters (inc. H and Q) when time slot xparam1 is supplied.
*
*
*
*/
class EstimatedParametersDescription
{
public:
virtual ~EstimatedParametersDescription();
EstimatedParametersDescription(std::vector<EstimationSubsample> &estSubsamples, std::vector<EstimatedParameter> &estParams);
std::vector<EstimationSubsample> estSubsamples;
std::vector<EstimatedParameter> estParams;
size_t getNumberOfPeriods() const;
};
#endif // !defined(E8F2C096_A301_42e8_80FF_A643291BF995__INCLUDED_)
/*
* Copyright (C) 2009-2010 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/>.
*/
///////////////////////////////////////////////////////////
// EstimationSubsample.cpp
// Implementation of the Class EstimationSubsample
// Created on: 02-Feb-2010 13:06:01
///////////////////////////////////////////////////////////
#include "EstimationSubsample.hh"
EstimationSubsample::EstimationSubsample(size_t INstartPeriod, size_t INendPeriod) :
startPeriod(INstartPeriod), endPeriod(INendPeriod)
{
}
EstimationSubsample::~EstimationSubsample()
{
}
/*
* Copyright (C) 2009-2011 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/>.
*/
///////////////////////////////////////////////////////////
// EstimationSubsample.h
// Implementation of the Class EstimationSubsample
// Created on: 02-Feb-2010 13:06:01
///////////////////////////////////////////////////////////
#if !defined(EstSub34FB1351_4066_4993_B384_56AA65BC32C4__INCLUDED_)
#define EstSub34FB1351_4066_4993_B384_56AA65BC32C4__INCLUDED_
#include <cstdlib>
#include <vector>
/**
* Contains longest common periods for different parameters with different start
* and end periods:
*
* It defines start and end of that period.which has start higher/equal than any
* individual parameter start and its end lower|equal than any individual
* parameter end in that perod window.) integrated xparam1 and priors for that
* period
*
* All those EstPeriod-s need to be constructed at some point once at a start of
* estimation by EstPeriod costructor from the information such as invidual
* parameter start-end periods and the relevant associated priors for those
* periods. That initial info-set is held in the vector of vectors of
* EstParamSubSampleDescription
*
* it constructs and contains indices of all estimated xparam1 parameters valid
* for this period in the larger, extended xparam1x vector passed in. from the
* gradient function.
*
* The EstimatedParametersDescription. structure (or class with protected
* elements) integrates all that information and makes it available to (friend ?)
* class LogPosteriorDensity on as needed basis and updates all parameters (inc. H
* and Q) when time slot xparam1 is supplied.
*
* Time indices follow C convention: first period has index 0.
*/
class EstimationSubsample
{
public:
EstimationSubsample(size_t startPeriod, size_t endPeriod);
virtual ~EstimationSubsample();
size_t startPeriod;
size_t endPeriod;
/**
* indices of all estimated xparam1 parameters valid for this period in the larger,
* extended xparam1x vector passed in. from the gradient function will be added at a later stage of development
*/
// const std::vector<size_t> subSampleParamIDs;
};
#endif // !defined(34FB1351_4066_4993_B384_56AA65BC32C4__INCLUDED_)