Learn R Programming

ssym (version 1.5.2)

ncs: Tool to build incidence and penalty matrices, which can be used to approximate smooth functions by natural cubic splines.

Description

ncs builds the incidence and penalty matrices.

Usage

ncs(xx, lambda)

Arguments

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

Value

  • xxa matrix with the following attributes: incidence matrix, penalty matrix, smoothing parameter (if it has been specified), and another 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