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.
dist_f(df1, df2, ncp = NULL)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\)).
stats::FDist
dist <- dist_f(df1 = c(1,2,5,10,100), df2 = c(1,1,2,1,100))
dist
#> <distribution[5]>
#> [1] F(1, 1) F(2, 1) F(5, 2) F(10, 1) F(100, 100)
mean(dist)
#> [1] NA NA NA NA 1.020408
variance(dist)
#> [1] NA NA NA NA 0.04295085
skewness(dist)
#> [1] NA NA NA NA 0.6243619
kurtosis(dist)
#> [1] NA NA NA NA 0.7278883
generate(dist, 10)
#> [[1]]
#> [1] 0.17699560 0.05567944 4.96317296 222.95827169 0.14648381
#> [6] 0.40473243 0.29663718 0.24488178 10.25189377 244.28041546
#>
#> [[2]]
#> [1] 93.52841051 1.75963989 1.15613883 0.37587238 12.96395545 5.13795220
#> [7] 2.36518856 0.26999124 0.05107212 0.73895273
#>
#> [[3]]
#> [1] 10.6826321 2.8417828 0.1854272 0.7424301 0.7988277 2.3507882
#> [7] 0.2397850 2.6535022 0.3965064 302.0121210
#>
#> [[4]]
#> [1] 0.07955968 0.70528221 0.50798800 1.19764119 12.89817976 0.18602669
#> [7] 2.54512209 0.34397413 1.32663934 0.49027473
#>
#> [[5]]
#> [1] 1.1831332 0.9803610 1.3460859 0.5313298 0.6942822 1.0765423 0.9698401
#> [8] 1.0033818 1.2380607 1.0131018
#>
density(dist, 2)
#> [1] 0.075026360 0.089442719 0.132070447 0.105192421 0.002755106
density(dist, 2, log = TRUE)
#> [1] -2.589916 -2.414157 -2.024420 -2.251964 -5.894300
cdf(dist, 4)
#> [1] 0.7048328 0.6666667 0.7879856 0.6278936 1.0000000
quantile(dist, 0.7)
#> [1] 3.851840 5.055556 2.608427 6.357893 1.110896