public abstract class QuantileCalculationMethod extends Object
| Constructor and Description |
|---|
QuantileCalculationMethod() |
| Modifier and Type | Method and Description |
|---|---|
protected double |
checkIndex(double index,
int size,
boolean isExtrapolated)
Check the index is within the sample data range.
|
protected abstract QuantileResult |
expectedShortfall(double level,
DoubleArray sample)
Computed the expected shortfall.
|
double |
expectedShortfallFromSorted(double level,
DoubleArray sortedSample)
Compute the expected shortfall.
|
double |
expectedShortfallFromUnsorted(double level,
DoubleArray sample)
Compute the expected shortfall.
|
QuantileResult |
expectedShortfallResultFromUnsorted(double level,
DoubleArray sample)
Compute the expected shortfall.
|
protected abstract QuantileResult |
quantile(double level,
DoubleArray sample,
boolean isExtrapolated)
Computed the quantile.
|
double |
quantileFromSorted(double level,
DoubleArray sortedSample)
Compute the quantile estimation.
|
double |
quantileFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation.
|
QuantileResult |
quantileResultFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation.
|
QuantileResult |
quantileResultWithExtrapolationFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation.
|
double |
quantileWithExtrapolationFromSorted(double level,
DoubleArray sortedSample)
Compute the quantile estimation.
|
double |
quantileWithExtrapolationFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation.
|
public QuantileResult quantileResultFromUnsorted(double level, DoubleArray sample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, the quantile estimation with the level 99% corresponds to the smallest 99% observations and 1% of the observation are above that level.
If index value computed from the level is outside of the sample data range,
IllegalArgumentException is thrown.
The sample observations are supposed to be unsorted.
The quantile result produced contains the quantile value, the indices of the data points used to compute it as well as the weights assigned to each point in the computation. The indices are based on the original, unsorted array. Additionally, the indices start from 0 and so do not need to be shifted to account for java indexing, when using them to reference the data points in the quantile calculation.
level - the quantile levelsample - the sample observationspublic QuantileResult quantileResultWithExtrapolationFromUnsorted(double level, DoubleArray sample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, the quantile estimation with the level 99% corresponds to the smallest 99% observations and 1% of the observation are above that level.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e., quantile is computed with flat extrapolation.
The sample observations are supposed to be unsorted.
The quantile result produced contains the quantile value, the indices of the data points used to compute it as well as the weights assigned to each point in the computation. The indices are based on the original, unsorted array. Additionally, the indices start from 0 and so do not need to be shifted to account for java indexing, when using them to reference the data points in the quantile calculation.
level - the quantile levelsample - the sample observationspublic double quantileFromSorted(double level,
DoubleArray sortedSample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the quantile estimation with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range,
IllegalArgumentException is thrown.
The sample observations are sorted from the smallest to the largest.
level - the quantile levelsortedSample - the sample observationspublic double quantileFromUnsorted(double level,
DoubleArray sample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the quantile estimation with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range,
IllegalArgumentException is thrown.
The sample observations are supposed to be unsorted, the first step is to sort the data.
level - the quantile levelsample - the sample observationspublic double quantileWithExtrapolationFromSorted(double level,
DoubleArray sortedSample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the quantile estimation with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e., quantile is computed with flat extrapolation.
The sample observations are sorted from the smallest to the largest.
level - the quantile levelsortedSample - the sample observationspublic double quantileWithExtrapolationFromUnsorted(double level,
DoubleArray sample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the quantile estimation with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e., quantile is computed with flat extrapolation.
The sample observations are supposed to be unsorted, the first step is to sort the data.
level - the quantile levelsample - the sample observationspublic QuantileResult expectedShortfallResultFromUnsorted(double level, DoubleArray sample)
The shortfall level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, the expected shortfall with the level 99% corresponds to the average of the smallest 99% of the observations.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e.,
expected short fall is computed with flat extrapolation.
Thus this is coherent to quantileWithExtrapolationFromUnsorted(double, DoubleArray).
The sample observations are supposed to be unsorted.
The quantile result produced contains the expected shortfall value, the indices of the data points used to compute it as well as the weights assigned to each point in the computation. The indices are based on the original, unsorted array. Additionally, the indices start from 0 and so do not need to be shifted to account for java indexing, when using them to reference the data points in the quantile calculation.
level - the quantile levelsample - the sample observationspublic double expectedShortfallFromSorted(double level,
DoubleArray sortedSample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the expected shortfall with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e.,
expected short fall is computed with flat extrapolation.
Thus this is coherent to quantileWithExtrapolationFromSorted(double, DoubleArray).
The sample observations are sorted from the smallest to the largest.
level - the quantile levelsortedSample - the sample observationspublic double expectedShortfallFromUnsorted(double level,
DoubleArray sample)
The quantile level is in decimal, i.e. 99% = 0.99 and 0 < level < 1 should be satisfied. This is measured from the bottom, that is, Thus the expected shortfall with the level 99% corresponds to the smallest 99% observations.
If index value computed from the level is outside of the sample data range, the nearest data point is used, i.e.,
expected short fall is computed with flat extrapolation.
Thus this is coherent to quantileWithExtrapolationFromUnsorted(double, DoubleArray).
The sample observations are supposed to be unsorted, the first step is to sort the data.
level - the quantile levelsample - the sample observationsprotected abstract QuantileResult quantile(double level, DoubleArray sample, boolean isExtrapolated)
This protected method should be implemented in subclasses.
level - the quantile levelsample - the sample observationsisExtrapolated - extrapolated if true, not extrapolated otherwise.protected abstract QuantileResult expectedShortfall(double level, DoubleArray sample)
This protected method should be implemented in subclasses
and coherent to quantile(double, DoubleArray, boolean).
level - the quantile levelsample - the sample observationsprotected double checkIndex(double index,
int size,
boolean isExtrapolated)
If the index is outside the data range, the nearest data point is used in case of isExtrapolated == true or
an exception is thrown in case of isExtrapolated == false.
index - the indexsize - the sample sizeisExtrapolated - extrapolated if true, not extrapolated otherwiseCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.