ebpm_point1_gamma: Empirical Bayes Poisson Mean with Point (at 1) Gamma as Prior

View source: R/ebpm_point1_gamma.R

ebpm_point1_gammaR Documentation

Empirical Bayes Poisson Mean with Point (at 1) Gamma as Prior

Description

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 delta_1() + (1-pi_0) gamma(shape, scale)

Usage

ebpm_point1_gamma(x, s = 1, g_init = NULL, fix_g = FALSE, control = NULL)

Arguments

x

vector of Poisson observations.

s

vector of scale factors for Poisson observations: the model is y[j]~Pois(scale[j]*lambda[j]).

g_init

The prior distribution g, of the class point1_gamma. Usually this is left unspecified (NULL) and estimated from the data. However, it can be used in conjuction with fix_g = TRUE to fix the prior (useful, for example, to do computations with the "true" g in simulations). If g_init is specified but fix_g = FALSE, g_init specifies the initial value of g used during optimization.

fix_g

If TRUE, fix the prior g at g_init instead of estimating it.

control

A list of control parameters to be passed to the optimization function. 'nlm' is used.

pi0

Either "estimate" which optimizes over pi0 along with shape and scale, or a number in [0,1] that fixes pi0

Details

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}.

Value

A list containing elements:

posterior

A data frame of summary results (posterior means, and posterior log mean).

fitted_g

The fitted prior \hat{g} of class point1_gamma

log_likelihood

The optimal log likelihood attained L(\hat{g}).


stephenslab/ebpm documentation built on Oct. 19, 2023, 1 p.m.