[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.2852178 -2.3435122 -0.1658053 -1.6349149 -0.2921274 -1.6546702
#>  [7] -0.4163668  1.5029588 -0.2549947 -0.5262973
#> 
#> [[2]]
#>  [1]  1.55182946  0.36599633  0.32872846 -0.72607345  2.52447756  0.16709457
#>  [7] -0.04240957 -2.94568305  0.50471778 -8.17166314
#> 
#> [[3]]
#>  [1]  0.8342428 -0.2323731  0.2970574  1.1110677 -0.4044429 -0.1847371
#>  [7] -2.5738058 -0.7550842 -0.1455528  0.2201638
#> 
#> [[4]]
#>  [1]   3.1332209  -4.0498900  -2.0162359  -0.4811561  -2.4864638  -9.8488431
#>  [7]  -2.4200507 -22.4069828  -2.4347569  -2.4839774
#> 

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