[Stable]

dist_f(df1, df2, ncp = NULL)

Arguments

df1, df2

degrees of freedom. Inf is allowed.

ncp

non-centrality parameter. If omitted the central F is assumed.

Details

We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

In the following, let \(X\) be a Gamma random variable with parameters shape = \(\alpha\) and rate = \(\beta\).

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

Mean: \(\frac{\alpha}{\beta}\)

Variance: \(\frac{\alpha}{\beta^2}\)

Probability density function (p.m.f):

$$ f(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)} x^{\alpha - 1} e^{-\beta x} $$

Cumulative distribution function (c.d.f):

$$ f(x) = \frac{\Gamma(\alpha, \beta x)}{\Gamma{\alpha}} $$

Moment generating function (m.g.f):

$$ E(e^{tX}) = \Big(\frac{\beta}{ \beta - t}\Big)^{\alpha}, \thinspace t < \beta $$

See also

stats::FDist

Examples

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.4743386   0.3134471  57.1365590   0.3697037 719.9992235   5.0063191
#>  [7]  61.4585702  44.1580144   0.1464838   0.4047324
#> 
#> [[2]]
#>  [1]  0.20290730  0.07864699  0.10138624  0.07960338  1.31772909 26.09388299
#>  [7]  1.52559361  0.02756035  1.56496578  4.94757709
#> 
#> [[3]]
#>  [1]   0.6514306  10.6233140   2.6303528   2.4924693 353.3329873   3.7679502
#>  [7]  25.7443206   1.5658225   1.5903515   1.1549140
#> 
#> [[4]]
#>  [1]  67.9989726   0.7090127   0.8538470   0.7753523   4.8332287   0.5324407
#>  [7]  64.8255148   0.3581129   0.9281448 228.2107278
#> 
#> [[5]]
#>  [1] 0.8761848 0.8846237 0.9600552 1.1612001 1.2083398 0.8562573 1.3303753
#>  [8] 1.2072285 1.5412601 0.9393790
#> 

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