% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/krnn.R
\name{krnn_smoother}
\alias{krnn_smoother}
\title{k-RNN Moving-Average Smoother}
\usage{
krnn_smoother(
  X,
  y,
  k = 10L,
  grid_eval = NULL,
  boot = FALSE,
  B = 200L,
  alpha = 0.05,
  grid_fd = NULL,
  type = c("tukey", "simplicial")
)
}
\arguments{
\item{X}{Numeric matrix (\eqn{N \times M}).}

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

\item{k}{Half-neighbourhood size.}

\item{grid_eval}{Optional numeric vector of signed-depth values at which to
evaluate the smoother. Defaults to the training signed depths.}

\item{boot}{Logical; if \code{TRUE} compute bootstrap-t confidence
intervals. Default \code{FALSE}.}

\item{B}{Number of bootstrap replicates (only used when
\code{boot = TRUE}). Default \code{200}.}

\item{alpha}{Nominal level: coverage is \eqn{1 - \alpha}. Default
\code{0.05}.}

\item{grid_fd}{Numeric vector of length \eqn{M} (time grid).}

\item{type}{Depth variant.}
}
\value{
An object of class \code{"krnn_smoother"} with components:
\describe{
\item{sdp_eval}{Evaluation points (signed depths).}
\item{prob}{Estimated conditional probabilities.}
\item{ci_lower, ci_upper}{Bootstrap CI bounds (if
\code{boot = TRUE}).}
\item{k}{Half-neighbourhood size used.}
}
}
\description{
Estimates the conditional probability
\eqn{\hat{P}(y = 0 \mid \mathrm{sdp})} using the running-mean smoother
(moving average) with span \eqn{2k}. This is the regression interpretation
of the k-RNN (Section 3.4 of Perez Ruiz, 2020).
}
\examples{
set.seed(5)
M <- 100; N <- 80
t  <- seq(0, 1, length.out = M)
X0 <- t(replicate(40, sin(2 * pi * t) + rnorm(M, sd = 0.4)))
X1 <- t(replicate(40, cos(2 * pi * t) + rnorm(M, sd = 0.4)))
X  <- rbind(X0, X1)
y  <- rep(0:1, each = 40)
sm <- krnn_smoother(X, y, k = 10)
plot_krnn_smoother(sm)

}
