Home > . > priordens.m

priordens

PURPOSE ^

This procedure computes a prior density for

SYNOPSIS ^

function lnprior = priordens(para, pshape, p1, p2, p3, p4)

DESCRIPTION ^

 This procedure computes a prior density for
 the structural parameters of the DSGE models
 pshape: 0 is point mass, both para and p2 are ignored
         1 is BETA(mean,stdd)
         2 is GAMMA(mean,stdd)
         3 is NORMAL(mean,stdd)
         4 is INVGAMMA(s^2,nu)
         5 is UNIFORM [p3,p4]

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function lnprior = priordens(para, pshape, p1, p2, p3, p4)
0002 % This procedure computes a prior density for
0003 % the structural parameters of the DSGE models
0004 % pshape: 0 is point mass, both para and p2 are ignored
0005 %         1 is BETA(mean,stdd)
0006 %         2 is GAMMA(mean,stdd)
0007 %         3 is NORMAL(mean,stdd)
0008 %         4 is INVGAMMA(s^2,nu)
0009 %         5 is UNIFORM [p3,p4]
0010 
0011 lnprior = 0;
0012 nprio     = length(pshape);
0013 
0014 i = 1;
0015 while i <=  nprio;
0016     a = 0;    
0017     b = 0;
0018     if pshape(i) == 1;     % (generalized) BETA Prior
0019         mu = (p1(i)-p3(i))/(p4(i)-p3(i));
0020         stdd = p2(i)/(p4(i)-p3(i));
0021         a = (1-mu)*mu^2/stdd^2 - mu;
0022         b = a*(1/mu - 1);
0023         lnprior = lnprior + lpdfgbeta(para(i),a,b,p3(i),p4(i))   ;
0024     elseif pshape(i) == 2; % GAMMA PRIOR
0025          b = p2(i)^2/(p1(i)-p3(i));
0026         a = (p1(i)-p3(i))/b;
0027         lnprior = lnprior + lpdfgam(para(i)-p3(i),a,b);
0028     elseif pshape(i) == 3; % GAUSSIAN PRIOR
0029      lnprior = lnprior + lpdfnorm(para(i),p1(i),p2(i));
0030     elseif pshape(i) == 4; % INVGAMMA1 PRIOR
0031          lnprior = lnprior + lpdfig1(para(i),p1(i),p2(i));
0032     elseif pshape(i) == 5; % UNIFORM PRIOR
0033          lnprior = lnprior + log(1/(p2(i)-p1(i)));
0034     elseif pshape(i) == 6; % INVGAMMA2 PRIOR
0035         lnprior = lnprior + lpdfig2(para(i),p1(i),p2(i));
0036     end;
0037     i = i+1;
0038 end;
0039 
0040 % 10/11/03 MJ adapted from an earlier version in GAUSS by F. Schorfheide
0041 %             and translated to Matlab by R. Wouters
0042 % 11/18/03 MJ adopted M.Ratto's suggestion for inverse gamma
0043 %             changed order of input parameters
0044 % 01/16/04 MJ added invgamma2
0045 %             for invgamma p2 is now standard error
0046 % 16/02/04 SA changed beta prior call

Generated on Fri 16-Jun-2006 09:09:06 by m2html © 2003