These functions fit free-knot splines to data with one independent variable and one dependent variable. It is assumed that the number of knots is known in advance. freelsgen and freelsgold fit least-squares splines with no penalty, while freepsgen and freepsgold fit penalized splines. freelsgen and freepsgen use a genetic algorithm, while freelsgold and freepsgold use a blind search augmented with a golden section algorithm.
Usage
freelsgen(x, y, degree, numknot, seed = 5, stream = 0)
freelsgold(x, y, degree, numknot, seed = 5, stream = 0)
freepsgen(x, y, degree, numknot, seed = 5, stream = 0)
freepsgold(x, y, degree, numknot, seed = 5, stream = 0)
Arguments
x
A vector containing the values of the independent variable.
y
A vector containing the values of the dependent variable.
degree
The degree of the spline fit.
numknot
The number of knots.
seed
The value of the initial seed. Defaults to 5.
stream
The value of the initial stream to be used for parallel programming.
Defaults to 0.
Value
An object of class "freekt" containing the following components:
x
A vector containing the x values.
y
A vector containing the y values.
degree
The degree of the spline fit.
seed
The value of the initial seed.
stream
The value of the stream.
lambda
The optimum amount of penalty. This is automatically equal to 0 for freelsgen and freelsgold.
optknot
A vector containing the optimal knots.
tracehat
The trace of the hat matrix for the optimal fit.
GCV
The value of generalized cross validation (GCV) for the optimal fit.
GSJS
The GSJS estimator, an estimator of the variance of the data.
call
The function call.
References
Eubank, R. (1999), Nonparametric Regression and Spline Smoothing, New York: Marcel Dekker, Inc., Second ed.
Spiriti, S., Eubank, R., Smith, P., Young, D., "Knot Selection for Least-Squares and Penalized Splines," Journal of Statistical Computation and Simulation, in press.
See Also
fit.search.numknots for the case where the number of knots is not specified in advance.