% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simplexreg_deviance.R
\name{dev.unit.simplex}
\alias{dev.unit.simplex}
\title{Unit Deviance Function of the Simplex Distribution}
\usage{
dev.unit.simplex(y, mu)
}
\arguments{
\item{y}{Numeric scalar or vector of observed values (\eqn{0 < y < 1}).
If a vector, must be the same length as \code{mu} or recyclable.}

\item{mu}{Numeric scalar or vector of mean values (\eqn{0 < \mu < 1}).
If a vector, must be the same length as \code{y} or recyclable.}
}
\value{
A numeric scalar or vector of unit deviance values.
}
\description{
Computes the unit deviance (scaled deviance component) for the
simplex distribution.
}
\details{
The unit deviance for the simplex distribution is defined as:
\deqn{d(y, \mu) = \frac{(y - \mu)^2}{y(1-y)[\mu(1-\mu)]^2}.}

This function is used internally in maximum likelihood estimation and
model diagnostics for simplex regression.
}
\examples{
# Single value
dev.unit.simplex(y = 0.6, mu = 0.5)

# Vector of values
y_vec <- c(0.2, 0.5, 0.8)
mu_vec <- c(0.3, 0.5, 0.7)
dev.unit.simplex(y = y_vec, mu = mu_vec)

# Perfect fit returns zero deviance
dev.unit.simplex(y = 0.5, mu = 0.5)

}
\references{
Jørgensen, B. (1997).
\emph{The Theory of Dispersion Models}.
Chapman and Hall, London.

Song, P. X.-K. and Tan, M. (2000).
Marginal models for longitudinal continuous proportional data.
\emph{Biometrics}, \bold{56}(2), 496--502.
\doi{10.1111/j.0006-341X.2000.00496.x}
}
