hypg_cdf.m

来自「计量工具箱」· M 代码 · 共 28 行

M
28
字号
function  p = hypg_cdf(k,n,K,N)
% PURPOSE: hypergeometric cdf function
%---------------------------------------------------
% USAGE: p = hypg_cdf(k,n,K,N)
% where: k,n,K,N are parameters 
% 
%---------------------------------------------------
% RETURNS:
%        a vector of cumulative probabilities from the distribution      
% --------------------------------------------------
% SEE ALSO: hypg_d, hypg_cdf, hypg_rnd, 
%---------------------------------------------------

%       Anders Holtsberg, 18-11-93
%       Copyright (c) Anders Holtsberg
% documentation changed to match the econometrics toolbox
% by LeSage

if max([length(n) length(K) length(N)]) > 1
   error('Sorry, this is not implemented');
end

kk = -1:n;
cdf = max(0,min(1,cumsum(hypg_pdf(kk,n,K,N))));
p = k;
p(:) = cdf(max(1,min(n+2,floor(k(:))+2)));

⌨️ 快捷键说明

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