0
$\begingroup$

I have a random variable $X \sim N(\mu, \sigma^2)$ and a function $5x^2 + 2x$. How can I calculate $E(g(x))$ ?

I have two ideas, altough I'm not sure which one is right:

  • $E(g(x) = \int_{-\infty}^{\infty} g(x) f_X(x) dx\\ =\int_{-\infty}^{\infty} 5x^2 + 2x\frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 }$

  • The function above just computes the weighted average of the values that $g(x)$ can take on for different values of x. The normal distrubution is symmetric, so $E[g(x)] = 5 \mu^2 + 2\mu$

Sorry if the question might sound stupid, I don't have a statistics background.

$\endgroup$
3
  • 3
    $\begingroup$ Var(x) = E(x^2) - E(x)^2 $\endgroup$ Oct 19, 2019 at 14:31
  • 2
    $\begingroup$ Expectation is 'linear': For constants $c,d$ and random variables $X,Y$, we have $E[cX+dY]=cE[X]+dE[Y]$ whenever all expectations exist.// Note that $E[X^2]$ does not equal $(E[X])^2$ for a non-constant variable $X$. $\endgroup$ Oct 19, 2019 at 16:30
  • 1
    $\begingroup$ $\int_{-\infty}^{\infty} 5x^2 + 2x\frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 }$ should be $\int_{-\infty}^{\infty} (5x^2 + 2x)\frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 },$ which turns into two terms--one trivial and one requiring a bit of throught. // What does symmetry have to do with this? $\endgroup$
    – BruceET
    Oct 20, 2019 at 2:17

2 Answers 2

2
$\begingroup$

$E[g(x)] = E[5x^2+2x] = 5E[x^2] + 2E[x]$.

$E[x^2] = var(x) + E(x)^2 = \sigma^{2} + \mu^{2}$.

Hence $E[g(x)] = 5(\sigma^2 + \mu^2) + 2\mu$.

Read for Delta method for more general cases.


Edit) Sorry for the sign. For the $E[x^2]$, I changed the sign from (-) to (+) and henceforth.

When $g(\cdot)$ is not linear (for the $N(\cdot, \cdot)$, higher order moments are "known", but for general cases they are not) or X is non-normal, then you may apply delta method in order to get distribution of $g(x)$.

$\endgroup$
3
  • 1
    $\begingroup$ What 'Delta method' in this context? $\endgroup$ Oct 19, 2019 at 16:23
  • 3
    $\begingroup$ No, this is wrong (a $+$ sign has changed to a $-$ sign); cf. comment by @JesperHybel on main question. for the correct formula. $\endgroup$ Oct 19, 2019 at 16:31
  • $\begingroup$ Right general idea. Checking results for a special case by simulation. $\endgroup$
    – BruceET
    Oct 20, 2019 at 1:39
0
$\begingroup$

Comment: Checking by simulation, for the special case $\mu = 25, \sigma = 3.$

set.seed(2019)
mu = 25;  sg = 3
x = rnorm(10^7, mu, sg)

y = 5*x^2 + 2*x
> mean(y)
[1] 3220.226   # aprx answ
2*sd(y)/sqrt(10^7)
[1] 0.4798108  # 95% margin of simulation error

5*(sg^2 - mu^2) + 2*mu
[1] -3030      # doesn't match aprx answ
5*(sg^2 + mu^2) + 2*mu
[1] 3220       # seems to match aprx answ

@crux26: Looks as if @DilipSarwate is right; you have a wrong sign. Please edit your answer.

$\endgroup$

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.