全部版块 我的主页
空间群组 学术联盟 Matlab 编程
1967 1
2009-07-30
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);
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-10-17 09:39:55
非常感谢了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群