% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/amoroso.R
\name{amoroso_mix}
\alias{amoroso_mix}
\alias{dAmorosoMix}
\alias{pAmorosoMix}
\alias{rAmorosoMix}
\alias{qAmorosoMix}
\title{Amoroso mixture distribution}
\usage{
dAmorosoMix(x, w, loc, scale, shape1, shape2, log = 0)

pAmorosoMix(q, w, loc, scale, shape1, shape2, lower.tail = 1, log.p = 0)

rAmorosoMix(n, w, loc, scale, shape1, shape2)

qAmorosoMix(
  p,
  w,
  loc,
  scale,
  shape1,
  shape2,
  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 treat the weights
as non-negative and normalize them internally when needed.}

\item{loc}{Numeric vector of length \eqn{K} giving component locations.}

\item{scale}{Numeric vector of length \eqn{K} giving component scales. Negative values flip support
for the corresponding component.}

\item{shape1}{Numeric vector of length \eqn{K} giving the first Amoroso shape parameter for each component.}

\item{shape2}{Numeric vector of length \eqn{K} giving the second Amoroso shape parameter for each component.}

\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.}

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

\item{maxiter}{Integer maximum number of iterations for \code{stats::uniroot}.}
}
\value{
Mixture density/CDF/RNG functions return numeric scalars. \code{qAmorosoMix()} returns a
numeric vector with the same length as \code{p}.
}
\description{
Finite mixture of Amoroso components for flexible positive-support bulk modeling.
}
\details{
The mixture density is
\deqn{
f(x) = \sum_{k = 1}^K \tilde{w}_k f_{Amoroso}(x \mid a_k, \theta_k, \alpha_k, \beta_k),
}
with normalized weights \eqn{\tilde{w}_k}. These scalar functions are NIMBLE-compatible; for
vectorized R usage, use \code{\link[=amoroso_lowercase]{amoroso_lowercase()}}.

The Amoroso family is especially useful for positive-support data because it can reproduce a wide
range of skewed and heavy-right-tail shapes while remaining analytically tractable through its
gamma transformation. The mixture CDF is
\deqn{
F(x) = \sum_{k=1}^K \tilde{w}_k F_{Amoroso}(x \mid a_k,\theta_k,\alpha_k,\beta_k),
}
and random generation proceeds by selecting a component and sampling from that component.

Closed-form mixture quantiles are not available, so \code{qAmorosoMix()} inverts the mixture CDF
numerically. The analytical mixture mean is the weighted average of the component means,
\eqn{a_k + \theta_k \Gamma(\alpha_k + 1/\beta_k) / \Gamma(\alpha_k)}, whenever those component
moments exist.
}
\section{Functions}{
\itemize{
\item \code{dAmorosoMix()}: Density Function of Amoroso Mixture Distribution

\item \code{pAmorosoMix()}: Cumulative Distribution Function of Amoroso Mixture Distribution

\item \code{rAmorosoMix()}: Random Generation for Amoroso Mixture Distribution

\item \code{qAmorosoMix()}: Quantile Function of Amoroso Mixture Distribution

}}
\examples{
w <- c(0.60, 0.25, 0.15)
loc <- c(0, 1, 2)
scale <- c(1.0, 1.2, 1.6)
shape1 <- c(2, 4, 6)
shape2 <- c(1.0, 1.2, 1.5)

dAmorosoMix(2.0, w, loc, scale, shape1, shape2, log = 0)
pAmorosoMix(2.0, w, loc, scale, shape1, shape2, lower.tail = 1, log.p = 0)
qAmorosoMix(0.50, w, loc, scale, shape1, shape2)
qAmorosoMix(0.95, w, loc, scale, shape1, shape2)
replicate(10, rAmorosoMix(1, w, loc, scale, shape1, shape2))
}
\seealso{
\code{\link[=amoroso_mixgpd]{amoroso_mixgpd()}}, \code{\link[=amoroso_gpd]{amoroso_gpd()}}, \code{\link[=amoroso_lowercase]{amoroso_lowercase()}},
\code{\link[=build_nimble_bundle]{build_nimble_bundle()}}, \code{\link[=kernel_support_table]{kernel_support_table()}}.

Other amoroso kernel families: 
\code{\link{amoroso_gpd}},
\code{\link{amoroso_mixgpd}}
}
\concept{amoroso kernel families}
