Options
All
  • Public
  • Public/Protected
  • All
Menu

Base class for latent model monte carlo simulation. Independent of the copula type and the generator. Generates the factors and variable samples and determines event threshold but it is not responsible for actual event specification; thats the derived classes responsibility according to what they model. Derived classes need mainly to implement nextSample (Worker::nextSample in the multithreaded version) to compute the simulation event generated, if any, from the latent variables sample. They also have the accompanying event trait to specify.

CRTP used for performance to avoid virtual table resolution in the Monte Carlo. Not only in sample generation but access; quite an amount of time can go into statistics computation, for a portfolio of tens of thousands positions that part of the problem will be starting to overtake the simulation costs.

todo:

someone with sound experience on cache misses look into this, the statistics will be getting memory in and out of the cpu heavily and it might be possible to get performance out of that.

todo:

parallelize the statistics computation, things like Var/ESF splits are very expensive.

todo:

consider another design, taking the statistics outside the models.

Hierarchy

Implements

Index

Constructors

constructor

  • new RandomLM(derivedRandomLM: any, copulaPolicy: any, USNG?: USG<Real[]>): RandomLM
  • Parameters

    • derivedRandomLM: any
    • copulaPolicy: any
    • Default value USNG: USG<Real[]> = new SobolRsg()

    Returns RandomLM

Properties

USNG

USNG: USG<Real[]>

_alwaysForward

_alwaysForward: boolean = false

_basket

_basket: RelinkableHandle<Basket> = new RelinkableHandle()

_calculated

_calculated: boolean = false

Protected _copula

_copula: any

Protected _copulasRng

_copulasRng: any

_frozen

_frozen: boolean = false

_isDisposed

_isDisposed: boolean = false

Protected _maxHorizon

_maxHorizon: Size = 4050

Protected _nSims

_nSims: Size

Protected _numFactors

_numFactors: Size

Protected _numLMVars

_numLMVars: Size

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

_seed

_seed: BigNatural

Protected _simsBuffer

_simsBuffer: simEvent[][]

alwaysForwardNotifications

alwaysForwardNotifications: () => void

Type declaration

    • (): void
    • Returns void

calculate

calculate: () => void

Type declaration

    • (): void
    • Returns void

copulaPolicy

copulaPolicy: any

deepUpdate

deepUpdate: () => void

Type declaration

    • (): void
    • Returns void

densityTrancheLoss

densityTrancheLoss: (d: Date, lossFraction: Real) => Real

Type declaration

    • Parameters

      • d: Date
      • lossFraction: Real

      Returns Real

derivedRandomLM

derivedRandomLM: any

dispose

dispose: () => void

Type declaration

    • (): void
    • Returns void

freeze

freeze: () => void

Type declaration

    • (): void
    • Returns void

isDisposed

isDisposed: boolean

notifyObservers

notifyObservers: () => void

Type declaration

    • (): void
    • Returns void

probOverLoss

probOverLoss: (d: Date, lossFraction: Real) => Probability

Type declaration

recalculate

recalculate: () => void

Type declaration

    • (): void
    • Returns void

registerObserver

registerObserver: (o: Observer) => void

Type declaration

registerWith

registerWith: (h: Observable) => void

Type declaration

registerWithObservables

registerWithObservables: (o: Observer) => void

Type declaration

setBasket

setBasket: (bskt: Basket) => void

Type declaration

splitESFLevel

splitESFLevel: (d: Date, loss: Real) => Real[]

Type declaration

unfreeze

unfreeze: () => void

Type declaration

    • (): void
    • Returns void

unregisterObserver

unregisterObserver: (o: Observer) => void

Type declaration

unregisterWith

unregisterWith: (h: Observable) => Size

Type declaration

unregisterWithAll

unregisterWithAll: () => void

Type declaration

    • (): void
    • Returns void

Methods

computeHistogram

  • Parameters

    • d: Date

    Returns Histogram

defaultCorrelation

  • defaultCorrelation(d: Date, iName: Size, jName: Size): Real

expectedRecovery

expectedShortfall

  • expectedShortfall(d: Date, percent: Real): Real

expectedTrancheLoss

  • expectedTrancheLoss(d: Date): Real

expectedTrancheLossInterval

  • Parameters

    Returns [Real, Real]

getEventRecovery

  • Parameters

    Returns Real

getSim

  • Parameters

    Returns simEvent[]

init

  • Parameters

    Returns void

lossDistribution

percentile

  • percentile(d: Date, percentile: Real): Real

percentileAndInterval

  • Parameters

    • d: Date
    • percentile: Real

    Returns [Real, Real, Real]

performCalculations

  • performCalculations(): void

performSimulations

  • performSimulations(): void
  • Returns void

probAtLeastNEvents

probsBeingNthEvent

resetModel

  • resetModel(): void

splitVaRAndError

  • Parameters

    Returns Real[][]

splitVaRLevel

  • splitVaRLevel(date: Date, loss: Real): Real[]

update

  • update(): void