PlaceKnots | R Documentation |
Place knots for ordinary B-splines or periodic B-splines using automatic strategies.
PlaceKnots(x, d, k, domain = NULL, uniform = FALSE, periodic = FALSE)
x |
observed |
d |
B-spline order. |
k |
number of interior knots. |
domain |
a vector of two values giving domain interval |
uniform |
if TRUE, place equidistant knots; if FALSE, place quantile knots with clamped boundary knots. |
periodic |
if TRUE, return the domain knot sequence that is sufficient for constructing periodic B-splines (see |
A vector of K = k + 2d
knots for ordinary B-splines, or k + 2
knots for periodic B-splines.
Zheyuan Li zheyuan.li@bath.edu
require(gps)
x <- rnorm(50)
## uniform knots for uniform cubic B-splines
xt1 <- PlaceKnots(x, d = 4, k = 5, uniform = TRUE)
B1 <- splines::splineDesign(xt1, x, ord = 4)
## clamped quantile knots for clamped non-uniform cubic B-splines
xt2 <- PlaceKnots(x, d = 4, k = 5, uniform = FALSE)
B2 <- splines::splineDesign(xt2, x, ord = 4)
## uniform knots for uniform periodic cubic B-splines
xd1 <- PlaceKnots(x, d = 4, k = 5, uniform = TRUE, periodic = TRUE)
PB1 <- pbsDesign(x, xd1, d = 4)
## quantile knots for non-uniform periodic cubic B-splines
xd2 <- PlaceKnots(x, d = 4, k = 5, uniform = FALSE, periodic = TRUE)
PB2 <- pbsDesign(x, xd2, d = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.