# Sums of independent, identically distributed lognormal distributions

## "...almost nothing is known of the distribution of the sum of lognormals." Over the years I've been working with the ProbabilityManagement.org a not-for-profit that Dr. Sam Savage, author of The Flaw of Averages, started. Their mission is to cure the flaw of averages. The flaw of average states, plans made from average assumptions are wrong on average. Through that organization I learned about the problem of finding the distribution of sums of lognormally distributed random variables.

### Why would anybody want to the distribution of the sums?

A popular way to model crypto token prices is with lognormal distributions (if you have too). Let's say you want to know the probability a portfolio of tokens will be greater than a particular price threshold. That's pretty common, if you want to assure a DeFI loan won't be liquidated for being under collateralized. Or if you are pricing a derivatives contracts, or a basket of options, these would involve sums of lognormal price volatility distributions.

There are non-financial fields where modeling lognormals is also a common practice, like in geology, biology, engineering and many others .

### A practical solution Tom Keelin, Lonnie Chrisman and Sam Savage recently wrote a paper that outlines a solution. Here's the abstract from the paper:

"The metalog probability distributions can represent virtually any continuous shape with a single family of equations, making them far more flexible for representing data than the Pearson and other distributions. Moreover, the metalogs are easy to parameterize with data without non-linear parameter estimation, have simple closed-form equations, and offer a choice of boundedness. Their closed-form quantile functions (F-1) enable fast and convenient simulation. The previously unsolved problem of a closed-form analytical expression for the sum of lognormals is one application. Uses include simulating total impact of an uncertain number N of risk events (each with iid [independent, identically distributed] individual lognormal impact), noise in wireless communications networks and many others. Beyond sums of lognormals, the approach may be directly applied to represent and subsequently simulate sums of iid variables from virtually any continuous distribution, and, more broadly, to products, extreme values, or other many-to-one change of iid or correlated variables."

I decided to write the javascript version of this using an interpolatable (is that a word??) data table based on a spreadsheet the authors produced. Here's the github repo and a codepen which is largely based on it.

If this is an area of interest for you and you like to help there are a few open items listed in the repo. I'd like to get the data table into decentralized storage (IPFS, Gun, Sai, others) so nobody ever has to calculate these values again, they may just look them up. If you're curious and want to learn more about metalog distributions and how we're using them in DeFI join the discord server.