function [prior,PRIOR] = get_prior(p,PPD)
%function [prior,PRIOR] = get_prior(p,PPD) evalues at p the log likelihood  of the 
%vector of estimated parameters given assumed prior distribution functions
%summarized in PPD
%1=beta; 2=gamma; 3=normal; 4=uniform.
%Replication materials for: ``What Do Long Data Tell Us About the Permanent Component of Inflation?''
%© Stephanie Schmitt-Grohé and Martín Uribe,  2023. 

PRIOR = [];

find(PPD(:,end)==1);
PRIOR(ans,1) = dbeta(p(ans),PPD(ans,1),PPD(ans,2));

find(PPD(:,end)==2);
PRIOR(ans,1) = dgamma(p(ans),PPD(ans,1),PPD(ans,2));

find(PPD(:,end)==3);
PRIOR(ans,1) = dnormal(p(ans),PPD(ans,1),PPD(ans,2));

find(PPD(:,end)==4);
PRIOR(ans,1) = duniform(p(ans),PPD(ans,3),PPD(ans,4));

prior = sum(log(PRIOR));
