public final class ExponentiallyWeightedInterpolationQuantileMethod extends QuantileCalculationMethod
Reference: "Value-at-risk", OpenGamma Documentation 31, Version 0.2, January 2016. Section A.4.
| Constructor and Description |
|---|
ExponentiallyWeightedInterpolationQuantileMethod(double lambda)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected QuantileResult |
expectedShortfall(double level,
DoubleArray sortedSample)
Computed the expected shortfall.
|
QuantileResult |
expectedShortfallDetailsFromUnsorted(double level,
DoubleArray sample)
Compute the expected shortfall and the details used in the result.
|
double |
expectedShortfallFromUnsorted(double level,
DoubleArray sample)
Compute the expected shortfall.
|
QuantileResult |
expectedShortfallResultFromUnsorted(double level,
DoubleArray sample)
Compute the expected shortfall.
|
protected QuantileResult |
quantile(double level,
DoubleArray sortedSample,
boolean isExtrapolated)
Computed the quantile.
|
QuantileResult |
quantileDetailsFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation and the details used in the result.
|
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 |
quantileWithExtrapolationFromUnsorted(double level,
DoubleArray sample)
Compute the quantile estimation.
|
double[] |
weights(int size)
Returns the weights for a given sample size.
|
checkIndex, expectedShortfallFromSorted, quantileFromSorted, quantileWithExtrapolationFromSortedpublic ExponentiallyWeightedInterpolationQuantileMethod(double lambda)
The exponential weight lambda must be > 0 and < 1.0.
lambda - the exponential weightpublic QuantileResult quantileResultFromUnsorted(double level, DoubleArray sample)
QuantileCalculationMethodThe 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.
quantileResultFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic QuantileResult quantileResultWithExtrapolationFromUnsorted(double level, DoubleArray sample)
QuantileCalculationMethodThe 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.
quantileResultWithExtrapolationFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic double quantileFromUnsorted(double level,
DoubleArray sample)
QuantileCalculationMethodThe 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.
quantileFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic double quantileWithExtrapolationFromUnsorted(double level,
DoubleArray sample)
QuantileCalculationMethodThe 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.
quantileWithExtrapolationFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic QuantileResult expectedShortfallResultFromUnsorted(double level, DoubleArray sample)
QuantileCalculationMethodThe 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 QuantileCalculationMethod.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.
expectedShortfallResultFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic double expectedShortfallFromUnsorted(double level,
DoubleArray sample)
QuantileCalculationMethodThe 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 QuantileCalculationMethod.quantileWithExtrapolationFromUnsorted(double, DoubleArray).
The sample observations are supposed to be unsorted, the first step is to sort the data.
expectedShortfallFromUnsorted in class QuantileCalculationMethodlevel - the quantile levelsample - the sample observationspublic QuantileResult quantileDetailsFromUnsorted(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.
The details consists on the indices of the samples actually used in the quantile computation - indices in the input sample - and the weights for each of those samples. The details are sufficient to recompute the quantile directly from the input sample.
The sample observations are supposed to be unsorted, the first step is to sort the data.
level - the quantile levelsample - the sample observationspublic QuantileResult expectedShortfallDetailsFromUnsorted(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 details consists on the indices of the samples actually used in the expected shortfall computation - indices in the input sample - and the weights for each of those samples. The details are sufficient to recompute the expected shortfall directly from the input sample.
The sample observations are supposed to be unsorted, the first step is to sort the data.
level - the quantile levelsample - the sample observationsprotected QuantileResult quantile(double level, DoubleArray sortedSample, boolean isExtrapolated)
QuantileCalculationMethodThis protected method should be implemented in subclasses.
quantile in class QuantileCalculationMethodlevel - the quantile levelsortedSample - the sample observationsisExtrapolated - extrapolated if true, not extrapolated otherwise.protected QuantileResult expectedShortfall(double level, DoubleArray sortedSample)
QuantileCalculationMethod
This protected method should be implemented in subclasses
and coherent to QuantileCalculationMethod.quantile(double, DoubleArray, boolean).
expectedShortfall in class QuantileCalculationMethodlevel - the quantile levelsortedSample - the sample observationspublic double[] weights(int size)
size - the sample sizeCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.