From 2ce930105d47d51da41334dc4804b1a95fd5854d Mon Sep 17 00:00:00 2001
From: stepan <stepan@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Sat, 21 Mar 2009 22:50:03 +0000
Subject: [PATCH] Merged commit 2503 (from trunk).

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2504 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/check_list_of_variables.m | 24 +++++++++++++++++++++++-
 matlab/dynare_estimation.m       |  5 +++++
 matlab/dynare_estimation_1.m     |  5 -----
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/matlab/check_list_of_variables.m b/matlab/check_list_of_variables.m
index 6705ced009..5377d0b28a 100644
--- a/matlab/check_list_of_variables.m
+++ b/matlab/check_list_of_variables.m
@@ -14,7 +14,7 @@ function varlist = check_list_of_variables(options_, M_, varlist)
 %        
 % SPECIAL REQUIREMENTS
 
-% Copyright (C) 2003-2008 Dynare Team
+% Copyright (C) 2003-2009 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -31,6 +31,28 @@ function varlist = check_list_of_variables(options_, M_, varlist)
 % 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_.bvar_dsge && options_.bayesian_irf
+       if ~isempty(varlist)
+           for i=1:size(varlist,1)
+               idx = strmatch(deblank(varlist(i,:)),options_.varobs,'exact');
+               if isempty(idx)
+                   disp([varlist(i,:) ' is not an observed variable!']);
+                   message = 1;
+               end
+           end
+           if size(varlist,1)~=size(options_.varobs)
+               message = 1;
+           end
+           if message
+               disp(' ')
+               disp('Posterior IRFs will be computed for all observed variables.')
+               disp(' ')
+           end
+       end
+        varlist = options_.varobs;
+        return
+    end
+    
     if isempty(varlist)
         disp(' ')
         disp(['You did not declare endogenous variables after the estimation command.'])
diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m
index a5b0eee35b..a4bff9e3eb 100644
--- a/matlab/dynare_estimation.m
+++ b/matlab/dynare_estimation.m
@@ -30,6 +30,11 @@ function dynare_estimation(var_list,varargin)
 
 global options_ oo_ M_ oo_recursive_
 
+%% Decide if a DSGE or DSGE-VAR has to be estimated.
+if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
+    options_.bvar_dsge = 1;
+end
+
 var_list = check_list_of_variables(options_, M_, var_list);
 options_.varlist = var_list;
 
diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m
index abad83e70a..184ab183ad 100644
--- a/matlab/dynare_estimation_1.m
+++ b/matlab/dynare_estimation_1.m
@@ -44,11 +44,6 @@ for i = 1:size(M_.endo_names,1)
   end
 end
 
-%% Decide if a DSGE or DSGE-VAR has to be estimated.
-if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
-    options_.bvar_dsge = 1;
-end
-
 %% Set the order of approximation to one (if needed).
 if options_.order > 1
     options_.order = 1;
-- 
GitLab