Two sums out of a product

41 Views Asked by At

Problem

Assuming $\theta \in [0, 1], y_i \in \{0, 1\}$, I'm having trouble deriving the expression on the right from the one on the left: $$ \begin{align} \prod_i \theta^{y_i}(1-\theta)^{(1-y_i)} ~~~~~\Longrightarrow~~~~~ \theta\sum_i y_i(1-\theta) \sum_i (1-y_i) \end{align} $$

The meaning is that $\theta$ is the probability of heads in a coin toss and $y_1$ is an outcome (a head or a tail).

Attempt

I thought I'd start by taking the log of the product:

$$ \begin{align} \prod_i \theta^{y_i}(1-\theta)^{(1-y_i)} &= \exp\log\bigg(\prod_i \theta^{y_i}(1-\theta)^{(1-y_i)}\bigg)\\ &= \exp\sum_i \bigg(\log\theta^{y_i} +\log(1-\theta)^{(1-y_i)}\bigg)\\ &= \exp\sum_i \bigg(y_i\log\theta^{} +{(1-y_i)\log(1-\theta)}\bigg)\\ \end{align} $$

Stuck at this point. Any feedback appreciated.

Source: Kruschke (2014) Doing Bayesian Data Analysis, 2nd Edition, formula 5.11:

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

$$ \prod_i \theta^{y_i} (1-\theta)^{(1-y_i)}= \theta^{ y_1} \theta^{ y_2} \cdots \theta^{ y_n }(1-\theta)^{ (1-y_1)} (1-\theta)^{ (1-y_2)} \cdots (1-\theta)^{(1-y_n)} $$ $$=\theta^{ \sum_{i=1}^{n} y_i } (1-\theta)^{\sum_{i=1}^{n} (1-y_i)}$$

$$=\theta^{ \sum_{i=1}^{n} y_i } (1-\theta)^{n-\sum_{i=1}^{n} -y_i}$$

$$=\theta^{ heads } (1-\theta)^{n-heads}$$