Difference between revisions of "SoLN paper supporting materials"
(→How to use library) 

Line 24:  Line 24:  
== How to use library ==  == How to use library ==  
+  
+  If you don't already have Analytica, download and install [https://analytica.com/products/free101/ Analytica Free 101] for Windows. Then download the library from the above link. After launching Analytica, start a blank model and select '''File / Add Module...''', and select library file from the link above. If you are unsure, select Embed.  
When you have an uncertain variable whose uncertainty is best described as a sumofLogNormal distribution, define it using the SoLN distribution function. For example, for a sum of 34 LNs, each with σ=1.13, use:  When you have an uncertain variable whose uncertainty is best described as a sumofLogNormal distribution, define it using the SoLN distribution function. For example, for a sum of 34 LNs, each with σ=1.13, use:  
:Chance X1 := <code>SoLN( N:34, sigma:1.13 )</code>  :Chance X1 := <code>SoLN( N:34, sigma:1.13 )</code>  
+  
+  If you are new to Analytica  drag an oval node from the toolbar to the diagram, title it X1, and press the (x+y) button to edit its definition. For its definition, type <code>SoLN( N:34, sigma:1.13 )</code>. To learn more, see the [[Analytica Tutorial]].  
::''Note: The paper uses the convention of describing a LogNormal by μ and σ, the parameters of the underlying Normal distribution (i.e., so that each component distribution is <code>[[Exp]]( [[Normal]]( mu, sigma ) )</code>. Note that Analytica's convention is to describe a [[LogNormalLogNormal distribution]] by specifying any 2 statistics of the LogNormal variable itself  the median, geometric standard deviation, arithmetic mean or arithmetic standard deviation. This library uses the convention of the paper, rather than the standard Analytica convention. The relationship is as follows. If you desire each component distribution to be <code>LogNormal( med, gsdev )</code>, then μ=[[Ln]](med) and σ=[[Ln]](gsdev).''  ::''Note: The paper uses the convention of describing a LogNormal by μ and σ, the parameters of the underlying Normal distribution (i.e., so that each component distribution is <code>[[Exp]]( [[Normal]]( mu, sigma ) )</code>. Note that Analytica's convention is to describe a [[LogNormalLogNormal distribution]] by specifying any 2 statistics of the LogNormal variable itself  the median, geometric standard deviation, arithmetic mean or arithmetic standard deviation. This library uses the convention of the paper, rather than the standard Analytica convention. The relationship is as follows. If you desire each component distribution to be <code>LogNormal( med, gsdev )</code>, then μ=[[Ln]](med) and σ=[[Ln]](gsdev).'' 
Revision as of 23:58, 6 May 2019
Contents
Supporting Materials for Keelin, et. al. (2019)
This page contains supporting materials for the paper
 Thomas W. Keelin, Lonnie Chrisman, Sam L. Savage (2019), "Extremely accurate sums of Lognormals in closed form using Metalog distributions", submitted to the Proceedings of the 2019 Winter Simulation Conference.
This paper has been submitted. Until final copy is complete, this page and the downloadable materials may be revised.
Abstract
We provide closedform equations that closely approximate the sum of iid lognormal distributions as a function of lognormal parameters, μ and σ, and of N, the finite number of such distributions to be summed. This is accomplished through a finite table of inputs to a metalog distribution for a limited set of lognormal shape parameters and N’s, which may then be interpolated to estimate the continuous set of lognormal parameters and countable N’s. Uses include estimating total impact of N risk events, each with iid individual lognormal impact, noise in wireless communications networks and other applications. Furthermore, beyond lognormals, the approach may be directly applied to sums of iid variables from virtually any continuous distribution.
Implementation
Our algorithm computes CDF, Inverse CDF, and probability densities for an Average (or sum) of N Log Normal distributions to a maximum error in CDF of less that 0.01 for all N from 2 to 100 and σ from 0.04 to 1.5. We are providing the following Analytica implementation of the algorithm for download:
 Download: Sum of LogNormal Library.ana
If you want to implement this in a different language, we note that it is almost trivial to implement (assuming you have a matrix multiply routine) once you have the Qtables. See the paper for the details.
QTables
The algorithm uses precompiled Qtables. The Sum of LogNormal Library.ana includes these table, or you can download just the tables here as an Excel spreadsheet.
 Download: Sum of LogNormal Qtables.xlsx
How to use library
If you don't already have Analytica, download and install Analytica Free 101 for Windows. Then download the library from the above link. After launching Analytica, start a blank model and select File / Add Module..., and select library file from the link above. If you are unsure, select Embed.
When you have an uncertain variable whose uncertainty is best described as a sumofLogNormal distribution, define it using the SoLN distribution function. For example, for a sum of 34 LNs, each with σ=1.13, use:
 Chance X1 :=
SoLN( N:34, sigma:1.13 )
If you are new to Analytica  drag an oval node from the toolbar to the diagram, title it X1, and press the (x+y) button to edit its definition. For its definition, type SoLN( N:34, sigma:1.13 )
. To learn more, see the Analytica Tutorial.
 Note: The paper uses the convention of describing a LogNormal by μ and σ, the parameters of the underlying Normal distribution (i.e., so that each component distribution is
Exp( Normal( mu, sigma ) )
. Note that Analytica's convention is to describe a LogNormal distribution by specifying any 2 statistics of the LogNormal variable itself  the median, geometric standard deviation, arithmetic mean or arithmetic standard deviation. This library uses the convention of the paper, rather than the standard Analytica convention. The relationship is as follows. If you desire each component distribution to beLogNormal( med, gsdev )
, then μ=Ln(med) and σ=Ln(gsdev).
 Note: The paper uses the convention of describing a LogNormal by μ and σ, the parameters of the underlying Normal distribution (i.e., so that each component distribution is
At an infinite simulation sample size, this is equivalent to
The following graphs compare the histograms of each of these that result from a LatinHypercube simulation with a sample size of 1000:
The PDF shows some variation in both curves since it is a histogram of 1000 sampled points in both cases. In many cases, Monte Carlo simulation of sums of LogNormals doesn't achieve very good quantile accuracy, even at very large sample sizes, and especially on the tails. Since we're simulating the SoLN here as a single distribution, we get very smooth coverage using Latin Hypercube, compares to more variation in the PDF when 34 independent LogNormals are simulated.
The AoLN(N, sigma, mean)
and SoLN(N, sigma, mean
functions act as Analytica distribution functions, running in MonteCarlo, LatinHypercube or Sobol Sampling mode from uncertainty views, and returning the median value in Midviews.
For analytic calculation of density, cumulative density, or inversecumulative density (aka quantiles), the library provides the functions:

Dens_AoLN( x, N, sigma, mean)
andDens_SoLN( x, N, sigma, mean)

Cum_AoLN( x, N, sigma, mean)
andCum_SoLN( x, N, sigma, mean)

Cum_AoLN_Inv( p, N, sigma, mean)
andCum_SoLN_Inv( p, N, sigma, mean)
These use the same naming convention as other analytic distribution functions in Analytica.
Enable comment autorefresher