x <- 0:100
genspline(x)
# Generate a quadratic B-spline with 1 equally spaced internal knot
genspline(x, spline="bs", nknots=1, degree=2)
# Generate a natural spline with 2 knots at times of 10 and 50
genspline(x, spline="ns", knots=c(10, 50))
# Generate a piecewise linear spline with a knot at time=30
genspline(x, spline="ls", knots=30)
Run the code above in your browser using DataLab