Skip to contents

Draws a length-2^lev_res function whose wavelet detail coefficients at scale s are independent draws from an ash-style normal mixture \sum_k \pi_{s,k} N(0, (\sigma_k / 2^{\alpha s})^2). The first mixture component is a point mass at zero with weight pi0[s]; the remaining components share a common grid of standard deviations on (0, \infty). The inverse DWT (wavethresh::wr) maps the sampled coefficient vector to position space.

Usage

mf_simu_ibss_per_level(
  lev_res = 7L,
  length_grid = 10L,
  pi0,
  alpha = 0.8,
  prop_decay = 0.1
)

Arguments

lev_res

integer >= 2. Resolution level: the sampled function lives on a length-2^lev_res grid. Default 7 (length 128).

length_grid

integer >= 2. Number of components in the per-scale ash mixture, including the null component at zero. Default 10.

pi0

optional numeric vector of length lev_res. Per-scale null-component weight. When omitted, defaults to 1 - exp(-prop_decay * 1:lev_res).

alpha

non-negative numeric. Scale-dependent variance shrinkage exponent: at scale s, the per-component sd is divided by 2^{alpha * s}. Larger alpha produces smoother functions. Default 0.8.

prop_decay

numeric in [0, 1]. Controls how the default pi0 decays across scales: larger prop_decay gives a sparser fine-scale signal. Ignored when pi0 is supplied explicitly. Default 0.1.

Value

A list with components

sim_func

numeric vector of length 2^lev_res, the position-space sample.

true_coef

numeric vector of the wavelet detail coefficients used to construct the sample.

mix_per_scale

length-lev_res list of ashr::normalmix objects, one per wavelet scale.

emp_pi0

length-lev_res numeric vector of empirical null-component fractions per scale (the fraction of detail coefficients that came back exactly zero from the mixture sampler).

Details

This is the prior class fSuSiE infers in its IBSS step, so the bundled simulation matches the model's assumed generative process. Used by the example datasets and the covariate-adjustment vignette.

References

Manuscript: methods/derivation.tex (IBSS prior derivation).

Examples

set.seed(1L)
f <- mf_simu_ibss_per_level(lev_res = 7L)
length(f$sim_func)            # 128
#> [1] 128
plot(f$sim_func, type = "l", xlab = "position", ylab = "f")