% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pci_dist.R
\name{pci_dist}
\alias{pci_dist}
\title{Create a Distribution Specification for Process Capability Analysis}
\usage{
pci_dist(pdf, cdf = NULL, params = list(), support = c(-Inf, Inf))
}
\arguments{
\item{pdf}{A function \code{function(x, ...)} returning the density at
\code{x}. Additional distribution parameters are passed via \code{params}.}

\item{cdf}{A function \code{function(x, ...)} returning the cumulative
probability \eqn{P(Z \le x)}. If \code{NULL}, a numerical CDF is derived
via \code{\link[stats]{integrate}} over \code{pdf}.}

\item{params}{A named list of distribution parameters forwarded to
\code{pdf} and \code{cdf} via \code{\link{do.call}}.}

\item{support}{A length-2 numeric vector giving the lower and upper bounds
of the distribution's support (default \code{c(-Inf, Inf)}).}
}
\value{
An S3 object of class \code{"pci_dist"} with elements:
  \item{pdf_fn}{Closure that evaluates the PDF at a given point.}
  \item{cdf_fn}{Closure that evaluates the CDF at a given point.}
  \item{params}{The supplied parameter list.}
  \item{support}{The supplied support bounds.}
  \item{cdf_is_numeric}{Logical; \code{TRUE} if CDF was derived numerically.}
}
\description{
Constructs an S3 object of class \code{"pci_dist"} that encapsulates the
probability density function (PDF) and cumulative distribution function (CDF)
of a quality characteristic. This object is passed to \code{\link{pci}},
\code{\link{pci_ci}}, and \code{\link{pci_grid}} when computing generalised
indices such as \eqn{C_{py}}.
}
\examples{
# Normal distribution
d <- pci_dist(
  pdf = function(x, mean, sd) dnorm(x, mean, sd),
  cdf = function(x, mean, sd) pnorm(x, mean, sd),
  params = list(mean = 0, sd = 1)
)
d$cdf_fn(0)   # 0.5

# Weibull with only PDF (CDF derived numerically)
d2 <- pci_dist(
  pdf = function(x, shape, scale) dweibull(x, shape, scale),
  params = list(shape = 2, scale = 10),
  support = c(0, 60)
)

}
