% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/HelperFunctions.R
\name{.compute_loocv}
\alias{.compute_loocv}
\title{Evaluate Exact Leave-One-Out Criterion at a Given Penalty Configuration}
\usage{
.compute_loocv(par, log_penalty_vec, env, ...)
}
\arguments{
\item{par}{Numeric vector; log-scale penalty parameters. First two elements
are log(wiggle_penalty) and log(flat_ridge_penalty). Remaining elements
(if any) are log-scale predictor/partition penalties.}

\item{log_penalty_vec}{Numeric vector; log-scale predictor/partition
penalties (passed separately for compatibility with the grid search).}

\item{env}{List; pre-computed objects and tuning configuration. Contains:
\describe{
  \item{X, y, X_gram, Xy}{Design matrices, response, Gram matrices,
    cross-products.}
  \item{A, R_constraints, K, p_expansions, N_obs}{Constraint matrix and
    dimensions.}
  \item{smoothing_spline_penalty}{Integrated second-derivative penalty
    matrix.}
  \item{custom_penalty_mat}{Optional custom penalty matrix.}
  \item{colnm_expansions}{Character vector of expansion column names.}
  \item{unique_penalty_per_predictor, unique_penalty_per_partition}{Logicals.}
  \item{family}{GLM family object.}
  \item{delta}{Pseudocount for link function stabilization.}
  \item{gcv_gamma}{Modified-GCV inflation factor applied to the
    effective-degrees-of-freedom term in the denominator.}
  \item{meta_penalty}{Meta-penalty coefficient.}
  \item{order_list}{List of observation indices per partition.}
  \item{observation_weights, homogenous_weights}{Observation weighting.}
  \item{parallel flags, cl, chunk_size, num_chunks, rem_chunks}{Parallel
    config.}
  \item{unconstrained_fit_fxn, keep_weighted_Lambda, iterate}{Fitting
    config.}
  \item{qp_score_function, quadprog, qp_Amat, qp_bvec, qp_meq}{QP config.}
  \item{tol, sd_y}{Convergence tolerance and response scale.}
  \item{constraint_value_vectors}{Constraint values.}
  \item{glm_weight_function, schur_correction_function}{GLM functions.}
  \item{need_dispersion_for_estimation, dispersion_function}{Dispersion.}
  \item{blockfit, just_linear_without_interactions}{Blockfit config.}
  \item{use_blockfit}{Logical; pre-computed dispatch flag for blockfit.}
  \item{flat_cols}{Integer vector; pre-computed flat column indices.}
  \item{Vhalf, VhalfInv}{Correlation structure matrices.}
  \item{verbose, include_warnings}{Output control.}
}}

\item{...}{Additional arguments passed to fitting functions.}
}
\value{
List containing the fitted objects plus \code{criterion_value},
  \code{LOO_u}, \code{h_diag}, and \code{C_list}.
}
\description{
Computes the exact leave-one-out tuning criterion for the same transformed
linearized problem used elsewhere in the tuning machinery.
}
\keyword{internal}
