Category Archives: Prior/Posterior Distribution

Beta-binomial

You have a sequence of coins \(X_1,…,X_n\) drawn iid from a Bernouli distribution with unknown parameter \(p\) and known fixed \(n\). Assume a priori that the coins parameter \(p\) follows a Beta distribution with parameters \(\alpha,\beta\).

  1. Given the sequence  \(X_1,…,X_n\) what is the posterior pdf of \(p\) ?
  2. For what value of \(p\) is the maximum of the posterior pdf attained.

Hint: If \(X\) is distributed Bernoulli(p) then for \(x=1,0\) one has \(P(X=x)=p^x(1-p)^{(1-x)}\). Furthermore, if \(X_1,X_2\) are i.i.d. Bernoulli(p) then
\[P(X_1=x_1, X_2=x_2 )=P(X_1=x_1)P(X_2=x_2 )=p^{x_1}(1-p)^{(1-x_1)}p^{x_2}(1-p)^{(1-x_2)}\]

Expectation of hierachical model

Consider the following hierarchical random variable

  1. \(\lambda \sim \mbox{Geometric}(p)\)
  2. \(Y \mid \lambda \sim \mbox{Poisson}(\lambda)\)
Compute \(\mathbf{E}(Y)\).

 

Biased coins

Given a random variable \(x = \{ 0,1\} \) where \(0\) corresponds to heads and \(1\) corresponds to tails.

For a single coin flip: \( \mathbf{P}(x \mid p) = p^x(1-p)^{1-x}\).

For a sequence of \(n\) coin flips: \( \mathbf{P}(x_1,…,x_n \mid p) = \prod_{i=1}^n p^{x_i}(1-p)^{1-x_{i}}\).

I have a bag with three types of coins with the following probabilities of drawing each type:

\( \mathbf{P}(p=.5) = .7 \),  \( \mathbf{P}(p=.1) = .2 \), \( \mathbf{P}(p=.9) = .1 \).

I draw a coin from the bag. I flip it \(n\) times resulting in a sequence \(X_1,…,X_n\).

 

  1. Using Bayes rule provide the formula for
    \[ \mathbf{P}(p = .1 \mid x_1,…,x_n),\quad
    \mathbf{P}(p = .5 \mid x_1,…,x_n), \quad\text{and}\quad
    \mathbf{P}(p = .9 \mid x_1,…,x_n) \].
  2. If  \(x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8)=(1,1,0,1,1,0,0,1)\) what is the most likely value  probability \(p \) of the coin the was used ?