| Title: | Bayesian Wavelet Denoising with Wendland-Semicircle Slab Mixture |
|---|---|
| Description: | Bayesian wavelet denoising using a resolution-adaptive spike-and-slab prior whose continuous slab is a mixture of a compactly supported Wendland-type density and the semicircle density. The package provides Gaussian and Laplace working-likelihood versions, empirical-Bayes fitting of resolution-specific slab weights, robust noise-scale estimation, posterior-mean coefficient shrinkage, reconstruction by the inverse discrete wavelet transform, and diagnostic tools. |
| Authors: | Nilotpal Sanyal [aut, cre] |
| Maintainer: | Nilotpal Sanyal <nsanyal@utep.edu> |
| License: | GPL-2 | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-09-23 06:15:12 UTC |
| Source: | https://github.com/cran/WSwavelet |
Bayesian wavelet denoising with a resolution-adaptive spike-and-slab prior. The continuous slab is a mixture of a compactly supported Wendland-type density and the semicircle density. The package provides Gaussian and Laplace working-likelihood versions, empirical-Bayes fitting of resolution-specific slab weights, robust noise-scale estimation, posterior-mean coefficient shrinkage, inverse-DWT reconstruction, and diagnostic tools.
The primary user-facing function is
wswavelet. It requires a finite numeric
vector whose length is a dyadic integer, such as 128 or 1024. The function
applies an orthogonal discrete wavelet transform using
wavethresh, retains the scaling coefficients, shrinks detail
coefficients, and reconstructs the denoised signal.
The prior for a detail coefficient at level is
Here is the spike probability, is the
conditional Wendland weight among nonzero coefficients, and
is the common support scale.
See wswavelet for the empirical-Bayes
fitting details and level_posterior for the coefficient-level
posterior calculation.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
wswavelet,
level_posterior,
evaluate_shrinkage_curve
Estimates the observational noise standard deviation from high-frequency wavelet coefficients using a robust median absolute deviation rule.
estimate_noise_sd( wavelet_object, detail_levels, supplied_sd = NULL, mad_levels = 1L )estimate_noise_sd( wavelet_object, detail_levels, supplied_sd = NULL, mad_levels = 1L )
wavelet_object |
A wavelet object returned by
|
detail_levels |
A nonempty numeric or integer vector of detail levels
available in |
supplied_sd |
Optional known positive noise standard deviation. If supplied, it is returned directly and the MAD calculation is skipped. |
mad_levels |
The positive integer number of finest detail levels to pool when estimating the scale. The default is 1. |
Unless supplied_sd is provided, the function computes
using the finest mad_levels detail levels. If the resulting value
is not positive and finite, the function falls back to pooling up to the
three finest available detail levels. A strictly positive machine-scale
value is returned in the remaining degenerate case.
A single positive numeric value giving the supplied or estimated noise standard deviation.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
set.seed(1) y <- rnorm(128) wd <- wavethresh::wd(y, filter.number = 6L, bc = "periodic") lev <- 0:(wavethresh::nlevelsWT(wd) - 1L) estimate_noise_sd(wd, lev)set.seed(1) y <- rnorm(128) wd <- wavethresh::wd(y, filter.number = 6L, bc = "periodic") lev <- 0:(wavethresh::nlevelsWT(wd) - 1L) estimate_noise_sd(wd, lev)
Evaluates the fitted posterior-mean shrinkage rule and posterior component probabilities over a grid of hypothetical observed coefficients at one detail level.
evaluate_shrinkage_curve( fit, level_index = 1L, d_grid = seq(-4, 4, length.out = 401L) )evaluate_shrinkage_curve( fit, level_index = 1L, d_grid = seq(-4, 4, length.out = 401L) )
fit |
A fitted object returned by
|
level_index |
The position of the detail level in |
d_grid |
A numeric vector of hypothetical observed coefficient values at which the shrinkage rule is evaluated. |
For each value in d_grid, the function recomputes the posterior for
the selected level using the fitted , ,
, and likelihood. The resulting curve is the empirical-Bayes
version of the coefficientwise posterior-mean rule
The output can be used to plot attenuation, compare the rule with the
identity map , or inspect how posterior evidence for the
spike changes with the observed coefficient.
A data frame with columns d, estimate,
posterior_spike, posterior_wendland, and
posterior_semicircle.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
set.seed(1) n <- 128 x <- seq(0, 1, length.out = n) y <- sin(6 * pi * x) + rnorm(n, sd = 0.5) fit <- wswavelet( y, filter.number = 6L, quadrature_n = 24L ) curve <- evaluate_shrinkage_curve(fit, level_index = 1L) head(curve)set.seed(1) n <- 128 x <- seq(0, 1, length.out = n) y <- sin(6 * pi * x) + rnorm(n, sd = 0.5) fit <- wswavelet( y, filter.number = 6L, quadrature_n = 24L ) curve <- evaluate_shrinkage_curve(fit, level_index = 1L) head(curve)
Computes the complete three-component posterior for a vector of observed wavelet coefficients at one resolution level.
level_posterior( d, pi_j, omega_j, beta_j, sigma, likelihood, laplace_rate, quadrature_n, use_exact_wendland )level_posterior( d, pi_j, omega_j, beta_j, sigma, likelihood, laplace_rate, quadrature_n, use_exact_wendland )
d |
A numeric vector of observed wavelet coefficients. The calculation is vectorized, with one posterior calculation for each element. |
pi_j |
The prior probability of the point-mass spike at zero for the
resolution level. It must lie in |
omega_j |
The conditional prior probability of the Wendland slab
among nonzero coefficients. It must lie in |
beta_j |
The positive common support scale for the two continuous slabs. |
sigma |
The positive Gaussian noise standard deviation. It is used for the Gaussian likelihood and for Gaussian quadrature calculations. |
likelihood |
Either |
laplace_rate |
The positive rate |
quadrature_n |
The number of Gauss-Legendre nodes used for numerical integration. |
use_exact_wendland |
Logical value indicating whether the exact finite-sum Wendland formula should be used for Laplace moments. |
The continuous slab is
For component , define
The posterior component probabilities are
where
The returned posterior mean is
The spike contributes zero to this posterior mean. Computations are
performed on the log scale where appropriate to reduce numerical
underflow. Endpoint cases such as or
are handled explicitly.
A list with one row or one entry per value of d:
log_marginalThe log marginal density
.
probabilityA matrix with columns spike,
wendland, and semicircle, containing posterior component
probabilities.
posterior_meanThe posterior-mean shrinkage estimate
.
component_meanA matrix containing the posterior means conditional on the Wendland and semicircle components.
component_log_m0A matrix containing the log zeroth moments for the two continuous components.
quadrature_fallbacksThe number of Wendland coefficients for which the exact Laplace calculation used numerical fallback.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
wswavelet,
evaluate_shrinkage_curve,
wendland_kernel,
semicircle_kernel
d <- c(-1, 0, 1) post <- level_posterior( d = d, pi_j = 0.75, omega_j = 0.5, beta_j = 2, sigma = 1, likelihood = "gaussian", laplace_rate = 0.5, quadrature_n = 24L, use_exact_wendland = TRUE ) post$posterior_mean post$probabilityd <- c(-1, 0, 1) post <- level_posterior( d = d, pi_j = 0.75, omega_j = 0.5, beta_j = 2, sigma = 1, likelihood = "gaussian", laplace_rate = 0.5, quadrature_n = 24L, use_exact_wendland = TRUE ) post$posterior_mean post$probability
Evaluates the normalized semicircle slab density on the standardized
interval .
semicircle_kernel(u)semicircle_kernel(u)
u |
A numeric vector of standardized coefficient values. |
The density is
It is symmetric, integrates to one, and is more dispersed than the
Wendland component used in the package. For a support scale
, the corresponding density for a coefficient is
.
A numeric vector of the same length as u, containing the density
values.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
wendland_kernel,
level_posterior
u <- seq(-1.2, 1.2, length.out = 7) semicircle_kernel(u)u <- seq(-1.2, 1.2, length.out = 7) semicircle_kernel(u)
Evaluates the normalized compactly supported Wendland-type slab density on
the standardized interval .
wendland_kernel(u)wendland_kernel(u)
u |
A numeric vector of standardized coefficient values. |
The density is
It is symmetric, integrates to one, is concentrated near zero, and is
exactly zero outside the open unit interval. For a support scale
, the corresponding density for a coefficient is
.
A numeric vector of the same length as u, containing the density
values.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
semicircle_kernel,
level_posterior
u <- seq(-1.2, 1.2, length.out = 7) wendland_kernel(u)u <- seq(-1.2, 1.2, length.out = 7) wendland_kernel(u)
Runs a standard collection of numerical checks for endpoint handling, symmetry, support bounds, finiteness, and Gaussian monotonicity of the posterior-mean shrinkage rule.
ws_numerical_checks(quadrature_n = 128L)ws_numerical_checks(quadrature_n = 128L)
quadrature_n |
The number of Gauss-Legendre nodes used in the numerical integrations. Larger values can improve accuracy but increase computation time. |
The routine evaluates Gaussian and Laplace posterior means over a fixed
coefficient grid for all combinations of spike probability
and Wendland weight
. It checks the numerical versions of
and
.
For the Gaussian likelihood, min_first_difference checks the
expected nondecreasing behavior on the grid. The endpoint columns verify
the exact no-spike and all-spike rules.
A data frame with one row for each likelihood, spike probability, and slab
weight combination. Important columns are max_oddness_error,
min_first_difference, max_support_excess,
all_finite, pi0_exact_slab, and pi1_exact_zero.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
checks <- ws_numerical_checks(quadrature_n = 48L) checkschecks <- ws_numerical_checks(quadrature_n = 48L) checks
Fits the resolution-adaptive Wendland-Semicircle Bayesian wavelet denoiser, shrinks detail coefficients by posterior means, and reconstructs the signal with the inverse discrete wavelet transform.
wswavelet( y, filter.number = 10L, family = "DaubExPhase", bc = "periodic", j0 = 0L, likelihood = c("gaussian", "laplace"), supplied_sd = NULL, spike_offset = 2, spike_gamma = 2.4, beta_quantile = 0.99, beta_quantile_type = 8L, beta_floor = 1e-8, omega_model = c("adaptive", "constant", "fixed"), fixed_omega = NULL, eta_start = c(0, 0), eta_bounds = c(-12, 12), laplace_rate = NULL, quadrature_n = 48L, use_exact_wendland = TRUE, mad_levels = 1L, return_wavelet = FALSE )wswavelet( y, filter.number = 10L, family = "DaubExPhase", bc = "periodic", j0 = 0L, likelihood = c("gaussian", "laplace"), supplied_sd = NULL, spike_offset = 2, spike_gamma = 2.4, beta_quantile = 0.99, beta_quantile_type = 8L, beta_floor = 1e-8, omega_model = c("adaptive", "constant", "fixed"), fixed_omega = NULL, eta_start = c(0, 0), eta_bounds = c(-12, 12), laplace_rate = NULL, quadrature_n = 48L, use_exact_wendland = TRUE, mad_levels = 1L, return_wavelet = FALSE )
y |
A finite numeric signal vector. Its length must be a dyadic integer, such as 128, 256, or 1024. |
filter.number |
The wavelet filter order passed to
|
family |
The wavelet family passed to |
bc |
The boundary convention passed to |
j0 |
The coarsest detail level to shrink. Detail levels below
|
likelihood |
The coefficientwise working likelihood. Use
|
supplied_sd |
Optional known noise standard deviation. If
|
spike_offset |
The offset |
spike_gamma |
The positive resolution-sparsity exponent
|
beta_quantile |
The probability |
beta_quantile_type |
The integer quantile convention passed to
|
beta_floor |
A positive numerical floor used to prevent a zero support scale when the noise estimate and coefficients are numerically zero. |
omega_model |
How the Wendland weight is modeled across resolution
levels. |
fixed_omega |
A fixed Wendland weight in |
eta_start |
Starting values for the empirical-Bayes logistic trend
parameters |
eta_bounds |
Common finite lower and upper bounds for the optimized
logistic parameters. The default is |
laplace_rate |
Optional positive rate parameter for the Laplace
working likelihood. If |
quadrature_n |
Number of Gauss-Legendre nodes used for numerical integration. The default is 48. Larger values may improve accuracy but increase computation time. |
use_exact_wendland |
Logical value. For the Laplace likelihood,
|
mad_levels |
Number of finest detail levels pooled for the robust noise-scale estimate. The default is 1. |
return_wavelet |
Logical value. If |
The prior for a detail coefficient at resolution level is
The spike probability is
For the adaptive model, the Wendland weight is
The support scale is selected from the observed detail coefficients using
followed by the positive numerical floor
where is beta_floor.
When omega_model = "constant", the fitted Wendland weight is
at every level. When
omega_model = "fixed", no weight optimization is performed.
For Gaussian errors, the coefficientwise likelihood is
For the Laplace working likelihood, the implementation uses
The empirical-Bayes parameters are fitted by bounded L-BFGS-B optimization of the joint log marginal likelihood. The posterior mean replaces each detail coefficient, while the scaling coefficients are retained without shrinkage.
A list with the following principal components:
estimateThe reconstructed denoised signal.
sigma_hatThe estimated or supplied noise standard deviation.
laplace_rate_hatThe rate used for the Laplace working likelihood.
likelihoodThe selected likelihood.
omega_modelThe selected mixture-weight model.
eta_hatThe fitted logistic-trend parameters, padded to length two for the constant and fixed cases.
optimizationThe optimization result or fixed-weight record.
level_summaryA data frame containing level-specific support scales, prior probabilities, fitted weights, average posterior component probabilities, and numerical diagnostics.
detailA list containing the observed and fitted coefficients and posterior quantities for each detail level.
originalThe input signal.
diagnosticsQuadrature, fallback, non-finite-integral, quantile-type, and MAD-level information.
settingsThe principal fitting settings.
If return_wavelet = TRUE, the list also contains
wavelet_object and thresholded_wavelet.
Nilotpal Sanyal
Sanyal, N. (2026). Resolution-Adaptive Compact-Support Priors for Bayesian Wavelet Denoising: A Wendland-Semicircle Slab Mixture for Low-SNR Signal Recovery. Axioms, 15(9), 678. <DOI:10.3390/axioms15090678>
level_posterior,
evaluate_shrinkage_curve,
estimate_noise_sd,
wd
set.seed(1) n <- 128 x <- seq(0, 1, length.out = n) y <- sin(6 * pi * x) + rnorm(n, sd = 0.5) fit <- wswavelet( y, likelihood = "gaussian", filter.number = 6L, quadrature_n = 24L ) fit$estimate fit$level_summaryset.seed(1) n <- 128 x <- seq(0, 1, length.out = n) y <- sin(6 * pi * x) + rnorm(n, sd = 0.5) fit <- wswavelet( y, likelihood = "gaussian", filter.number = 6L, quadrature_n = 24L ) fit$estimate fit$level_summary