dot-fit_coefficients: Fit Coefficients During Penalty Tuning: blockfit_solve or...

.fit_coefficientsR Documentation

Fit Coefficients During Penalty Tuning: blockfit_solve or get_B

Description

Dispatches to blockfit_solve when the blockfit conditions are met (i.e. env$use_blockfit is TRUE), otherwise calls get_B. On blockfit_solve failure, falls back to get_B automatically.

Usage

.fit_coefficients(G_list, Lambda, L_partition_list, env, return_G_getB, ...)

Arguments

G_list

List; eigendecomposition results from compute_G_eigen, containing Ghalf and GhalfInv.

Lambda

Matrix; current combined penalty matrix.

L_partition_list

List; partition-specific penalty matrices.

env

List; tuning environment from .build_tuning_env.

return_G_getB

Logical; whether to return G inside the fit. Set to TRUE within .compute_gcvu and .compute_gcvu_gradient so that B_list$G_list carries the (possibly GLM-iterated) G matrices required for the subsequent AGAmult_wrapper and trace computations.

...

Additional arguments forwarded to the fitting routine.

Details

The blockfit condition mirrors lgspline.fit: blockfit && length(flat_cols) > 0 && K > 0, pre-computed in tune_Lambda and stored in env$use_blockfit.

return_G_getB is set to TRUE by the callers so that B_list$G_list contains the updated G matrices (after any GLM weight iteration inside get_B or blockfit_solve). These are needed immediately after this call for AGAmult_wrapper and the trace computation.

When correlation structure inputs are supplied, this wrapper does not introduce a separate tuning-specific notation or solver path. Instead, the same correlated coefficient estimator used in the final model fit is called here inside each tuning-objective evaluation. In particular, any structured-correlation Woodbury factorization \mathbf{G}^{-1} = \mathbf{G}_{\mathrm{on}}^{-1} + \mathbf{G}_{\mathrm{off}}^{-1} is handled inside get_B and documented in lgspline-details.

Value

List; output of blockfit_solve or get_B, containing at minimum $B (coefficient list) and $G_list.


lgspline documentation built on May 8, 2026, 5:07 p.m.