Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Empirical

Represents a random variable with an empirical distribution defined by two vectors containing X and Y values.

The X and Y value arrays must have the same size. The X and Y values must be in ascending order, and the Y values must range from zero to one.

For more information on empirical distributions see empirical distribution.

Hierarchy

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new Empirical(xVals: number[], yVals: number[], seed?: number): Empirical
  • Initializes a new instance of the Empirical class.

    Parameters

    • xVals: number[]

      Array with possible values for the variable (from min to max).

    • yVals: number[]

      Array with cumulative probabilities (from zero to one).

    • Optional seed: number

      Optional value used to initialize the random sequence.

    Returns Empirical

Accessors

xVals

  • get xVals(): number[]
  • Gets the array with x-values used to generate the random values.

    Returns number[]

yVals

  • get yVals(): number[]
  • Gets the array with y-values used to generate the random values.

    Returns number[]

Methods

sample

  • sample(): number
  • Gets a random value that follows an empirical distribution with a CDF function defined by the xVals and yVals arrays.

    Returns number

Generated using TypeDoc