2

If $X$ is random variable that has two density function $f(x)$ with probability $p$ and $g(x)$ with probability $1-p$, and mean and standard deviation of $f(x)$ and $g(x)$ are $\mu_1$, $\sigma_1$, $u_2$, $\sigma_2$. Define an indicator function

$$ I = \begin{cases} 1, & \text{$X$ follows $f(x)$}; \\ 0, & \text{otherwise} \end{cases} $$

Then what is the mean and variance of $X$?

I have tried that pdf(x)=p I(1)+ (1-p) I(0), so the expectation of X is p*mu1+(1-p)*mu2, but what's the variance.

eric_kernfeld
  • 4,828
  • 1
  • 16
  • 41
  • You might find $Var(X)=E[X^2] - (E[X])^2$ an easier approach since $I^2=I$ – Henry Feb 03 '20 at 11:01
  • Welcome to the site! I've added the self-study tag and added a more informative title; I hope these edits preserve the intent of the question. – eric_kernfeld Feb 03 '20 at 15:22

2 Answers2

1

Hint: You have specified that density $f$ holds with probability $p$. This should tell you something important about the distribution of the indicator $I$.

Ben
  • 91,027
  • 3
  • 150
  • 376
1

Your new density is: $$h(x)=pf(x)+(1-p)g(x)$$

So, by just substituting, you can calculate each moment and find the variance: $$\begin{align}E[X]&=\int_{\mathcal{X}} x (pf(x)+(1-p)g(x))dx=p\int_{\mathcal{X}}x f(x)dx+(1-p)\int_{\mathcal{X}}x g(x)dx\\&=p\mu_1+(1-p)\mu_2\end{align}$$

Using similar approach for the second moment: $$\begin{align}E[X^2]&=\int_{\mathcal{X}} x^2 (pf(x)+(1-p)g(x))dx=p\int_{\mathcal{X}}x^2 f(x)dx+(1-p)\int_{\mathcal{X}}x^2 g(x)dx\\&=p(\mu_1^2+\sigma_1^2)+(1-p)(\mu_2^2+\sigma_2^2)\end{align}$$

gunes
  • 49,700
  • 3
  • 39
  • 75