Function Repository Resource:

DoubleParetoLogNormalDistribution

Source Notebook

Represent a double Pareto log-normal distribution

Contributed by: Robert Rimmer

ResourceFunction["DoubleParetoLogNormalDistribution"][α,β,μ,σ]

represents a double Pareto lognormal distribution which results from exponentiation of the a random variable derived as the difference between two exponential random variables plus a normal random variable.

Details

The double Pareto log-normal distribution is a statistical distribution with two Pareto tails; the right tail exhibits power law tail behavior similar to a Fréchet type extreme value disrtibution.
ResourceFunction["DoubleParetoLogNormalDistribution"] can be used with other statistical functions such as CDF and Quantile.

Examples

Basic Examples (2) 

In this example, plotting the density, the right tail exponent has a heavy power tail with tail exponent 1.5, the left tail exponent at 3.0 mainly controls the shape of the left side of the distribution and does not contribute to left tail behavior:

In[1]:=
Plot[PDF[
  ResourceFunction["DoubleParetoLogNormalDistribution"][1.5, 3.0, 1, 1], x], {x, -1, 10}, PlotRange -> All]
Out[1]=

The mean cannot be expressed as a simple function of parameters. It will exist when the right tail exponent, α is greater than 1. Numerical integration provides a solution:

In[2]:=
mean = NIntegrate[
  x PDF[ResourceFunction["DoubleParetoLogNormalDistribution"][1.5, 3.0, 1, 1], x], {x, -\[Infinity], \[Infinity]}]
Out[2]=

The variance for this set of parameters does not exist because α is less than 2, making this a heavy-tailed distribution:

In[3]:=
NIntegrate[(x - mean)^2  PDF[
   ResourceFunction["DoubleParetoLogNormalDistribution"][1.5, 3.0, 1, 1], x], {x, -\[Infinity], \[Infinity]}]
Out[3]=

Generate a random sample for the DoubleParetoLogNormalDistributon with a right Pareto tail exponent of 1.8 and a left tail exponent of 2. The PDF and histogram are shown as well as the parameter estimates from the sample, s. Note that a short form name for the distribution is available in the definition:

In[4]:=
{a, b, d, c} = {1.8, 2, 0, 1};
s = RandomVariate[
   ResourceFunction["DoubleParetoLogNormalDistribution"][a, b, d, c], 10000];
h0 = Histogram[s, Automatic, "PDF"];
g1 = Plot[
   PDF[ResourceFunction["DoubleParetoLogNormalDistribution"][a, b, d, c], x], {x, 0, 20}, PlotRange -> All, PlotStyle -> {Thick, Darker[Red]}];
Show[h0, g1, PlotRange -> {{0, 20}, All}]
Out[8]=

The estimated distribution with parameters can be computed with the function EstimatedDistribution:

In[9]:=
EstimatedDistribution[s, ResourceFunction[
  "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]]]
Out[9]=

The parameters are listed with the function FindDistributionParameters; α is the right tail exponent, β the left tail exponent, μ a location parameter, σ the scale parameter:

In[10]:=
FindDistributionParameters[s, ResourceFunction[
  "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]]]
Out[10]=

Scope (3) 

Here is a plot of the continuous distribution function:

In[11]:=
Plot[CDF[
  ResourceFunction["DoubleParetoLogNormalDistribution"][1.8, 2, 0, 1],
   x], {x, -1, 10}, PlotRange -> All]
Out[11]=

The Quantile function uses FindRoot and CDF and is listable, but slow:

In[12]:=
Quantile[
 ResourceFunction["DoubleParetoLogNormalDistribution"][1.8, 2, 0, 1], {0.25, 0.5, 0.75}]
Out[12]=

The function DistributionParameterAssumptions shows the domain of each parameter:

In[13]:=
DistributionParameterAssumptions[
 ResourceFunction[
  "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]]]
Out[13]=

Applications (3) 

The Log[high/low] of a intraday stock market price can be used as a surrogate measure of daily volatility. This measure has a distribution which is well fit by the DoubleParetoLogNormalDistribution:

In[14]:=
ts = FinancialData["SPY", "OHLC", {2014}];
lnhilo = Log[#2/#3] & @@@ Normal[QuantityMagnitude[ts]["Values"]];
dplnD = EstimatedDistribution[lnhilo, ResourceFunction[
   "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]]]
Out[13]=

This LogLogPlot shows the right tail behavior of the estimated distribution from the data and the distribution fit. The tail behavior becomes log-log linear consistent with a power tail distribution:

In[15]:=
empD = EmpiricalDistribution[lnhilo];
LogLogPlot[{1 - CDF[dplnD, x], 1 - CDF[empD, x]}, {x, 0.001, Max[Abs[lnhilo]]}, PerformanceGoal -> "Speed", PlotLabel -> "Tail Fit Log[hi/lo]"]
Out[16]=

Results from hypothesis testing:

In[17]:=
HT = DistributionFitTest[lnhilo, dplnD, "HypothesisTestData"];
HT["TestDataTable", All]
Out[18]=

Properties and Relations (10) 

The distribution can be efficiently derived using TransformedDistribution and ParameterMixtureDistribution as shown below. ALD is an asymmetric Laplace distribution with a right tail parameter, α, and a left tail parameter, β, centered at zero. The DoubleParetoLogNormalDistribution can then be described as a parameter mixture distribution of the LogNormalDistribution, with the location parameter determined by ALD:

In[19]:=
ALD = TransformedDistribution[
  x - y, {x \[Distributed] ExponentialDistribution[\[Alpha]], y \[Distributed] ExponentialDistribution[\[Beta]]}]
Out[19]=

The DoubleParetoLogNormalDistribution then can be considered a mixture of the ALD and a LogNormalDistribution:

In[20]:=
dpln = ParameterMixtureDistribution[
  LogNormalDistribution[m + \[Mu], \[Sigma]], m \[Distributed] ALD]
Out[20]=
In[21]:=
dplnPDF = PDF[dpln, x]
Out[21]=

The densities are the same:

In[22]:=
dplnPDF == PDF[ResourceFunction[
   "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]], x]
Out[22]=

The normal Laplace distribution (see resource function NormalLaplaceDistribution) can be derived as the distribution of the difference between two exponentials plus a normal random variable, i.e. it represents the sum of an ALD random variable and a normal random variable:

In[23]:=
NLD = TransformedDistribution[
  x - y + z, {x \[Distributed] ExponentialDistribution[\[Alpha]], y \[Distributed] ExponentialDistribution[\[Beta]], z \[Distributed] NormalDistribution[\[Mu], \[Sigma]]}]
Out[23]=

The PDF of the transformed distribution:

In[24]:=
pdfnld = PDF[NLD, x]
Out[24]=

Generate the NormalLaplaceDistribution:

In[25]:=
ResourceFunction["NormalLaplaceDistribution"]
Out[25]=

The density formulas are equal:

In[26]:=
pdfnld == PDF[ResourceFunction[
ResourceObject[<|"Name" -> "NormalLaplaceDistribution", "ShortName" -> "NormalLaplaceDistribution", "UUID" -> "25d4f22c-1bce-4ff2-b34b-8a4b5458e4fa", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "A statistical distribution for the sum of a normal and an asymmetric Laplace random variable", "RepositoryLocation" -> URL[
        "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$e40834d13cc645349badb1018cd056f7`NormalLaplaceDistribution", "FunctionLocation" -> CloudObject[
        "https://www.wolframcloud.com/obj/7aa1bab9-7842-4247-928f-73d6cb79d025"]|>, ResourceSystemBase -> Automatic]][\[Alpha], \[Beta], \[Mu], \[Sigma]], x] // Simplify
Out[26]=

TransformedDistribution does not expand the NormalLaplaceDistribution into basic components and cannot be used directly to solve the relationship to the DoubleParetoLogNormalDistribution:

In[27]:=
TransformedDistribution[Exp[x], x \[Distributed] ResourceFunction[
ResourceObject[<|"Name" -> "NormalLaplaceDistribution", "ShortName" -> "NormalLaplaceDistribution", "UUID" -> "25d4f22c-1bce-4ff2-b34b-8a4b5458e4fa", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "A statistical distribution for the sum of a normal and an asymmetric Laplace random variable", "RepositoryLocation" -> URL[
        "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$e40834d13cc645349badb1018cd056f7`NormalLaplaceDistribution", "FunctionLocation" -> CloudObject[
        "https://www.wolframcloud.com/obj/7aa1bab9-7842-4247-928f-73d6cb79d025"]|>, ResourceSystemBase -> Automatic]][\[Alpha], \[Beta], \[Mu], \[Sigma]] // FunctionExpand]
Out[27]=

The basic components of the the NormalLaplaceDistribution are exponentiated to give the TransformedDistribution form of the DoubleParetoLogNormalDistribution:

In[28]:=
dpln = TransformedDistribution[
  Exp[x - y + z], {x \[Distributed] ExponentialDistribution[\[Alpha]],
    y \[Distributed] ExponentialDistribution[\[Beta]], z \[Distributed] NormalDistribution[\[Mu], \[Sigma]]}]
Out[28]=

FullSimplify can find the equality (this may take several minutes):

In[29]:=
FullSimplify[
  Refine[PDF[dpln, x], x > 0] == Refine[PDF[
     ResourceFunction[
      "DoubleParetoLogNormalDistribution"][\[Alpha], \[Beta], \[Mu], \[Sigma]], x], x > 0], {\[Alpha] > 0, \[Beta] > 0, \[Sigma] > 0, \[Mu] \[Element] Reals}] // AbsoluteTiming
Out[29]=

Publisher

Robert Rimmer

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 23 August 2024

Source Metadata

Related Resources

License Information