Dear Member,
I want to find the estimates of my model by minimizing an objective function using "fmincon"command of Matlab. I write the following program.
function[arg]=argmin(x)
c0=x(1,1); % constant of equation 2.9
c1=x(2,1); % Coefficient associated with first term in equation 2.9
w=x(3,1); % constant of eqaution no 2.11
alpha=x(4,1); % Coefficient associated with first term in equation 2.9
beta=x(5,1); % Coefficient associated with second term in equaiton 2.9
load r; % data series whome we wants to correct for outliers
delta=.975; % percentage of observation to me downweighted
%%************************************************************
%
t=size(r,1);
j=zeros(t,1);
meau=zeros(t,1);
var=zeros(t,1);
mpy=zeros(t,1);
%%This section of program define the jump factor
if delta==0.99
c_delta=1.0185;
end
if delta==0.975
c_delta=1.0465;
end
if delta==0.95
c_delta=1.0953;
end
%%This section of program estiamte the equation 2.6, 2.9, 2.10, 2.11 simulatenously
for i=1:t
if i==1
meau0=mean(r); % initial value of eqation no 2.9
sd=std(r);
j0=(0-meau0)/sd; % initial value of J equation no 2.6
var0=std(r)^2; % initial value of eqation no 2.11
mpy0=sign(j0)*min(abs(j0),norminv(delta)); % initial value of eqation no 2.10
%%*******************************************************************************************************
meau(i,1)=c0+c1*sqrt(var0)*mpy0; % equation no 2.9 of the paper
var(i,1)=w+alpha*var0*c_delta*mpy0^2+beta*var0; % equation no 2.11 of the paper
j(i,1)=(r(i,1)-meau(i,1))/sqrt(var(i,1)); % equation no 2.6 of the paper
mpy(i,1)=sign(j(i,1))*min(abs(j(i,1)),norminv(delta)); % equaiton no 2.10 of the paper
else
meau(i,1)=c0+c1*sqrt(var(i-1,1))*mpy(i-1,1);
var(i,1)=w+alpha*var(i-1,1)*c_delta*mpy(i-1,1)^2+beta*var(i-1,1);
j(i,1)=(r(i,1)-meau(i,1))/sqrt(var(i,1));
mpy(i,1)=sign(j(i,1))*min(abs(j(i,1)),norminv(delta));
end
%%************************************m******************************************
end
abs1=abs(j);
z =2*log10(abs1);
%%The estimation of Rho, that is used in equation no 2.13 (function which is to be minimize)
v=4;
rho=-z+.82660*(1+v)*log10(1+exp(z)/(v-2));
arg=mean(rho);
These are the codes of mathematics of proposed test in the paper attached. Then I have an other program in which I use the minimization function "fmincon". The program is given below.
function [mn, fv]=minimization()
x0=[.51; .08; .4; 4.18; .88];
A=[ 0, 0, 0, 1, 1];
b=[.99];
lb=[-5,-5,0,0,0];
lu=[5,5,5,1,1];
%options = struct('MaxFunEvals', 2000);
options=optimset('Algorithm','sqp','MaxFunEvals', 2000,'MaxIter',500);
%opt = optimset('Display','iter');
[mn, fv]=fmincon(@argmin,x0,A,b,[],[],lb,lu,[],options);
When I run this program it does not work. I have simulated series "r" of AR(1)-GARCH(1,1) process. When there is no outliers in the series the estimated values should be close to the original ones.

댓글 수: 1

Walter Roberson
Walter Roberson 2016년 5월 14일
Please show the complete error message, everything in red.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Optimization Toolbox에 대해 자세히 알아보기

질문:

2016년 5월 14일

댓글:

2016년 5월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by