empirical Bayes Poisson smoothing
Arguments
- x, s
data vector and scaling factor. s can be a vector of the same length as x, or a scalar.
- g_init
a list of initial value of sigma2, and g_smooth. g_smooth is the initial prior g of the smoothing method. Can be NULL.
- q_init
a list of initial values of m, smooth. m is the posterior mean of mu, smooth the posterior mean of b. See the details below.
- init_control
See function ebps_init_control_default
- general_control
See function ebps_general_control_default
- smooth_control
See function ebps_smooth_control_default
Details
The problem is $$x_i\sim Poisson(\lambda_i,$$ $$\lambda_i = \exp(\mu_i)),$$ $$\mu_i\sim N(b_i,\sigma^2),$$ $$\b_i\sim g(.).$$
The init_control argument is a list in which any of the following
named components will override the default algorithm settings (as
defined by ebps_init_control_default):
m_init_method'vga' or 'smash_poi'
The general_control argument is a list in which any of the following
named components will override the default algorithm settings (as
defined by ebps_general_control_default):
est_sigma2whether estiamte sigma2 or fix it
maxitermax iteration of the main algorithm, default is 100
maxiter_vgamax iteration of the vga step
vga_toltolerance for vga step stopping
verboseprint progress?
toltolerance for stopping the main algorithm
convergence_criteria'objabs' or 'nugabs'
make_power_of_2'reflect' or 'extend'
plot_updatesinternal use only
The smooth_control argument is a list in which any of the following
named components will override the default algorithm settings (as
defined by ebps_smooth_control_default):
wave_trans'dwt' or 'ndwt'
ndwt_method'smash' or 'ti.thresh'
ebnm_paramsparameters for ebnm used in wavelet smoothing
warmstartinit posterior using last iteration's results
WDWT matrix for non-haar wavelet basis
Examples
set.seed(12345)
n=2^9
sigma=0.5
mu=c(rep(0.3,n/4), rep(3, n/4), rep(10, n/4), rep(0.3, n/4))
x = rpois(n,exp(log(mu)+rnorm(n,sd=sigma)))
fit = ebps(x)
#> Error in ebps_init(x, s, general_controls$make_power_of_2, g_init, q_init, init_controls$m_init_method): could not find function "ebps_init"
plot(x,col='grey80')
lines(fit$posterior$mean_smooth)
#> Error: object 'fit' not found
fit$sigma2
#> Error: object 'fit' not found
plot(fit$elbo_trace)
#> Error: object 'fit' not found