function [param,sumlike, output] = SWARCHFIT_6(y)
%%%%% model: Switching Variance model; to check why SWARCH failed
%%%%% y = mean(y) + c(s) + e
%%%%% e = u*h(s)^1/2; u - iid.N(0,1)
%%%%% reference Cai 1992
%%%%% coeff = [c(1) c(2) h(1) h(2) pro11 pro12(=1-pro11) pro21(=1-pro22) pro22]
%%%%% ATTENTION: Model results are very sensitive to initial starting value
%%%%% of params, get the right starting value will lead you to the global
%%%%% optimum.
% Linear inequality related to
% SumConA = [0 0 0 0 1 0 1 0
% 0 0 0 0 0 1 0 1];
% SumConB = [1; 1];
% pro = [pro11 pro21; pro12 pro22]; param(pro part) = [pro11 pro21 pro12 pro22];
SumConEqA = [0 0 0 0 1 0 1 0
0 0 0 0 0 1 0 1];
SumConEqB = [1; 1];
lowerBounds = [-1 -1 0 0 0 0 0 0];
% as lower bounds constraints.
upperBounds = [ 1 1 1 1 1 1 1 1];
% options = optimset('fmincon');
options = optimset('Display','iter');
options = optimset(options, 'MaxIter',100);
% options = optimset(options, 'Algorithm','Active-set');
% options = optimset(options, 'Algorithm','Trust-region-reflective');
options = optimset(options, 'Algorithm','interior-point');
%%%%%%%%%%%%%%% Trust-region-reflective ; interior-point : Active-set
%%%%%%%%%%%%%%% with interior-point we get the global maximum. with
%%%%%%%%%%%%%%% Trust only local maximum
param0 = [0.01 0.05 0.0017 0.0017 0.9 0.1 0.1 0.9]';
% param0 = [0.04 0.42 -0.01 0.13 0.67 0.3 0.9 0.1 0.13 0.87];
% param0 = [0.05 -0.01 -0.01 0.01 049 0.51 0.9 0.9 0.1 0.1]';
% [param,sumlike, output] = fmincon(@(param)SWATCH2_LIKE(y, param), param0,[],[],[],[],lowerBounds,upperBounds, @confuneq_SWATCH2, options);
% param0 = param;
[param,sumlike, output] = fmincon(@(param)SWARCHLIKE_6(y, param), param0,[],[],SumConEqA,SumConEqB,lowerBounds,upperBounds, [], options);


雷达卡


京公网安备 11010802022788号







