Interface IEmpiricalStatistics
A statistics accumulator that keeps its samples, so that it gives the empirical distribution's percentiles and
conditional expectations: what QuantLib's empirical risk measures, GenericRiskStatistics<S>, read of
GeneralStatistics.
public interface IEmpiricalStatistics : IStatistics, ISummaryStatistics
- Inherited Members
- Extension Methods
Properties
Data
Gets the collected samples, each with its weight: a view of the accumulator's own storage, valid until it next changes, sorted only after a call that sorts it (Percentile(double), TopPercentile(double)).
ReadOnlySpan<(double Value, double Weight)> Data { get; }
Property Value
Methods
ExpectationValue(Func<double, double>)
The expectation of a function over every sample.
(double? Value, int Samples) ExpectationValue(Func<double, double> f)
Parameters
Returns
- (double? Value, int Samples)
The expectation, null where there's no sample, and the number of samples.
ExpectationValue(Func<double, double>, Func<double, bool>)
The expectation of a function over the samples in a range, E[f | R] = Σ_{xᵢ ∈ R} f(xᵢ)wᵢ / Σ_{xᵢ ∈ R} wᵢ, with the number of samples in the range.
(double? Value, int Samples) ExpectationValue(Func<double, double> f, Func<double, bool> inRange)
Parameters
fFunc<double, double>The function.
inRangeFunc<double, bool>Whether a sample belongs to the range.
Returns
- (double? Value, int Samples)
The expectation, null where no sample is in the range, and the number of samples.
Percentile(double)
The y-th percentile: the value x̄ such that y = Σ_{xᵢ < x̄} wᵢ / Σᵢ wᵢ.
double Percentile(double y)
Parameters
ydoubleThe percentile, in (0, 1].
Returns
- double
The percentile.
TopPercentile(double)
The y-th top percentile: the value x̄ such that y = Σ_{xᵢ > x̄} wᵢ / Σᵢ wᵢ.
double TopPercentile(double y)
Parameters
ydoubleThe percentile, in (0, 1].
Returns
- double
The top percentile.