MakeGrid {gps} | R Documentation |
Make a grid of x
-values between domain knots
Description
Place equidistant grid points on each knot span to produce a grid of x
-values between domain knots, suitable for evaluating B-splines.
Usage
MakeGrid(xd, n, rm.dup = FALSE)
Arguments
xd |
domain knot sequence. |
n |
number of equidistant grid points on each knot span. |
rm.dup |
if FALSE, interior knots will appear twice on the grid; if TRUE, they will appear only once. |
Details
Denote the domain knot sequence by s_0, s_1, s_2, \ldots, s_k, s_{k + 1}
, where (s_j)_1^k
are interior knots and s_0 = a
, s_{k + 1} = b
are domain endpoints. A knot span is the interval between two successive knots, i.e., [s_j, s_{j + 1}]
.
To make a suitable grid on [a, b]
for evaluating B-splines, we can place n
equidistant grid points on each knot span, ending up with n(k + 1)
grid points in total. Interior knots will show up twice in this grid. To keep only one instance, set rm.dup = TRUE
.
Value
A vector of grid points.
Author(s)
Zheyuan Li zheyuan.li@bath.edu
Examples
require(gps)
## 4 domain knots: two interior knots 0.5 and 1.5 in domain [0, 3]
xd <- c(0, 0.5, 1.5, 3)
## interior knots will appear twice
MakeGrid(xd, 5, rm.dup = FALSE)
## interior knots only appear once
MakeGrid(xd, 5, rm.dup = TRUE)