Estimation DLL: explicitly fail with option loglinear or observation trends

time-shift
Sébastien Villemot 2013-02-07 16:43:44 +01:00
parent 6fc94a12d0
commit be2764520a
5 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2010 Dynare Team
* Copyright (C) 2009-2013 Dynare Team
*
* This file is part of Dynare.
*
@ -25,8 +25,7 @@
#include "DetrendData.hh"
DetrendData::DetrendData(const bool INlogLinear) //, Vector& INtrendCoeff)
: logLinear(INlogLinear) //trendCoeff(INtrendCoeff)
DetrendData::DetrendData()
{
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2010 Dynare Team
* Copyright (C) 2009-2013 Dynare Team
*
* This file is part of Dynare.
*
@ -32,13 +32,9 @@ class DetrendData
public:
virtual ~DetrendData(){};
DetrendData(const bool logLinear); // add later Vector& trendCoeff);
DetrendData();
void detrend(const VectorView &SteadyState, const MatrixConstView &dataView, MatrixView &detrendedDataView);
private:
const bool logLinear;
//Vector trendCoeff;
};
#endif // !defined(312823A1_6248_4af0_B204_DB22F1237E9B__INCLUDED_)

View File

@ -38,8 +38,8 @@ InitializeKalmanFilter::InitializeKalmanFilter(const std::string &dynamicDllFile
double lyapunov_tol_arg, int &info) :
lyapunov_tol(lyapunov_tol_arg),
zeta_varobs_back_mixed(zeta_varobs_back_mixed_arg),
detrendData(false), modelSolution(dynamicDllFile, n_endo_arg, n_exo_arg, zeta_fwrd_arg, zeta_back_arg,
zeta_mixed_arg, zeta_static_arg, qz_criterium_arg),
modelSolution(dynamicDllFile, n_endo_arg, n_exo_arg, zeta_fwrd_arg, zeta_back_arg,
zeta_mixed_arg, zeta_static_arg, qz_criterium_arg),
discLyapFast(zeta_varobs_back_mixed.size()),
g_x(n_endo_arg, zeta_back_arg.size() + zeta_mixed_arg.size()),
g_u(n_endo_arg, n_exo_arg),

View File

@ -637,6 +637,15 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data,
const mxArray *M_ = mexGetVariablePtr("global", "M_");
const mxArray *options_ = mexGetVariablePtr("global", "options_");
const mxArray *estim_params_ = mexGetVariablePtr("global", "estim_params_");
const mxArray *bayestopt_ = mexGetVariablePtr("global", "bayestopt_");
double loglinear = *mxGetPr(mxGetField(options_, 0, "loglinear"));
if (loglinear == 1)
throw LogMHMCMCposteriorMexErrMsgTxtException("Option loglinear is not supported");
double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend"));
if (with_trend == 1)
throw LogMHMCMCposteriorMexErrMsgTxtException("Observation trends are not supported");
// Construct arguments of constructor of LogLikelihoodMain
char *fName = mxArrayToString(mxGetField(M_, 0, "fname"));
@ -712,7 +721,6 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data,
// Construct GaussianPrior drawDistribution m=0, sd=1
GaussianPrior drawGaussDist01(0.0, 1.0, -INFINITY, INFINITY, 0.0, 1.0);
// get Jscale = diag(bayestopt_.jscale);
const mxArray *bayestopt_ = mexGetVariablePtr("global", "bayestopt_");
const Matrix Jscale(n_estParams);
const VectorConstView vJscale(mxGetPr(mxGetField(bayestopt_, 0, "jscale")), n_estParams, 1);
Proposal pdd(vJscale, D);

View File

@ -106,6 +106,14 @@ logposterior(VEC1 &estParams, const MatrixConstView &data,
const mxArray *bayestopt_, const mxArray *oo_, VEC2 &steadyState, double *trend_coeff,
int &info, VectorView &deepParams, Matrix &H, MatrixView &Q)
{
double loglinear = *mxGetPr(mxGetField(options_, 0, "loglinear"));
if (loglinear == 1)
throw LogposteriorMexErrMsgTxtException("Option loglinear is not supported");
double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend"));
if (with_trend == 1)
throw LogposteriorMexErrMsgTxtException("Observation trends are not supported");
// Construct arguments of constructor of LogLikelihoodMain
char *fName = mxArrayToString(mxGetField(M_, 0, "fname"));
std::string dynamicDllFile(fName);