Home > matlab > evaluate_prior.m

evaluate_prior

PURPOSE ^

Evaluate the prior density at parameters.

SYNOPSIS ^

function [ldens,parameters] = evaluate_prior(parameters)

DESCRIPTION ^

 Evaluate the prior density at parameters.

 INPUTS
    o parameters  a string ('posterior mode','posterior mean','posterior median','prior mode','prior mean') or a vector of values for 
                  the (estimated) parameters of the model.
    
    
 OUTPUTS
    o ldens       [double]  value of the logged prior density.
    o parameters  [double]  vector of values for the estimated parameters.
    
 SPECIAL REQUIREMENTS
    None

 REMARKS
 [1] This function cannot evaluate the prior density of a dsge-var model...

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ldens,parameters] = evaluate_prior(parameters)
0002 % Evaluate the prior density at parameters.
0003 %
0004 % INPUTS
0005 %    o parameters  a string ('posterior mode','posterior mean','posterior median','prior mode','prior mean') or a vector of values for
0006 %                  the (estimated) parameters of the model.
0007 %
0008 %
0009 % OUTPUTS
0010 %    o ldens       [double]  value of the logged prior density.
0011 %    o parameters  [double]  vector of values for the estimated parameters.
0012 %
0013 % SPECIAL REQUIREMENTS
0014 %    None
0015 %
0016 % REMARKS
0017 % [1] This function cannot evaluate the prior density of a dsge-var model...
0018 
0019 % Copyright (C) 2009 Dynare Team
0020 %
0021 % This file is part of Dynare.
0022 %
0023 % Dynare is free software: you can redistribute it and/or modify
0024 % it under the terms of the GNU General Public License as published by
0025 % the Free Software Foundation, either version 3 of the License, or
0026 % (at your option) any later version.
0027 %
0028 % Dynare is distributed in the hope that it will be useful,
0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0031 % GNU General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU General Public License
0034 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0035 
0036 global bayestopt_
0037 
0038 if nargin==0
0039     parameters = 'posterior mode';
0040 end
0041 
0042 if ischar(parameters)
0043     switch parameters
0044       case 'posterior mode'
0045         parameters = get_posterior_parameters('mode');
0046       case 'posterior mean'
0047         parameters = get_posterior_parameters('mean');
0048       case 'posterior median'
0049         parameters = get_posterior_parameters('median');
0050       case 'prior mode'
0051         parameters = bayestopt_.p5(:);
0052       case 'prior mean'
0053         parameters = bayestopt_.p1;
0054       otherwise
0055         disp('eval_prior:: If the input argument is a string, then it has to be equal to:')
0056         disp('                ''posterior mode'', ')
0057         disp('                ''posterior mean'', ')
0058         disp('                ''posterior median'', ')
0059         disp('                ''prior mode'' or')
0060         disp('                ''prior mean''.')
0061         error
0062     end
0063 end
0064 clear('priordens');
0065 ldens = priordens(parameters, bayestopt_.pshape, bayestopt_.p6, bayestopt_.p7, bayestopt_.p3, bayestopt_.p4);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005