dist_cauchy(location, scale)

## Arguments

location location and scale parameters. location and scale parameters.

## Details

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.

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

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.

## Examples

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

dist
#> <distribution>
#>  Cauchy(0, 0.5) Cauchy(0, 1)   Cauchy(0, 2)   Cauchy(-2, 1) mean(dist)
#>  NA NA NA NAvariance(dist)
#>  NA NA NA NAskewness(dist)
#>  NA NA NA NAkurtosis(dist)
#>  NA NA NA NA
generate(dist, 10)
#> []
#>    0.48431441 -0.41067449  0.63727704 -0.20644842  0.66921610 -0.02590136
#>   -1.72429530 -0.47202527 -0.28296064 -0.46126548
#>
#> []
#>    3.76054425  0.46319786  0.25958782 -1.87465440 -3.01301039 -1.86037015
#>    1.68265890 -0.06457316 -1.24670931 -0.42296261
#>
#> []
#>    -0.1051280   1.6393922  -3.5184328   5.5314315   0.2914638  -5.1980748
#>    -6.2572125   6.6384089  -0.9539910 -35.9684536
#>
#> []
#>   -2.0651436 -1.9464927 -3.6498567  0.3363926 -2.2634289 -3.5980958
#>   -3.7512371 -2.9627453 -9.3857830 -1.0651374
#>
density(dist, 2)
#>  0.03744822 0.06366198 0.07957747 0.01872411density(dist, 2, log = TRUE)
#>  -3.284796 -2.754168 -2.531024 -3.977943
cdf(dist, 4)
#>  0.9604166 0.9220209 0.8524164 0.9474315
quantile(dist, 0.7)
#>   0.3632713  0.7265425  1.4530851 -1.2734575