Post-smooth a fit's per-effect curves and add credible bands
Source:R/mfsusie_methods.R
mf_post_smooth.RdFour smoothing methods are dispatched by method:
Usage
mf_post_smooth(
fit,
method = c("TI", "scalewise", "HMM", "smash"),
level = 0.95,
threshold_factor = 1,
wavelet_filter = 1L,
wavelet_family = "DaubExPhase",
halfK = 20L,
overwrite_previous = FALSE,
X = NULL,
Y = NULL
)Arguments
- fit
- method
one of
"scalewise","TI","HMM".- level
numeric in (0, 1), credible-band coverage. Default 0.95.
- threshold_factor
numeric, multiplier on the universal
sqrt(2 log T)threshold formethod = "scalewise". Ignored by other methods.- wavelet_filter
integer, wavelet filter number for the TI stationary-wavelet transform. Default 1 (Haar).
- wavelet_family
character, wavelet family for the TI stationary-wavelet transform. Default
"DaubExPhase".- halfK
integer, half-grid size for the HMM
fit_hmmhelper. Default 20.- X
optional numeric matrix
n x p, the original genotype matrix. Required when the fit was built withattach_smoothing_inputs = FALSE; ignored otherwise.- Y
optional list of length
Mof numeric matrices, the original per-outcome response matrices. Required when the fit was built withattach_smoothing_inputs = FALSE; ignored otherwise.
Value
the input fit with $effect_curves, $credible_bands,
and $lfsr_curves populated. Scalar outcomes
(T_basis[m] = 1) skip the wavelet step (smoothing is a
no-op there).
Details
"scalewise"– per-scale soft-thresholding of the lead variable's wavelet posterior mean. Fast, no iterations, uses only the wavelet posterior moments. Suitable for quick visual cleanup."TI"(default) – cycle-spinning translation-invariant denoising (Coifman & Donoho 1995). For each effect, isolates the per-effect residual response (in position space), regresses onto the alpha-weighted X aggregate, applies the stationary wavelet transform row-by-row, scalewiseashr::ashshrinkage on wavelet coefficients, and inverts via cycle-spinning average. Produces tighter credible bands than scalewise."HMM"– hidden Markov denoising on per-position regression coefficients. Yields a posterior mean curve plus a mixture- posterior local false sign rate."smash"–smashr::smash.gausempirical-Bayes wavelet shrinkage on the per-position regression estimate. Requires thesmashrpackage (Suggests).
All four methods populate lfsr_curves. For TI, scalewise,
and smash the lfsr is pnorm(-|mean| / sd) under the
Gaussian-posterior approximation; for HMM it comes from the
mixture posterior directly.
By default the smoother reads fit$Y_grid (post-remap Y) and
fit$X_eff (per-effect alpha-weighted X aggregate), both
attached by mfsusie() when attach_smoothing_inputs = TRUE.
When the fit was built with attach_smoothing_inputs = FALSE
you can pass the original X and Y here and the smoother
will compute and attach them on the fly.