From 11b9eafa5409d0fbc9029f4ddfee6ca7a499e51f Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx,de>
Date: Fri, 11 Apr 2014 14:27:32 +0200
Subject: [PATCH] Add more info on requirement on dsge_var prior weight needed
 for prior to be proper.

(cherry picked from commit 74fd0850d61f8ba464ff08ed42c4019d27722fb3)
(cherry picked from commit b69174477c1e0afbcc01ca8a1b63fa2014130418)
---
 doc/dynare.texi              | 2 +-
 matlab/dsge_var_likelihood.m | 2 ++
 matlab/print_info.m          | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index f8a4908f4..a1282180b 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -4928,7 +4928,7 @@ distribution of IRFs. The length of the IRFs are controlled by the
 @item dsge_var = @var{DOUBLE}
 @anchor{dsge_var} Triggers the estimation of a DSGE-VAR model, where the
 weight of  the DSGE prior  of the VAR model  is calibrated to  the value
-passed (see @cite{Del  Negro and Schorfheide (2004)}). NB:  The previous method
+passed (see @cite{Del  Negro and Schorfheide (2004)}). It represents ratio of dummy over actual observations. To assure that the prior is proper, the value must be bigger than @math{(k+n)/T}, where @math{k} is the number of estimated parameters, @math{n} is the number of observables, and @math{T} is the number of observations. NB:  The previous method
 of   declaring  @code{dsge_prior_weight}   as  a   parameter  and   then
 calibrating it is now deprecated and will be removed in a future release
 of Dynare.
diff --git a/matlab/dsge_var_likelihood.m b/matlab/dsge_var_likelihood.m
index 1177b4751..f2ee0b2e1 100644
--- a/matlab/dsge_var_likelihood.m
+++ b/matlab/dsge_var_likelihood.m
@@ -114,6 +114,8 @@ if dsge_prior_weight<(NumberOfParameters+NumberOfObservedVariables)/DynareDatase
     fval = objective_function_penalty_base+abs(DynareDataset.info.ntobs*dsge_prior_weight-(NumberOfParameters+NumberOfObservedVariables));
     exit_flag = 0;
     info = 51;
+    info(2)=dsge_prior_weight;
+    info(3)=(NumberOfParameters+NumberOfObservedVariables)/DynareDataset.info.ntobs;
     return
 end
 
diff --git a/matlab/print_info.m b/matlab/print_info.m
index 791404390..38158dacd 100644
--- a/matlab/print_info.m
+++ b/matlab/print_info.m
@@ -105,6 +105,7 @@ if ~noprint
       case 49
         error('The model violates one (many) endogenous prior restriction(s)')
       case 51
+        fprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n',info(2),info(3));
         error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!')
       case 52 %dsge_var_likelihood
         error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations is not positive definite!');
-- 
GitLab