Apologies for the rather vague title, I'm missing some terminology here. Feel free to correct me.
I would like to sample random variables from two distributions, $Z$, a Beta distribution with shape parameters $\hat{a}$ and $\hat{b}$, and $XY$ a product distribution generated by multiplying random variables sampled from a (different) Beta distribution ($X$, shape parameters $a$ and $b$) with independently sampled discrete random variables $Y$ equal to 1 with a probability $c$ and zero otherwise. The tricky part is I need the mean and variance of $Z$ and $XY$ to be identical.
Formally then (I'm not a mathematician so expect notation errors),
$Z\sim B(\hat{a}, \hat{b})$
$X\sim B(a, b)$
$P(Y=1)=c,\ P(Y=0)=1-c$
The following are the analytic expectation and variance of $Z$ and $XY$, the latter I get to using the expressions for E/var of a production distribution here:
$E(Z)=\frac{1}{1+\hat{b}/\hat{a}}$
$Var(Z)=\frac{1}{4(2\hat{b}+1)}$
$E(XY)=\frac{c}{1+b/a}$
$Var(XY)=c\left(\frac{1}{4(2b+1)} + \frac{1-c}{(1+b/a)^2}\right)$
Then setting $E(Z)=E(XY)$ and $Var(Z)=Var(XY)$ I aim to get expressions for $a$ and $b$ for known $\hat{a}$ and $\hat{b}$ and $c$. I arrive at the following:
$a=\left(\frac{1}{4}\left(\frac{1}{4c(2\hat{b}+1)} - \frac{(1-c)}{(1-\hat{\beta})^2} \right)^{-1}-1\right)\frac{1}{2\hat{\beta}}$
$b=a\hat{\beta}$
where
$\hat{\beta}=(1+\hat{b}/\hat{a})c-1$
Not super pretty in know.
The trouble is that when I compute $a$ and $b$ as above, the analytic expectation and variances of $Z$ and $XY$ don't match so clearly I have made a mistake somewhere in the analysis.
Can anyone suggest a correction or alternative approach to getting what I want?
Cheers