This is documentation for an old release of SciPy (version 0.18.1). Read this page in the documentation of the latest stable release (version 1.15.1).
scipy.special.ncfdtr¶
- scipy.special.ncfdtr(dfn, dfd, nc, f) = <ufunc 'ncfdtr'>¶
Cumulative distribution function of the non-central F distribution.
The non-central F describes the distribution of,
Z=X/dnY/ddwhere X and Y are independently distributed, with X distributed non-central χ2 with noncentrality parameter nc and dn degrees of freedom, and Y distributed χ2 with dd degrees of freedom.
Parameters: dfn : array_like
Degrees of freedom of the numerator sum of squares. Range (0, inf).
dfd : array_like
Degrees of freedom of the denominator sum of squares. Range (0, inf).
nc : array_like
Noncentrality parameter. Should be in range (0, 1e4).
f : array_like
Quantiles, i.e. the upper limit of integration.
Returns: cdf : float or ndarray
The calculated CDF. If all inputs are scalar, the return will be a float. Otherwise it will be an array.
See also
- ncdfdtri
- Inverse CDF (iCDF) of the non-central F distribution.
- ncdfdtridfd
- Calculate dfd, given CDF and iCDF values.
- ncdfdtridfn
- Calculate dfn, given CDF and iCDF values.
- ncdfdtrinc
- Calculate noncentrality parameter, given CDF, iCDF, dfn, dfd.
Notes
Wrapper for the CDFLIB [R440] Fortran routine cdffnc.
The cumulative distribution function is computed using Formula 26.6.20 of [R441]:
F(dn,dd,nc,f)=∞∑j=0e−nc/2(nc/2)jj!Ix(dn2+j,dd2),where I is the regularized incomplete beta function, and x=fdn/(fdn+dd).
The computation time required for this routine is proportional to the noncentrality parameter nc. Very large values of this parameter can consume immense computer resources. This is why the search range is bounded by 10,000.
References
[R440] (1, 2) Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. [R441] (1, 2) Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972. Examples
>>> from scipy import special >>> from scipy import stats >>> import matplotlib.pyplot as plt
Plot the CDF of the non-central F distribution, for nc=0. Compare with the F-distribution from scipy.stats:
>>> x = np.linspace(-1, 8, num=500) >>> dfn = 3 >>> dfd = 2 >>> ncf_stats = stats.f.cdf(x, dfn, dfd) >>> ncf_special = special.ncfdtr(dfn, dfd, 0, x)
>>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.plot(x, ncf_stats, 'b-', lw=3) >>> ax.plot(x, ncf_special, 'r-') >>> plt.show()