% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cauchy.R
\name{cauchy_mix}
\alias{cauchy_mix}
\alias{dCauchyMix}
\alias{pCauchyMix}
\alias{rCauchyMix}
\alias{qCauchyMix}
\title{Cauchy mixture distribution}
\usage{
dCauchyMix(x, w, location, scale, log = 0)

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

rCauchyMix(n, w, location, scale)

qCauchyMix(
  p,
  w,
  location,
  scale,
  lower.tail = TRUE,
  log.p = FALSE,
  tol = 1e-10,
  maxiter = 200
)
}
\arguments{
\item{x}{Numeric scalar giving the point at which the density is evaluated.}

\item{w}{Numeric vector of mixture weights of length \eqn{K}. The functions normalize \code{w}
internally when needed.}

\item{location, scale}{Numeric vectors of length \eqn{K} giving component locations and scales.}

\item{log}{Logical; if \code{TRUE}, return the log-density.}

\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. The RNG implementation supports \code{n = 1}.}

\item{p}{Numeric scalar probability in \eqn{(0,1)} for the quantile function.}

\item{tol}{Numeric scalar tolerance passed to \code{stats::uniroot}.}

\item{maxiter}{Integer maximum number of iterations for \code{stats::uniroot}.}
}
\value{
Density/CDF/RNG functions return numeric scalars. \code{qCauchyMix()} returns a numeric
vector with the same length as \code{p}.
}
\description{
Finite mixture of Cauchy components for symmetric heavy-tailed bulk modeling on the real line.
}
\details{
The mixture density is
\deqn{
f(x) = \sum_{k = 1}^K \tilde{w}_k f_C(x \mid \ell_k, s_k),
}
with normalized weights \eqn{\tilde{w}_k}. These scalar functions are NIMBLE-compatible; for
vectorized R usage, use \code{\link[=cauchy_mix_lowercase]{cauchy_mix_lowercase()}}.

The mixture CDF is the weighted average of component CDFs,
\deqn{
F(x) = \sum_{k=1}^K \tilde{w}_k
\left\{\frac{1}{2} + \frac{1}{\pi}\arctan\left(\frac{x-\ell_k}{s_k}\right)\right\}.
}
Random generation first selects a component according to the normalized weights and then draws
from the chosen Cauchy law by inverse-CDF sampling.

Because each Cauchy component has undefined mean and variance, the mixture also lacks an
ordinary mean in general. That is why the package exposes Cauchy kernels for densities, CDFs,
quantiles, medians, survival functions, and restricted means, but not for ordinary predictive
means.
}
\section{Functions}{
\itemize{
\item \code{dCauchyMix()}: Cauchy mixture density

\item \code{pCauchyMix()}: Cauchy mixture distribution function

\item \code{rCauchyMix()}: Cauchy mixture random generation

\item \code{qCauchyMix()}: Cauchy mixture quantile function

}}
\examples{
w <- c(0.50, 0.30, 0.20)
location <- c(-2, 0, 3)
scale <- c(1.0, 0.7, 1.5)

dCauchyMix(0.5, w = w, location = location, scale = scale, log = FALSE)
pCauchyMix(0.5, w = w, location = location, scale = scale,
           lower.tail = TRUE, log.p = FALSE)
qCauchyMix(0.50, w = w, location = location, scale = scale)
qCauchyMix(0.95, w = w, location = location, scale = scale)
replicate(10, rCauchyMix(1, w = w, location = location, scale = scale))

}
\seealso{
\code{\link[=cauchy]{cauchy()}}, \code{\link[=cauchy_mix_lowercase]{cauchy_mix_lowercase()}}, \code{\link[=build_nimble_bundle]{build_nimble_bundle()}}, \code{\link[=kernel_support_table]{kernel_support_table()}}.
}
\concept{cauchy kernel families}
