-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Composite R^1 Exponential Distribution Shell (1, 2) - Minimum Among Exponential Distribution #1 (3, 4) - Minimum Among Exponential Distribution #2 (5, 6, 7) - Composite R^1 Exponential Distribution Constructor (8, 9, 10) - Minimum of Realized Exponential Distributions (11, 12) - Composite R^1 Rate Distribution Shell (15, 16) - Realized R^1 Rate Distribution Standard (17, 18, 19) - Realized R^1 Rate Distribution Constructor (20, 21, 22) - R^1 Exponential Rate Distribution Array (23, 24, 25) - Probability of Index as Minimum (26, 27, 28) - Composite R^1 Order Statistics Shell (29, 30) - Exponential IID Joint Moment #1 (31, 32, 33) - Exponential IID Joint Moment #2 (34, 35, 36) - Exponential IID Joint Moment #3 (37, 38, 39) - Exponential IID Joint Moment #4 (40, 41, 42) - Two IID Exponential Sum Shell (43, 44) - Smaller R^1 Exponential Rate Distribution (45, 46) - Larger R^1 Exponential Rate Distribution (47, 48) - Two IID Exponential Sum Constructor (49, 50, 51) - Two IID Exponential Sum Support (52) - Two IID Exponential Sum Density (53, 54, 55) - Two IID Sum Quadrature Count (56, 57) - Two IID Exponential Sum Mean (58, 59, 60) Bug Fixes/Re-organization: - Composite R^1 To Minima Realization (13, 14) Samples: IdeaDRIP:
- Loading branch information
Showing
6 changed files
with
739 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
Features: | ||
|
||
- Composite R^1 Exponential Distribution Shell (1, 2) | ||
- Minimum Among Exponential Distribution #1 (3, 4) | ||
- Minimum Among Exponential Distribution #2 (5, 6, 7) | ||
- Composite R^1 Exponential Distribution Constructor (8, 9, 10) | ||
- Minimum of Realized Exponential Distributions (11, 12) | ||
- Composite R^1 Rate Distribution Shell (15, 16) | ||
- Realized R^1 Rate Distribution Standard (17, 18, 19) | ||
- Realized R^1 Rate Distribution Constructor (20, 21, 22) | ||
- R^1 Exponential Rate Distribution Array (23, 24, 25) | ||
- Probability of Index as Minimum (26, 27, 28) | ||
- Composite R^1 Order Statistics Shell (29, 30) | ||
- Exponential IID Joint Moment #1 (31, 32, 33) | ||
- Exponential IID Joint Moment #2 (34, 35, 36) | ||
- Exponential IID Joint Moment #3 (37, 38, 39) | ||
- Exponential IID Joint Moment #4 (40, 41, 42) | ||
- Two IID Exponential Sum Shell (43, 44) | ||
- Smaller R^1 Exponential Rate Distribution (45, 46) | ||
- Larger R^1 Exponential Rate Distribution (47, 48) | ||
- Two IID Exponential Sum Constructor (49, 50, 51) | ||
- Two IID Exponential Sum Support (52) | ||
- Two IID Exponential Sum Density (53, 54, 55) | ||
- Two IID Sum Quadrature Count (56, 57) | ||
- Two IID Exponential Sum Mean (58, 59, 60) | ||
|
||
|
||
Bug Fixes/Re-organization: | ||
|
||
- Composite R^1 To Minima Realization (13, 14) | ||
|
||
|
||
Samples: | ||
|
||
|
||
IdeaDRIP: |
Binary file not shown.
175 changes: 175 additions & 0 deletions
175
src/main/java/org/drip/measure/exponential/CompositeR1OrderStatistics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
|
||
package org.drip.measure.exponential; | ||
|
||
/* | ||
* -*- 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>CompositeR1OrderStatistics</i> generates the Order Statistics for a Composite Set of R<sup>1</sup> | ||
* Exponential Distributions. 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 CompositeR1OrderStatistics | ||
{ | ||
|
||
/** | ||
* Compute the Joint Moment of a Set of i.i.d. Distributions | ||
* | ||
* @param r1RateDistribution R<sup>1</sup> Exponential Distribution | ||
* @param variateCount Variate Count | ||
* @param index1 First Index | ||
* @param index2 Second Index | ||
* | ||
* @return Joint Moment of a Set of i.i.d. Distributions | ||
* | ||
* @throws Exception Thrown if the Inputs are Invalid | ||
*/ | ||
|
||
public static final double IIDJointMoment ( | ||
final R1RateDistribution r1RateDistribution, | ||
final int variateCount, | ||
final int index1, | ||
final int index2) | ||
throws Exception | ||
{ | ||
if (null == r1RateDistribution || | ||
0 > index1 || index1 >= variateCount || | ||
0 > index2 || index2 >= variateCount || index1 == index2 | ||
) | ||
{ | ||
throw new Exception ( | ||
"CompositeR1OrderStatistics::IIDJointMoment => Invalid Inputs" | ||
); | ||
} | ||
|
||
double expectationMaxIndex = 0.; | ||
double expectationMinIndex = 0.; | ||
double expectationMinIndexSquared = 0.; | ||
int maxIndex = index1 > index2 ? index1 : index2; | ||
int minIndex = index1 < index2 ? index1 : index2; | ||
|
||
double inverseRate = 1. / r1RateDistribution.rate(); | ||
|
||
for (int k = 0; | ||
k < minIndex; | ||
++k) | ||
{ | ||
double expectation = inverseRate / (variateCount - k); | ||
expectationMinIndexSquared += expectation * expectation; | ||
expectationMinIndex += expectation; | ||
} | ||
|
||
for (int k = 0; | ||
k < maxIndex; | ||
++k) | ||
{ | ||
expectationMaxIndex += inverseRate / (variateCount - k); | ||
} | ||
|
||
return expectationMinIndex * expectationMaxIndex + expectationMinIndexSquared + | ||
expectationMinIndex * expectationMinIndex; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.