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 |
TRUE to place equidistant knots; FALSE to place quantile knots with clamped boundary knots. |
periodic |
if TRUE, return domain knot sequence that is sufficient for constructing periodic B-splines; if FALSE, return full knot sequence that is required for constructing ordinary B-splines |
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.mgcv)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.