check_order.m
来自「The BNL toolbox is a set of Matlab funct」· M 代码 · 共 41 行
M
41 行
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 + =
减小字号Ctrl + -
显示快捷键?