| knots {splines2} | R Documentation |
Methods for the generic function knots from the stats package
to obtain internal or boundary knots from the objects produced by this
package.
## S3 method for class 'bSpline2'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'dbs'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'ibs'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'mSpline'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'iSpline'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'cSpline'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'bernsteinPoly'
knots(Fn, type = c("internal", "boundary"), ...)
## S3 method for class 'naturalSpline'
knots(Fn, type = c("internal", "boundary"), ...)
Fn |
An |
type |
A character vector of length one indicating the type of knots to
return. The available choices are |
... |
Optional arguments that are not used now. |
A numerical vector.
library(splines2) set.seed(123) x <- rnorm(100) ## B-spline basis bsMat <- bSpline(x, df = 8, degree = 3) ## extract internal knots placed based on the quantile of x (internal_knots <- knots(bsMat)) ## extract boundary knots placed based on the range of x boundary_knots <- knots(bsMat, type = "boundary") all.equal(boundary_knots, range(x))