Learn R Programming

lgspline (version 0.2.0)

get_2ndDerivPenalty_wrapper: Wrapper for Smoothing Spline Penalty Computation

Description

Computes smoothing spline penalty matrix with optional parallel processing. Calls get_2ndDerivPenalty after processing spline vs. nonspline terms and preparing for parallel if desired.

Usage

get_2ndDerivPenalty_wrapper(
  K,
  colnm_expansions,
  C,
  power1_cols,
  power2_cols,
  power3_cols,
  power4_cols,
  interaction_single_cols,
  interaction_quad_cols,
  triplet_cols,
  nonspline_cols,
  nc,
  parallel,
  cl
)

Value

A \(p \times p\) penalty matrix for smoothing spline regularization containing the elementwise sum of the integrated squared second derivative of the fitted function with respect to predictors of interest.

Function is exported for reference purposes - use at your own risk!

Arguments

K

Number of partitions (\(K+1\))

colnm_expansions

Column names of basis expansions

C

Basis expansion matrix of two rows, first of all maximums, second of all minimums, for all variables of interest = rbind(apply(C, 2, max)), rbind(apply(C, 2, min))) for cubic expansions "C"

power1_cols

Linear term columns

power2_cols

Quadratic term columns

power3_cols

Cubic term columns

power4_cols

Quartic term columns

interaction_single_cols

Single interaction columns

interaction_quad_cols

Quadratic interaction columns

triplet_cols

Triplet interaction columns

nonspline_cols

Predictors not treated as spline effects

nc

Number of cubic expansions

parallel

Logical to enable parallel processing

cl

Cluster object for parallel computation