Commit 40e5c61e authored by Johannes Pfeifer 's avatar Johannes Pfeifer
Browse files

Restrict endogenous prior to stationary models and allow for measurement error

parent 1883eb09
......@@ -761,8 +761,12 @@ else
lnprior = priordens(xparam1,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4);
end
if DynareOptions.endogenous_prior==1
[lnpriormom] = endogenous_prior(Y,Pstar,BayesInfo);
fval = (likelihood-lnprior-lnpriormom);
if DynareOptions.lik_init==2 || DynareOptions.lik_init==3
error('Endogenous prior not supported with non-stationary models')
else
[lnpriormom] = endogenous_prior(Y,Pstar,BayesInfo,H);
fval = (likelihood-lnprior-lnpriormom);
end
else
fval = (likelihood-lnprior);
end
......
function [lnpriormom] = endogenous_prior(data,Pstar,BayesInfo)
function [lnpriormom] = endogenous_prior(data,Pstar,BayesInfo,H)
% Computes the endogenous log prior addition to the initial prior
%
% INPUTS
......@@ -82,8 +82,7 @@ mf=BayesInfo.mf1;
II=eye(size(Pstar,2));
Z=II(mf,:);
% This is Ftheta, variance of model variables, given param vector theta:
Ftheta=diag(Z*Pstar(:,mf)); % +H;
Ftheta=diag(Z*Pstar(:,mf)+H);
% below commented out line is for Del Negro Schorfheide style priors:
% lnpriormom=-.5*n*TT*log(2*pi)-.5*TT*log(det(sigma))-.5*TT*trace(inv(sigma)*(gamyy-2*phi'*gamxy+phi'*gamxx*phi));
lnpriormom=.5*n*log(Tsamp/(2*pi))-.5*log(det(Shat))-.5*Tsamp*(Fhat-Ftheta)'/Shat*(Fhat-Ftheta);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment