ebpm_two_gamma | R Documentation |
Uses Empirical Bayes to fit the model
x_j | \lambda_j ~ Poi(s_j \lambda_j)
with
lambda_j ~ g()
with Point Gamma: g() = pi_0 gamma(shape1, scale1) + (1-pi_0) gamma(shape2, scale2)
ebpm_two_gamma(
x,
s = 1,
g_init = NULL,
fix_g = F,
n_iter = 100,
rel_tol = 1e-10,
control = NULL
)
x |
vector of Poisson observations. |
s |
vector of scale factors for Poisson observations: the model is |
g_init |
The prior distribution |
fix_g |
If |
control |
A list of control parameters to be passed to the optimization function. 'nlm' is used. |
n_iter: |
number of maximum EM steps |
rel_tol: |
tolerance for (maximum) relative change in parameters in |
The model is fit in two stages: i) estimate g
by maximum likelihood (over pi_0, shape, scale)
ii) Compute posterior distributions for \lambda_j
given x_j,\hat{g}
.
A list containing elements:
posterior
A data frame of summary results (posterior means, posterior log mean).
fitted_g
The fitted prior \hat{g}
of class point_gamma
log_likelihood
The optimal log likelihood attained
L(\hat{g})
.
beta = c(rep(0,50),rexp(50))
x = rpois(100,beta) # simulate Poisson observations
s = replicate(100,1)
out = ebpm_two_gamma(x,s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.