Mercurial > octave-nkf
diff scripts/statistics/distributions/hygecdf.m @ 7002:12ab7f5fc663
[project @ 2007-10-10 18:27:06 by jwe]
author | jwe |
---|---|
date | Wed, 10 Oct 2007 18:27:07 +0000 |
parents | 34f96dd5441b |
children | 93c65f2a5668 |
line wrap: on
line diff
--- a/scripts/statistics/distributions/hygecdf.m Wed Oct 10 18:03:02 2007 +0000 +++ b/scripts/statistics/distributions/hygecdf.m Wed Oct 10 18:27:07 2007 +0000 @@ -18,38 +18,36 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} hygecdf (@var{x}, @var{m}, @var{t}, @var{n}) +## @deftypefn {Function File} {} hygecdf (@var{x}, @var{t}, @var{m}, @var{n}) ## Compute the cumulative distribution function (CDF) at @var{x} of the -## hypergeometric distribution with parameters @var{m}, @var{t}, and +## hypergeometric distribution with parameters @var{t}, @var{m}, and ## @var{n}. This is the probability of obtaining not more than @var{x} ## marked items when randomly drawing a sample of size @var{n} without ## replacement from a population of total size @var{t} containing ## @var{m} marked items. ## -## The parameters @var{m}, @var{t}, and @var{n} must positive integers +## The parameters @var{t}, @var{m}, and @var{n} must positive integers ## with @var{m} and @var{n} not greater than @var{t}. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> ## Description: CDF of the hypergeometric distribution -function cdf = hygecdf (x, m, t, n) +function cdf = hygecdf (x, t, m, n) if (nargin != 4) print_usage (); endif - if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hygecdf: m, t and n must all be positive integers"); + if (!isscalar (t) || !isscalar (m) || !isscalar (n)) + error ("hygecdf: t, m and n must all be positive integers"); endif - if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | - (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) + if ((t < 0) | (m < 0) | (n <= 0) | (t != round (t)) | + (m != round (m)) | (n != round (n)) | (m > t) | (n > t)) cdf = NaN * ones (size (x)) else - cdf = discrete_cdf (x, 0 : n, hygepdf (0 : n, m, t, n)); + cdf = discrete_cdf (x, 0 : n, hygepdf (0 : n, t, m, n)); endif endfunction - -