lik_binom: Likelihood object for Binomial error distribution

View source: R/lik.R

lik_binomR Documentation

Likelihood object for Binomial error distribution

Description

Creates a likelihood object for ash for use with Binomial error distribution

Usage

lik_binom(y, n, link = c("identity", "logit"))

Arguments

y

Binomial observations

n

Binomial number of trials

link

Link function. The "identity" link directly puts unimodal prior on Binomial success probabilities p, and "logit" link puts unimodal prior on logit(p).

Details

Suppose we have Binomial observations y where y_i\sim Bin(n_i,p_i). We either put an unimodal prior g on the success probabilities p_i\sim g (by specifying link="identity") or on the logit success probabilities logit(p_i)\sim g (by specifying link="logit"). Either way, ASH with this Binomial likelihood function will compute the posterior mean of the success probabilities p_i.

Examples

   p = rbeta(100,2,2) # prior mode: 0.5
   n = rpois(100,10)
   y = rbinom(100,n,p) # simulate Binomial observations
   ash(rep(0,length(y)),1,lik=lik_binom(y,n))

ashr documentation built on Aug. 22, 2023, 1:07 a.m.