EVOLUTION-MANAGER
Edit File: Fdist.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: The F Distribution</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for FDist {stats}"><tr><td>FDist {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>The F Distribution</h2> <h3>Description</h3> <p>Density, distribution function, quantile function and random generation for the F distribution with <code>df1</code> and <code>df2</code> degrees of freedom (and optional non-centrality parameter <code>ncp</code>). </p> <h3>Usage</h3> <pre> df(x, df1, df2, ncp, log = FALSE) pf(q, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE) qf(p, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE) rf(n, df1, df2, ncp) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, q</code></td> <td> <p>vector of quantiles.</p> </td></tr> <tr valign="top"><td><code>p</code></td> <td> <p>vector of probabilities.</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>number of observations. If <code>length(n) > 1</code>, the length is taken to be the number required.</p> </td></tr> <tr valign="top"><td><code>df1, df2</code></td> <td> <p>degrees of freedom. <code>Inf</code> is allowed.</p> </td></tr> <tr valign="top"><td><code>ncp</code></td> <td> <p>non-centrality parameter. If omitted the central F is assumed.</p> </td></tr> <tr valign="top"><td><code>log, log.p</code></td> <td> <p>logical; if TRUE, probabilities p are given as log(p).</p> </td></tr> <tr valign="top"><td><code>lower.tail</code></td> <td> <p>logical; if TRUE (default), probabilities are <i>P[X ≤ x]</i>, otherwise, <i>P[X > x]</i>.</p> </td></tr> </table> <h3>Details</h3> <p>The F distribution with <code>df1 =</code> <i>n1</i> and <code>df2 =</code> <i>n2</i> degrees of freedom has density </p> <p style="text-align: center;"><i>f(x) = Γ((n1 + n2)/2) / (Γ(n1/2) Γ(n2/2)) (n1/n2)^(n1/2) x^(n1/2 - 1) (1 + (n1/n2) x)^-(n1 + n2)/2</i></p> <p>for <i>x > 0</i>. </p> <p>It is the distribution of the ratio of the mean squares of <i>n1</i> and <i>n2</i> independent standard normals, and hence of the ratio of two independent chi-squared variates each divided by its degrees of freedom. Since the ratio of a normal and the root mean-square of <i>m</i> independent normals has a Student's <i>t_m</i> distribution, the square of a <i>t_m</i> variate has a F distribution on 1 and <i>m</i> degrees of freedom. </p> <p>The non-central F distribution is again the ratio of mean squares of independent normals of unit variance, but those in the numerator are allowed to have non-zero means and <code>ncp</code> is the sum of squares of the means. See <a href="Chisquare.html">Chisquare</a> for further details on non-central distributions. </p> <h3>Value</h3> <p><code>df</code> gives the density, <code>pf</code> gives the distribution function <code>qf</code> gives the quantile function, and <code>rf</code> generates random deviates. </p> <p>Invalid arguments will result in return value <code>NaN</code>, with a warning. </p> <p>The length of the result is determined by <code>n</code> for <code>rf</code>, and is the maximum of the lengths of the numerical arguments for the other functions. </p> <p>The numerical arguments other than <code>n</code> are recycled to the length of the result. Only the first elements of the logical arguments are used. </p> <h3>Note</h3> <p>Supplying <code>ncp = 0</code> uses the algorithm for the non-central distribution, which is not the same algorithm used if <code>ncp</code> is omitted. This is to give consistent behaviour in extreme cases with values of <code>ncp</code> very near zero. </p> <p>The code for non-zero <code>ncp</code> is principally intended to be used for moderate values of <code>ncp</code>: it will not be highly accurate, especially in the tails, for large values. </p> <h3>Source</h3> <p>For the central case of <code>df</code>, computed <em>via</em> a binomial probability, code contributed by Catherine Loader (see <code><a href="Binomial.html">dbinom</a></code>); for the non-central case computed <em>via</em> <code><a href="Beta.html">dbeta</a></code>, code contributed by Peter Ruckdeschel. </p> <p>For <code>pf</code>, <em>via</em> <code><a href="Beta.html">pbeta</a></code> (or for large <code>df2</code>, <em>via</em> <code><a href="Chisquare.html">pchisq</a></code>). </p> <p>For <code>qf</code>, <em>via</em> <code><a href="Chisquare.html">qchisq</a></code> for large <code>df2</code>, else <em>via</em> <code><a href="Beta.html">qbeta</a></code>. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <p>Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) <em>Continuous Univariate Distributions</em>, volume 2, chapters 27 and 30. Wiley, New York. </p> <h3>See Also</h3> <p><a href="Distributions.html">Distributions</a> for other standard distributions, including <code><a href="Chisquare.html">dchisq</a></code> for chi-squared and <code><a href="TDist.html">dt</a></code> for Student's t distributions. </p> <h3>Examples</h3> <pre> ## Equivalence of pt(.,nu) with pf(.^2, 1,nu): x <- seq(0.001, 5, len = 100) nu <- 4 stopifnot(all.equal(2*pt(x,nu) - 1, pf(x^2, 1,nu)), ## upper tails: all.equal(2*pt(x, nu, lower=FALSE), pf(x^2, 1,nu, lower=FALSE))) ## the density of the square of a t_m is 2*dt(x, m)/(2*x) # check this is the same as the density of F_{1,m} all.equal(df(x^2, 1, 5), dt(x, 5)/x) ## Identity: qf(2*p - 1, 1, df) == qt(p, df)^2 for p >= 1/2 p <- seq(1/2, .99, length = 50); df <- 10 rel.err <- function(x, y) ifelse(x == y, 0, abs(x-y)/mean(abs(c(x,y)))) quantile(rel.err(qf(2*p - 1, df1 = 1, df2 = df), qt(p, df)^2), .90) # ~= 7e-9 </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>