7
$\begingroup$

Suppose I take the PDF of the LogNormal distribution with parameters m and s evaluated at x. I obviously get an expression involving m. I now want to integrate that expression not with respect to x but with respect to m as m goes from -infinity to infinity I get a ConditionalExpression that says the result is 1/x but on condition that x be less than 1. And, yet, if I NIntegrate the same expression when I make x greater than 1, I seem to always get the same result: 1/x. Why is Mathematica imposing what seems to be a needless condition on the result of the Integration? Why does it not know what the answer is when x>1?

 pdfv=Refine[PDF[LogNormalDistribution[m,s],x],x>0]
 Integrate[pdfv,{m,DirectedInfinity[-1],DirectedInfinity[1]}]
 With[{v1 = PDF[LogNormalDistribution[m, 0.1], 2.5]}, 
   NIntegrate[v1, {m, -\[Infinity], \[Infinity]}]] (* yields 0.4 *)
 With[{v2 = PDF[LogNormalDistribution[m, 0.1], 4.0]}, 
   NIntegrate[v2, {m, -\[Infinity], \[Infinity]}]] (* yields 0.25 *)

For what it's worth, I'm trying to get the distribution of lognormal distributions from which a single result might have occurred if we know the underlying process was lognormal. ( We also have some prior belief as to the second parameter of the underlying lognormal.)

$\endgroup$
9
$\begingroup$

Mathematica seems to split the integrand component,

E^(-((-m + Log[x])^2/(2 s^2)))

into

E^(-((m^2 + Log[x]^2)/(2 s^2)))

times the sort-of "coefficient"

E^((m Log[x])/s^2)  (* == x^(m/s^2) *)

in order to calculate the integral in terms of Meijer $G$. For reasons that are obscure to me, it seems to want the coefficient of m in the exponent to be negative. (Most likely it's for the sake of convergence, but that condition is unnecessary.)

Translation fixes it, by getting rid of the linear term that leads to the condition.

Assuming[x > 0 && s > 0,
 Integrate[
  pdfv /. m -> m + Log[x], {m, DirectedInfinity[-1], DirectedInfinity[1]}]
 ]
(*  1/x  *)

This supports the guess above. It seems like a minor(?) flaw in the algorithm.

Hints:

Assuming[x > 0 && s > 0,
  foo = Trace[
    Integrate[pdfv, {m, DirectedInfinity[-1], DirectedInfinity[1]}],
    _Integrate`ImproperDump`MeijerGfunction,
    TraceInternal -> True,
    TraceAbove -> True
    ]];

Assuming[x > 0 && s > 0,
 Block[{Internal`Integrate`debugSwitch = 10},
  Integrate[pdfv, {m, DirectedInfinity[-1], DirectedInfinity[1]}]
  ]]

Look for Log[x]/s^2 and Log[x]<0.

$\endgroup$
  • 1
    $\begingroup$ Nice analysis. +1 $\endgroup$ – ciao Jul 27 '15 at 4:33

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.