1
$\begingroup$

Let $X$ follow a half-normal distribution with pdf $f(x|\sigma)=\frac{\sqrt{2}}{\sigma\sqrt{\pi}}exp(-\frac{x^2}{2\sigma^2}), x >0$. How can I derive $Var(X)$?

my work:

I know that $Var(X)=E(X^2)-(EX)^2$, but I cannot solve for $E(X^2)$:

$E(X^2)=\int^\infty_0\frac{\sqrt{2}x^2}{\sigma\sqrt{\pi}}exp(-\frac{x^2}{2\sigma^2})dx$.

How can I integrate this?

$\endgroup$
6
  • 3
    $\begingroup$ Hint: write the integral for $E[X^2]$ as a integral over the entire real line instead of an integral over the positive real line. Still stumped? Make a change of variables $y=-x$ in the integral for $E[X^2]$ to see if inspiration strikes. $\endgroup$ Apr 18, 2020 at 0:27
  • $\begingroup$ @DilipSarwate I'm afraid I'm still stumped even using that change in variable. $\endgroup$
    – Ron Snow
    Apr 18, 2020 at 3:07
  • 1
    $\begingroup$ As others have mentioned, it is as simple as $E[X^2]=E[Y^2]$ where $Y\sim N(0,\sigma^2)$. A bit more work is required for $E[X]=E[|Y|]$ but chances are this has been done here before. $\endgroup$ Apr 18, 2020 at 6:42
  • 1
    $\begingroup$ Change of variable $y=x^2$ and identify a Gamma integral. $\endgroup$
    – Xi'an
    Apr 18, 2020 at 7:19
  • $\begingroup$ @Xi'an I like your suggested change in variable. Thanks! $\endgroup$
    – Ron Snow
    Apr 18, 2020 at 19:48

2 Answers 2

3
$\begingroup$

Hint: if $X \sim \text{HalfNormal}(\sigma^2)$ and $Y \sim \text{Normal}(0,\sigma^2)$, then for any symmetric and integrable $f$ $$ E[f(X)] = E[f(|Y|)] = E[f(Y)|Y \ge 0] = 2 E[f(Y) 1(Y \ge 0)]. $$

I always get tripped up a little on the difference between conditioning and multiplying by indicators.

$\endgroup$
1
  • $\begingroup$ Ah, I see. That's clever. I would've messed up on including the 2 $\endgroup$
    – Ron Snow
    Apr 18, 2020 at 3:08
1
$\begingroup$

See Wikipedia on half normal. Then consider the simulation in R below. You already have some of the key results.

set.seed(2020)     # for reproducibility
z = rnorm(10^7)    # standard normal
mean(z);  mean(z^2)
[1] -2.9034e-06    # aprx E(Z) = 0
[1] 0.9996958      # aprx E(Z^2) = 1
x = abs(z)
var(x);  mean(x^2);  mean(x)
[1] 0.3633301      # aprx Var(X)= 1-2/pi = 0.363 
[1] 0.9996958      # aprx E(x^2)=E(Z^2)=1
[1] 0.7977253      # aprx E(x)=sqrt(2/pi) = 0.798
sqrt(2/pi)
[1] 0.7978846
1- 2/pi
[1] 0.3633802
mean(x^2) - mean(x)^2
[1] 0.3633301      # aprx Var(X) again

In Comment, @Dilip was trying to get you to see that $E(Z^2) = E(X^2).$

$\endgroup$
1
  • $\begingroup$ Wonderful- thank you for providing the code to simulate, too! $\endgroup$
    – Ron Snow
    Apr 18, 2020 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.