% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/signed_depth.R
\name{signed_distance_integral}
\alias{signed_distance_integral}
\title{Signed Distance Integral}
\usage{
signed_distance_integral(X, x_ref = NULL, grid = NULL)
}
\arguments{
\item{X}{Numeric matrix (\eqn{N \times M}).}

\item{x_ref}{Numeric vector of length \eqn{M}: the reference curve.
If \code{NULL} (default), \code{\link{reference_curve}} is called
internally.}

\item{grid}{Numeric vector of length \eqn{M} with observation times.
Defaults to equally spaced points on \eqn{[0, 1]}.}
}
\value{
A numeric vector of length \eqn{N}.
}
\description{
For each curve \eqn{x_i(t)}, computes
\deqn{\int_I \bigl(x_i(t) - x_{\mathrm{ref}}(t)\bigr)\,dt,}
which is positive when the curve lies predominantly above the reference
and negative when it lies below. This integral assigns a sign to the depth
of each curve (equation 3.1 of Perez Ruiz, 2020).
}
\examples{
set.seed(1)
X <- matrix(rnorm(40 * 80), nrow = 40)
sdi <- signed_distance_integral(X)
hist(sdi, main = "Signed distance integrals", xlab = "SDI")

}
\seealso{
\code{\link{signed_depth}}, \code{\link{reference_curve}}
}
