Learn R Programming

lgspline (version 0.2.0)

make_constraint_matrix: Create Smoothing Spline Constraint Matrix

Description

Constructs constraint matrix \(\textbf{A}\) enforcing continuity and smoothness at knot boundaries by constraining function values, derivatives, and interactions between partitions.

Usage

make_constraint_matrix(
  nc,
  CKnots,
  power1_cols,
  power2_cols,
  nonspline_cols,
  interaction_single_cols,
  interaction_quad_cols,
  triplet_cols,
  K,
  include_constrain_fitted,
  include_constrain_first_deriv,
  include_constrain_second_deriv,
  include_constrain_interactions,
  include_2way_interactions,
  include_3way_interactions,
  include_quadratic_interactions,
  colnm_expansions,
  expansion_scales
)

Value

Matrix \(\textbf{A}\) of constraint coefficients. Columns correspond to constraints, rows to coefficients across all \(K+1\) partitions.

Arguments

nc

Integer; number of columns in basis expansion

CKnots

Matrix; basis expansions evaluated at knot points

power1_cols

Integer vector; indices of linear terms

power2_cols

Integer vector; indices of quadratic terms

nonspline_cols

Integer vector; indices of non-spline terms

interaction_single_cols

Integer vector; indices of linear interaction terms

interaction_quad_cols

Integer vector; indices of quadratic interaction terms

triplet_cols

Integer vector; indices of three-way interaction terms

K

Integer; number of interior knots (\(K+1\) partitions)

include_constrain_fitted

Logical; constrain function values at knots

include_constrain_first_deriv

Logical; constrain first derivatives at knots

include_constrain_second_deriv

Logical; constrain second derivatives at knots

include_constrain_interactions

Logical; constrain interaction terms at knots

include_2way_interactions

Logical; include two-way interactions

include_3way_interactions

Logical; include three-way interactions

include_quadratic_interactions

Logical; include quadratic interactions

colnm_expansions

Character vector; column names for basis expansions

expansion_scales

Numeric vector; scaling factors for standardization