X_mean=mean(X);
X_std=std(X);
X=zscore(X);
[P,T,latent]=princomp(X);
A=latent;
P;
percent=0.86;
k=0;
for i=1:size(X,2);
alpha(i)=sum(latent(1:i))/sum(latent);
if alpha(i)>=percent;
k=i;
break;
end
end
Xp=zeros(size(X));
for j=1:k;
Xp=Xp+T(:,j)*P(:,j)';
end
beta=0.95;
theta=zeros(3,1);
for i=1:3;
for j=k+1:size(X,2);
theta(i)=theta(i)+latent(j)^(i);
end
end
for j=1:k;
B=latent*P(2,j)*P(2,j);
end
h0=1-2*theta(1)*theta(3)/3/theta(2)^2;
SPEknbe=theta(1)*(norminv(beta)*(2*theta(2)*h0^2)^0.5/theta(1)+1+thet
a(2)*h0*(h0-1)/theta(1)^2)^(1/h0);
T2knbeta=k*(size(X)-1)/(size(X)-k)*finv(beta,k,size(X,1));
XT=d01_f;
[n1,m1]=size(XT);
P1=P(:,1:k);
XT = (XT - repmat(X_mean,n1,1))./repmat(X_std,n1,1);
T_test=XT*P1;
for i=1:598;
TT(i)=T_test(i,:)*diag(1./latent(1:k))*T_test(i,:)';
评论0