⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 construct_equiv_class_cpt.m

📁 The BNL toolbox is a set of Matlab functions for defining and estimating the parameters of a Bayesi
💻 M
字号:
function equiv_class_CPT=construct_equiv_class_CPT(link,lin_pred,N)
%equiv_class_CPT=construct_equiv_class_CPT constructs conditional probability tables 


equiv_class_CPT=cell(size(lin_pred));
for i=1:length(lin_pred)
    nd=ndims(lin_pred{i});
    siz=size(lin_pred{i});
    if siz(end)~=N 
        n=1;
        grouped=1;
    else
        n=N;
        grouped=0;
    end
    
   if grouped lp=lin_pred{i};
   else lp=permute(lin_pred{i},[1:nd-2 nd nd-1]);%if ungrouped data, last dimension is persons
   end
   if strmatch(link{i},'multinomial')
        probs=multinom_logistic(lp);
   elseif strmatch(link{i},'cumulative')
        probs=cum_logistic(lp);
        %probs=multinom_logistic(lp);
        %f=find(probs~=probs2)
        %if ~isempty(f) 
        %    f
        %    probs-probs2
            
        %end
   elseif strmatch(link{i},'adjacent')
        probs=adj_logistic(lp);
       else error('no valid link function specified');
       end
    if isvector(probs) probs=probs(:);, end;
    if ~grouped    probs=permute(probs,[1:nd-2 nd nd-1]);%shift person dimension
    end                                            %back to last dimension
    equiv_class_CPT{i}=probs;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -