Hi i'm trying to update this code from a principal component analysis but it does'nt work now. Error in IndexCol (line 61). [w,fval]=fmincon(@(x)minTE(x,rtrack,y),starting,[],[],Aeq,1); I'd appreciate your help.
2 views (last 30 days)
Show older comments
for k=3:N selected=coeff(:,[1:k]); %Varimax rotation B=rotatefactors(selected,'Method','varimax');% %Selection of index tracking members [C,I]=max(abs(B)); winner=names(I);
%TE minimization
rtrack=r(:,I);
ini=1/k;
starting=repmat(ini,k,1);
Aeq=ones(1,k);
[w,fval]=fmincon(@(x)minTE(x,rtrack,y),starting,[],[],Aeq,1);
%Tracking error for in-of-sample period
d=w'*rtrack'-y';
TE(k-2,1)=std(d)*100;
%Plot out-of-sample performance
outSample=inSample+1;
rout=r1(outSample:end,I);
x1=1:size(rout);
trackIndexOut=w'*rout';
yout=y1(outSample:end);
%Tracking error for out-of-sample period
d=w'*rout'-yout';
TEOut(k-2,1)=sqrt(d*d')*100;
end
0 Comments
Answers (0)
See Also
Categories
Find more on Robotics System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!