From 4d39f4a3f09983efd95af8ce045ee0ce88e6a230 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Tue, 29 Mar 2022 12:16:48 +0200
Subject: [PATCH] Occbin: use data instead of rawdata and gracefully exit if
 prefilter option is specified

Closes #1842

(cherry picked from commit 35c30dc037dc00e654aea3b8f9419f6fefef2068)
---
 matlab/+occbin/IVF_posterior.m     | 2 +-
 matlab/initial_estimation_checks.m | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/matlab/+occbin/IVF_posterior.m b/matlab/+occbin/IVF_posterior.m
index edb28041db..533f5f6692 100644
--- a/matlab/+occbin/IVF_posterior.m
+++ b/matlab/+occbin/IVF_posterior.m
@@ -50,7 +50,7 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,Model,DynareOpti
 DLIK=[];
 Hess=[];
 trend_coeff = [];
-obs = obs_info.rawdata;
+obs = dataset_.data;
 obs_list = DynareOptions.varobs(:);
 exit_flag   = 1;
 
diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m
index 89629275f4..9cf98c82f8 100644
--- a/matlab/initial_estimation_checks.m
+++ b/matlab/initial_estimation_checks.m
@@ -76,6 +76,12 @@ if DynareOptions.order>1
     end
 end
 
+if DynareOptions.occbin.likelihood.status || DynareOptions.occbin.smoother.status
+    if DynareOptions.prefilter
+        error('initial_estimation_checks:: Occbin is incompatible with the prefilter option due to the sample mean generally not corresponding to the steady state with an occasionally binding constraint.')
+    end
+end
+
 if (DynareOptions.occbin.likelihood.status && DynareOptions.occbin.likelihood.inversion_filter) || (DynareOptions.occbin.smoother.status && DynareOptions.occbin.smoother.inversion_filter)
     err_index= find(diag(Model.Sigma_e)~=0);
     if length(err_index)~=length(DynareOptions.varobs)
-- 
GitLab