np: Creates design matrices for univariate and bivariate...

View source: R/tps.R

npR Documentation

Creates design matrices for univariate and bivariate applications

Description

np accepts one or two numeric vectors of equal length as inputs. From these inputs, univariate or bivariate smoothing design matrices are produced. Currently available basis functions are truncated polynomials and thin plate splines. When bivariate smoothing is selected, np calls create_bivariate_design.

Usage

np(x1, x2 = NULL, num_knots = NULL, knots = NULL, basis = "tps", degree = 3)

Arguments

x1

numeric vector

x2

optional vector for bivariate non-parametric function

num_knots

optional number of knots

knots

optional numeric vector of knots

basis

character vector for basis function. tps for thin-plate spline and trunc.poly for truncated polynomial

degree

for truncated polynomial basis function

Value

list with the following elements:

  • X parametric design matrix

  • Z non-parametric design matrix

  • knots numeric vector of knots for the model

  • Xnms names of parameters passed to np

  • basis selected basis function

  • degree degree for truncated polynomial basis function

References

Ruppert, David, Matt P. Wand, and Raymond J. Carroll. Semiparametric Regression. No. 12. Cambridge university press, 2003. Section 5.6.

Matt Wand (2018). SemiPar: Semiparametric Regression. R package version 1.0-4.2.

Examples

x1 <- rnorm(100)
res <- np(x1, num_knots=10, basis="trunc.poly", degree=2)
res

bayesGAM documentation built on March 18, 2022, 6:29 p.m.