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

📄 adj_logit.m

📁 The BNL toolbox is a set of Matlab functions for defining and estimating the parameters of a Bayesi
💻 M
字号:
function y=adj_logit(x,baselinecategory)
%every column of x is prob vector of size k, y is adjacent categories logit of length k-1
%if only one prob vector, use row vector!


if isvector(x)
     if (size(x,2)==1), error('sum of rows =1, input should be row vector! ');,return,end;
end

d=ndims(x);
siz=size(x);
shift=prod(siz(1:end-1));
y=zeros(shift,siz(end)-1);
a=sum(x,d);
if any(a(:)<.999) || any(a(:)>1.001), error('one of the x is not a probability vector, sum(x)~=1');,return,end;
z=reshape(x,[shift siz(d)]);

y=log(z(:,2:siz(d))./z(:,1:siz(d)-1));
y=reshape(y,[siz(1:d-1) siz(d)-1]);

 

⌨️ 快捷键说明

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