dist_student_t(df, mu = 0, sigma = 1, ncp = NULL)

## Arguments

df degrees of freedom ($$> 0$$, maybe non-integer). df = Inf is allowed. The location parameter of the distribution. If ncp == 0 (or NULL), this is the median. The scale parameter of the distribution. non-centrality parameter $$\delta$$; currently except for rt(), only for abs(ncp) <= 37.62. If omitted, use the central t distribution.

## Details

The Student's T distribution is closely related to the Normal() distribution, but has heavier tails. As $$\nu$$ increases to $$\infty$$, the Student's T converges to a Normal. The T distribution appears repeatedly throughout classic frequentist hypothesis testing when comparing group means.

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

In the following, let $$X$$ be a central Students T random variable with df = $$\nu$$.

Support: $$R$$, the set of all real numbers

Mean: Undefined unless $$\nu \ge 2$$, in which case the mean is zero.

Variance:

$$\frac{\nu}{\nu - 2}$$

Undefined if $$\nu < 1$$, infinite when $$1 < \nu \le 2$$.

Probability density function (p.d.f):

$$f(x) = \frac{\Gamma(\frac{\nu + 1}{2})}{\sqrt{\nu \pi} \Gamma(\frac{\nu}{2})} (1 + \frac{x^2}{\nu} )^{- \frac{\nu + 1}{2}}$$

## Examples

dist <- dist_student_t(df = c(1,2,5), mu = c(0,1,2), sigma = c(1,2,3))

dist
#> <distribution[3]>
#> [1] t(1, 0, 1) t(2, 1, 2) t(5, 2, 3)mean(dist)
#> [1] NA  1  2variance(dist)
#> [1]  NA Inf  15
generate(dist, 10)
#> [[1]]
#>  [1]  0.63017890  0.80817754 13.67350714  0.40719714  0.81023079 -0.07963269
#>  [7] -0.61222199 -0.58856860  0.36477731 -1.47654233
#>
#> [[2]]
#>  [1] -1.638119  3.561696  1.647123 -1.432021 -4.012675  1.650036 -1.397216
#>  [8]  2.015674  6.345520  2.381649
#>
#> [[3]]
#>  [1]  1.144954  5.356423 -1.954513 -6.163206 -2.044159 -7.777897  2.338265
#>  [8]  6.399335  1.788889  4.995309
#>
density(dist, 2)
#> [1] 0.06366198 0.14814815 0.12653556density(dist, 2, log = TRUE)
#> [1] -2.754168 -1.909543 -2.067232
cdf(dist, 4)
#> [1] 0.9220209 0.8638034 0.7327454
quantile(dist, 0.7)
#> [1] 0.7265425 2.2344268 3.6782889