Home > matlab > get_posterior_parameters.m

get_posterior_parameters

PURPOSE ^

function xparam = get_posterior_parameters(type)

SYNOPSIS ^

function xparam = get_posterior_parameters(type)

DESCRIPTION ^

 function xparam = get_posterior_parameters(type)
 Selects (estimated) parameters (posterior mode or posterior mean).
 
 INPUTS 
   o type       [char]     = 'mode' or 'mean'.
  
 OUTPUTS 
   o xparam     vector of estimated parameters  

 SPECIAL REQUIREMENTS
   None.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xparam = get_posterior_parameters(type)
0002 
0003 % function xparam = get_posterior_parameters(type)
0004 % Selects (estimated) parameters (posterior mode or posterior mean).
0005 %
0006 % INPUTS
0007 %   o type       [char]     = 'mode' or 'mean'.
0008 %
0009 % OUTPUTS
0010 %   o xparam     vector of estimated parameters
0011 %
0012 % SPECIAL REQUIREMENTS
0013 %   None.
0014 
0015 % Copyright (C) 2006-2009 Dynare Team
0016 %
0017 % This file is part of Dynare.
0018 %
0019 % Dynare is free software: you can redistribute it and/or modify
0020 % it under the terms of the GNU General Public License as published by
0021 % the Free Software Foundation, either version 3 of the License, or
0022 % (at your option) any later version.
0023 %
0024 % Dynare is distributed in the hope that it will be useful,
0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 % GNU General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU General Public License
0030 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0031 
0032 global estim_params_ oo_ options_ M_ 
0033 
0034 nvx = estim_params_.nvx;
0035 nvn = estim_params_.nvn;
0036 ncx = estim_params_.ncx;
0037 ncn = estim_params_.ncn;
0038 np  = estim_params_.np;
0039 
0040 xparam = zeros(nvx+nvn+ncx+ncn+np,1);
0041 
0042 m = 1;
0043 for i=1:nvx
0044     k1 = estim_params_.var_exo(i,1);
0045     name1 = deblank(M_.exo_names(k1,:));
0046     xparam(m) = eval(['oo_.posterior_' type '.shocks_std.' name1]);
0047     M_.Sigma_e(k1,k1) = xparam(m)^2;
0048     m = m+1;
0049 end
0050 
0051 for i=1:nvn
0052     k1 = estim_params_.var_endo(i,1);
0053     name1 = deblank(options_.varobs(k1,:));
0054     xparam(m) = eval(['oo_.posterior_' type '.measurement_errors_std.' name1]);
0055     m = m+1;
0056 end
0057 
0058 for i=1:ncx
0059     k1 = estim_params_.corrx(i,1);
0060     k2 = estim_params_.corrx(i,2);
0061     name1 = deblank(M_.exo_names(k1,:));
0062     name2 = deblank(M_.exo_names(k2,:));
0063     xparam(m) = eval(['oo_.posterior_' type '.shocks_corr.' name1 '_' name2]);
0064     M_.Sigma_e(k1,k2) = xparam(m);
0065     M_.Sigma_e(k2,k1) = xparam(m);
0066     m = m+1;
0067 end
0068 
0069 for i=1:ncn
0070     k1 = estim_params_.corrn(i,1);
0071     k2 = estim_params_.corrn(i,2);
0072     name1 = deblank(options_.varobs(k1,:));
0073     name2 = deblank(options_.varobs(k2,:));
0074     xparam(m) = eval(['oo_.posterior_' type '.measurement_errors_corr.' name1 '_' name2]);
0075     m = m+1;
0076 end
0077 
0078 FirstDeep = m;
0079 
0080 for i=1:np
0081     name1 = deblank(M_.param_names(estim_params_.param_vals(i,1),:));
0082     xparam(m) = eval(['oo_.posterior_' type '.parameters.' name1]);
0083     assignin('base',name1,xparam(m));% Useless with version 4 (except maybe for users)
0084     m = m+1;
0085 end
0086 
0087 if np
0088     M_.params(estim_params_.param_vals(:,1)) = xparam(FirstDeep:end);
0089 end

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