1function generate_trace_plots(chain_number)
2%function generate_trace_plots(chain_number)
3% Generates trace plots for all estimated parameters and the posterior
4%
5% INPUTS
6%    chain_number:  [scalar]    number of the chain for which to construct the trace plots
7%
8% OUTPUTS
9%    none
10%
11% SPECIAL REQUIREMENTS
12%    none
13
14% Copyright (C) 2016-2018 Dynare Team
15%
16% This file is part of Dynare.
17%
18% Dynare is free software: you can redistribute it and/or modify
19% it under the terms of the GNU General Public License as published by
20% the Free Software Foundation, either version 3 of the License, or
21% (at your option) any later version.
22%
23% Dynare is distributed in the hope that it will be useful,
24% but WITHOUT ANY WARRANTY; without even the implied warranty of
25% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26% GNU General Public License for more details.
27%
28% You should have received a copy of the GNU General Public License
29% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
30
31global M_ options_ estim_params_
32
33
34% Get informations about the posterior draws:
35MetropolisFolder = CheckPath('metropolis', M_.dname);
36load_last_mh_history_file(MetropolisFolder, M_.fname);
37if chain_number>record.Nblck
38    error('generate_trace_plots:: chain number is bigger than existing number of chains')
39end
40
41trace_plot(options_, M_, estim_params_, 'PosteriorDensity', chain_number)
42
43for ii=1:size(estim_params_.param_vals, 1)
44    parameter_name = M_.param_names{estim_params_.param_vals(ii,1)};
45    trace_plot(options_, M_, estim_params_, 'DeepParameter', chain_number, parameter_name)
46end
47
48for ii=1:size(estim_params_.var_exo, 1)
49    parameter_name = M_.exo_names{estim_params_.var_exo(ii,1)};
50    trace_plot(options_, M_, estim_params_, 'StructuralShock', chain_number, parameter_name)
51end
52
53for ii=1:size(estim_params_.var_endo, 1)
54    parameter_name = M_.endo_names{estim_params_.var_endo(ii,1)};
55    trace_plot(options_, M_, estim_params_, 'MeasurementError', chain_number, parameter_name)
56end
57
58for ii=1:size(estim_params_.corrn, 1)
59    parameter_name_1 = M_.endo_names{estim_params_.corrn(ii,1)};
60    parameter_name_2 = M_.endo_names{estim_params_.corrn(ii,2)};
61    trace_plot(options_, M_, estim_params_, 'MeasurementError', chain_number, parameter_name_1, parameter_name_2)
62end
63
64for ii=1:size(estim_params_.corrx, 1)
65    parameter_name_1 = M_.exo_names{estim_params_.corrx(ii,1)};
66    parameter_name_2 = M_.exo_names{estim_params_.corrx(ii,2)};
67    trace_plot(options_, M_, estim_params_, 'StructuralShock', chain_number, parameter_name_1, parameter_name_2)
68end