1function [ldens,parameters] = evaluate_prior(parameters,M_,estim_params_,oo_,options_,bayestopt_)
2% Evaluate the prior density at parameters.
3%
4% INPUTS
5%    o parameters  a string ('posterior mode','posterior mean','posterior median','prior mode','prior mean') or a vector of values for
6%                  the (estimated) parameters of the model.
7%    o M_          [structure]  Definition of the model
8%    o oo_         [structure]  Storage of results
9%    o options_    [structure]  Options
10%    o bayestopt_  [structure]  describing the priors
11%    o estim_params_ [structure] characterizing parameters to be estimated
12%
13%
14% OUTPUTS
15%    o ldens       [double]  value of the logged prior density.
16%    o parameters  [double]  vector of values for the estimated parameters.
17%
18% SPECIAL REQUIREMENTS
19%    None
20%
21% REMARKS
22% [1] This function cannot evaluate the prior density of a dsge-var model...
23
24% Copyright (C) 2009-2017 Dynare Team
25%
26% This file is part of Dynare.
27%
28% Dynare is free software: you can redistribute it and/or modify
29% it under the terms of the GNU General Public License as published by
30% the Free Software Foundation, either version 3 of the License, or
31% (at your option) any later version.
32%
33% Dynare is distributed in the hope that it will be useful,
34% but WITHOUT ANY WARRANTY; without even the implied warranty of
35% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36% GNU General Public License for more details.
37%
38% You should have received a copy of the GNU General Public License
39% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
40
41if nargin==0
42    parameters = 'posterior mode';
43end
44
45if ischar(parameters)
46    switch parameters
47      case 'posterior mode'
48        parameters = get_posterior_parameters('mode',M_,estim_params_,oo_,options_);
49      case 'posterior mean'
50        parameters = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
51      case 'posterior median'
52        parameters = get_posterior_parameters('median',M_,estim_params_,oo_,options_);
53      case 'prior mode'
54        parameters = bayestopt_.p5(:);
55      case 'prior mean'
56        parameters = bayestopt_.p1;
57      otherwise
58        disp('eval_prior:: If the input argument is a string, then it has to be equal to:')
59        disp('                ''posterior mode'', ')
60        disp('                ''posterior mean'', ')
61        disp('                ''posterior median'', ')
62        disp('                ''prior mode'' or')
63        disp('                ''prior mean''.')
64        error
65    end
66end
67
68ldens = priordens(parameters, bayestopt_.pshape, bayestopt_.p6, bayestopt_.p7, bayestopt_.p3, bayestopt_.p4);