Learn R Programming

spikeSlabGAM (version 1.1-19)

sm: Generate a reparameterized P-spline base

Description

The returned matrix is a low-rank approximation of the original P-spline basis (unless decomposition = "asIs"), that is projected into the complement of the nullspace of the associated penalty (unless centerBase = FALSE), i.e. for the default second order difference penalty, the resulting basis cannot reproduce linear or constant functions and parameterizes the "wiggly" part of the influence of x only. This means that it very rarely makes sense to run a model with sm(x) without also using lin(x) or u(x). The projection improves the separability between the linear and smooth parts of the influence of x and centers the resulting function estimates s.t \(\sum_i f(x_i) = 0\).

Usage

sm(
  x,
  K = min(length(unique(x)), 20),
  spline.degree = 3,
  diff.ord = 2,
  rankZ = 0.999,
  centerBase = T,
  centerx = x,
  decomposition = c("ortho", "MM", "asIs"),
  tol = 1e-10
)

Arguments

x

covariate

K

number of basis functions in the original basis (defaults to 20)

spline.degree

defaults to 3 for cubic B-plines

diff.ord

order of the difference penalty, defaults to 2 for penalizing deviations from linearity

rankZ

how many eigenvectors to retain from the eigen decomposition: either a number > 3 or the proportion of the sum of eigenvalues the retained eigenvectors must represent at least. Defaults to .999.

centerBase

project the basis of the penalized part into the complement of the column space of the basis of the unpenalized part? defaults to TRUE

centerx

vector of x-values used for centering (defaults to x)

decomposition

use a truncated spectral decomposition of the implied prior covariance of \(f(x)\) for a low rank representation with orthogonal basis functions and i.i.d. coefficients ("ortho"), or use the mixed model reparameterization for non-orthogonal basis functions and i.i.d. coefficients ("MM") or use basis functions as they are with i.i.d. coefficients ("asIs"). Defaults to "ortho".

tol

count eigenvalues smaller than this as zero

Value

a basis for a smooth function in x

References

Kneib, T. (2006). Mixed model based inference in structured additive regression. Dr. Hut. https://edoc.ub.uni-muenchen.de/archive/00005011/