Home > matlab > metropolis_run_analysis.m

metropolis_run_analysis

PURPOSE ^

function metropolis_run_analysis(M)

SYNOPSIS ^

function metropolis_run_analysis(M,basetopt,j)

DESCRIPTION ^

function metropolis_run_analysis(M)
 analizes Metropolis runs
  
 INPUTS
   M:         (struct)  Model structure
   basetopt:  (struct)  Estimated parameters structure
   j:         (int)     Index of estimated paramter
  
 OUTPUTS
   none

 SPECIAL REQUIREMENTS
   none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function metropolis_run_analysis(M,basetopt,j)
0002 %function metropolis_run_analysis(M)
0003 % analizes Metropolis runs
0004 %
0005 % INPUTS
0006 %   M:         (struct)  Model structure
0007 %   basetopt:  (struct)  Estimated parameters structure
0008 %   j:         (int)     Index of estimated paramter
0009 %
0010 % OUTPUTS
0011 %   none
0012 %
0013 % SPECIAL REQUIREMENTS
0014 %   none
0015 
0016 % Copyright (C) 2003-2009, 2010, 2011 Dynare Team
0017 %
0018 % This file is part of Dynare.
0019 %
0020 % Dynare is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % Dynare is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 load([M.fname '/metropolis/' M.fname '_mh_history'])
0034 nblck = record.Nblck;
0035 ndraws = sum(record.MhDraws(:,1));
0036 
0037 logPost = [];
0038 params = [];
0039 blck = 1;
0040 for i=1:record.LastFileNumber
0041     fname = [M.fname '/metropolis/' M.fname '_mh' int2str(i) '_blck' ...
0042             int2str(blck) '.mat'];
0043     if exist(fname,'file')
0044         o=load(fname);
0045         logPost = [logPost; o.logpo2];
0046         params  = [params; o.x2];
0047     end
0048 end
0049 
0050 figure;
0051 subplot(2,1,1)
0052 plot(logPost)
0053 subplot(2,1,2)
0054 plot(params(:,j))
0055 title(['parameter ' int2str(j)])

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005