📄 t3fitpartitioning.m
字号:
function [fitA,fitB,fitC,BCcontr,ACcontr,ABcontr]=t3fitpartitioning(Xprep,n,m,p,AS,BT,CU,K,renormmode);
% [fitA,fitB,fitC,BCcontr,ACcontr,ABcontr]=t3fitpartitioning(Xprep,n,m,p,AS,BT,CU,K,renormmode);
%
% Xprep = preprocessed data
% AS,BT,CU,K = rotated component matrices and core
% computes fit of each entity, per mode
% computes fit contributions by comnbinaitons of modes in case of "renormalization"
% (renommode=1,2,or 3 is used)
Res=Xprep-AS*K*kron(CU',BT');
% A-mode
fitA=(100-sum(Res'.^2)./sum(Xprep'.^2)*100)';
% B-mode
Res=permnew(Res,n,m,p);
Xprep=permnew(Xprep,n,m,p);
fitB=(100-sum(Res'.^2)./sum(Xprep'.^2)*100)';
% C-mode
Res=permnew(Res,m,p,n);
Xprep=permnew(Xprep,m,p,n);
fitC=(100-sum(Res'.^2)./sum(Xprep'.^2)*100)';
Xprep=permnew(Xprep,p,n,m);
Res=permnew(Res,p,n,m);
BCcontr=0;ACcontr=0;ABcontr=0;
if renormmode==1
% compute fit contribution to total fit% of each B&C-mode component combination
F=AS*K;
BCcontr=sum(F.^2)/ssq(Xprep)*100;
disp(' ');
disp(' Contributions to total fit% of each B&C-mode component');disp(' ');
writescr(BCcontr,'8.2');
end;
if renormmode==2
% compute fit contribution to total fit% of each A&C-mode component combination
F=BT*permnew(K,r1,r2,r3);
ACcontr=sum(F.^2)/ssq(Xprep)*100;
disp(' ');
disp(' Contributions to total fit% of each A&C-mode component');disp(' ');
writescr(ACcontr,'8,2');
end;
if renormmode==3
% compute fit contribution to total fit% of each A&B-mode component combination
F=CU*permnew(permnew(K,r1,r2,r3),r2,r3,r1);
ABcontr=sum(F.^2)/ssq(Xprep)*100;
disp(' ');
disp(' Contributions to total fit% of each A&B-mode component');disp(' ');
writescr(ABcontr,'8.2');
end;
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -