Skip to contents

Creates Functional Bootstraped (statistical) Bands. The 'band' function rests on two basic ASSUMPTIONS:

- Assumption 1 (A1): All curves are of equal length. If necessary, any interpolation must be performed externally.

- Assumption 2 (A2): Curves originate from stationary processes.

If these assumptions are not met, the function will return an error (A1) or result in potentially erroneous outputs (A2).

Usage

band(data, type, alpha, iid = TRUE, k.coef = 50,
B = 400)

Arguments

data

A data frame of dimensions [t, n], where 'n' is the number of curves and 't' is the length of the curves. All curves need to be of equal length.

type

Type of the statistical band (c("confidence", "prediction")).

alpha

Desired type I error probability.

iid

Dependency of the curves (iid = c(TRUE, FALSE)). Setting iid=TRUE runs an ordinary (naive) bootstrap, where all curves are assumed to be independent. When setting iid=FALSE, a two-stage bootstrap is run, where curve clusters (comprising all of their curves) are resampled with replacement in the initial stage, and one curve per cluster is sampled without replacement in the second stage. If iid is set to FALSE, curves are assumed to be nested in curve clusters. The cluster structure needs to be specified in the colnames of the data frame using letters to indicate clusters (see 'Format').

k.coef

Number of Fourier coefficients (e.g., k = 50). Determines the smoothness of the curve approximation.

B

Number of bootstrap iterations (e.g., B = 1000). Default is 400.

Value

A data frame object that contains upper and lower band boundaries, alongside a mean curve.

Author

Daniel Koska

Examples

library(FunBootBand)
band.limits <- band(data, type = "prediction", alpha = 0.05, iid = TRUE, B = 50)
plot(band.limits[1,], # upper band limit
     xlim = c(0, 101),
     ylim = range(band.limits),
     type = "l")
lines(band.limits[2, ]) # mean curve
lines(band.limits[3, ]) # lower band limit