There are two coins from which one is randomly chosen and tossed 5 times, and the sequence of heads or tails is recorded. Consider the table below, which contains sample data from the experiment described above.
| Trial | Coin Chosen (Z) | Outcomes (X) | Heads Count | Tails Count |
|---|
| 1 | 1 | H H H H H | 5 | 0 |
| 2 | 1 | T T T T T | 0 | 5 |
| 3 | 2 | H H H H T | 4 | 1 |
| 4 | 1 | H H H H H | 5 | 0 |
| 5 | 1 | T H H H H | 4 | 1 |
| 6 | 1 | T T H H T | 2 | 3 |
Based on the above data, answer the given subquestions.
(BONUS QUESTION)
Now assume that the coin identity Z is hidden from the given table, but the outcomes X are observed. Two coins have unknown head probabilities θ1 and θ2. One of the coins is chosen at random with equal probability (P(Z=1)=P(Z=2)=0.5), and then tossed 5 times.
Suppose the initial parameter guesses are:
θ1(0)=0.4,θ2(0)=0.8.
Perform one iteration of the EM algorithm:
E-step: Compute the posterior probabilities
ri1=P(Zi=1∣Xi,θ(0)),ri2=1−ri1
for each trial i=1,…,6.
M-step: Use these posterior weights to update
θ1(1)=∑i=16ri1⋅5∑i=16ri1⋅(heads in trial i),
θ2(1)=∑i=16ri2⋅5∑i=16ri2⋅(heads in trial i).
Using the updated parameters θ1(1),θ2(1), compute the posterior probability that trial 5 (HTHHH) was generated by coin 1:
P(Z5=1∣X5,θ1(1),θ2(1)).