Home > code > plot > plot_pcsv_partial_mc.m

plot_pcsv_partial_mc

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 cd('..');
0002 boot;
0003 cd(cgmm_config.directories.plot);
0004 
0005 load(cgmm_config.monte_carlo.pcsv_partial);
0006 
0007 all_re_cgmm = zeros(size(cgmm_estimates{1},1)-1,length(time_steps));
0008 all_re_fs = zeros(size(cgmm_estimates{1},1)-1,length(time_steps));
0009 
0010 mean_mre_cgmm = zeros(1, length(time_steps));
0011 mean_mre_fs = zeros(1, length(time_steps));
0012 std_mre_cgmm = zeros(1, length(time_steps));
0013 std_mre_fs = zeros(1, length(time_steps));
0014 
0015 for k=1:length(time_steps)
0016   theta_fs = first_step_estimates{k};
0017   theta_true = theta_fs(1,:);
0018   theta = theta_fs(2:end,:);
0019   
0020   theta_true = repmat(theta_true, size(theta,1) ,1);
0021   re = abs(theta-theta_true) ./ abs(theta_true);
0022   mre = mean(re);
0023   stdre = std(re);
0024   % all estimates
0025   all_re_fs(:,k) = mean(re,2);
0026   mean_mre_fs(k) = mean(mre);
0027   std_mre_fs(k) = std(mre);
0028   % kappa
0029   kappa_mre_fs(k) = mean(mre(1));
0030   % theta
0031   theta_mre_fs(k) = mean(mre(2));
0032   % sigma
0033   sigma_mre_fs(k) = mean(mre(3));
0034   % rho
0035   rho_mre_fs(k) = mean(mre(4));
0036   
0037   theta_cgmm = cgmm_estimates{k};
0038   theta = theta_cgmm(2:end,:);
0039   re = abs(theta-theta_true) ./ abs(theta_true);
0040   mre = mean(re);
0041   stdre = std(re);
0042   % all estimates
0043   all_re_cgmm(:,k) = mean(re,2);
0044   mean_mre_cgmm(k) = mean(mre);
0045   std_mre_cgmm(k) = std(mre);
0046   % kappa
0047   kappa_mre_cgmm(k) = mean(mre(1));
0048   % theta
0049   theta_mre_cgmm(k) = mean(mre(2));
0050   % sigma
0051   sigma_mre_cgmm(k) = mean(mre(3));
0052   % rho
0053   rho_mre_cgmm(k) = mean(mre(4));
0054 end
0055 
0056 all_re_cgmm(:,end) = NA;
0057 mean_mre_cgmm(end) = NA;
0058 std_mre_cgmm(end) = NA;
0059 % kappa
0060 kappa_mre_cgmm(end) = NA;
0061 % theta
0062 theta_mre_cgmm(end) = NA;
0063 % sigma
0064 sigma_mre_cgmm(end) = NA;
0065 % rho
0066 rho_mre_cgmm(end) = NA;
0067 
0068 subplot(2,1,1);
0069 
0070 plot(time_steps, all_re_fs, 'k');
0071 hold on;
0072 plot(time_steps, mean_mre_fs, 'r', 'linewidth', 5);
0073 hold off;
0074 legend('100 independent simulations', 'Mean of all simulations', 'location', 'southwest');
0075 ylabel('mean relative error');
0076 xlabel('number of data points in time series');
0077 title('PCSV partial CMM mean relative estimation errors');
0078 
0079 subplot(2,1,2);
0080 plot(time_steps, std_mre_fs);
0081 ylabel('standard deviation of mean relative error');
0082 xlabel('number of data points in time series');
0083 
0084 print(cgmm_config.plots.mre.all('pcsv_partial'), cgmm_config.plots.device)
0085 
0086 subplot(2,2,1);
0087 plot(time_steps, kappa_mre_fs);
0088 title('kappa');
0089 subplot(2,2,2);
0090 plot(time_steps, theta_mre_fs);
0091 title('theta');
0092 subplot(2,2,3);
0093 plot(time_steps, sigma_mre_fs);
0094 title('sigma');
0095 subplot(2,2,4);
0096 plot(time_steps, rho_mre_fs);
0097 title('rho');
0098 
0099 print(cgmm_config.plots.mre.individual('pcsv_partial'), cgmm_config.plots.device)

Generated on Mon 29-Apr-2013 19:29:13 by m2html © 2005