% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/0-base-distributions.R
\name{cauchy}
\alias{cauchy}
\alias{dCauchy}
\alias{pCauchy}
\alias{rCauchy}
\alias{qCauchy}
\title{Cauchy distribution}
\usage{
dCauchy(x, location, scale, log = 0)

pCauchy(q, location, scale, lower.tail = 1, log.p = 0)

rCauchy(n, location, scale)

qCauchy(p, location, scale, lower.tail = TRUE, log.p = FALSE)
}
\arguments{
\item{x}{Numeric scalar giving the point at which the density is evaluated.}

\item{location}{Numeric scalar location parameter.}

\item{scale}{Numeric scalar scale parameter; must be positive.}

\item{log}{Logical; if \code{TRUE}, return the log-density (integer flag \code{0/1} in NIMBLE).}

\item{q}{Numeric scalar giving the point at which the distribution function is evaluated.}

\item{lower.tail}{Logical; if \code{TRUE} (default), probabilities are \eqn{P(X \le q)}.}

\item{log.p}{Logical; if \code{TRUE}, probabilities are returned on the log scale.}

\item{n}{Integer giving the number of draws. For portability inside NIMBLE,
the RNG implementation supports \code{n = 1}.}

\item{p}{Numeric scalar probability in \eqn{(0,1)} for the quantile function.}
}
\value{
\code{dCauchy()} returns a numeric scalar density, \code{pCauchy()} returns a numeric scalar CDF,
\code{rCauchy()} returns one random draw, and \code{qCauchy()} returns a numeric quantile.
}
\description{
Scalar Cauchy utilities implemented for NIMBLE compatibility. These functions support symmetric
heavy-tailed kernels on the real line and feed directly into the finite Cauchy mixture family.
}
\details{
The density is
\deqn{
f(x) = \frac{1}{\pi s \{1 + ((x - \ell)/s)^2\}},
}
where \code{location = ell} and \code{scale = s > 0}.

These uppercase NIMBLE-compatible functions are scalar (\code{x}/\code{q} and \code{n = 1}).
For vectorized R usage, use \code{\link[=base_lowercase]{base_lowercase()}}.

The Cauchy law is a stable heavy-tailed distribution with undefined mean and variance. That is
why the package allows the Cauchy kernel only as a bulk distribution and deliberately does not
pair it with GPD tails in the kernel registry. For predictive summaries,
ordinary means are not available under Cauchy kernels; medians, quantiles,
survival curves, and restricted means remain well defined.

The distribution function is
\deqn{
F(x) = \frac{1}{2} + \frac{1}{\pi}\arctan\left(\frac{x-\ell}{s}\right),
}
and the quantile is the corresponding inverse
\deqn{
Q(p) = \ell + s \tan\{\pi(p-1/2)\}.
}
}
\section{Functions}{
\itemize{
\item \code{dCauchy()}: Cauchy density function

\item \code{pCauchy()}: Cauchy distribution function

\item \code{rCauchy()}: Cauchy random generation

\item \code{qCauchy()}: Cauchy quantile function

}}
\examples{
location <- 0
scale <- 1.5

dCauchy(0.5, location, scale, log = 0)
pCauchy(0.5, location, scale, lower.tail = 1, log.p = 0)
qCauchy(0.50, location, scale)
qCauchy(0.95, location, scale)
replicate(10, rCauchy(1, location, scale))

}
\seealso{
\code{\link[=cauchy_mix]{cauchy_mix()}}, \code{\link[=base_lowercase]{base_lowercase()}}, \code{\link[=kernel_support_table]{kernel_support_table()}}.

Other base bulk distributions: 
\code{\link{InvGauss}},
\code{\link{amoroso}}
}
\concept{base bulk distributions}
