vbands: Compute bootstrap variability bands

View source: R/uncertainty_quantification.R

vbandsR Documentation

Compute bootstrap variability bands

Description

Compute variability bands for the optimized trend filtering estimate via the sample quantiles of the bootstrap ensemble generated by bootstrap_trendfilter().

Usage

vbands(obj, level = 0.95)

Arguments

obj

A "bootstrap_trendfilter" object.

level

The level of the pointwise variability bands. Defaults to level = 0.95.

Value

A tibble with column set c("x","lower_band","upper_band").

References

  1. Politsch et al. (2020a). Trend filtering – I. A modern statistical tool for time-domain astronomy and astronomical spectroscopy. MNRAS, 492(3), p. 4005-4018. [Publisher] [arXiv].

  2. Politsch et al. (2020b). Trend Filtering – II. Denoising astronomical signals with varying degrees of smoothness. MNRAS, 492(3), p. 4019-4032. [Publisher] [arXiv].

See Also

bootstrap_trendfilter()

Examples

# Example 1: Phase-folded light curve of an eclipsing binary star system
#
# The apparent brightness over time of a star system that has two suns
# that regularly eclipse one another from our vantage point on Earth. Here,
# the time series is stacked according to the orbital period of the binary
# system, with the primary eclipse occuring at `phase = 0` and the input
# domain ranging from -0.5 to 0.5.

data("eclipsing_binary")
head(eclipsing_binary)

x <- eclipsing_binary$phase
y <- eclipsing_binary$flux
weights <- 1 / eclipsing_binary$std_err^2

cv_tf <- cv_trendfilter(
  x = x,
  y = y,
  weights = weights,
  max_iter = 1e4,
  obj_tol = 1e-6
)

boot_tf <- bootstrap_trendfilter(
  obj = cv_tf,
  algorithm = "nonparametric",
  edf = cv_tf$edf_min["MAE"]
)
bands <- vbands(boot_tf)


# Example 2: The "Lyman-alpha forest" in the spectrum of a distant quasar

data("quasar_spectrum")
head(quasar_spectrum)

x <- quasar_spectrum$log10_wavelength
y <- quasar_spectrum$flux
weights <- quasar_spectrum$weights

sure_tf <- sure_trendfilter(x, y, weights)
boot_tf <- bootstrap_trendfilter(
  obj = sure_tf,
  algorithm = "parametric",
  edf = sure_tf$edf_min
)
bands <- vbands(boot_tf)

capolitsch/trendfiltering documentation built on May 7, 2023, 3:31 a.m.