Per-position smash regression of a multi-position response
Source:R/post_smooth_smash.R
univariate_smash_regression.RdFor 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 one of two empirical-Bayes wavelet
shrinkers selected by flavor. Returns the smoothed
position-space effect estimate and a (1 - alpha) credible
band derived from the posterior variance.
Usage
univariate_smash_regression(
Y,
X,
alpha = 0.05,
flavor = c("ash", "smashr"),
...
)Arguments
- Y
numeric matrix (
n x T) or numeric vector of lengthn(treated asn x 1). Per-position response.- X
numeric matrix (
n x 1) or numeric vector of lengthn. Single regressor.- alpha
numeric in
(0, 1). Credible-band level is1 - alpha. Default0.05.- flavor
"ash"(default) runs cycle-spinning + per-coefficientashr::ash;"smashr"callssmashr::smash.gausand requires thesmashrSuggests package.- ...
extra arguments forwarded to the underlying shrinkage tool. For
flavor = "ash", forwarded toashr::ash(e.g.,nullweight = 10). Forflavor = "smashr", forwarded tosmashr::smash.gaus.
Value
A list with components effect_estimate (length T
numeric) and cred_band (2 x T matrix with rows
c("up", "low")).
