function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,M_,options_,bayestopt_,dr, atT, innov] = IVF_posterior(xparam1,... dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,BoundsInfo,dr, endo_steady_state, exo_steady_state, exo_det_steady_state) % [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,M_,options_,bayestopt_,dr, atT, innov] = IVF_posterior(xparam1,... % dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,BoundsInfo,dr, endo_steady_state, exo_steady_state, exo_det_steady_state) % Computes Likelihood with inversion filter % % INPUTS % - xparam1 [double] current values for the estimated parameters. % - dataset_ [structure] dataset after transformations % - dataset_info [structure] storing informations about the % sample; not used but required for interface % - options_ [structure] Matlab's structure describing the current options % - M_ [structure] Matlab's structure describing the model % - estim_params_ [structure] characterizing parameters to be estimated % - bayestopt_ [structure] describing the priors % - BoundsInfo [structure] containing prior bounds % - dr [structure] Reduced form model. % - endo_steady_state [vector] steady state value for endogenous variables % - exo_steady_state [vector] steady state value for exogenous variables % - exo_det_steady_state [vector] steady state value for exogenous deterministic variables % % OUTPUTS % - fval [double] scalar, value of the likelihood or posterior kernel. % - info [integer] 4×1 vector, informations resolution of the model and evaluation of the likelihood. % - exit_flag [integer] scalar, equal to 1 (no issues when evaluating the likelihood) or 0 (not able to evaluate the likelihood). % - DLIK [double] Empty array. % - Hess [double] Empty array. % - SteadyState [double] Empty array. % - trend [double] Empty array. % - M_ [struct] Updated M_ structure described in INPUTS section. % - options_ [struct] Updated options_ structure described in INPUTS section. % - bayestopt_ [struct] See INPUTS section. % - dr [structure] Reduced form model. % - atT [double] (m*T) matrix, smoothed endogenous variables (a_{t|T}) (decision-rule order) % - innov [double] (r*T) matrix, smoothed structural shocks (r>n is the umber of shocks). % Copyright © 2021-2023 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 . DLIK=[]; Hess=[]; trend_coeff = []; obs = dataset_.data; obs_list = options_.varobs(:); exit_flag = 1; if size(xparam1,1)1e-3 disp_verbose('Penalize failure of residuals to be zero',options_.verbosity) fval = Inf; info(1) = 303; info(4) = sum(resids(:).^2); exit_flag = 0; return end if ~isempty(xparam1) prior = -priordens(xparam1,bayestopt_.pshape,bayestopt_.p6,bayestopt_.p7,bayestopt_.p3,bayestopt_.p4); else prior = 0; end if prior == Inf % If parameters outside prior bound, minus prior density is very large fval = Inf; info(4) = 1000; exit_flag = 0; return end %--------------------------------------------- % Calculate posterior %--------------------------------------------- % remember that the likelihood has already been multiplied by -1 % hence, posterior is -1 times the log of the prior fval = like+prior;