# How to compute expected value?

Hi I am trying to compute this: It's a denominator of ANS function in sequential statistics.The result is:

I set "sigma1"=1 and "mi" is considered as a constant.Do you have any idea how to get the published result, please? Many thanks!

The result is published in: Sharma K. K. Singh B. and Goel J. (2009)," Sensitivity Analysis of Sequential Normal Testing Procedure. "J. Stat. & Appl. Vol. 4, No. 1, 45-57.

• Could you please add the reference of the result? – Alice May 9 '17 at 18:34

The integral you want to solve is, $$E(z \mid \mu) = \sqrt{\frac{\lambda}{\pi}} \left[ (\mu_1 - \mu_0) S - \frac{1}{2} (\mu_1^2 - \mu_0^2) T \right],$$ where $$S = \int_{-\infty}^\infty x \exp\left(- \lambda(x-\mu)^2\right) dx,$$ and $$T = \int_{-\infty}^\infty \exp\left(- \lambda(x-\mu)^2\right) dx.$$

I'm using $\lambda = \frac{1}{2 \sigma^2},$ but we can just make the substitution later.

We'll start by substituting $w = x - \mu$ in both integrals. We get,

$$T = \int_{-\infty}^\infty \exp (-\lambda w^2) dw$$

and

$$\begin{split} S &= \int_{-\infty}^\infty w \exp(-\lambda w^2) dw + \mu T \\ &= U + \mu T, \end{split}$$ where we defined $U = \int_{-\infty}^\infty w \exp (-\lambda w^2) dw.$ So it is now sufficient to calculate $U$ and $T.$ Let's start with $U$ because it's easy.

The integrand of $U$ is odd, and thus the integral must be zero. To see this, we write $U$ in a piecewise fashion and solve it,

$$\begin{split} U &= \int_{-\infty}^\infty w \exp (-\lambda w^2) dw \\ &= \int_{-\infty}^0 w \exp (-\lambda w^2) dw + \int_0^\infty w \exp (-\lambda w^2) dw \\ &= -\int_0^\infty v \exp (-\lambda v^2) dv + \int_0^\infty w \exp (-\lambda w^2) dw = 0, \end{split}$$ where in the third line, I substituted $w$ with $v = -w.$

Therefore $$S = \mu T.$$

We can solve $T$ by first finding $T^2$ and then noting that the integrand of $T$ is positive everywhere, and thus, $T$ must be the positive square root of $T^2.$ So,

$$\begin{split} T^2 &= \left[\int_{-\infty}^\infty \exp\left(- \lambda w^2\right) dx\right]^2 \\ &= \int_{-\infty}^\infty \exp\left(- \lambda w^2\right) dw \int_{-\infty}^\infty \exp\left(- \lambda v^2\right) dv \\ &= \int_{-\infty}^\infty \int_{-\infty}^\infty \exp\left( -\lambda (w^2 + v^2) \right) dw dv \\ &= 2 \pi \int_0^\infty r \exp(-\lambda r^2) dr \\ &= \pi \int_0^\infty \exp(-\lambda u) du = \frac{\pi}{\lambda}, \end{split}$$ where in the fourth line I converted the two dimensional $w-v$ space into two dimensional circular polar coordinates, and noting that the integrand is purely a function of the radius, and not the circular angle. Therefore,

$$T = \sqrt{\frac{\pi}{\lambda}}.$$

Now we can evaluate the overall integral,

$$\begin{split} E(z \mid \mu) &= \sqrt{\frac{\lambda}{\pi}} \left[ (\mu_1 - \mu_0) S - \frac{1}{2} (\mu_1^2 - \mu_0^2) T \right] \\ &= (\mu_1 - \mu_0) \mu + \frac{1}{2} (\mu_0^2 - \mu_1^2) \end{split}$$