Standard libraries/Distribution variations library
Distribution variations library
This library contains various functions for defining standard distributions using different sets of parameters.
Using the Library
To use these functions in your model, you must add the Distribution variations.ana library to your model. To add, select File → Add Library... and find the Distribution variations.ana file.
After selecting, you should select linked. Once added, the library appears on your definition menu and the functions may be used.
Functions in library
Function Smooth_fractile( fract,F,I,over )
- Identifier
- Smooth_fractile
- Title
- Smooth Fractile
- Parameter declaration
- (fract : ascending[I] ;
- F : positive ascending[I] ;
- I : index = common ;
- over : ... optional atomic )
- Description
-
- Given a set of fractiles, this returns a smooth distribution with tails having the indicated fractiles. The fractiles to use must be specified in F, each value being between 0 and 1, and the fractile values must be in fract.
For example, to specify a distribution having a P10, P50 and P90 of 7, 13, and 15, set:
F := [0.1, 0.5, 0.9]
fract := Table(F) ( 7, 13, 15 )
and call Smooth_Fractile(fract,F)
Function Beta_m_sd( m,sd,lower,upper,over )
- Identifier
- Beta_m_sd
- Title
- beta_m_sd(m,sd)
- Parameter declaration
- (m : numeric, sd : positive ; lower,upper:optional numeric; over : ... optional atomic )
- Description
-
- A beta distribution parameterized by the theoretical mean and std.dev. for the resulting distribution.
- Based on Method of Moments.
- Reference:
- Morgan, M.G., and Henrion, M., "Uncertainty", 1990, p. 97
Function Lognormal_m_sd( mean,stddev,over )
- Identifier
- Lognormal_m_sd
- Title
- LogNormal_m_sd(m,sd)
- Parameter declaration
- (mean, stddev; over: ... optional atomic )
- Description
-
- This function is no longer need since the built-in log normal function has been enhanced. The definition has been updated accordingly. It is included here only for backwards compatibility.
- This function works well when the ratio of mean/stddev >= 1. Otherwise the sample stddev may vary considerably from the desired.
Function Pert( min,mode,max,over )
- Identifier
- Pert
- Title
- Pert(min,mode,max)
- Parameter declaration
- (min,mode,max; over : ... optional atomic )
- Description
-
- A Pert-distribution, which is a beta distribution defined by a given min, mode, and max.
Function Gamma_m_sd( m,sd,over )
- Identifier
- Gamma_m_sd
- Title
- Gamma_m_sd(m,sd)
- Parameter declaration
- (m,sd : positive; over : ... optional atomic )
- Description
::The gamma distribution, parameterized by the theoretical mean and std.dev. of the target distribution.
- Uses Method of Moments. Reference:
- Morgan, M.G., and Henrion, M., "Uncertainty", 1990, p. 93.
- Uses Method of Moments. Reference:
Function Warp_dist( dist,fracts,F,over )
- Identifier
- Warp_dist
- Title
- Warp Dist
- Parameter declaration
- (dist : Samp ;
- fracts : ascending[F] ;
- F : positive ascending IndexType;
- over : ... optional atomic )
- Description
-
- Applies a smooth warping funtion to a given sample so as to obtain the listed fractiles, while maintaining the approximate shape of the distribution. For example, if you have p10, p50 and p90 percentiles and you want a "Normal-like" distribution, you could use:
index F:=[10%,50%,90%];
var pctiles := Array(F,[5,10,20]);
Warp_dist(Normal(0,1),pctiles,F)
- The resulting distribution will not be a Normal (you can't necessarily obtain a normal with any three fractiles, since Normal has only 2 free parameters), but it will be basically bell-shaped -- skewed a bit to the left to obtain the given fractiles.
- Note that if you were to provide only two fractiles, Normality would be preserved in this example.
Function Erlang( m,n,over )
- Identifier
- Erlang
- Title
- Erlang(m,n)
- Parameter declaration
- (m,n; over : ... optional atomic )
- Description
-
- The Erlang distribution is really just a variant of the Gamma distribution with another name, although it generally refers to the special case when parameter n is an integer, while the corresponding parameter A in a gamma distribution is often non-integer.
- The time of arrival of the nth event in a Poisson process with mean arrival of m follows an Erlang distribution.
Function Pareto( a,b,over )
- Identifier
- Pareto
- Title
- Pareto(a,b)
- Parameter declaration
- (a,b; over : ... optional atomic )
- Description
::The Pareto distribution.
- The "classic" use of the Pareto distribution is to model the distribution of wealth in a society, under an assumption that a smaller percentage of the people own a larger percentage of the wealth (e.g., 20% of the population control 80% of the wealth).
- The Pareto distribution is appropriate for a variety of "population" models. Examples: The size of objects in a population (e.g., grains of sand), value of assets in a collection of assets, file sizes, word frequencies, number of acquaintances of a given person, etc.
Function Rayleigh( mode,over )
- Identifier
- Rayleigh
- Title
- Rayleigh(mode)
- Parameter declaration
- (mode; over : ... optional atomic )
- Description
-
- The Rayleigh distribution results when you have two orthogonal components that are each normally distributed, such as might be the case with Wind Speed. The length of the vector itself will then have a Rayleigh distribution.
- The Rayleigh is a special case of the Weibull distribution -- Weibull(2,sqrt(2)*mode). It also coincides with Chi-Squared, conditional exponential, and the Rice distributions.
Function Negbinomial( r,p,over )
- Identifier
- Negbinomial
- Title
- NegBinomial(r,p)
- Parameter declaration
- (r,p; over : ... optional atomic )
- Description
-
- The number of events that occur in a binomial process with probability p of success until the r'th success occurs.
Function Inversegaussian( A,B,over )
- Identifier
- Inversegaussian
- Title
- InverseGaussian(A,B)
- Parameter declaration
- (A,B : positive ; over : ... optional atomic )
- Description
-
- The inverse gaussian distribution with location parameter A and scale parameter B. Used in reliability studies. Gives the first passage time in a standard Brownian motion with postive drift.
- Some books refer to this as the Wald Distribution. Others define the Wald distribution as the special case where A=1.
- This algorithm due to:
- Michael, Schucany, and Haas (1976)
Function Wald( k,over )
- Identifier
- Wald
- Title
- Wald(k)
- Parameter declaration
- (k : positive; over : ... optional atomic )
- Description
-
- The Wald distribution.
- See also InverseGaussian -- some texts call that distribution the Wald distribution.
Function Lorenzian( mode,scale,over )
- Identifier
- Lorenzian
- Title
- Lorenzian (mode,scale)
- Parameter declaration
- (mode,scale; over : ... optional atomic )
- Description
-
- The Lorenzian distribution (also known as Cauchy, Cauchy-Lorenz, Lorenz, and Breit-Wigner) is a continuous bell-shaped distribution having the indicated mode, and with the second parameter specifying the half-width at the half-maximum density.
- It has uses in physics, especially in the study of resonance and spectroscopy where it describes the shape of spectral lines that are broadened through various resonances.
- The standard form, in which mode=0 and shape=1, is known as the standard Cauchy distribution.
- The Lorenz distribution has some unusual mathematical properties that are uncommon among the standard distributions. Its mean, variance and higher moments are all undefined. As a result, the law of large numbers does not apply to samples generated from a Lorenz distribution.
- One other property of interest: The ratio of two standard normal random variables follows a standard Cauchy distribution.
Function Triangular10_50_90( p10,p50,p90,noErr,over )
- Identifier
- Triangular10_50_90
- Title
- Triangular10_50_90
- Parameter declaration
- (p10,p50,p90 ; noErr : optional boolean = 0; over:... optional atomic )
- Description
This defines a trianglar distribution given percentiles p10 <= p50 <= p90.
There are a couple downsides of defining a triangular distribution using percentiles, rather than using Min-Mode-Max as is done with the built-in Triangular distribution function. First, the percentiles do not uniquely specify the triangular distribution. When p10 and p90 are on opposite sides of the mode, there are often two possible triangular distributions with the indicated fractiles, and when p10 and p90 are on the same side of the mode, there is a fully unconstrained degree of freedom, leading to an infinite number of triangular distributions matching the fractiles. In these cases, this function will select one of the possible consistent distributions.
In addition to non-uniqueness, there are some combinations of p10<=p50<=p90 that have no triangular distribution with the indicated percentiles. This may occur when p50-p10 << p90-p50 or p50-p10 >> p90-p50 (where << means **much** less than). In this case, an error results. You can suppress this error by setting the noErr parameter to false, in which case a triangular distribution not precisely matching the indicated p10, p50 and p90 percentiles is returned. In many cases, the non-precise distribution will be close to the percentiles, but in some cases it may be substantially different.
Function Triangular10_mode_90( p10,mode,p90,over )
- Identifier
- Triangular10_mode_90
- Title
- Triangular10_Mode_90
- Parameter declaration
- (p10,mode,p90 : scalar; over:...atomic optional )
- Description
-
- A triangular distribution defined by its p10 and p90 fractiles (p10<=p90) and mode.
Function Weibull_10_50_90( x10,x50,x90,over )
- Identifier
- Weibull_10_50_90
- Title
- Weibull 10 50 90
- Parameter declaration
- (x10,x50,x90 : atom ; over : ... optional atom )
- Description
-
- Defines a translated Weibull distribution having the indicated 10-50-90 percentiles, if possible. A translated Weibull distribution has an underlying form Weibull(a,b)+c
Not all combinations of fractiles can be fit exactly. It can be shown that no Weibull distribution has fractiles satisfying (x50-x10) / (x90-x50) > 1.569. Thus, if your fractiles have skew exceeding this limit, the resulting distribution will not fit the fractiles exactly. In that case, a distribution in the general vicinity is returned (i.e., it'll do the best it can)
Function Normal_p1_p2( q1,q2,p1,p2 )
- Identifier
- Normal_p1_p2
- Title
- Normal_p1_p2(q1,q2,p1,p2)
- Parameter declaration
- (q1,q2,p1,p2 )
- Description
-
- A Normal distribution given any two percentiles.
Any two percentile estimates is sufficient to uniquely determine a Normal distribution. For example, if you have estimates of the 10th and 25th percentiles, then pass p1=10%, p2=25%, and set q1 to your 10th percentile estimate and q2 to your 25th percentile.
This distribution function can also be used within Random(...)
Enable comment auto-refresher