ebps: empirical Bayes Poisson smoothing

View source: R/ebps.R

ebpsR Documentation

empirical Bayes Poisson smoothing

Description

empirical Bayes Poisson smoothing

Usage

ebps(
  x,
  s = NULL,
  g_init = NULL,
  q_init = NULL,
  init_control = list(),
  general_control = list(),
  smooth_control = list()
)

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_sigma2

whether estiamte sigma2 or fix it

maxiter

max iteration of the main algorithm, default is 100

maxiter_vga

max iteration of the vga step

vga_tol

tolerance for vga step stopping

verbose

print progress?

tol

tolerance for stopping the main algorithm

convergence_criteria

'objabs' or 'nugabs'

make_power_of_2

'reflect' or 'extend'

plot_updates

internal 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_params

parameters for ebnm used in wavelet smoothing

warmstart

init posterior using last iteration's results

W

DWT 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)
plot(x,col='grey80')
lines(fit$posterior$mean_smooth)
fit$sigma2
plot(fit$elbo_trace)

DongyueXie/smashrgen documentation built on Jan. 14, 2024, 5:30 a.m.