📄 check_order.m
字号:
function check_order(term)
%checks order of the structure of the linear predictor
%structure of the linear predictor :
%first all f0 vectors that contain 0, then all f0 vectors that contain no
%within f0 and f1:
%ordering according to order of nodenr:
%last cell element
%corresponds to highest nodenumber (children). for interactions: lowest nodenr of
%interactions counts
containschildnode=zeros(length(term),1);
for j=1:length(term)%term is cell of vectors
containschildnode(j)=(term{j}(1)==0);
end
f1=find(containschildnode==1);
f2=find(containschildnode~=1);
if max(f1)>min(f2)
error('In the linear predictor structure, terms that contain 0 (interactions with effects in pred_mat) should be the first elements');
end
m=[];
for i=1:length(f1)
a=term{f1(i)};
m=[m min(a(a>0))];
end
if sum(m~=sort(m))~=0
error('In the linear predictor structure, terms for lowest node numbers should appear first');
end
m=[];
for i=1:length(f2)
a=term{f2(i)};
m=[m min(a(a>0))];
end
if sum(m~=sort(m))~=0
error('In the linear predictor structure, terms for lowest node numbers should appear first');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -