x <- 0:100
genspline(x)
# Generate a quadratic B-spline with 1 equally spaced internal knot
genspline(x, spline="bs", knots=2, degree=2)
# Generate a natural cubic spline with 3 knots at selected quantiles
genspline(x, spline="ns", knots=c(0.1, 0.5, 0.7))
# Generate a piecewise linear spline with 3 equally spaced knots
genspline(x, spline="ls", knots=3)
Run the code above in your browser using DataLab