dimBS: Local-Polynomial Basis Dimension Helper

View source: R/util.R

dimBSR Documentation

Local-Polynomial Basis Dimension Helper

Description

dimBS returns the number of columns implied by an additive, generalized local-polynomial, or tensor-product basis specification. It is a compatibility wrapper around the internal dim_basis() helper used by np.

Usage

dimBS(basis = "additive",
      kernel = TRUE,
      degree = NULL,
      segments = NULL,
      include = NULL,
      categories = NULL)

Arguments

Basis Specification

Basis family, continuous-kernel counting mode, polynomial degree, and segment controls.

basis

basis family. One of "additive", "glp", or "tensor".

kernel

logical indicating whether only the continuous-kernel basis should be counted. When FALSE, optional categorical augmentation controlled by include and categories is included.

degree

non-negative integer vector of local-polynomial degrees.

segments

positive integer vector giving the number of segments for each continuous predictor. Defaults to one segment per degree entry.

Categorical Augmentation

Optional categorical-component controls used when kernel = FALSE.

include

non-negative integer vector indicating which categorical components are included when kernel = FALSE.

categories

non-negative integer vector giving category counts for included categorical components when kernel = FALSE.

Details

dimBS() is provided for compatibility with crs. In np, the underlying implementation lives in dim_basis(), which is used internally for LP basis-dimension checks and safe NOMAD restart initialization.

Value

A numeric scalar giving the implied basis dimension.

Examples

dimBS(basis = "tensor", degree = c(2, 2))
dimBS(basis = "glp", degree = c(3, 1, 0))

np documentation built on May 3, 2026, 1:07 a.m.