FDist
The F Distribution
Description
Calculates density, cumulative probability, quantile, and
generate random sample for the F distribution (continuous).
Usage
df(x, df1, df2, ncp = 0, log = FALSE) # density
pf(q, df1, df2, ncp = 0, lower.tail = TRUE, log.p = FALSE) # probability
qf(p, df1, df2, ncp = 0, lower.tail = TRUE, log.p = FALSE) # quantile
rf(n, df1, df2, ncp = 0) # random
Arguments
x, q |
numeric vectors in the range [0, Inf) that specify the quantiles.
|
p |
a numeric vector in the range [0, 1] that specifies the probabilities.
|
n |
an integer scalar in the range [0, Inf) that specifies the number of random samples requested.
If the input value is not an integer, it is truncated.
If length(n) is greater than 1,
the random function returns length(n) random samples.
|
df1 |
a numeric vector in the range [0, Inf) that specifies the degree of freedom for the numerator.
|
df2 |
a numeric vector in the range [0, Inf) that specifies the degree of freedom for the denominator.
|
ncp |
a numeric vector in the range [0, Inf) that specifies the noncentrality parameter.
|
log |
a logical value.
If FALSE (default), the density function returns the density itself.
If TRUE, it returns the log of the density.
|
lower.tail |
a logical value.
If TRUE (default), the probability supplied to the quantile function
or returned by the probability function is P[X <= x].
If FALSE, it is P[X > x].
|
log.p |
a logical value.
If FALSE (default), the probability supplied to the quantile function
or returned by the probability function is the probability itself.
If TRUE, it is the log of the probability.
|
Details
The distribution parameter(s) are replicated cyclically to be the same length as
the input x, q, p, or the number of random samples requested.
Missing values (NAs) in the input or the distribution parameter(s)
will cause the corresponding elements of the result to be missing.
Value
returns density (df),
cumulative probability (pf),
quantile (qf), or
random sample (rf) for the F distribution with parameters df1 and df2
and an optional noncentrality parameter ncp.
Side Effects
If the .Random.seed dataset exists, the random sample function updates its value.
The random sample function creates the .Random.seed dataset if it does not exist.
Background
The F distribution is a family of continuous probability distributions
defined on the interval [0, Inf) and parameterized by two positive parameters,
df1 and df2,
the degrees of freedom of two independent chi-squared random variables respectively
whose ratio is calculated.
References
Johnson, N. L. and Kotz, S. 1970. Continuous Univariate Distributions, Volume 2. Boston, MA: Houghton-Mifflin.
Posten, H. O. 1993. An effective algorithm for the noncentral beta distribution function. The American Statistician. Volume 47. 129-131.
See Also
Examples
stat <- 1:10
1 - pf(stat, 4, 12) # p-value of stat
rf(10, 5, 15) #sample of 10 with 5 and 15 degrees of freedom
# power of a test for several noncentrality values
1 - pf(qf(.95, 4, 5), 4, 5, 0:10)