public class RandomVariableMutableClone extends Object implements RandomVariableInterface
RandomVariableInterface
)
and implements the interface of an mutable class (here RandomVariableInterface
).
If a method is called which mutates the object (a mutator), a defensive copy is performed once.
The reference to the immutable class is then replaced by the reference to the defensive copy.
By returning an RandomVariableMutableClone
of an
RandomVariableInterface
defensive copies are made only when necessary.
This class is not thread safe (classes implementing RandomVariableInterface
are not expected to be thread safe).Constructor and Description |
---|
RandomVariableMutableClone(RandomVariableInterface randomVariable)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
RandomVariableInterface |
abs()
Deprecated.
Applies x → Math.abs(x), i.e. x → |x| to this random variable.
|
RandomVariableInterface |
accrue(RandomVariableInterface rate,
double periodLength)
Deprecated.
Applies x → x * (1.0 + rate * periodLength) to this random variable.
|
RandomVariableInterface |
add(double value)
Deprecated.
Applies x → x + value to this random variable.
|
RandomVariableInterface |
add(RandomVariableInterface randomVariable)
Deprecated.
Applies x → x+randomVariable to this random variable.
|
RandomVariableInterface |
addProduct(RandomVariableInterface factor1,
double factor2)
Deprecated.
Applies x → x + factor1 * factor2
|
RandomVariableInterface |
addProduct(RandomVariableInterface factor1,
RandomVariableInterface factor2)
Deprecated.
Applies x → x + factor1 * factor2
|
RandomVariableInterface |
addRatio(RandomVariableInterface numerator,
RandomVariableInterface denominator)
Deprecated.
Applies x → x + numerator / denominator
|
RandomVariableInterface |
apply(UnivariateFunction function)
Deprecated.
Applies x → function.value(x) to this random variable.
|
RandomVariableInterface |
barrier(RandomVariableInterface trigger,
RandomVariableInterface valueIfTriggerNonNegative,
double valueIfTriggerNegative)
Deprecated.
Applies x → (trigger ≥ 0 ?
|
RandomVariableInterface |
barrier(RandomVariableInterface trigger,
RandomVariableInterface valueIfTriggerNonNegative,
RandomVariableInterface valueIfTriggerNegative)
Deprecated.
Applies x → (trigger ≥ 0 ?
|
RandomVariableInterface |
cache()
Deprecated.
Return a cacheable version of this object (often a self-reference).
|
RandomVariableInterface |
cap(double cap)
Deprecated.
Applies x → min(x,cap) to this random variable.
|
RandomVariableInterface |
cap(RandomVariableInterface cap)
Deprecated.
Applies x → min(x,cap) to this random variable.
|
RandomVariableInterface |
cos()
Deprecated.
Applies x → cos(x) to this random variable.
|
RandomVariableInterface |
discount(RandomVariableInterface rate,
double periodLength)
Deprecated.
Applies x → x / (1.0 + rate * periodLength) to this random variable.
|
RandomVariableInterface |
div(double value)
Deprecated.
Applies x → x / value to this random variable.
|
RandomVariableInterface |
div(RandomVariableInterface randomVariable)
Deprecated.
Applies x → x/randomVariable to this random variable.
|
boolean |
equals(RandomVariableInterface randomVariable)
Deprecated.
Compare this random variable with a given one
|
RandomVariableInterface |
exp()
Deprecated.
Applies x → exp(x) to this random variable.
|
RandomVariableInterface |
floor(double floor)
Deprecated.
Applies x → max(x,floor) to this random variable.
|
RandomVariableInterface |
floor(RandomVariableInterface floor)
Deprecated.
Applies x → max(x,floor) to this random variable.
|
double |
get(int pathOrState)
Deprecated.
Evaluate at a given path or state.
|
double |
getAverage()
Deprecated.
Returns the expectation of this random variable.
|
double |
getAverage(RandomVariableInterface probabilities)
Deprecated.
Returns the expectation of this random variable for a given probability measure (weight).
|
double |
getFiltrationTime()
Deprecated.
Returns the filtration time.
|
double[] |
getHistogram(double[] intervalPoints)
Deprecated.
Generates a Histogram based on the realizations stored in this random variable.
|
double[][] |
getHistogram(int numberOfPoints,
double standardDeviations)
Deprecated.
Generates a histogram based on the realizations stored in this random variable
using interval points calculated from the arguments, see also
RandomVariableInterface.getHistogram(double[]) . |
double |
getMax()
Deprecated.
Returns the maximum value attained by this random variable.
|
double |
getMin()
Deprecated.
Returns the minimum value attained by this random variable.
|
RandomVariableInterface |
getMutableCopy()
Deprecated.
|
double |
getQuantile(double quantile)
Deprecated.
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)
Deprecated.
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)
Deprecated.
Returns the expectation over a quantile for this given random variable.
|
double[] |
getRealizations()
Deprecated.
Returns a vector representing the realization of this random variable.
|
double[] |
getRealizations(int numberOfPaths)
Deprecated.
Returns the realizations as double array.
|
double |
getStandardDeviation()
Deprecated.
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)
Deprecated.
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()
Deprecated.
Returns the standard error (discretization error) of this random variable.
|
double |
getStandardError(RandomVariableInterface probabilities)
Deprecated.
Returns the standard error (discretization error) of this random variable.
|
double |
getVariance()
Deprecated.
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)
Deprecated.
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()
Deprecated.
Applies x → 1/x to this random variable.
|
boolean |
isDeterministic()
Deprecated.
Check if this random variable is deterministic in the sense that it is represented by a single double value.
|
RandomVariableInterface |
isNaN()
Deprecated.
Applies x → (Double.isNaN(x) ?
|
RandomVariableInterface |
log()
Deprecated.
Applies x → log(x) to this random variable.
|
RandomVariableInterface |
mult(double value)
Deprecated.
Applies x → x * value to this random variable.
|
RandomVariableInterface |
mult(RandomVariableInterface randomVariable)
Deprecated.
Applies x → x*randomVariable to this random variable.
|
RandomVariableInterface |
pow(double exponent)
Deprecated.
Applies x → pow(x,exponent) to this random variable.
|
RandomVariableInterface |
sin()
Deprecated.
Applies x → sin(x) to this random variable.
|
int |
size()
Deprecated.
Returns the number of paths or states.
|
RandomVariableInterface |
sqrt()
Deprecated.
Applies x → sqrt(x) to this random variable.
|
RandomVariableInterface |
squared()
Deprecated.
Applies x → x * x to this random variable.
|
RandomVariableInterface |
sub(double value)
Deprecated.
Applies x → x - value to this random variable.
|
RandomVariableInterface |
sub(RandomVariableInterface randomVariable)
Deprecated.
Applies x → x-randomVariable to this random variable.
|
RandomVariableInterface |
subRatio(RandomVariableInterface numerator,
RandomVariableInterface denominator)
Deprecated.
Applies x → x - numerator / denominator
|
public RandomVariableMutableClone(RandomVariableInterface randomVariable)
public RandomVariableInterface abs()
RandomVariableInterface
abs
in interface RandomVariableInterface
public RandomVariableInterface add(double value)
RandomVariableInterface
add
in interface RandomVariableInterface
value
- The value to add.public RandomVariableInterface add(RandomVariableInterface randomVariable)
RandomVariableInterface
add
in interface RandomVariableInterface
randomVariable
- A random variable (compatible with this random variable).public RandomVariableInterface addProduct(RandomVariableInterface factor1, double factor2)
RandomVariableInterface
addProduct
in interface RandomVariableInterface
factor1
- The factor 1. A random variable (compatible with this random variable).factor2
- The factor 2.public RandomVariableInterface addProduct(RandomVariableInterface factor1, RandomVariableInterface factor2)
RandomVariableInterface
addProduct
in interface RandomVariableInterface
factor1
- The factor 1. A random variable (compatible with this random variable).factor2
- The factor 2. A random variable (compatible with this random variable).public RandomVariableInterface accrue(RandomVariableInterface rate, double periodLength)
RandomVariableInterface
accrue
in interface RandomVariableInterface
rate
- The accruing rate. A random variable (compatible with this random variable).periodLength
- The period lengthpublic RandomVariableInterface apply(UnivariateFunction function)
RandomVariableInterface
apply
in interface RandomVariableInterface
function
- A univariate function mapping doubles to doubles.public RandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, RandomVariableInterface valueIfTriggerNegative)
RandomVariableInterface
barrier
in interface RandomVariableInterface
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 0public RandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, double valueIfTriggerNegative)
RandomVariableInterface
barrier
in interface RandomVariableInterface
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 0public RandomVariableInterface cap(double cap)
RandomVariableInterface
cap
in interface RandomVariableInterface
cap
- The cap.public RandomVariableInterface cap(RandomVariableInterface cap)
RandomVariableInterface
cap
in interface RandomVariableInterface
cap
- The cap. A random variable (compatible with this random variable).public RandomVariableInterface discount(RandomVariableInterface rate, double periodLength)
RandomVariableInterface
discount
in interface RandomVariableInterface
rate
- The discounting rate. A random variable (compatible with this random variable).periodLength
- The period lengthpublic RandomVariableInterface div(double value)
RandomVariableInterface
div
in interface RandomVariableInterface
value
- The value to divide.public RandomVariableInterface div(RandomVariableInterface randomVariable)
RandomVariableInterface
div
in interface RandomVariableInterface
randomVariable
- A random variable (compatible with this random variable).public boolean equals(RandomVariableInterface randomVariable)
RandomVariableInterface
equals
in interface RandomVariableInterface
randomVariable
- Random variable to compare with.public RandomVariableInterface exp()
RandomVariableInterface
exp
in interface RandomVariableInterface
public RandomVariableInterface floor(double floor)
RandomVariableInterface
floor
in interface RandomVariableInterface
floor
- The floor.public RandomVariableInterface floor(RandomVariableInterface floor)
RandomVariableInterface
floor
in interface RandomVariableInterface
floor
- The floor. A random variable (compatible with this random variable).public double get(int pathOrState)
RandomVariableInterface
get
in interface RandomVariableInterface
pathOrState
- Index of the path or state.public double getAverage()
RandomVariableInterface
getAverage
in interface RandomVariableInterface
public double getAverage(RandomVariableInterface probabilities)
RandomVariableInterface
this.mult(probabilities).getAverage() / probabilities.getAverage()
getAverage
in interface RandomVariableInterface
probabilities
- The probability weights.public double getQuantile(double quantile)
RandomVariableInterface
getQuantile
in interface RandomVariableInterface
quantile
- The quantile level.public double getQuantile(double quantile, RandomVariableInterface probabilities)
RandomVariableInterface
getQuantile
in interface RandomVariableInterface
quantile
- The quantile level.probabilities
- The probability weights.public double getQuantileExpectation(double quantileStart, double quantileEnd)
RandomVariableInterface
getQuantileExpectation
in interface RandomVariableInterface
quantileStart
- Lower bound of the integral.quantileEnd
- Upper bound of the integral.public double[] getHistogram(double[] intervalPoints)
RandomVariableInterface
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.getHistogram
in interface RandomVariableInterface
intervalPoints
- Array of ascending values defining the interval boundaries.public double[][] getHistogram(int numberOfPoints, double standardDeviations)
RandomVariableInterface
RandomVariableInterface.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
RandomVariableInterface.getAverage()
,RandomVariableInterface.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.getHistogram
in interface RandomVariableInterface
numberOfPoints
- The number of interval points.standardDeviations
- The number of standard deviations defining the discretization radius.RandomVariableInterface.getHistogram(double[])
for the given the interval points. The length of result[0] and result[1] is numberOfPoints+1.public double getFiltrationTime()
RandomVariableInterface
getFiltrationTime
in interface RandomVariableInterface
public double getMax()
RandomVariableInterface
getMax
in interface RandomVariableInterface
public double getMin()
RandomVariableInterface
getMin
in interface RandomVariableInterface
public RandomVariableInterface getMutableCopy()
getMutableCopy
in interface RandomVariableInterface
public double[] getRealizations()
RandomVariableInterface
getRealizations
in interface RandomVariableInterface
public double[] getRealizations(int numberOfPaths)
RandomVariableInterface
getRealizations
in interface RandomVariableInterface
numberOfPaths
- The number of paths.public double getStandardDeviation()
RandomVariableInterface
getStandardDeviation
in interface RandomVariableInterface
public double getStandardDeviation(RandomVariableInterface probabilities)
RandomVariableInterface
getStandardDeviation
in interface RandomVariableInterface
probabilities
- The probability weights.public double getStandardError()
RandomVariableInterface
RandomVariableInterface.getStandardDeviation()
.getStandardError
in interface RandomVariableInterface
public double getStandardError(RandomVariableInterface probabilities)
RandomVariableInterface
RandomVariableInterface.getStandardDeviation(RandomVariableInterface)
.getStandardError
in interface RandomVariableInterface
probabilities
- The probability weights.public double getVariance()
RandomVariableInterface
getVariance
in interface RandomVariableInterface
public double getVariance(RandomVariableInterface probabilities)
RandomVariableInterface
getVariance
in interface RandomVariableInterface
probabilities
- The probability weights.public RandomVariableInterface invert()
RandomVariableInterface
invert
in interface RandomVariableInterface
public boolean isDeterministic()
RandomVariableInterface
isDeterministic
in interface RandomVariableInterface
public RandomVariableInterface log()
RandomVariableInterface
log
in interface RandomVariableInterface
public RandomVariableInterface sin()
RandomVariableInterface
sin
in interface RandomVariableInterface
public RandomVariableInterface cos()
RandomVariableInterface
cos
in interface RandomVariableInterface
public RandomVariableInterface mult(double value)
RandomVariableInterface
mult
in interface RandomVariableInterface
value
- The value to multiply.public RandomVariableInterface mult(RandomVariableInterface randomVariable)
RandomVariableInterface
mult
in interface RandomVariableInterface
randomVariable
- A random variable (compatible with this random variable).public RandomVariableInterface pow(double exponent)
RandomVariableInterface
pow
in interface RandomVariableInterface
exponent
- The exponent.public int size()
RandomVariableInterface
size
in interface RandomVariableInterface
public RandomVariableInterface squared()
RandomVariableInterface
squared
in interface RandomVariableInterface
public RandomVariableInterface sqrt()
RandomVariableInterface
sqrt
in interface RandomVariableInterface
public RandomVariableInterface sub(double value)
RandomVariableInterface
sub
in interface RandomVariableInterface
value
- The value to subtract.public RandomVariableInterface sub(RandomVariableInterface randomVariable)
RandomVariableInterface
sub
in interface RandomVariableInterface
randomVariable
- A random variable (compatible with this random variable).public RandomVariableInterface addRatio(RandomVariableInterface numerator, RandomVariableInterface denominator)
RandomVariableInterface
addRatio
in interface RandomVariableInterface
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).public RandomVariableInterface subRatio(RandomVariableInterface numerator, RandomVariableInterface denominator)
RandomVariableInterface
subRatio
in interface RandomVariableInterface
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).public RandomVariableInterface isNaN()
RandomVariableInterface
isNaN
in interface RandomVariableInterface
public RandomVariableInterface cache()
RandomVariableInterface
cache
in interface RandomVariableInterface
Copyright © 2016. All rights reserved.