Learn R Programming

distributional (version 0.6.0)

dist_f: The F Distribution

Description

[Stable]

The F distribution is commonly used in statistical inference, particularly in the analysis of variance (ANOVA), testing the equality of variances, and in regression analysis. It arises as the ratio of two scaled chi-squared distributions divided by their respective degrees of freedom.

Usage

dist_f(df1, df2, ncp = NULL)

Arguments

df1

Degrees of freedom for the numerator. Can be any positive number.

df2

Degrees of freedom for the denominator. Can be any positive number.

ncp

Non-centrality parameter. If NULL (default), the central F distribution is used. If specified, must be non-negative.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_f.html

In the following, let \(X\) be an F random variable with numerator degrees of freedom df1 = \(d_1\) and denominator degrees of freedom df2 = \(d_2\).

Support: \(x \in (0, \infty)\)

Mean:

For the central F distribution (ncp = NULL):

$$ E(X) = \frac{d_2}{d_2 - 2} $$

for \(d_2 > 2\), otherwise undefined.

For the non-central F distribution with non-centrality parameter ncp = \(\lambda\):

$$ E(X) = \frac{d_2 (d_1 + \lambda)}{d_1 (d_2 - 2)} $$

for \(d_2 > 2\), otherwise undefined.

Variance:

For the central F distribution (ncp = NULL):

$$ \text{Var}(X) = \frac{2 d_2^2 (d_1 + d_2 - 2)}{d_1 (d_2 - 2)^2 (d_2 - 4)} $$

for \(d_2 > 4\), otherwise undefined.

For the non-central F distribution with non-centrality parameter ncp = \(\lambda\):

$$ \text{Var}(X) = \frac{2 d_2^2}{d_1^2} \cdot \frac{(d_1 + \lambda)^2 + (d_1 + 2\lambda)(d_2 - 2)}{(d_2 - 2)^2 (d_2 - 4)} $$

for \(d_2 > 4\), otherwise undefined.

Skewness:

For the central F distribution (ncp = NULL):

$$ \text{Skew}(X) = \frac{(2 d_1 + d_2 - 2) \sqrt{8 (d_2 - 4)}}{(d_2 - 6) \sqrt{d_1 (d_1 + d_2 - 2)}} $$

for \(d_2 > 6\), otherwise undefined.

For the non-central F distribution, skewness has no simple closed form and is not computed.

Excess Kurtosis:

For the central F distribution (ncp = NULL):

$$ \text{Kurt}(X) = \frac{12[d_1 (5 d_2 - 22)(d_1 + d_2 - 2) + (d_2 - 4)(d_2 - 2)^2]}{d_1 (d_2 - 6)(d_2 - 8)(d_1 + d_2 - 2)} $$

for \(d_2 > 8\), otherwise undefined.

For the non-central F distribution, kurtosis has no simple closed form and is not computed.

Probability density function (p.d.f):

For the central F distribution (ncp = NULL):

$$ f(x) = \frac{\sqrt{\frac{(d_1 x)^{d_1} d_2^{d_2}}{(d_1 x + d_2)^{d_1 + d_2}}}}{x \, B(d_1/2, d_2/2)} $$

where \(B(\cdot, \cdot)\) is the beta function.

For the non-central F distribution, the density involves an infinite series and is approximated numerically.

Cumulative distribution function (c.d.f):

The c.d.f. does not have a simple closed form expression and is approximated numerically using regularized incomplete beta functions and related special functions.

Moment generating function (m.g.f):

The moment generating function for the F distribution does not exist in general (it diverges for \(t > 0\)).

See Also

stats::FDist

Examples

Run this code
dist <- dist_f(df1 = c(1,2,5,10,100), df2 = c(1,1,2,1,100))

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)

Run the code above in your browser using DataLab