Solve the following integral: $\int_{x_0}^\infty \log(x) e^{-(x-a)^2/b}dx \quad x_0,b>0$

406 Views Asked by At

I want to compute this integral preferably in closed-form without expanding the $\log$ function; however, efficiently computable approximations might also solve my problem:

$\int_{x_0}^\infty \log(x) e^{-\frac{(x-a)^2}{b}}dx \quad x_0,b>0$

Background: I am trying to compute the expectation of a logarithmic function of random variables from a truncated normal distribution:

$\mathbb{E}_{x\sim \mathcal{N}(\mu,\sigma^2|x\geq x_0>0)}[\log(x)]$

Equivalently, I need to solve the follwing integral:

$\int_{x_0}^\infty \log(x) \frac{e^{-\frac{(x-\mu)^2}{2\sigma^2}}}{\sigma^2\sqrt{2\pi}(1-\Phi(\frac{x_0-\mu}{\sigma}))}dx=\frac{1}{\sigma^2\sqrt{2\pi}(1-\Phi(\frac{x_0-\mu}{\sigma}))}\int_{x_0}^\infty \log(x) e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx$

I'm stuck here.

Thanks for any help.

3

There are 3 best solutions below

4
On BEST ANSWER

Here is a suggested solution. Recall that $$ \frac{\partial}{\partial t} x^t = x^t\log(x) $$

and notice that the above derivative will be equal to $\log(x)$ when $t = 0$. Therefore, $$ I = \int^\infty_{x_0} \log(x) \exp\left(-\frac{1}{2} \left[\frac{x - \mu}{\sigma}\right]^2\right)dx = \left.\int^\infty_{x_0} \left[\frac{\partial}{\partial t} x^t\right] \exp\left(-\frac{1}{2} \left[\frac{x - \mu}{\sigma}\right]^2\right)dx\right|_{t = 0} $$

Using Leibniz integral rule, the above integral can be rewritten as $$ I = \left.\dfrac{d}{dt} \int^\infty_{x_0} x^t \exp\left(-\frac{1}{2} \left[\frac{x - \mu}{\sigma}\right]^2\right)dx\right|_{t = 0}. $$

Let $u = \frac{1}{2}\left(\frac{x - \mu}{\sigma}\right)^2$, accordingly, $\frac{\sigma}{\sqrt{2}} u^{-\frac{1}{2}} du = dx$. Hence,

$$ I = \frac{\sigma}{\sqrt{2}} \left.\dfrac{d}{dt} \int^\infty_{\xi_0} u^{1 - \frac{t}{2} - 1} e^{-u}du\right|_{t = 0} = \frac{\sigma}{\sqrt{2}} \left.\dfrac{d}{dt} \Gamma\left(1 - \frac{t}{2}, \xi_0 \right)\right|_{t = 0} $$ where $\xi_0 = \frac{1}{2}\left(\frac{x_0 - \mu}{\sigma}\right)^2$. Using the definition of the first-order derivative of the upper incomplete gamma function $\Gamma(\cdot, \cdot)$ that was given by Geddes et. al. (1990), the above integral reduces to: $$ I = -\frac{\sigma}{2\sqrt{2}} \left.\left[\log \xi_0 \Gamma\left(1 - \frac{t}{2}, \xi_0 \right) + \xi_0 T\left(3, 1 - \frac{t}{2}, \xi_0\right) \right]\right|_{t = 0} = -\frac{\sigma}{2\sqrt{2}} \left[\log \xi_0 \Gamma\left(1, \xi_0 \right) + \xi_0 T\left(3, 1, \xi_0\right) \right] $$ where $$ T\left(3, 1, \xi_0\right) = G^{3,0}_{2,3} \left(\xi_0 \left| \begin{matrix} 0 , 0 \\ -1, 0, - 1 \end{matrix} \right. \right) $$ is a special case of the Meijer G-function.

Reference:

K.O. Geddes, M.L. Glasser, R.A. Moore and T.C. Scott (1990), Evaluation of Classes of Definite Integrals Involving Elementary Functions via Differentiation of Special Functions. Applicable Algebra in Engineering, Communication and Computing, vol. 1, pp. 149-165

4
On

Too long for a comment : Even the simple case $\color{#0055AA}{a=x_0}$ yields an expression in terms of
$($ generalized $)$ hypergeometric functions :

$$ I(a,b)~=~\frac14~\sqrt{\frac\pi b}~\bigg[2a^2\cdot~_2F_2\bigg(\{1,1\},\bigg\{\frac32,~2\bigg\},-\frac{a^2}b\bigg)-b\cdot J(a,b)\bigg], $$

with

$$ J(a,b)~=~\gamma~+~\ln\frac4b~+~\text{erf}~\bigg(\frac a{\sqrt b}\bigg)\cdot\bigg(\gamma-2+\ln\frac{a^2}b\bigg), $$

where $\text{erf}$ represents the error function, and $\gamma$ stands for the Euler-Mascheroni constant.

It is therefore highly doubtful that the more general definite integral posted in the original question possesses a closed form even in terms of these special functions. Perhaps Meijer's G-function might sweep in and save the day ? Just a thought $\ldots$

2
On

A quick approximation for large $a$ using the saddle point method: The integrand can be written as $e^{f(x)}$, where $$f(x) = \log\log x - \frac{(x-a)^2}{b}.$$ We find $$f'(x) = \frac{1}{x\log x} - \frac{2(x-a)}{b}.$$ Thus, for large $a$ we find $f'(a)=\frac{1}{a\log a}\approx 0$. We find $f(a) = \log\log a$ and $$f''(a) = -\frac{2}{b} + O\left(\frac{1}{a^2\log a}\right) \approx -\frac{2}{b}.$$ Therefore, \begin{align*} \int_{x_0}^\infty \log(x) e^{-(x-a)^2/b}dx &\approx \int_{x_0}^\infty \exp\left(\log\log a -\frac{1}{b}(x-a)^2\right) dx \\ &= \sqrt{\pi b}\log a\, \Phi\left(\sqrt{\frac{2}{b}}(a-x_0)\right). %&= \frac{1}{2}\sqrt{\pi b}\log a %\left(1+\mathrm{erf}\left(\frac{a-x_0}{\sqrt{b}}\right)\right). \end{align*} (It can be shown that the same result holds if we assume instead that $b$ is small.)

Addendum: Below we plot the absolute relative error and the absolute error using this approximation for $x_0=1$.

enter image description here

enter image description here