isb: I-spline basis of each column of a given matrix

View source: R/ispline.R

isbR Documentation

I-spline basis of each column of a given matrix

Description

Create a I-spline basis for an array. isb will equally distribute the knots over the value range using quantiles.

Usage

isb(x, spline.knots = 0, knots = NULL, spline.degree = 1)

Arguments

x

The predictor variable, which will be transformed into I-spline basis.

spline.knots

Number of inner knots to use. isb will equally distribute the knots over the value range using quantiles. spline.knots will only be used if knots is not given.

knots

An array consisting all knots (boundary knots as well as the interior knots) to be used to create the spline basis.

spline.degree

The polynomial degree of the spline basis.

Value

The I-spline with the used spline settings as attribute. The spline settings attribute can transform the same attribute of any other objects using the same knots.

Author(s)

Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov

References

P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.

J.O. Ramsay (1988) Monotone regression splines in action. Statistical Science, 3(4):425-461

See Also

svmmaj

Examples

## plot the spline transformation given a monotone sequence
B0 <- isb(0:100, spline.knots = 2, spline.degree = 3)
plot(NULL, xlim = c(0, 140), ylim = c(0, 1), xlab = 'x',ylab = 'I-spline')
for(i in 1:ncol(B0))
  lines(B0[,i], col = i, lwd = 3)
legend('bottomright', legend = 1:ncol(B0), col = 1:ncol(B0),
  lty = 1, lwd = 3, title = 'Spline Columns'
)
## create I-spline basis for the first 50 observations
x  <- iris$Sepal.Length
B1  <- isb(x[1:50], spline.knots = 4, spline.degree = 3)
## extracting the spline transformation settings
spline.param <- attr(B1, 'splineInterval')
## use the same settings to apply to the next 50 observations
B2 <- isb(x[-(1:50)], spline.degree = 3, knots = spline.param)

SVMMaj documentation built on May 23, 2022, 9:05 a.m.