|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function [ Qhj,Qh,prey]=crossval7(X,Y)
%px是自变量的个数;
%py是因变量的个数;
[C,px,py]=fun1(X,Y);
PRESShj=zeros(px,py);
c=norm1(C);
X=c(:,1:px);
Y=c(:,px+1:px+py);
x=norm1(X);
y=norm1(Y);
[line,row]=size(x);
for h=1:px
for j=1:line
newx=X;
newy=Y;
newx(j,:)=[];
newy(j,:)=[];
[t,p0,w,wh,f0,FF]=fun717(px,py,[newx,newy]);
prey(j,:,h)=X(j,:)*FF(:,2:px+1,h)'+FF(:,1,h)';
end
PRESShj(h,:)=sum((Y-prey(:,:,h)).^2);
end
PRESSh=(sum(PRESShj'))';
for h=1:px
[t1,p0,w,wh,f0,FF]=fun717(px,py,c);
prey2(:,:,h)=X(:,:)*FF(:,2:px+1,h)'+ones(line,1)*FF(:,1,h)';
SShj(h,:)=sum((Y-prey2(:,:,h)).^2);
end
SSh(h,1)=(sum(SShj'))';
Qhj=ones(px-1,py)-PRESShj(2:px,:)./SShj(1:px-1,:); % 错位
Qh=ones(px-1,1)-PRESSh(2:px,1)./SSh(1:px-1,1); 这里错了
??? Index exceeds matrix dimensions.
Error in ==> crossval7 at 33
Qh=ones(px-1,1)-PRESSh(2:px,1)./SSh(1:px-1,1);
[ 本帖最后由 ChaChing 于 2009-4-29 21:49 编辑 ] |
|