Message Boards Message Boards

2 Replies
0 Total Likes
View groups...
Share this post:

Problem evaluating an expression involving TransformedDistribution

Posted 10 years ago
Evaluating the following expression where the LogNormal distribution has second parameter = 0.2 takes a couple of seconds on my computer:
Mean[TransformedDistribution[Abs[x - 100]/Max[x, 100], x \[Distributed] LogNormalDistribution[4.6039217458887975, 0.2]]]

(The result is 0.141523)

But when I change the second parameter to 0.5, the evaluation seems to go on indefinitely. Further, I am unable to abort the evaluation (when I choose Abort Evaluation from the Evaluation menu, nothing happens) and in order to get Mathematica to stop, I need to quit the application and restart.
Mean[TransformedDistribution[Abs[x - 100]/Max[x, 100], x \[Distributed] LogNormalDistribution[4.6039217458887975, 0.5]]]

Why would this be? I'm using Mathematica 8.0
POSTED BY: Gerald Feigin
2 Replies
Posted 10 years ago
Thanks for the helpful reply.  Interesting that Mathematica 8 can evaluate the expression symbolically (with a & b as parameters) much faster than it can evaluate the expression numerically for a specific value of a & b. 
POSTED BY: Gerald Feigin
The numerical method chosen by Mathematica 8 to solve this numerical problem might not be the best one.  I am able to stop the evaluation on my machine with version 8, but the evaluation does seem to be slow. In version 9, it seems to evaluate much faster.

I would suggest first trying to work the problem out symbolically like this:
Mean@TransformedDistribution[Abs[x - 100]/Max[x, 100], x \[Distributed] LogNormalDistribution[a, b]]
This gives the mean for generic parameters "a" and "b".

You can substitute in the values or run a numerical experiment to verify the formula. The following formula takes the mean of a million sample values from the TransformedDistribution:
  TransformedDistribution[Abs[x - 100]/Max[x, 100],
   x \[Distributed] LogNormalDistribution[4.6039217458887975, 0.5]],
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract