rspl {gps} | R Documentation |
Simulate random cubic splines
Description
Simulate random cubic splines.
Usage
rspl(x, domain = NULL, n = 1)
Arguments
x |
|
domain |
a vector of two values giving domain interval |
n |
number of replicates to simulate. |
Value
A list of four components:
-
y
is a vector of random cubic spline values evaluated atx
whenn = 1
, or a matrix ofn
columns whenn > 1
, where each column is an independent replicate of random cubic splines; -
b
is a vector of random B-spline coefficients whenn = 1
, or a matrix ofn
columns whenn > 1
, where each column is an independent replicate of random B-spline coefficients; -
xt
is the full knot sequence for B-splines; -
domain
gives the domain of the simulated spline(s).
Author(s)
Zheyuan Li zheyuan.li@bath.edu
Examples
require(gps)
x <- seq.int(0, 1, 0.01)
## a random cubic spline
y <- rspl(x, n = 1)$y
op <- par(mar = c(2, 2, 1.5, 0.5))
plot(x, y, type = "l", ann = FALSE)
title("a random cubic spline")
par(op)
## 5 random cubic splines
Y <- rspl(x, n = 5)$y
op <- par(mar = c(2, 2, 1.5, 0.5))
matplot(x, Y, type = "l", lty = 1, ylab = "y")
title("5 random cubic splines")
par(op)
[Package gps version 1.2 Index]