do_dmat8c
3 min readMar 13, 2018
function dmat = do_dmat8c (perf2dmat, a, v, Ter)
%% options
dm_a = a;
dm_v = v;
dm_Ter = Ter;
% always varying parameters
dm_pi = eye(8);
dm_g = eye(8);
dm_z = eye(8);
% always fixed parameters
dm_eta = ones(8,1);
dm_sz = ones(8,1);
dm_st = ones(8,1);
dmat_optionFit = multiestv4 ;dmat_optionFit.DesignMatrix = ...
{dm_a, dm_Ter, dm_eta, dm_z, dm_sz, dm_st, dm_v, dm_pi, dm_g};dmat_optionFit.EstimationMethodScalar = 5;
dmat_optionFit.MaxIter = 5000;
dmat_optionFit.OutlierTreatment = 'Mixed Model'; %'EWMA';
dmat_optionFit.NoFitting = 0;dmat_optionFit.SpecificBias = 1/2*ones(8,1);%% estimation
dmat.output = multiestv4 (perf2dmat, dmat_optionFit) ;
% parametres estimés (dm) et leur Std error (se)
dmat.dm_a_1 = dmat.output.Minimum(1,1);
dmat.dm_a_2 = dmat.output.Minimum(2,1);
dmat.dm_a_3 = dmat.output.Minimum(3,1);
dmat.dm_a_4 = dmat.output.Minimum(4,1);
dmat.dm_a_5 = dmat.output.Minimum(5,1);
dmat.dm_a_6 = dmat.output.Minimum(6,1);
dmat.dm_a_7 = dmat.output.Minimum(7,1);
dmat.dm_a_8 = dmat.output.Minimum(8,1);
dmat.se_a_1 = dmat.output.StdErr(1,1);
dmat.se_a_2 = dmat.output.StdErr(2,1);
dmat.se_a_3 = dmat.output.StdErr(3,1);
dmat.se_a_4 = dmat.output.StdErr(4,1);
dmat.se_a_5 = dmat.output.StdErr(5,1);
dmat.se_a_6 = dmat.output.StdErr(6,1);
dmat.se_a_7 = dmat.output.StdErr(7,1);
dmat.se_a_8 = dmat.output.StdErr(8,1);
%
dmat.dm_Ter_1 = dmat.output.Minimum(1,2);
dmat.dm_Ter_2 = dmat.output.Minimum(2,2);
dmat.dm_Ter_3 = dmat.output.Minimum(3,2);
dmat.dm_Ter_4 = dmat.output.Minimum(4,2);
dmat.dm_Ter_5 = dmat.output.Minimum(5,2);
dmat.dm_Ter_6 = dmat.output.Minimum(6,2);
dmat.dm_Ter_7 = dmat.output.Minimum(7,2);
dmat.dm_Ter_8 = dmat.output.Minimum(8,2);
dmat.se_Ter_1 = dmat.output.StdErr(1,2);
dmat.se_Ter_2 = dmat.output.StdErr(2,2);
dmat.se_Ter_3 = dmat.output.StdErr(3,2);
dmat.se_Ter_4 = dmat.output.StdErr(4,2);
dmat.se_Ter_5 = dmat.output.StdErr(5,2);
dmat.se_Ter_6 = dmat.output.StdErr(6,2);
dmat.se_Ter_7 = dmat.output.StdErr(7,2);
dmat.se_Ter_8 = dmat.output.StdErr(8,2);
dmat.dm_eta_1 = dmat.output.Minimum(1,3);
dmat.dm_eta_2 = dmat.output.Minimum(2,3);
dmat.dm_eta_3 = dmat.output.Minimum(3,3);
dmat.dm_eta_4 = dmat.output.Minimum(4,3);
dmat.dm_eta_5 = dmat.output.Minimum(5,3);
dmat.dm_eta_6 = dmat.output.Minimum(6,3);
dmat.dm_eta_7 = dmat.output.Minimum(7,3);
dmat.dm_eta_8 = dmat.output.Minimum(8,3);
dmat.se_eta_1 = dmat.output.StdErr(1,3);
dmat.se_eta_2 = dmat.output.StdErr(2,3);
dmat.se_eta_3 = dmat.output.StdErr(3,3);
dmat.se_eta_4 = dmat.output.StdErr(4,3);
dmat.se_eta_5 = dmat.output.StdErr(5,3);
dmat.se_eta_6 = dmat.output.StdErr(6,3);
dmat.se_eta_7 = dmat.output.StdErr(7,3);
dmat.se_eta_8 = dmat.output.StdErr(8,3);
dmat.dm_z_1 = dmat.output.Minimum(1,4);
dmat.dm_z_2 = dmat.output.Minimum(2,4);
dmat.dm_z_3 = dmat.output.Minimum(3,4);
dmat.dm_z_4 = dmat.output.Minimum(4,4);
dmat.dm_z_5 = dmat.output.Minimum(5,4);
dmat.dm_z_6 = dmat.output.Minimum(6,4);
dmat.dm_z_7 = dmat.output.Minimum(7,4);
dmat.dm_z_8 = dmat.output.Minimum(8,4);
dmat.se_z_1 = dmat.output.StdErr(1,4);
dmat.se_z_2 = dmat.output.StdErr(2,4);
dmat.se_z_3 = dmat.output.StdErr(3,4);
dmat.se_z_4 = dmat.output.StdErr(4,4);
dmat.se_z_5 = dmat.output.StdErr(5,4);
dmat.se_z_6 = dmat.output.StdErr(6,4);
dmat.se_z_7 = dmat.output.StdErr(7,4);
dmat.se_z_8 = dmat.output.StdErr(8,4);
dmat.dm_sz_1 = dmat.output.Minimum(1,5);
dmat.dm_sz_2 = dmat.output.Minimum(2,5);
dmat.dm_sz_3 = dmat.output.Minimum(3,5);
dmat.dm_sz_4 = dmat.output.Minimum(4,5);
dmat.dm_sz_5 = dmat.output.Minimum(5,5);
dmat.dm_sz_6 = dmat.output.Minimum(6,5);
dmat.dm_sz_7 = dmat.output.Minimum(7,5);
dmat.dm_sz_8 = dmat.output.Minimum(8,5);
dmat.se_sz_1 = dmat.output.StdErr(1,5);
dmat.se_sz_2 = dmat.output.StdErr(2,5);
dmat.se_sz_3 = dmat.output.StdErr(3,5);
dmat.se_sz_4 = dmat.output.StdErr(4,5);
dmat.se_sz_5 = dmat.output.StdErr(5,5);
dmat.se_sz_6 = dmat.output.StdErr(6,5);
dmat.se_sz_7 = dmat.output.StdErr(7,5);
dmat.se_sz_8 = dmat.output.StdErr(8,5);
dmat.dm_st_1 = dmat.output.Minimum(1,6);
dmat.dm_st_2 = dmat.output.Minimum(2,6);
dmat.dm_st_3 = dmat.output.Minimum(3,6);
dmat.dm_st_4 = dmat.output.Minimum(4,6);
dmat.dm_st_5 = dmat.output.Minimum(5,6);
dmat.dm_st_6 = dmat.output.Minimum(6,6);
dmat.dm_st_7 = dmat.output.Minimum(7,6);
dmat.dm_st_8 = dmat.output.Minimum(8,6);
dmat.se_st_1 = dmat.output.StdErr(1,6);
dmat.se_st_2 = dmat.output.StdErr(2,6);
dmat.se_st_3 = dmat.output.StdErr(3,6);
dmat.se_st_4 = dmat.output.StdErr(4,6);
dmat.se_st_5 = dmat.output.StdErr(5,6);
dmat.se_st_6 = dmat.output.StdErr(6,6);
dmat.se_st_7 = dmat.output.StdErr(7,6);
dmat.se_st_8 = dmat.output.StdErr(8,6);
dmat.dm_v_1 = dmat.output.Minimum(1,7);
dmat.dm_v_2 = dmat.output.Minimum(2,7);
dmat.dm_v_3 = dmat.output.Minimum(3,7);
dmat.dm_v_4 = dmat.output.Minimum(4,7);
dmat.dm_v_5 = dmat.output.Minimum(5,7);
dmat.dm_v_6 = dmat.output.Minimum(6,7);
dmat.dm_v_7 = dmat.output.Minimum(7,7);
dmat.dm_v_8 = dmat.output.Minimum(8,7);
dmat.se_v_1 = dmat.output.StdErr(1,7);
dmat.se_v_2 = dmat.output.StdErr(2,7);
dmat.se_v_3 = dmat.output.StdErr(3,7);
dmat.se_v_4 = dmat.output.StdErr(4,7);
dmat.se_v_5 = dmat.output.StdErr(5,7);
dmat.se_v_6 = dmat.output.StdErr(6,7);
dmat.se_v_7 = dmat.output.StdErr(7,7);
dmat.se_v_8 = dmat.output.StdErr(8,7);
dmat.dm_pi_1 = dmat.output.Minimum(1,8);
dmat.dm_pi_2 = dmat.output.Minimum(2,8);
dmat.dm_pi_3 = dmat.output.Minimum(3,8);
dmat.dm_pi_4 = dmat.output.Minimum(4,8);
dmat.dm_pi_5 = dmat.output.Minimum(5,8);
dmat.dm_pi_6 = dmat.output.Minimum(6,8);
dmat.dm_pi_7 = dmat.output.Minimum(7,8);
dmat.dm_pi_8 = dmat.output.Minimum(8,8);
dmat.se_pi_1 = dmat.output.StdErr(1,8);
dmat.se_pi_2 = dmat.output.StdErr(2,8);
dmat.se_pi_3 = dmat.output.StdErr(3,8);
dmat.se_pi_4 = dmat.output.StdErr(4,8);
dmat.se_pi_5 = dmat.output.StdErr(5,8);
dmat.se_pi_6 = dmat.output.StdErr(6,8);
dmat.se_pi_7 = dmat.output.StdErr(7,8);
dmat.se_pi_8 = dmat.output.StdErr(8,8);
dmat.dm_g_1 = dmat.output.Minimum(1,9);
dmat.dm_g_2 = dmat.output.Minimum(2,9);
dmat.dm_g_3 = dmat.output.Minimum(3,9);
dmat.dm_g_4 = dmat.output.Minimum(4,9);
dmat.dm_g_5 = dmat.output.Minimum(5,9);
dmat.dm_g_6 = dmat.output.Minimum(6,9);
dmat.dm_g_7 = dmat.output.Minimum(7,9);
dmat.dm_g_8 = dmat.output.Minimum(8,9);
dmat.se_g_1 = dmat.output.StdErr(1,9);
dmat.se_g_2 = dmat.output.StdErr(2,9);
dmat.se_g_3 = dmat.output.StdErr(3,9);
dmat.se_g_4 = dmat.output.StdErr(4,9);
dmat.se_g_5 = dmat.output.StdErr(5,9);
dmat.se_g_6 = dmat.output.StdErr(6,9);
dmat.se_g_7 = dmat.output.StdErr(7,9);
dmat.se_g_8 = dmat.output.StdErr(8,9);
% Fitinfo
dmat.FitInfo =dmat.output.FitInfo;
dmat.BIC = dmat.output.FitInfo.BIC;
dmat.chi = dmat.output.FitInfo.ChiSquare;
dmat.Hessian =dmat.output.Hessian;