Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- Exponential To R^1 Pareto #1 (1, 2, 3)
	- Exponential To R^1 Pareto #2 (4, 5, 6)
	- R^1 Exponential To Pareto Shell (9, 10)
	- R^1 Exponential To Pareto Normalizer (11, 12)
	- R^1 Exponential To Pareto Lambda (13, 14)
	- R^1 Exponential To Pareto k (15, 16)
	- R^1 Pareto Distribution Normalizer Estimation (17, 18)
	- Exponential To R^1 Pareto #3 (19, 20, 21)
	- R^1 Exponential To Pareto Constructor (24, 25, 26)
	- R^1 Exponential To Pareto Support (27, 28)
	- R^1 Exponential To Pareto Density (29, 30)
	- Exponential To R^1 Pareto #4 (31, 32, 33)
	- R^1 Exponential To Pareto Cumulative (34, 35, 36)
	- R^1 Exponential To Pareto Mean #1 (37, 38, 39)
	- R^1 Exponential To Pareto Mean #2 (40, 41, 42)
	- R^1 Exponential To Pareto Variance #1 (43, 44, 45)
	- R^1 Exponential To Pareto Variance #2 (46, 47, 48)
	- R^1 Pareto Distribution Run Sweep (52, 53)


Bug Fixes/Re-organization:

	- R^1 Gamma To Maxwell Boltzmann Squared (7)
	- R^1 Gamma To Exponential (8)
	- Trim Pareto Distribution Normalizer (22, 23)
	- Rename To R^1 Pareto Distribution (49, 50, 51)


Samples:

	- R^1 CDF and PDF #1 (54, 55, 56)
	- R^1 CDF and PDF #2 (57, 58)
	- R^1 CDF and PDF #3 (59, 60)


IdeaDRIP:
  • Loading branch information
Lakshmik committed Aug 16, 2023
1 parent 0c4eaa9 commit 0d60ad3
Show file tree
Hide file tree
Showing 8 changed files with 494 additions and 16 deletions.
39 changes: 39 additions & 0 deletions ReleaseNotes/12_28_2022.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Features:

- Exponential To R^1 Pareto #1 (1, 2, 3)
- Exponential To R^1 Pareto #2 (4, 5, 6)
- R^1 Exponential To Pareto Shell (9, 10)
- R^1 Exponential To Pareto Normalizer (11, 12)
- R^1 Exponential To Pareto Lambda (13, 14)
- R^1 Exponential To Pareto k (15, 16)
- R^1 Pareto Distribution Normalizer Estimation (17, 18)
- Exponential To R^1 Pareto #3 (19, 20, 21)
- R^1 Exponential To Pareto Constructor (24, 25, 26)
- R^1 Exponential To Pareto Support (27, 28)
- R^1 Exponential To Pareto Density (29, 30)
- Exponential To R^1 Pareto #4 (31, 32, 33)
- R^1 Exponential To Pareto Cumulative (34, 35, 36)
- R^1 Exponential To Pareto Mean #1 (37, 38, 39)
- R^1 Exponential To Pareto Mean #2 (40, 41, 42)
- R^1 Exponential To Pareto Variance #1 (43, 44, 45)
- R^1 Exponential To Pareto Variance #2 (46, 47, 48)
- R^1 Pareto Distribution Run Sweep (52, 53)


Bug Fixes/Re-organization:

- R^1 Gamma To Maxwell Boltzmann Squared (7)
- R^1 Gamma To Exponential (8)
- Trim Pareto Distribution Normalizer (22, 23)
- Rename To R^1 Pareto Distribution (49, 50, 51)


Samples:

- R^1 CDF and PDF #1 (54, 55, 56)
- R^1 CDF and PDF #2 (57, 58)
- R^1 CDF and PDF #3 (59, 60)


IdeaDRIP:
234 changes: 234 additions & 0 deletions src/main/java/org/drip/measure/continuous/R1ParetoDistribution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@

package org.drip.measure.continuous;

import org.drip.numerical.common.NumberUtil;

/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/

/*!
* Copyright (C) 2023 Lakshmi Krishnamurthy
*
* This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
* asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
* analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
* equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
* numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
* graph builder/navigator, and computational support.
*
* https://lakshmidrip.github.io/DROP/
*
* DROP is composed of three modules:
*
* - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
* - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
* - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
*
* DROP Product Core implements libraries for the following:
* - Fixed Income Analytics
* - Loan Analytics
* - Transaction Cost Analytics
*
* DROP Portfolio Core implements libraries for the following:
* - Asset Allocation Analytics
* - Asset Liability Management Analytics
* - Capital Estimation Analytics
* - Exposure Analytics
* - Margin Analytics
* - XVA Analytics
*
* DROP Computational Core implements libraries for the following:
* - Algorithm Support
* - Computation Support
* - Function Analysis
* - Graph Algorithm
* - Model Validation
* - Numerical Analysis
* - Numerical Optimizer
* - Spline Builder
* - Statistical Learning
*
* Documentation for DROP is Spread Over:
*
* - Main => https://lakshmidrip.github.io/DROP/
* - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
* - GitHub => https://github.com/lakshmiDRIP/DROP
* - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
* - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
* - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
* - Release Versions => https://lakshmidrip.github.io/DROP/version.html
* - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
* - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* <i>R1ParetoDistribution</i> implements the R<sup>1</sup> Pareto Distribution. The References are:
*
* <br><br>
* <ul>
* <li>
* Devroye, L. (1986): <i>Non-Uniform Random Variate Generation</i> <b>Springer-Verlag</b> New York
* </li>
* <li>
* Exponential Distribution (2019): Exponential Distribution
* https://en.wikipedia.org/wiki/Exponential_distribution
* </li>
* <li>
* Norton, M., V. Khokhlov, and S. Uryasev (2019): Calculating CVaR and bPOE for Common Probability
* Distributions with Application to Portfolio Optimization and Density Estimation <i>Annals of
* Operations Research</i> <b>299 (1-2)</b> 1281-1315
* </li>
* <li>
* Ross, S. M. (2009): <i>Introduction to Probability and Statistics for Engineers and Scientists
* 4<sup>th</sup> Edition</i> <b>Associated Press</b> New York, NY
* </li>
* <li>
* Schmidt, D. F., and D. Makalic (2009): Universal Models for the Exponential Distribution <i>IEEE
* Transactions on Information Theory</i> <b>55 (7)</b> 3087-3090
* </li>
* </ul>
*
* <br><br>
* <ul>
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalAnalysisLibrary.md">Numerical Analysis Library</a></li>
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/measure/README.md">R<sup>d</sup> Continuous/Discrete Probability Measures</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/measure/exponential/README.md">R<sup>1</sup> Exponential Distribution Implementation/Properties</a></li>
* </ul>
*
* @author Lakshmi Krishnamurthy
*/

public class R1ParetoDistribution
extends R1Univariate
{
private double _k = Double.NaN;
private double _lambda = Double.NaN;

/**
* R1ParetoDistribution Constructor
*
* @param lambda Rate Parameter
* @param k K Parameter
*
* @throws Exception Thrown if the Inputs are invalid
*/

public R1ParetoDistribution (
final double lambda,
final double k)
throws Exception
{
if (!NumberUtil.IsValid (
_lambda = lambda
) || 0. >= _lambda || !NumberUtil.IsValid (
_k = k
) || 0. >= _k
)
{
throw new Exception (
"R1ParetoDistribution Constructor => Invalid Inputs"
);
}
}

/**
* Retrieve k
*
* @return k
*/
public double k()
{
return _k;
}

/**
* Retrieve Lambda
*
* @return Lambda
*/

public double lambda()
{
return _lambda;
}

@Override public double[] support()
{
return new double[]
{
_k,
Double.POSITIVE_INFINITY
};
}

@Override public double density (
final double t)
throws Exception
{
if (!supported (
t
))
{
throw new Exception (
"R1ParetoDistribution::density => Variate not in Range"
);
}

return _lambda * Math.pow (
_k,
_lambda
) * Math.pow (
t,
-1. - _lambda
);
}

@Override public double cumulative (
final double t)
throws Exception
{
if (!supported (
t
))
{
throw new Exception (
"R1ParetoDistribution::cumulative => Variate not in Range"
);
}

return 1. - Math.pow (
_k / t,
_lambda
);
}

@Override public double mean()
throws Exception
{
return _lambda * _k / (1. >= _lambda ? 1. - _lambda : _lambda - 1.);
}

@Override public double variance()
throws Exception
{
double mean = mean();

return _lambda * _k * _k / (2. >= _lambda ? 2. - _lambda : _lambda - 2.) - mean * mean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public R1RateDistribution (
final double lambda)
throws Exception
{
if (!NumberUtil.IsValid (_lambda = lambda) || 0. > _lambda)
if (!NumberUtil.IsValid (_lambda = lambda) || 0. >= _lambda)
{
throw new Exception ("R1RateDistribution Constructor => Invalid lambda");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/

/**
* <i>GammaToR1Exponential</i> implements the R<sup>1</sup> Exponential Distribution in Terms of the
* <i>R1GammaToExponential</i> implements the R<sup>1</sup> Exponential Distribution in Terms of the
* R<sup>1</sup> Gamma Distribution. The References are:
*
* <br><br>
Expand Down Expand Up @@ -119,12 +119,12 @@
* @author Lakshmi Krishnamurthy
*/

public class GammaToR1Exponential
public class R1GammaToExponential
extends R1ShapeScaleDistribution
{

/**
* GammaToR1Exponential Constructor
* R1GammaToExponential Constructor
*
* @param scaleParameter Scale Parameter
* @param gammaEstimator Gamma Estimator
Expand All @@ -134,7 +134,7 @@ public class GammaToR1Exponential
* @throws Exception Thrown if the Inputs are Invalid
*/

public GammaToR1Exponential (
public R1GammaToExponential (
final double scaleParameter,
final R1ToR1 gammaEstimator,
final R1ToR1 digammaEstimator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/

/**
* <i>GammaToMaxwellBoltzmannSquared</i> implements the Maxwell-Boltzmann Squared Distribution using the
* <i>R1GammaToMaxwellBoltzmannSquared</i> implements the Maxwell-Boltzmann Squared Distribution using the
* R<sup>1</sup> Gamma Distribution. The References are:
*
* <br><br>
Expand Down Expand Up @@ -119,13 +119,13 @@
* @author Lakshmi Krishnamurthy
*/

public class GammaToMaxwellBoltzmannSquared
public class R1GammaToMaxwellBoltzmannSquared
extends R1ShapeScaleDistribution
{
private double _a = Double.NaN;

/**
* GammaToMaxwellBoltzmannSquared Constructor
* R1GammaToMaxwellBoltzmannSquared Constructor
*
* @param a "A" Parameter
* @param gammaEstimator Gamma Estimator
Expand All @@ -135,7 +135,7 @@ public class GammaToMaxwellBoltzmannSquared
* @throws java.lang.Exception Thrown if the Inputs are Invalid
*/

public GammaToMaxwellBoltzmannSquared (
public R1GammaToMaxwellBoltzmannSquared (
final double a,
final R1ToR1 gammaEstimator,
final R1ToR1 digammaEstimator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import org.drip.function.definition.R1ToR1;
import org.drip.function.definition.R2ToR1;
import org.drip.measure.transform.GammaToMaxwellBoltzmannSquared;
import org.drip.measure.transform.R1GammaToMaxwellBoltzmannSquared;
import org.drip.service.common.FormatUtil;
import org.drip.service.env.EnvManager;
import org.drip.specialfunction.digamma.CumulativeSeriesEstimator;
Expand Down Expand Up @@ -239,8 +239,8 @@ public static final void main (

for (double a : aArray)
{
GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new GammaToMaxwellBoltzmannSquared (
R1GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new R1GammaToMaxwellBoltzmannSquared (
a,
gammaEstimator,
digammaEstimator,
Expand Down Expand Up @@ -281,8 +281,8 @@ public static final void main (

for (double a : aArray)
{
GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new GammaToMaxwellBoltzmannSquared (
R1GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new R1GammaToMaxwellBoltzmannSquared (
a,
gammaEstimator,
digammaEstimator,
Expand Down Expand Up @@ -321,8 +321,8 @@ public static final void main (

for (double a : aArray)
{
GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new GammaToMaxwellBoltzmannSquared (
R1GammaToMaxwellBoltzmannSquared maxwellBoltzmannSquaredDistribution =
new R1GammaToMaxwellBoltzmannSquared (
a,
gammaEstimator,
digammaEstimator,
Expand Down
Loading

0 comments on commit 0d60ad3

Please sign in to comment.