# Software for computing with extremely wide probability distributions

My friend and I need to make some calculations involving probability distributions over extremely wide ranges of values.

For example, I want to be able to take a bunch of random variables with lognormal PDFs, add and multiply them together, then use this as a likelihood function in a Bayesian update of a Pareto distribution prior, and take the mean of the resulting posterior distribution.

My distributions often have significant probability mass over 50 orders of magnitude. So I can't just approximate everything as log-normal distributions.

My friend has currently implemented this with buckets on a log scale, with about 4 buckets per order of magnitude. This is somewhat slow and we haven't proven any error bounds on this approach. I feel like it's quite foolish to try to write statistical computation software as an amateur.

Is there an existing library that implements this kind of functionality?

• When you say you want to "add and multiply them" what is being added or multiplied? The random variables? The densities? The distribution functions? Are these independent random variables? What model is this a likelihood for? Can you give a small reproducible example of the calculation? – Glen_b Aug 10 '16 at 23:37
• The random variables are being added and multiplied. These are indeed independent random variables, but the same random variable might appear in the model in multiple places. I don't know what you mean by "what model is this a likelihood for". Here's a small example. X, Y and Z are all lognormally distributed random variables. I want to find the posterior distribution given a Pareto distribution as my prior and the density function of (X + Y * Z) as likelihood function. – Buck Shlegeris Aug 11 '16 at 5:07

You could take a look at the actuar package

Distributions available :

• Burr
• Inverse Burr
• Generalized Beta
• Transformed Beta
• Pareto
• Generalized Pareto
• Inverse Pareto
• Inverse Exponential
• Inverse Gamma
• Log Gamma
• Inverse Paralogistic
• Log logistic
• Inverse Transformed Gamma
• Transformed Gamma
• Inverse Weibull

I know that most of then are heavy tailed distributions, but I can't "order" them to help you.