binomial.beta.mix: Computes the posterior for binomial sampling and a mixture of...

Description Usage Arguments Value Author(s) Examples

Description

Computes the parameters and mixing probabilities for a binomial sampling problem where the prior is a discrete mixture of beta densities.

Usage

1
binomial.beta.mix(probs,betapar,data)

Arguments

probs

vector of probabilities of the beta components of the prior

betapar

matrix where each row contains the shape parameters for a beta component of the prior

data

vector of number of successes and number of failures

Value

probs

vector of probabilities of the beta components of the posterior

betapar

matrix where each row contains the shape parameters for a beta component of the posterior

Author(s)

Jim Albert

Examples

1
2
3
4
5
6
probs=c(.5, .5)
beta.par1=c(15,5)
beta.par2=c(10,10)
betapar=rbind(beta.par1,beta.par2)
data=c(20,15)
binomial.beta.mix(probs,betapar,data)

Example output

$probs
beta.par1 beta.par2 
0.2917961 0.7082039 

$betapar
          [,1] [,2]
beta.par1   35   20
beta.par2   30   25

LearnBayes documentation built on May 1, 2019, 7:03 p.m.