flash_ebnm is a helper function that provides readable syntax for
constructing ebnm functions that can serve as
arguments to parameter ebnm_fn in functions flash,
flash_greedy, and flash_factors_init (see
Examples below). It is also possible to write a custom function
from scratch: see Details below for a simple example. A more
involved example can be found in the "Extending ebnm with custom ebnm-style
functions" vignette in the ebnm package.
flash_ebnm(...)Parameters to be passed to function ebnm
in package ebnm. An argument to prior_family should be
provided unless the default family of point-normal priors is desired.
Arguments to parameters x, s, or output must not be
included. Finally, if g_init is included, then fix_g = TRUE
must be as well. To fix a prior grid, use parameter scale rather
than g_init.
A function that can be passed as argument to parameter
ebnm_fn in functions flash,
flash_greedy, and flash_factors_init.
As input to parameter ebnm_fn in functions flash,
flash_greedy, and flash_factors_init,
it should suffice for many purposes to
provide functions from package ebnm as is (for example, one might
set ebnm_fn = ebnm_point_laplace). To use non-default
arguments, function flash_ebnm may be used (see Examples).
Custom functions may also be written; for details, see the "Extending
ebnm with custom ebnm-style functions" vignette in the
ebnm package.
# A custom EBNM function might be written as follows:
my_ebnm_fn <- function(x, s, g_init, fix_g, output) {
ebnm_res <- ebnm_point_laplace(
x = x,
s = s,
g_init = g_init,
fix_g = fix_g,
output = output,
control = list(iterlim = 10)
)
return(ebnm_res)
}
# The following are equivalent:
fl1 <- flash(
gtex,
ebnm_fn = my_ebnm_fn,
greedy_Kmax = 2
)
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Wrapping up...
#> Done.
#> Nullchecking 2 factors...
#> Done.
fl2 <- flash(
gtex,
ebnm_fn = flash_ebnm(
prior_family = "point_laplace",
control = list(iterlim = 10)
),
greedy_Kmax = 2
)
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Wrapping up...
#> Done.
#> Nullchecking 2 factors...
#> Done.