Inconsistent Function Monotonicity from hand and Mathematica image

35 Views Asked by At

$g(x)=\frac{\phi(x)}{1-\Phi(x)}$, where $\phi(x)$ and $\Phi(x)$ are p.d.f and c.d.f of standard normal distribution respectively.

$g'(x)=\frac{\phi'(x)(1-\Phi(x))+\phi^2(x)}{(1-\Phi(x))^2}=\frac{\phi(x)}{(1-\Phi(x))^2} \left( \phi(x)-x(1-\Phi(x)) \right)$ since $\phi'(x)=-x\phi(x)$.

Let $h(x)=\phi(x)-x(1-\Phi(x))$, $h'(x)$ is thus $\phi'(x)-(1-\Phi(x))+x\phi(x)=\Phi(x)-1 \leq 0$

$h(x)$ is non-increasing, and $\lim_{x\to \infty} h(x)=0 $, thus $h(x)\geq0$ and since $\frac{\phi(x)}{(1-\Phi(x))^2}\geq 0$ then $g'(x)\geq0$. $g(x)$ must be non-decreasing.

But in Mathematica, I have this like a wavy line. Mathematica Image

What's the problem please!

1

There are 1 best solutions below

0
On BEST ANSWER

You need to use FullSimplify, after which you will obtain

$$g(x) = \sqrt{\frac{2}{\pi}} \frac{e^{-x^2/2}}{\operatorname{erfc}(x/\sqrt{2})},$$ and this function evaluates correctly since the implementation of Erfc avoids the loss of precision due to evaluating Erf at arguments that are so large that it is almost $1$.

So for instance, input

PDF[NormalDistribution[0, 1], x]/(1 - CDF[NormalDistribution[0, 1], x]) // FullSimplify

to yield the form of $g$ shown above, then plot this function over the desired interval.