Package-level declarations

Types

Link copied to clipboard
class AcceptanceRejectionRV(val proposalDistribution: ContinuousDistributionIfc, val majorizingConstant: Double, val pdf: PDFIfc, rnStream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Implements the acceptance/rejection algorithm for uni-variate distributions. The user must supply a continuous distribution that acts as the proposal distribution and the PDF of the distribution from which random variates will be generated. The two distributions must be domain compatible. The proposal distribution's domain must wholly contain the domain of the PDF from which random variates will be generated. If the target PDF's domain is not within the proposal distribution's domain then all proposed values would be rejected.

Link copied to clipboard
class AR1CorrelatedRNStream(lag1Corr: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RNStreamIfc

Uses the autoregressive to anything algorithm to generate correlated uniform variates. The user supplies the correlation of the underlying AR(1) process. The resulting correlation in the u's may not necessarily meet this correlation, due to the correlation matching problem.

Link copied to clipboard
class AR1NormalRV(val mean: Double = 0.0, val variance: Double = 1.0, val lag1Corr: Double = 0.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Creates an autoregressive order 1 normal process

Link copied to clipboard
class BernoulliRV(val probOfSuccess: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Bernoulli(probability of success) random variable

Link copied to clipboard
class BetaRV(val alpha1: Double = 1.0, val alpha2: Double = 1.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Beta(alpha1, alpha2) random variable, range (0,1)

Link copied to clipboard
class BinomialRV(val pSuccess: Double, val numTrials: Int, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

BinomialRV(probability of success, number of trials)

Link copied to clipboard
class BivariateLogNormalRV(val m1: Double = 1.0, val v1: Double = 1.0, val m2: Double = 1.0, val v2: Double = 1.0, val corr: Double = 0.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : MVRVariable

Allows for the generation of bi-variate lognormal random variables. These parameters are all for the lognormal distribution

Link copied to clipboard
class BivariateNormalRV(val mean1: Double = 0.0, val v1: Double = 1.0, val mean2: Double = 0.0, val v2: Double = 1.0, val corr: Double = 0.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : MVRVariable

Allows for the generation of bi-variate normal random variables Constructs a bi-variate normal with the provided parameters

Link copied to clipboard
class BVGaussianCopula(val bvnCorrelation: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariable

Generates a bivariate Gaussian copula. (u_1, u_2)

Link copied to clipboard
class BVGaussianCopulaRV(val marginal1: InverseCDFIfc, val marginal2: InverseCDFIfc, val bvnCorrelation: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariable

Uses a bivariate Gaussian copula to produce (u_1, u_2) and uses the generated (u_1, u_2) to generate (x_1, x_2) where x_1 is from marginal1 and x_2 is from marginal2. The joint distribution of (x_1, x_2) will have a correlation structure implied by the underlying bivariate Gaussian copula.

Link copied to clipboard
class ChiSquaredRV(val degreesOfFreedom: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Chi-Squared(degrees of freedom) random variable

Link copied to clipboard
open class ConstantRV(var constVal: Double, name: String? = null) : ParameterizedRV

Allows a constant value to pretend to be a random variable

Link copied to clipboard
class DEmpiricalRV(values: DoubleArray, cdf: DoubleArray, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Discrete Empirical Random Variable. Randomly selects from the supplied values in the value array according to the supplied CDF array. The CDF array must have valid probability elements and last element equal to 1. Every element must be greater than or equal to the previous element in the CDF array. That is, monotonically increasing.

Link copied to clipboard
class DUniformRV(val min: Int, val max: Int, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Discrete uniform(min, max) random variable

Link copied to clipboard
class EmpiricalRV(data: DoubleArray, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

A random variable that samples from the provided data. Each value is equally likely to occur.

Link copied to clipboard
class ExponentialRV(val mean: Double = 1.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Exponential(mean) random variable

Link copied to clipboard
class GammaRV(val shape: Double, val scale: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

GammaRV(shape, scale) random variable

Link copied to clipboard
class GeneralizedBetaRV(val alpha: Double, val beta: Double, val min: Double, val max: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

GeneralizeBetaRV(alpha1, alpha2, min, max) random variable

Link copied to clipboard
fun interface GenerateIfc

A SAM for specifying the function generate() of random variables

Link copied to clipboard
class GeometricRV(val probOfSuccess: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Geometric(probability of success) random variable, range 0, 1, 2, etc.

Link copied to clipboard
interface GetRVariableIfc

An interface for getting random variables

Link copied to clipboard
class Hyper2ExponentialRV(val mixingProb: Double, val mean1: Double, val mean2: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Two exponential random variables mixed to get a hyper-exponential. For higher order hyper-exponential use MixtureRV. The mixing probability is the probability of getting the first exponential distribution with mean1

Link copied to clipboard
class InverseCDFRV(val inverseCDF: InverseCDFIfc, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Facilitates the creation of random variables from distributions that implement InverseCDFIfc

Link copied to clipboard
class JohnsonBRV(val alpha1: Double, val alpha2: Double, val min: Double, val max: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

JohnsonB(alpha1, alpha2, min, max) random variable

Link copied to clipboard
object KSLRandom

The purpose of this class is to facilitate random variate generation from various distributions without having to create object instances.

Link copied to clipboard
class LaplaceRV(val location: Double, val scale: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

LaplaceRV(mean, scale)

Link copied to clipboard
class LogisticRV(val location: Double = 0.0, val scale: Double = 1.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Logistic(location, scale) random variable

Link copied to clipboard
class LogLogisticRV(val shape: Double, val scale: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

LogLogistic(shape, scale) random variable

Link copied to clipboard
class LognormalRV(val mean: Double, val variance: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Lognormal(mean, variance). The mean and variance are for the lognormal random variables

Link copied to clipboard
class MixtureRV(list: List<RVariableIfc>, cdf: DoubleArray, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable
Link copied to clipboard
class MVGaussianCopula(correlation: Array<DoubleArray>, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariable

Generations d-dimensional Gaussian copula, where the supplied correlation matrix is the correlation for the underlying multi-variate normal

Link copied to clipboard
class MVGaussianCopulaRV(val marginals: List<InverseCDFIfc>, correlation: Array<DoubleArray>, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariable
Link copied to clipboard
class MVIndependentMarginals(marginals: List<RVariableIfc>, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariable

Represents a multi-variate distribution with the specified marginals The sampling of each marginal random variable is independent. That is the resulting distribution has independent marginals. The supplied marginals may be the same distribution or not. If they are all the same, then use MVIndependentRV instead. All the random variables will share the same stream. The sampling ensures that is the sampling is consecutive within the stream and thus independent.

Link copied to clipboard
class MVIndependentRV(theDimension: Int, theRandomVariable: RVariableIfc) : MVRVariable

Represents a multi-variate distribution with the specified dimensions. The sampling of each dimension is independent. That is the resulting distribution has independent marginals that are represented by the same distribution as provided by the supplied random variable

Link copied to clipboard
class MVNormalRV(means: DoubleArray, covariances: Array<DoubleArray>, stream: RNStreamIfc = KSLRandom.nextRNStream()) : MVRVariableIfc

Generations multi-dimensional normal random variates

Link copied to clipboard
abstract class MVRVariable(stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : MVRVariableIfc, IdentityIfc, RNStreamControlIfc
Link copied to clipboard

An interface for defining multi-variate random variables

Link copied to clipboard
interface MVSampleIfc

An interface for getting multi-variable samples, each sample has many values held in an array. Clients need to implement the sample(array) function in order to fill up the array with the sample values. The array of size dimension represent 1 sample with elements as the sample values for each coordinate of the dimension. For example, for 2-D, sample returns an array {x0, x1} where x0 is the sample for the first coordinate and x1 is the sample value for the second coordinate.

Link copied to clipboard
class NegativeBinomialRV(val probOfSuccess: Double, val numSuccess: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

NegativeBinomial(probability of success, number of trials until rth success)

Link copied to clipboard
Link copied to clipboard
class NormalRV(val mean: Double = 0.0, val variance: Double = 1.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Normal(mean, variance)

Link copied to clipboard
abstract class ParameterizedRV(stream: RNStreamIfc, name: String? = null) : RVariable, RVParametersIfc
Link copied to clipboard
class PearsonType5RV(val shape: Double, val scale: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Pearson Type 5(shape, scale) random variable

Link copied to clipboard
class PearsonType6RV(val alpha1: Double, val alpha2: Double, val beta: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Pearson Type 6(alpha1, alpha2, beta) random variable

Link copied to clipboard
class PoissonRV(val mean: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Poisson(mean) random variable

Link copied to clipboard
class RatioOfUniformsRV(umax: Double, vmin: Double, vmax: Double, f: PDFIfc, rnStream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Provides a framework for generating random variates using the ratio of uniforms method. Specifies the pair (u, v), with ratio v/u

Link copied to clipboard
abstract class RVariable(stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : RVariableIfc, IdentityIfc, DoubleEmitterIfc

An abstract base class for building random variables. Implement the random generation procedure in the method generate().

Link copied to clipboard

An interface for defining random variables. The methods sample() and getValue() gets a new value of the random variable sampled accordingly. The method getPreviousValue() returns the value from the last call to sample() or getValue(). The value returned by getPreviousValue() stays the same until the next call to sample() or getValue(). The methods sample() or getValue() always get the next random value. If sample() or getValue() is never called then getPreviousValue() returns Double.NaN. Use sample() or getValue() to get a new random value and use getPreviousValue() to get the last sampled value.

Link copied to clipboard
class RVFunction(theFirst: RVariableIfc, theSecond: RVariableIfc, theTransform: (f: Double, s: Double) -> Double = { f: Double, s: Double -> f + s }, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : RVariable
Link copied to clipboard
Link copied to clipboard

The set of pre-defined types of random variables

Link copied to clipboard
class RVUFunction(theFirst: RVariableIfc, theTransform: (f: Double) -> Double = { f: Double -> f }, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : RVariable
Link copied to clipboard
class ShiftedGeometricRV(val probOfSuccess: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Shifted Geometric(probability of success) random variable, range 1, 2, 3, etc.

Link copied to clipboard
class ShiftedRV(val shift: Double, rv: RVariableIfc, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Shifts the generated value of the supplied random variable by the shift amount. The shift amount must be positive.

Link copied to clipboard
class StudentTRV(val degreesOfFreedom: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Constructs a StudentT distribution dof degrees of freedom

Link copied to clipboard
class TriangularRV(val min: Double, val mode: Double, val max: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Triangular(min, mode, max) random variable

Link copied to clipboard
class TruncatedNormalRV(val mean: Double = 0.0, val variance: Double = 1.0, interval: Interval, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV
Link copied to clipboard
class TruncatedRV(distribution: InvertibleCDFIfc, val cdfLL: Double, val cdfUL: Double, val lowerLimit: Double, val upperLimit: Double, stream: RNStreamIfc = KSLRandom.nextRNStream()) : RVariable

Constructs a truncated random variable based on the provided distribution

Link copied to clipboard
class UniformRV(val min: Double = 0.0, val max: Double = 1.0, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Generates a continuous uniform over the range

Link copied to clipboard
class WeibullRV(val shape: Double, val scale: Double, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : ParameterizedRV

Weibull(shape, scale) random variable

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun Double.div(other: RVariableIfc): RVariableIfc
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun main()
fun main()
Link copied to clipboard
operator fun Double.minus(other: RVariableIfc): RVariableIfc
Link copied to clipboard
fun <T> MutableList<T>.permute(streamNum: Int)
fun <T> MutableList<T>.permute(stream: RNStreamIfc = KSLRandom.defaultRNStream())
Link copied to clipboard
operator fun Double.plus(other: RVariableIfc): RVariableIfc
Link copied to clipboard
Link copied to clipboard
fun <T> List<T>.randomlySelect(streamNum: Int): T
fun <T> List<T>.randomlySelect(stream: RNStreamIfc = KSLRandom.defaultRNStream()): T
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun Double.times(other: RVariableIfc): RVariableIfc
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard