Learn R Programming

lgspline (version 0.2.0)

compute_Lambda: Construct Smoothing Spline Penalty Matrix

Description

Builds penalty matrix combining smoothing spline and ridge penalties with optional predictor/partition-specific components. Handles custom penalties and scaling.

Usage

compute_Lambda(
  custom_penalty_mat,
  L1,
  wiggle_penalty,
  flat_ridge_penalty,
  K,
  nc,
  unique_penalty_per_predictor,
  unique_penalty_per_partition,
  penalty_vec,
  colnm_expansions,
  just_Lambda = TRUE
)

Value

List containing:

  • Lambda - Combined \(nc \times nc\) penalty matrix (\(\boldsymbol{\Lambda}\))

  • L1 - Smoothing spline penalty matrix (\(\textbf{L}_1\))

  • L2 - Ridge penalty matrix (\(\textbf{L}_2\))

  • L_predictor_list - List of predictor-specific penalty matrices (\(\textbf{L}_\text{predictor\_list}\))

  • L_partition_list - List of partition-specific penalty matrices (\(\textbf{L}_\text{partition\_list}\))

If just_Lambda=TRUE and no partition penalties, returns only Lambda matrix \(\boldsymbol{\Lambda}\).

Arguments

custom_penalty_mat

Matrix; optional custom ridge penalty structure

L1

Matrix; integrated squared second derivative penalty (\(\textbf{L}_1\))

wiggle_penalty, flat_ridge_penalty

Numeric; smoothing and ridge penalty parameters

K

Integer; number of interior knots (\(K\))

nc

Integer; number of basis columns per partition

unique_penalty_per_predictor, unique_penalty_per_partition

Logical; enable predictor/partition-specific penalties

penalty_vec

Named numeric; custom penalty values for predictors/partitions

colnm_expansions

Character; column names for linking penalties to predictors

just_Lambda

Logical; return only combined penalty matrix (\(\boldsymbol{\Lambda}\))