% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/classifiers.R
\name{logistic_depth_classify}
\alias{logistic_depth_classify}
\alias{print.fd_logistic_fit}
\title{Logistic Regression Classifier on Signed Depth}
\usage{
logistic_depth_classify(
  X_train,
  y_train,
  X_test = NULL,
  model = c("sdp", "sdp+mode", "sdp*mode"),
  n_pc = 10L,
  grid = NULL,
  type = c("tukey", "simplicial")
)

\method{print}{fd_logistic_fit}(x, ...)
}
\arguments{
\item{X_train}{Numeric matrix (\eqn{n_{\mathrm{train}} \times M}).}

\item{y_train}{Integer vector of labels (0/1).}

\item{X_test}{Numeric matrix. If \code{NULL} the training set is used.}

\item{model}{Character: \code{"sdp"} (default), \code{"sdp+mode"}, or
\code{"sdp*mode"}.}

\item{n_pc}{Number of principal components for mode estimation. Default 10.}

\item{grid}{Numeric vector of length \eqn{M}.}

\item{type}{Depth variant.}

\item{x}{A \code{"fd_logistic_fit"} object.}

\item{...}{Ignored.}
}
\value{
An object of class \code{"fd_logistic_fit"} with components:
\describe{
\item{predicted}{Predicted class labels.}
\item{prob}{Matrix with columns \code{prob_0} and \code{prob_1}.}
\item{glm_fit}{The fitted \code{\link[stats]{glm}} object.}
\item{sd_train}{The \code{"fd_signed_depth"} object for the training
set.}
\item{model}{Character: model formula used.}
}

Invisibly returns \code{x}.
}
\description{
Fits a logistic regression model with class label as response and signed
depth (and optionally signed distance to the mode) as covariates
(Section 3.7 of Perez Ruiz, 2020).
}
\details{
Three model formulae are supported:
\describe{
\item{\code{"sdp"}}{Model 1: signed depth only.}
\item{\code{"sdp+mode"}}{Model 2: signed depth plus signed distance to
mode.}
\item{\code{"sdp*mode"}}{Model 3: Model 2 plus interaction term.}
}
}
\examples{
set.seed(13)
M <- 80; N <- 100
t  <- seq(0, 1, length.out = M)
X0 <- t(replicate(50, sin(2 * pi * t) + rnorm(M, sd = 0.4)))
X1 <- t(replicate(50, cos(2 * pi * t) + rnorm(M, sd = 0.4)))
X  <- rbind(X0, X1)
y  <- rep(0:1, each = 50)
fit <- logistic_depth_classify(X, y, model = "sdp")
summary(fit$glm_fit)

}
