Checks inputs and outputs of an ebnm-style function. Designed to
troubleshoot custom functions, especially those that are intended for use
in the flashier
package (e.g., as argument to the ebnm_fn
parameter in function flash
).
ebnm_check_fn(fn, x, s)
The function to be checked.
A test set (vector) of observations.
A test set of standard errors. Typically, ebnm-style functions should be able to accept a vector of standard errors or a scalar if all standard errors are identical. This is not always the case; for example, the horseshoe prior family requires homoskedastic standard errors.
Prints a success message and silently returns 1 if all checks pass. Otherwise the function errors out.
ebnm_check_fn(ebnm_normal, x = rnorm(10, sd = 2), s = 1)
#> Function has passed all checks.