FDist {base} | R Documentation |
The F Distribution
Description
Density, distribution function, quantile function and random
generation for the F distribution with df1
and df2
degrees of freedom (and optional non-centrality parameter
ncp
).
Usage
df(x, df1, df2, log = FALSE)
pf(q, df1, df2, ncp=0, lower.tail = TRUE, log.p = FALSE)
qf(p, df1, df2, lower.tail = TRUE, log.p = FALSE)
rf(n, df1, df2)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations to generate. |
df1 , df2 |
degrees of freedom. |
ncp |
non-centrality parameter. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are
|
Details
The F distribution with df1 =
n_1
and df2 =
n_2
degrees of freedom has density
f(x) = \frac{\Gamma(n_1/2 + n_2/2)}{\Gamma(n_1/2)\Gamma(n_2/2)}
\left(\frac{n_1}{n_2}\right)^{n_1/2} x^{n_1/2 -1}
\left(1 + \frac{n_1 x}{n_2}\right)^{-(n_1 + n_2) / 2}%
for x > 0
.
Value
df
gives the density,
pf
gives the distribution function
qf
gives the quantile function, and
rf
generates random deviates.
See Also
dt
for Student's t distribution, the square of which is
(almost) equivalent to the F distribution with df2
= 1
.
Examples
df(1,1,1) == dt(1,1)# TRUE
## 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