1## Copyright (C) 1995, 1996, 1997, 2005, 2006, 2007 Kurt Hornik
3## This file is part of Octave.
5## Octave is free software; you can redistribute it and/or modify it
6## under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 3 of the License, or (at
8## your option) any later version.
10## Octave is distributed in the hope that it will be useful, but
11## WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13## General Public License for more details.
15## You should have received a copy of the GNU General Public License
16## along with Octave; see the file COPYING. If not, see
17## <http://www.gnu.org/licenses/>.
20## @deftypefn {Function File} {} fcdf (@var{x}, @var{m}, @var{n})
21## For each element of @var{x}, compute the CDF at @var{x} of the F
22## distribution with @var{m} and @var{n} degrees of freedom, i.e.,
23## PROB (F (@var{m}, @var{n}) <= @var{x}).
26## Author: KH <Kurt.Hornik@wu-wien.ac.at>
27## Description: CDF of the F distribution
29function cdf = fcdf (x, m, n)
35 if (!isscalar (m) || !isscalar (n))
36 [retval, x, m, n] = common_size (x, m, n);
38 error ("fcdf: x, m and n must be of common size or scalar");
45 k = find (!(m > 0) | !(n > 0) | isnan (x));
50 k = find ((x == Inf) & (m > 0) & (n > 0));
55 k = find ((x > 0) & (x < Inf) & (m > 0) & (n > 0));
57 if (isscalar (m) && isscalar (n))
58 cdf(k) = 1 - betainc (1 ./ (1 + m .* x(k) ./ n), n / 2, m / 2);
60 cdf(k) = 1 - betainc (1 ./ (1 + m(k) .* x(k) ./ n(k)), n(k) / 2,