Skip to contents

For a single regressor X (length n) and a multi-position response Y (n x T), compute the per-position OLS estimate of Y on X and pass it to smashr::smash.gaus for empirical-Bayes wavelet shrinkage. Returns the smoothed position-space effect estimate and a (1 - alpha) credible band derived from the smash posterior variance.

Usage

univariate_smash_regression(Y, X, alpha = 0.05)

Arguments

Y

numeric matrix (n x T) or numeric vector of length n (treated as n x 1). Per-position response.

X

numeric matrix (n x 1) or numeric vector of length n. Single regressor.

alpha

numeric in (0, 1). Credible-band level is 1 - alpha. Default 0.05.

Value

A list with components effect_estimate (length T numeric) and cred_band (2 x T matrix with rows c("up", "low")).

Details

Used internally by mf_post_smooth(method = "smash"); also useful as a standalone post-processing utility on a single variable and a single functional outcome.

Examples

# \donttest{
if (requireNamespace("smashr", quietly = TRUE)) {
  set.seed(1L)
  X <- matrix(rnorm(60), 60, 1L)
  Y <- X %*% matrix(c(rep(0, 24), rep(1, 16), rep(0, 24)),
                    1L, 64L) + matrix(rnorm(60 * 64, sd = 0.5), 60)
  out <- univariate_smash_regression(Y, X)
  plot(out$effect_estimate, type = "l")
}

# }