Function Repository Resource:

NonNegativeExcessDistribution

Source Notebook

Compute the distribution of the amount in excess of a specific value drawn from an underlying distribution

Contributed by: Seth J. Chandler

ResourceFunction["NonNegativeExcessDistribution"][value,dist]

creates a distribution representing the non-negative amount in excess of value drawn from the distribution dist.

Details

The term "non-negative excess" means the amount not less than zero by which a certain value exceeds another value. Thus, the non-negative excess of 9 over 5 is 4, and the non-negative excess of 3 over 4 is 0.
ResourceFunction["NonNegativeExcessDistribution"] can be useful in modeling the distribution of financial responsibility of higher tiers of insurance (such as excess insurance) or of policyholders for amounts exceeding the limits of insurance.

Examples

Basic Examples (3) 

Compute the distribution of the amount in excess of 2/3 for a uniform distribution on the interval from 0 to 1:

In[1]:=
ResourceFunction["NonNegativeExcessDistribution"][2/3, UniformDistribution[{0, 1}]]
Out[1]=

Compute the mean of the excess:

In[2]:=
Mean[%]
Out[2]=

Compute the distribution of the amount in excess of a point for a uniform distribution in four dimensions:

In[3]:=
ResourceFunction[
 "NonNegativeExcessDistribution"][{1/3, 1/4, 7/9, 5/11}, UniformDistribution[4]]
Out[3]=

Compute the mean of the excess:

In[4]:=
Mean[%]
Out[4]=

Compute the distribution of the amount in excess of 10 for a log-normal distribution with a mean of 9 and a median of 3:

In[5]:=
ResourceFunction["NonNegativeExcessDistribution"][10, ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
      "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
      "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][9, 3]]
Out[5]=

Compute the mean and standard deviation:

In[6]:=
Through[{Mean, StandardDeviation}[%]] // FullSimplify
Out[6]=

Scope (2) 

The function works with discrete distributions:

In[7]:=
ResourceFunction["NonNegativeExcessDistribution"][13, BinomialDistribution[20, 2/3]]
Out[7]=
In[8]:=
DiscretePlot[PDF[%, k], {k, 0, 7}]
Out[8]=

One can compute a symbolic non-negative excess distribution from an underlying symbolic univariate distribution:

In[9]:=
dist = ResourceFunction["NonNegativeExcessDistribution"][xs, NormalDistribution[]]
Out[9]=

Compute various statistics of the resulting distribution:

In[10]:=
statistics = Through[{Mean, Variance, Skewness, Kurtosis}[dist]];
statistics // Short
Out[11]=

Calculate for a numeric value:

In[12]:=
statistics /. xs -> 1.
Out[12]=

Properties and Relations (2) 

One can nest non-negative excess distributions. Compute the mean amount owed by an insured who has a primary policy that covers up to 2/3 and a secondary policy that will pay any amount remaining (but not exceeding 1/10) after the primary has paid its 2/3:

In[13]:=
ResourceFunction["NonNegativeExcessDistribution"][1/10, ResourceFunction["NonNegativeExcessDistribution"][2/3, UniformDistribution[{0, 1}]]]
Out[13]=
In[14]:=
Mean[%]
Out[14]=

The result is no different than if there was a primary policy with a limit of 2/3 and 1/10:

In[15]:=
Mean[ResourceFunction["NonNegativeExcessDistribution"][2/3 + 1/10, UniformDistribution[{0, 1}]]]
Out[15]=

Applications (2) 

An excess insurer agrees to pay for damages in excess of $250,000 suffered by an insured where the distribution of losses is logarithmic, the mean loss is $10,000, and the median loss is $2,800. What premium would cause the excess insurer to break even:

In[16]:=
NExpectation[d, d \[Distributed] ResourceFunction["NonNegativeExcessDistribution"][250000, ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
        "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
        "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10000, 2800]]]
Out[16]=

A reinsurer agrees to pay 80% of the excess insurer's loss that is in turn over $100,000. What premium would cause the reinsurer to break even:

In[17]:=
NExpectation[0.8 r, r \[Distributed] ResourceFunction["NonNegativeExcessDistribution"][100000, ResourceFunction["NonNegativeExcessDistribution"][250000, ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
         "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
         "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10000, 2800]]]]
Out[17]=

Possible Issues (2) 

A mismatch between the dimension of value and the dimension of the distribution dist will gives an invalid distribution:

In[18]:=
ResourceFunction["NonNegativeExcessDistribution"][{3, 4}, NormalDistribution[a, b]]
Out[18]=

When one attempts to work with the resulting distribution errors can occur:

In[19]:=
RandomVariate[%]
Out[19]=
In[20]:=
ResourceFunction["NonNegativeExcessDistribution"][3, MultinormalDistribution[{0, 0}, {{1, 0}, {0, 1}}]]
Out[20]=
In[21]:=
RandomVariate[%]
Out[21]=

Neat Examples (6) 

Consider a distribution of judgments in a lawsuit that may be modeled as a log-normal distribution:

In[22]:=
j = ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
       "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
       "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10, 5];

Imagine an insurance policy with a limit of 20 and consider the expected positions of the insurer and insured:

In[23]:=
{Mean[CensoredDistribution[{0, 20}, j]], Mean[ResourceFunction["NonNegativeExcessDistribution"][20, j]]} // N
Out[23]=

Now, consider a second distribution with the same mean but a higher median:

In[24]:=
j2 = ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
       "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
       "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10, 9];

Examine the positions of the insurer and the insured:

In[25]:=
{Mean[CensoredDistribution[{0, 20}, j2]], Mean[ResourceFunction["NonNegativeExcessDistribution"][20, j2]]} // N
Out[25]=

Note the conflict in perspectives. From the perspective of the insurer, the second distribution leaves them in a worse expected position. From the perspective of the insured, the second distribution leaves them in a better position. Plot the difference in case values as the median goes from 1 to 9.9:

In[26]:=
Plot[{NExpectation[insurer, insurer \[Distributed] CensoredDistribution[{0, 20}, ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
          "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
          "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10, median]]], NExpectation[insured, insured \[Distributed] ResourceFunction["NonNegativeExcessDistribution"][20, ResourceFunction[
ResourceObject[<|"Name" -> "MeanMedianLogNormalDistribution", "ShortName" -> "MeanMedianLogNormalDistribution", "UUID" -> "5af0e61f-890c-4273-8b45-75967c9f256c", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Create a lognormal distribution using mean and median as parameters instead of the conventional parameters", "RepositoryLocation" -> URL[
          "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$99b6a6fd8fd648c4ac9074ef8877525c`MeanMedianLogNormalDistribution", "FunctionLocation" -> CloudObject[
          "https://www.wolframcloud.com/obj/da0748d9-6cbb-4132-98fd-fdd3c764b25c"]|>, ResourceSystemBase -> Automatic]][10, median]]]}, {median, 1, 9.9}, Sequence[
 PlotLegends -> {"insurer", "insured"}, Frame -> True, FrameLabel -> {"median", "$"}]]
Out[26]=

Consider how risk aversion alters the analysis. Suppose that when the insured considers two outputs from a distribution, they focus on the worst case:

In[27]:=
{Mean[CensoredDistribution[{0, 20}, j]], Mean@Map[Max, RandomVariate[
     ResourceFunction["NonNegativeExcessDistribution"][20, j], {1000, 2}]]} // N
Out[27]=
In[28]:=
{Mean[CensoredDistribution[{0, 20}, j2]], Mean@Map[Max, RandomVariate[
     ResourceFunction["NonNegativeExcessDistribution"][20, j2], {1000,
       2}]]} // N
Out[28]=

Publisher

Seth J. Chandler

Version History

  • 1.0.0 – 08 February 2023

Related Resources

License Information