Simultaneous Prediction and Confidence Bands for Functional Data

Computes simultaneous prediction and confidence bands for densely sampled functional data on a common grid. The calibration builds on the functional bootstrap approach of Lenhoff et al. (1999) ; hierarchical measurement designs are motivated by Koska et al. (2023) . Independent curves are resampled individually. Clustered data use an intact-subject bootstrap with equal subject weighting, and the clustered prediction target is one future curve from a new subject. Curves are represented by finite Fourier series, and an 'Rcpp' backend performs the bootstrap calibration.


funbootband

R-CMD-check Codecov test coverage

funbootband computes simultaneous prediction and confidence bands for dense functional data observed on a common grid. Curves are represented by finite Fourier series before bootstrap calibration. The package supports independent curves and repeated curves nested within subjects.

For clustered data, version 0.3.0 uses an intact-subject bootstrap: subjects are sampled with replacement and all curves belonging to a selected subject are retained. Subjects receive equal weight, including when cluster sizes differ. The clustered prediction target is one Fourier-reconstructed future curve from an independent new subject.

Installation

Install the CRAN release with:

install.packages("funbootband")

Install the development version with:

# install.packages("pak")
pak::pak("koda86/funbootband-cran")

Independent curves

library(funbootband)

set.seed(1)
T <- 101L
n <- 30L
x <- seq(0, 1, length.out = T)
mu <- 0.7 * sin(2 * pi * x) - 0.2 * cos(4 * pi * x)

Y <- replicate(n, {
  mu + rnorm(1, sd = 0.35) +
    rnorm(1, sd = 0.30) * sin(2 * pi * x) +
    rnorm(1, sd = 0.20) * cos(2 * pi * x)
})

fit_pred <- band(Y, type = "prediction", alpha = 0.10,
                 iid = TRUE, B = 1000L, k.coef = 4L)
fit_conf <- band(Y, type = "confidence", alpha = 0.10,
                 iid = TRUE, B = 1000L, k.coef = 4L)

Repeated curves nested within subjects

set.seed(2)
K_subject <- 12L
m <- rep(c(2L, 3L, 4L), length.out = K_subject)
id <- rep(seq_len(K_subject), m)

subject_effect <- sapply(seq_len(K_subject), function(i) {
  rnorm(1, sd = 0.35) +
    rnorm(1, sd = 0.30) * sin(2 * pi * x) +
    rnorm(1, sd = 0.20) * cos(2 * pi * x)
})

Y_clustered <- sapply(seq_along(id), function(j) {
  mu + subject_effect[, id[j]] +
    rnorm(1, sd = 0.18) * sin(4 * pi * x) +
    rnorm(1, sd = 0.12) * cos(4 * pi * x)
})

fit_clustered <- band(
  Y_clustered,
  type = "prediction",
  alpha = 0.10,
  iid = FALSE,
  id = id,
  B = 1000L,
  k.coef = 4L
)

fit_clustered$meta[c(
  "target", "weighting", "bootstrap_unit", "n_clusters"
)]

The clustered band is marginal over the subject population. It is not a conditional band for an already observed subject and does not provide joint coverage for several future curves.

References

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("funbootband")

0.3.0 by Daniel Koska, a month ago


https://github.com/koda86/funbootband-cran


Report a bug at https://github.com/koda86/funbootband-cran/issues


Browse source code at https://github.com/cran/funbootband


Authors: Daniel Koska [aut, cre, cph] (ORCID:


Documentation:   PDF Manual  


GPL-3 license


Imports Rcpp, stats

Suggests testthat, knitr, rmarkdown

Linking to Rcpp

System requirements: C++17


See at CRAN