[Stable]

The Cauchy distribution is the student's t distribution with one degree of freedom. The Cauchy distribution does not have a well defined mean or variance. Cauchy distributions often appear as priors in Bayesian contexts due to their heavy tails.

dist_cauchy(location, scale)

Arguments

location, scale

location and scale parameters.

Details

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

In the following, let \(X\) be a Cauchy variable with mean location = \(x_0\) and scale = \(\gamma\).

Support: \(R\), the set of all real numbers

Mean: Undefined.

Variance: Undefined.

Probability density function (p.d.f):

$$ f(x) = \frac{1}{\pi \gamma \left[1 + \left(\frac{x - x_0}{\gamma} \right)^2 \right]} $$

Cumulative distribution function (c.d.f):

$$ F(t) = \frac{1}{\pi} \arctan \left( \frac{t - x_0}{\gamma} \right) + \frac{1}{2} $$

Moment generating function (m.g.f):

Does not exist.

See also

Examples

dist <- dist_cauchy(location = c(0, 0, 0, -2), scale = c(0.5, 1, 2, 1))

dist
#> <distribution[4]>
#> [1] Cauchy(0, 0.5) Cauchy(0, 1)   Cauchy(0, 2)   Cauchy(-2, 1) 
mean(dist)
#> [1] NA NA NA NA
variance(dist)
#> [1] NA NA NA NA
skewness(dist)
#> [1] NA NA NA NA
kurtosis(dist)
#> [1] NA NA NA NA

generate(dist, 10)
#> [[1]]
#>  [1]  0.16436423 -0.36303672  1.26223878  0.08354728 -0.02120479 -1.47284153
#>  [7]  0.25235889 -4.08583157  0.20856069 -0.05809328
#> 
#> [[2]]
#>  [1]  0.14852868  0.55553383 -0.20222143 -0.09236857 -1.28690288 -0.37754209
#>  [7] -0.07277641  0.11008192  5.13322088 -2.04989004
#> 
#> [[3]]
#>  [1] -3.247181e-02  3.037688e+00 -9.729277e-01 -1.569769e+01 -8.401015e-01
#>  [6] -4.081397e+01 -8.695138e-01 -9.679548e-01  3.797027e+00  6.515121e-04
#> 
#> [[4]]
#>  [1] -1.2482954 -2.1738142 -0.7808444 -2.3925369 -2.1227681 -1.9873750
#>  [7] -7.9616775 -1.1767630 -4.0135263 -3.1509213
#> 

density(dist, 2)
#> [1] 0.03744822 0.06366198 0.07957747 0.01872411
density(dist, 2, log = TRUE)
#> [1] -3.284796 -2.754168 -2.531024 -3.977943

cdf(dist, 4)
#> [1] 0.9604166 0.9220209 0.8524164 0.9474315

quantile(dist, 0.7)
#> [1]  0.3632713  0.7265425  1.4530851 -1.2734575