dot-compute_tuning_residuals: Compute Residuals During Penalty Tuning

.compute_tuning_residualsR Documentation

Compute Residuals During Penalty Tuning

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.

Usage

.compute_tuning_residuals(
  y,
  preds,
  delta,
  family,
  observation_weights,
  K,
  order_list,
  ...
)

Arguments

y

List; response vectors by partition.

preds

List; prediction vectors by partition.

delta

Numeric; pseudocount for link function stabilization.

family

GLM family object.

observation_weights

List; observation weights by partition.

K

Integer; number of interior knots (partitions - 1).

order_list

List; observation indices per partition.

...

Additional arguments passed to family$custom_dev.resids.

Details

Three computation paths:

  1. Identity link or no custom deviance: Standard 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.

  2. Custom deviance residuals: Delegates to family$custom_dev.resids(y, mu, order_indices, family, observation_weights, ...).

Value

List of residual vectors, one per partition.


lgspline documentation built on Aug. 5, 2026, 1:10 a.m.