Find the density of the variance of a Bernoulli random variable using prior

98 Views Asked by At

Given that I have a Beta(1, 1) prior for the mean of a Bernoulli random variable, $P$, I need to find the density of the variance of a Bernoulli random variable $V = P(1 − P)$.

I attempt to find the density of $v$ as follows:

First solving P in terms of V: \begin{align*} V &= P(1-P) \\ V &= P - P^2 \\ -V &= P^2 - P \\ \frac{1}{4} - V &= P^2 - P - \frac{1}{4} \\ \frac{1}{4} - V &= \left(P - \frac{1}{2}\right)^2 \\ \\ P &= \frac{1}{2} + \sqrt{\frac{1}{4} - V} \\ \text{ or } P &= \frac{1}{2} - \sqrt{\frac{1}{4} - V} \\ \end{align*}

Then attempting to find $f_V(v)$ using the CDF method: \begin{align*} F_{V}(v) &= Pr(V \leq v) \\ &= Pr(P(1-P) \leq v) \\ &= Pr\left( \frac{1}{2} - \sqrt{\frac{1}{4} - v} \leq P \leq \frac{1}{2} + \sqrt{\frac{1}{4} - v} \right) \\ &= \int_{\frac{1}{2} - \sqrt{\frac{1}{4} - v}}^{\frac{1}{2} + \sqrt{\frac{1}{4} - v}} f_{P}(p) \ dp \\ &= F_P\left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right) - F_P\left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right) \\ \frac{d}{dv} F_{V}(v) &= \frac{d}{dv} \left[ F_P\left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right) - F_P\left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right) \right] \\ f_{V}(v) &= f_P\left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right)\left( -\frac{1}{\sqrt{1 - 4v}} \right) - f_P\left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right)\left( \frac{1}{\sqrt{1 - 4v}} \right) \\ &= -\frac{1}{\sqrt{1 - 4v}} \left[ f_P\left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right) + f_P\left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right) \right] \\ &= -\frac{1}{\sqrt{1 - 4v}} \left[ \left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right)\left(1 - \left(\frac{1}{2} + \sqrt{\frac{1}{4} - v}\right)\right) + \left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right)\left(1 - \left(\frac{1}{2} - \sqrt{\frac{1}{4} - v}\right)\right) \right] \\ &= -\frac{2v}{\sqrt{1 - 4v}} \end{align*}

But this function doesn't seem to make sense as a density so it appears I've done something wrong. Also, I know that the given prior is non-informative, but I'm not sure what I should expect about $f_V(v)$ based on that.

2

There are 2 best solutions below

0
On

The $\text{Beta}(1,1)$ distribution is the uniform distribution.

Note that $V$ is supported on $[0,1/4]$. It would probably help you a lot to look at a plot of $y=x(1-x)$.

You are close in the CDF approach but got the inequality mixed up. \begin{align} \mathbb{P}(V \le v) &= \mathbb{P}(P(1-P) \le v)\\ &= \mathbb{P}\left(P\le \frac{1}{2} - \sqrt{\frac{1}{4}-v} \right) + \mathbb{P}\left(P\ge \frac{1}{2} + \sqrt{\frac{1}{4}-v} \right)\\ &= 1 - 2\sqrt{\frac{1}{4}-v}. \end{align}

\begin{align} \frac{d}{dv} \mathbb{P}(V \le v) &= \frac{1}{\sqrt{1/4-v}}. \end{align}

This is the $\text{Beta}(1,1/2)$ distribution scaled down to fit on the interval $[0,1/4]$.

1
On

Let's see. The PDF of a Beta distribution, with shape parameters $a,b$ is $$f_P(p)=\dfrac{p^{a-1}(1-p)^{b-1}}{\beta[a,b]}\mathbf 1_{p\in[0;1]}$$

Which appears to be where you went awry.   When $a=1, b=1$, the numerator and denominator both conveniently become $1$.

So if $P\sim\mathcal{\beta eta}(1,1)$ then $f_P(p)= \mathbf 1_{p\in[0;1]}$. Ie: $P\sim\mathcal U[0;1]$.

We also have $P=\tfrac 12(1\pm\sqrt{1-4V})$, so we are mapping $[0;1/4]\mapsto[0;1/2]\cup[1/2;1]$ with a fold.


Thence the change of variables transformation, accounting for the fold, gives us:

$$\begin{align}f_V(v) &= f_P\left(\tfrac{1+\sqrt{1-4v}}2\right)\cdot\left\lvert\tfrac{\mathrm d (1+\sqrt{1-4v})/2}{\mathrm d v}\right\rvert+ f_P\left(\tfrac{1-\sqrt{1-4v}}2\right)\cdot\left\lvert\tfrac{\mathrm d (1-\sqrt{1-4v})/2}{\mathrm d v}\right\rvert \\[1ex] &=\dfrac 2{\sqrt{1-4v}} \mathbf 1_{v\in[0;1/4]}\end{align}$$


The CDF approach should give the same result.