centeredBasis.gen: Generation of a recentered B-spline basis matrix in additive...

View source: R/centeredBasis_gen.R

centeredBasis.genR Documentation

Generation of a recentered B-spline basis matrix in additive models

Description

Generation of a B-spline basis matrix with recentered columns to handle the identifiability constraint in additive models. See Wood (CRC Press 2017, pp. 175-176) for more details.

Usage

centeredBasis.gen(x, knots, cm = NULL, pen.order = 2, verbose = TRUE)

Arguments

x

vector of values where to compute the "recentered" B-spline basis

knots

vector of knots (that should cover the values in <x>)

cm

(Optional) values subtracted from each column of the original B-spline matrix

pen.order

penalty order for the B-spline parameters (Default: 2)

verbose

verbose indicator (Default: TRUE)

Value

List containing

  • B : ⁠ ⁠centered B-spline matrix (with columns recentered to have mean 0 over equi-spaced x values on the range of the knots).

  • Dd : ⁠ ⁠difference matrix (of order <pen.order>) for the associated centered B-spline matrix.

  • Pd : ⁠ ⁠penalty matrix (of order <pen.order>) for the associated centered B-spline matrix.

  • K : ⁠ ⁠number of centered B-splines in the basis.

  • cm : ⁠ ⁠values subtracted from each column of the original B-spline matrix. By default, this is a vector containing the mean of each column in the original B-spline matrix.

Author(s)

Philippe Lambert p.lambert@uliege.be

References

Lambert, P. and Gressani, 0. (2023) Penalty parameter selection and asymmetry corrections to Laplace approximations in Bayesian P-splines models. Statistical Modelling. <doi:10.1177/1471082X231181173>. Preprint: <arXiv:2210.01668>.

Examples

x = seq(0,1,by=.01)
knots = seq(0,1,length=5)
obj = centeredBasis.gen(x,knots)
matplot(x,obj$B,type="l",ylab="Centered B-splines")
colMeans(obj$B)


ordgam documentation built on Sept. 14, 2023, 5:07 p.m.