rspl {gps}R Documentation

Simulate random cubic splines

Description

Simulate random cubic splines.

Usage

rspl(x, domain = NULL, n = 1)

Arguments

x

x-values where simulated cubic splines are evaluated.

domain

a vector of two values giving domain interval [a, b]. Will use min(x) and max(x) if not specified.

n

number of replicates to simulate.

Value

A list of four components:

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]