gamsel (version 1.8-1)

basis.gen: Generate pseudo-spline bases

Description

Generate an approximation to the Demmler-Reinsch orthonormal bases for smoothing splines, using orthogonal polynomials. basis.gen generates a basis for a single x, and pseudo.bases generates a list of bases for each column of the matrix x.

Usage

basis.gen(x, df = 6, thresh = 0.01, degree = 8, parms = NULL,...)
pseudo.bases(x, degree = 8, df = 6, parallel=FALSE, ...)

Arguments

x

A vector of values for basis.gen, or a matrix for pseudo.bases

df

The degrees of freedom of the smoothing spline.

thresh

If the next eigenvector improves the approximation by less than threshold, a truncated bases is returned. For pseudo.bases this can be a single value or a vector of values, which are recycled sequentially for each column of x

degree

The nominal number of basis elements. The basis returned has no more than degree columns. For pseudo.bases this can be a single value or a vector of values, which are recycled sequentially for each column of x

parms

A parameter set. If included in the call, these are used to define the basis. This is used for prediction.

parallel

For pseudo.bases, allows for parallel bases computation in multiple cores.

other arguments for basis.gen can be passed through pseudo.bases

Value

An orthonormal basis is returned (a list for pseudo.bases). This has an attribute parms, which has elements coefsCoefficients needed to generate the orthogonal polynomials rotateTransformation matrix for transforming the polynomial basis dpenalty values for the diagonal penalty dfdf used degreenumber of columns

Details

basis.gen starts with a basis of orthogonal polynomials of total degree. These are each smoothed using a smoothing spline, which allows for a one-step approximation to the Demmler-Reinsch basis for a smoothing spline of rank equal to the degree. See the reference for details. The function also approximates the appropriate diagonal penalty matrix for this basis, so that the a approximate smoothing spline (generalized ridge regression) has the target df.

References

T. Hastie Pseudosplines. (1996) JRSSB 58(2), 379-396. Chouldechova, A. and Hastie, T. (2015) Generalized Additive Model Selection

Examples

Run this code
# NOT RUN {
data=gendata(n=500,p=12,k.lin=3,k.nonlin=3,deg=8,sigma=0.5)
attach(data)
bases=pseudo.bases(X,degree=10,df=6)
# }
# NOT RUN {
     require(doMC)
     registerDoMC(cores=4)
     bases=pseudo.bases(X,degree=10,df=6,parallel=TRUE)
# }

Run the code above in your browser using DataLab