% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tune_Lambda.R
\name{.compute_tuning_residuals}
\alias{.compute_tuning_residuals}
\title{Compute Residuals During Penalty Tuning}
\usage{
.compute_tuning_residuals(
  y,
  preds,
  delta,
  family,
  observation_weights,
  K,
  order_list,
  ...
)
}
\arguments{
\item{y}{List; response vectors by partition.}

\item{preds}{List; prediction vectors by partition.}

\item{delta}{Numeric; pseudocount for link function stabilization.}

\item{family}{GLM family object.}

\item{observation_weights}{List; observation weights by partition.}

\item{K}{Integer; number of interior knots (partitions - 1).}

\item{order_list}{List; observation indices per partition.}

\item{...}{Additional arguments passed to \code{family$custom_dev.resids}.}
}
\value{
List of residual vectors, one per partition.
}
\description{
Computes the residuals used by the tuning criteria. Handles identity link,
general GLM link functions with pseudocount delta, custom deviance residual
functions, and observation weights.
}
\details{
Three computation paths:
\enumerate{
  \item \strong{Identity link or no custom deviance}: Standard
    \eqn{g(y) - \hat{\eta}} residuals on the link scale, optionally
    weighted by observation weights for non-Gaussian families.
    For Gaussian identity link with heterogeneous weights, the weights
    have already been absorbed into X and y prior to this call.
  \item \strong{Custom deviance residuals}: Delegates to
    \code{family$custom_dev.resids(y, mu, order_indices, family,
    observation_weights, ...)}.
}
}
\keyword{internal}
