public interface RandomVariableInterface extends Serializable
value.mult(argument);
to value = value.mult(argument);
RandomVariableAccumulatorInterface
.
Modifier and Type | Method and Description |
---|---|
RandomVariableInterface |
abs()
Applies x → Math.abs(x), i.e. x → |x| to this random variable.
|
RandomVariableInterface |
accrue(RandomVariableInterface rate,
double periodLength)
Applies x → x * (1.0 + rate * periodLength) to this random variable.
|
RandomVariableInterface |
add(double value)
Applies x → x + value to this random variable.
|
RandomVariableInterface |
add(RandomVariableInterface randomVariable)
Applies x → x+randomVariable to this random variable.
|
RandomVariableInterface |
addProduct(RandomVariableInterface factor1,
double factor2)
Applies x → x + factor1 * factor2
|
RandomVariableInterface |
addProduct(RandomVariableInterface factor1,
RandomVariableInterface factor2)
Applies x → x + factor1 * factor2
|
RandomVariableInterface |
addRatio(RandomVariableInterface numerator,
RandomVariableInterface denominator)
Applies x → x + numerator / denominator
|
RandomVariableInterface |
apply(java.util.function.DoubleBinaryOperator operator,
RandomVariableInterface argument)
Applies x → operator(x,y) to this random variable, where x is this random variable and y is a given random variable.
|
RandomVariableInterface |
apply(DoubleTernaryOperator operator,
RandomVariableInterface argument1,
RandomVariableInterface argument2)
Applies x → operator(x,y,z) to this random variable, where x is this random variable and y and z are given random variable.
|
RandomVariableInterface |
apply(java.util.function.DoubleUnaryOperator operator)
Applies x → operator(x) to this random variable.
|
RandomVariableInterface |
barrier(RandomVariableInterface trigger,
RandomVariableInterface valueIfTriggerNonNegative,
double valueIfTriggerNegative)
Applies x → (trigger ≥ 0 ?
|
RandomVariableInterface |
barrier(RandomVariableInterface trigger,
RandomVariableInterface valueIfTriggerNonNegative,
RandomVariableInterface valueIfTriggerNegative)
Applies x → (trigger ≥ 0 ?
|
RandomVariableInterface |
cache()
Return a cacheable version of this object (often a self-reference).
|
default RandomVariableInterface |
cap(double cap)
Applies x → min(x,cap) to this random variable.
|
RandomVariableInterface |
cap(RandomVariableInterface cap)
Applies x → min(x,cap) to this random variable.
|
RandomVariableInterface |
cos()
Applies x → cos(x) to this random variable.
|
RandomVariableInterface |
discount(RandomVariableInterface rate,
double periodLength)
Applies x → x / (1.0 + rate * periodLength) to this random variable.
|
RandomVariableInterface |
div(double value)
Applies x → x / value to this random variable.
|
RandomVariableInterface |
div(RandomVariableInterface randomVariable)
Applies x → x/randomVariable to this random variable.
|
boolean |
equals(RandomVariableInterface randomVariable)
Compare this random variable with a given one
|
RandomVariableInterface |
exp()
Applies x → exp(x) to this random variable.
|
RandomVariableInterface |
floor(double floor)
Applies x → max(x,floor) to this random variable.
|
RandomVariableInterface |
floor(RandomVariableInterface floor)
Applies x → max(x,floor) to this random variable.
|
double |
get(int pathOrState)
Evaluate at a given path or state.
|
double |
getAverage()
Returns the expectation of this random variable.
|
double |
getAverage(RandomVariableInterface probabilities)
Returns the expectation of this random variable for a given probability measure (weight).
|
double |
getFiltrationTime()
Returns the filtration time.
|
double[] |
getHistogram(double[] intervalPoints)
Generates a Histogram based on the realizations stored in this random variable.
|
double[][] |
getHistogram(int numberOfPoints,
double standardDeviations)
Generates a histogram based on the realizations stored in this random variable
using interval points calculated from the arguments, see also
getHistogram(double[]) . |
double |
getMax()
Returns the maximum value attained by this random variable.
|
double |
getMin()
Returns the minimum value attained by this random variable.
|
RandomVariableInterface |
getMutableCopy()
Deprecated.
|
java.util.function.IntToDoubleFunction |
getOperator()
Returns the operator path → this.get(path) corresponding to this random variable.
|
double |
getQuantile(double quantile)
Returns the quantile value for this given random variable, i.e., the value x such that P(this < x) = quantile,
where P denotes the probability measure.
|
double |
getQuantile(double quantile,
RandomVariableInterface probabilities)
Returns the quantile value for this given random variable, i.e., the value x such that P(this < x) = quantile,
where P denotes the probability measure.
|
double |
getQuantileExpectation(double quantileStart,
double quantileEnd)
Returns the expectation over a quantile for this given random variable.
|
double[] |
getRealizations()
Returns a vector representing the realization of this random variable.
|
double[] |
getRealizations(int numberOfPaths)
Deprecated.
The method is intended for diagnostic purposes, deprecated because it makes to strong assumptions on the internal representation.
|
java.util.stream.DoubleStream |
getRealizationsStream()
Returns a stream of doubles corresponding to the realizations of this random variable.
|
double |
getSampleVariance()
Returns the sample variance of this random variable, i.e.,
V * size()/(size()-1) where V = getVariance().
|
double |
getStandardDeviation()
Returns the standard deviation of this random variable, i.e.,
sqrt(V) where V = ((X-m)^2).getAverage() and X = this and m = X.getAverage().
|
double |
getStandardDeviation(RandomVariableInterface probabilities)
Returns the standard deviation of this random variable, i.e.,
sqrt(V) where V = ((X-m)^2).getAverage(probabilities) and X = this and m = X.getAverage(probabilities).
|
double |
getStandardError()
Returns the standard error (discretization error) of this random variable.
|
double |
getStandardError(RandomVariableInterface probabilities)
Returns the standard error (discretization error) of this random variable.
|
double |
getVariance()
Returns the variance of this random variable, i.e.,
V where V = ((X-m)^2).getAverage() and X = this and m = X.getAverage().
|
double |
getVariance(RandomVariableInterface probabilities)
Returns the variance of this random variable, i.e.,
V where V = ((X-m)^2).getAverage(probabilities) and X = this and m = X.getAverage(probabilities).
|
RandomVariableInterface |
invert()
Applies x → 1/x to this random variable.
|
boolean |
isDeterministic()
Check if this random variable is deterministic in the sense that it is represented by a single double value.
|
RandomVariableInterface |
isNaN()
Applies x → (Double.isNaN(x) ?
|
RandomVariableInterface |
log()
Applies x → log(x) to this random variable.
|
RandomVariableInterface |
mult(double value)
Applies x → x * value to this random variable.
|
RandomVariableInterface |
mult(RandomVariableInterface randomVariable)
Applies x → x*randomVariable to this random variable.
|
RandomVariableInterface |
pow(double exponent)
Applies x → pow(x,exponent) to this random variable.
|
RandomVariableInterface |
sin()
Applies x → sin(x) to this random variable.
|
int |
size()
Returns the number of paths or states.
|
RandomVariableInterface |
sqrt()
Applies x → sqrt(x) to this random variable.
|
RandomVariableInterface |
squared()
Applies x → x * x to this random variable.
|
RandomVariableInterface |
sub(double value)
Applies x → x - value to this random variable.
|
RandomVariableInterface |
sub(RandomVariableInterface randomVariable)
Applies x → x-randomVariable to this random variable.
|
RandomVariableInterface |
subRatio(RandomVariableInterface numerator,
RandomVariableInterface denominator)
Applies x → x - numerator / denominator
|
boolean equals(RandomVariableInterface randomVariable)
randomVariable
- Random variable to compare with.double getFiltrationTime()
double get(int pathOrState)
pathOrState
- Index of the path or state.int size()
boolean isDeterministic()
double[] getRealizations()
double[] getRealizations(int numberOfPaths)
numberOfPaths
- The number of paths.java.util.function.IntToDoubleFunction getOperator()
java.util.stream.DoubleStream getRealizationsStream()
double getMin()
double getMax()
double getAverage()
double getAverage(RandomVariableInterface probabilities)
this.mult(probabilities).getAverage() / probabilities.getAverage()
probabilities
- The probability weights.double getVariance()
double getVariance(RandomVariableInterface probabilities)
probabilities
- The probability weights.double getSampleVariance()
double getStandardDeviation()
double getStandardDeviation(RandomVariableInterface probabilities)
probabilities
- The probability weights.double getStandardError()
getStandardDeviation()
.double getStandardError(RandomVariableInterface probabilities)
getStandardDeviation(RandomVariableInterface)
.probabilities
- The probability weights.double getQuantile(double quantile)
quantile
- The quantile level.double getQuantile(double quantile, RandomVariableInterface probabilities)
quantile
- The quantile level.probabilities
- The probability weights.double getQuantileExpectation(double quantileStart, double quantileEnd)
quantileStart
- Lower bound of the integral.quantileEnd
- Upper bound of the integral.double[] getHistogram(double[] intervalPoints)
result
array's length is intervalPoints.length+1
.
possibleValues
, then result = getHistogram(possibleValues)
returns an
array where result[i]
is the relative frequency of occurrence of possibleValues[i]
.
The sum of result[i] over all i is equal to 1, except for uninitialized random
variables where all values are 0.intervalPoints
- Array of ascending values defining the interval boundaries.double[][] getHistogram(int numberOfPoints, double standardDeviations)
getHistogram(double[])
.
The interval points are
set with equal distance over an the interval of the specified standard deviation.
The interval points used are
x[i] = mean + alpha[i] * standardDeviations * sigma
getAverage()
,getStandardDeviation()
.result
is an array of two vectors, where result[0] are the
intervals center points ('anchor points') and result[1] contains the relative frequency for the interval.
The 'anchor point' for the interval (-infinity, x[0]) is x[0] - 1/2 (x[1]-x[0])
and the 'anchor point' for the interval (x[n], infinity) is x[n] + 1/2 (x[n]-x[n-1]).
Here n = numberOfPoints is the number of interval points.numberOfPoints
- The number of interval points.standardDeviations
- The number of standard deviations defining the discretization radius.getHistogram(double[])
for the given the interval points. The length of result[0] and result[1] is numberOfPoints+1.RandomVariableInterface cache()
RandomVariableInterface apply(java.util.function.DoubleUnaryOperator operator)
operator
- An unary operator/function, mapping double to double.RandomVariableInterface apply(java.util.function.DoubleBinaryOperator operator, RandomVariableInterface argument)
operator
- A binary operator/function, mapping (double,double) to double.argument
- A random variable.RandomVariableInterface apply(DoubleTernaryOperator operator, RandomVariableInterface argument1, RandomVariableInterface argument2)
operator
- A ternary operator/function, mapping (double,double,double) to double.argument1
- A random variable representing y.argument2
- A random variable representing z.default RandomVariableInterface cap(double cap)
cap
- The cap.RandomVariableInterface floor(double floor)
floor
- The floor.RandomVariableInterface add(double value)
value
- The value to add.RandomVariableInterface sub(double value)
value
- The value to subtract.RandomVariableInterface mult(double value)
value
- The value to multiply.RandomVariableInterface div(double value)
value
- The value to divide.RandomVariableInterface pow(double exponent)
exponent
- The exponent.RandomVariableInterface squared()
RandomVariableInterface sqrt()
RandomVariableInterface exp()
RandomVariableInterface log()
RandomVariableInterface sin()
RandomVariableInterface cos()
RandomVariableInterface add(RandomVariableInterface randomVariable)
randomVariable
- A random variable (compatible with this random variable).RandomVariableInterface sub(RandomVariableInterface randomVariable)
randomVariable
- A random variable (compatible with this random variable).RandomVariableInterface mult(RandomVariableInterface randomVariable)
randomVariable
- A random variable (compatible with this random variable).RandomVariableInterface div(RandomVariableInterface randomVariable)
randomVariable
- A random variable (compatible with this random variable).RandomVariableInterface cap(RandomVariableInterface cap)
cap
- The cap. A random variable (compatible with this random variable).RandomVariableInterface floor(RandomVariableInterface floor)
floor
- The floor. A random variable (compatible with this random variable).RandomVariableInterface accrue(RandomVariableInterface rate, double periodLength)
rate
- The accruing rate. A random variable (compatible with this random variable).periodLength
- The period lengthRandomVariableInterface discount(RandomVariableInterface rate, double periodLength)
rate
- The discounting rate. A random variable (compatible with this random variable).periodLength
- The period lengthRandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, RandomVariableInterface valueIfTriggerNegative)
trigger
- The trigger. A random variable (compatible with this random variable).valueIfTriggerNonNegative
- The value used if the trigger is greater or equal 0valueIfTriggerNegative
- The value used if the trigger is less than 0RandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, double valueIfTriggerNegative)
trigger
- The trigger. A random variable (compatible with this random variable).valueIfTriggerNonNegative
- The value used if the trigger is greater or equal 0valueIfTriggerNegative
- The value used if the trigger is less than 0RandomVariableInterface invert()
RandomVariableInterface abs()
RandomVariableInterface addProduct(RandomVariableInterface factor1, double factor2)
factor1
- The factor 1. A random variable (compatible with this random variable).factor2
- The factor 2.RandomVariableInterface addProduct(RandomVariableInterface factor1, RandomVariableInterface factor2)
factor1
- The factor 1. A random variable (compatible with this random variable).factor2
- The factor 2. A random variable (compatible with this random variable).RandomVariableInterface addRatio(RandomVariableInterface numerator, RandomVariableInterface denominator)
numerator
- The numerator of the ratio to add. A random variable (compatible with this random variable).denominator
- The denominator of the ratio to add. A random variable (compatible with this random variable).RandomVariableInterface subRatio(RandomVariableInterface numerator, RandomVariableInterface denominator)
numerator
- The numerator of the ratio to sub. A random variable (compatible with this random variable).denominator
- The denominator of the ratio to sub. A random variable (compatible with this random variable).RandomVariableInterface isNaN()
@Deprecated RandomVariableInterface getMutableCopy()
Copyright © 2016. All rights reserved.