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.
dimBS(basis = "additive",
kernel = TRUE,
degree = NULL,
segments = NULL,
include = NULL,
categories = NULL)A numeric scalar giving the implied basis dimension.
Basis family, continuous-kernel counting mode, polynomial degree, and segment controls.
basis family. One of "additive", "glp", or
"tensor".
logical indicating whether only the continuous-kernel basis should
be counted. When FALSE, optional categorical augmentation
controlled by include and categories is included.
non-negative integer vector of local-polynomial degrees.
positive integer vector giving the number of segments for each continuous predictor. Defaults to one segment per degree entry.
Optional categorical-component controls used when kernel = FALSE.
non-negative integer vector indicating which categorical
components are included when kernel = FALSE.
non-negative integer vector giving category counts for included
categorical components when kernel = FALSE.
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. For kernel=TRUE,
basis="glp", and one segment per continuous predictor, the count is
the number of non-intercept multi-indices satisfying
\(0\leq\alpha_j\leq d_j\) and
\(\sum_j\alpha_j\leq\max_j d_j\). This unit-segment
rule is the local-polynomial contract; non-unit segment and categorical
augmentation semantics are unchanged. Counts beyond the supported
100,000-term native GLP capacity fail before basis allocation.
dimBS(basis = "tensor", degree = c(2, 2))
dimBS(basis = "glp", degree = c(3, 1, 0))
Run the code above in your browser using DataLab