rspl | R Documentation |
Simulate random cubic splines.
rspl(x, domain = NULL, n = 1)
x |
|
domain |
a vector of two values giving domain interval |
n |
number of replicates to simulate. |
A list of four components:
y
is a vector of random cubic spline values evaluated at x
when n = 1
, or a matrix of n
columns when n > 1
, where each column is an independent replicate of random cubic splines;
b
is a vector of random B-spline coefficients when n = 1
, or a matrix of n
columns when n > 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).
Zheyuan Li zheyuan.li@bath.edu
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.