# Power law distribution

(Redirected from CumPowerLawDist)

New to Analytica 6.0 (in the Power Law Distribution Library)

The Power law distribution is a continuous positive-only, univariate distribution that describes a quantity whose probability decreases as a power of its magnitude, i.e.,

$\displaystyle{ p(x) \propto x^{-\lambda} }$

It is defined for $\displaystyle{ x\ge 1 }$ and $\displaystyle{ \lambda\gt 1 }$. It has a finite mean for $\displaystyle{ \lambda\gt 2 }$ and a finite variance for $\displaystyle{ \lambda\gt 3 }$.

On a log-log plot, both the probability density graph and the exceedance plot are straight lines.

The distribution also has a "scale-free" (or scale-invariance) property: If you scale your quantity by multiplying by a constant factor, the scaled quantity follows the same distribution.

To use the power law distribution, you need to add the "Power Law Distribution Library" to your model (which is included with Analytica 6.0). This distribution is implemented as UDFs, and provides an nice template for you to follow if you want to add other distributions to Analytica that aren't already build-in.

## Uses

Many processes have been found to follow power laws over substantial ranges of values. From the distribution in incomes, size of meteoroids, earthquake magnitudes, spectral density of weight matrices in deep neural networks, word usage, number of neighbors in various networks, etc. (Note: The power law here is a continuous distribution. The last two examples are discrete, but on a large scale can be modeled as if continuous).

## Functions

### PowerLawDist( lambda, over )

The distribution function. Use this function to describe a quantity that has an exponential distribution.

To describe independent variables over one or more indexes, list the indexes in the «over» parameter. For example,

PowerLawDist( lambda, over: Region, Technology )

### DensPowerLawDist( x, lambda)

The analytic probability density at «x», given by

$\displaystyle{ p(x) = (\lambda-1) x^{-\lambda} }$

### CumPowerLawDist(x, lambda )

The analytic cumulative probability at «x», which returns the probability that an power-law-distributed quantity with exponent -«lambda» is less than or equal to «x». This is equal to

$\displaystyle{ F(x) = 1 - x^{1-\lambda} }$

### CumPowerLawDistInv(p, lambda )

The inverse cumulative probability function (quantile function), given the value x where the probability of the value being less than or equal to x is «p». This is equal to

$\displaystyle{ F^{-1}(p) = (1-p)^{1/(1-\lambda)} }$

## Statistics

The theoretical statistics (i.e., in the absence of sampling error) for the power law distribution with a «lambda» parameter value of $\displaystyle{ \lambda }$ are as follows.

• Mean = $\displaystyle{ {\lambda-1}\over{\lambda-2} }$, exists for $\displaystyle{ \lambda\gt 2 }$
• Mode = 0
• Median = $\displaystyle{ 2^{1\over{\lambda-1}} }$
• Moments: $\displaystyle{ E[x^c] = {{\lambda-1}\over{\lambda-(c+1)}} }$, exists for $\displaystyle{ \lambda\gt c+1 }$
• SDeviation = $\displaystyle{ \sqrt{{{c-1}\over{c^3-7 c^2+16 c-12}}} }$, exists for $\displaystyle{ \lambda\gt 3 }$
• Variance = $\displaystyle{ {{c-1}\over{c-3}} - \left({{c-1}\over{c-2}}\right)^2 = {{c-1}\over{c^3-7 c^2+16 c-12}} }$, exists for $\displaystyle{ \lambda\gt 3 }$
• Skewness = $\displaystyle{ {1\over{\sigma^3}} \left( {{c-1}\over{c-4}} -3\mu\sigma^2 - \mu^3\right) }$, exists when $\displaystyle{ \lambda\gt 4 }$
• Kurtosis =

## Parameter Estimation

Given an array of data points, x, indexed by I. The following expression estimates $\displaystyle{ \lambda }$. 

Local x_s:=Sort(x,I); Local exc := 1-(@I-1/2)/IndexLength(I); 1 - Regression(ln(exc),ln(x_s),I)