Learn R Programming

ssym (version 1.5.1)

ncs: Tool to build incidence and penalty matrices in order to approximate smooth functions by natural cubic splines.

Description

ncs is used to build the incidence matrix, the penalty matrix as well as other interest matrices to approximate functions by natural cubic splines.

Usage

ncs(xx, lambda)

Arguments

xx
values of the explanatory variable.
lambda
an optional positive value, which corresponds to the smoothing parameter.

Value

  • xxa matrix having the following attributes: incidence matrix, penalty matrix, smoothing parameter (if it has been specified), and other interest matrices.

References

Green, P.J. and Silverman, B.W. (1994) Nonparametric Regression and Generalized Linear Models, Boca Raton: Chapman and Hall.

Examples

Run this code
n <- 300
t <- sort(round(runif(n),digits=1))

t2 <- ncs(t)
N <- attr(t2, "N") ## Incidence Matrix
M <- attr(t2, "K") ## Penalty Matrix

Run the code above in your browser using DataLab