Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract base class for one-factor copula models

Reference: John Hull and Alan White, The Perfect Copula, June 2006

Let $Q_i(t)$ be the cumulative probability of default of counterparty i before time t.

In a one-factor model, consider random variables $$ Y_i = a_i,M+\sqrt{1-a_i^2}:Z_i $$ where $M$ and $Z_i$ have independent zero-mean unit-variance distributions and $-1\leq a_i \leq 1$. The correlation between $Y_i$ and $Y_j$ is then $a_i a_j$.

Let $F_Y(y)$ be the cumulative distribution function of $Y_i$. $y$ is mapped to $t$ such that percentiles match, i.e. $F_Y(y)=Q_i(t)$ or $y=F_Y^{-1}(Q_i(t))$.

Now let $F_Z(z)$ be the cumulated distribution function of $Z_i$. For given realization of $M$, this determines the distribution of $y$: $$ Prob ,(Y_i < y|M) = F_Z \left( \frac{y-a_i,M}{\sqrt{1-a_i^2}}\right) \qquad \mbox{or} \qquad Prob ,(t_i < t|M) = F_Z \left( \frac{F_Y^{-1}(Q_i(t))-a_i,M} {\sqrt{1-a_i^2}} \right) $$

The distribution functions of $ M, Z_i $ are specified in derived classes. The distribution function of $ Y $ is then given by the convolution $$ F_Y(y) = Prob,(Y<y) = \int_{-\infty}^\infty,\int_{-\infty}^{\infty}: D_Z(z),D_M(m) \quad \Theta \left(y - a,m - \sqrt{1-a^2},z\right),dm,dz, \qquad \Theta (x) = \left{ \begin{array}{ll} 1 & x \geq 0 \ 0 & x < 0 \end{array}\right. $$ where $ D_Z(z) $ and $ D_M(m) $ are the probability densities of $ Z$ and $ M, $ respectively.

This convolution can also be written $$ F(y) = Prob ,(Y < y) = \int_{-\infty}^\infty D_M(m),dm: \int_{-\infty}^{g(y,a,m)} D_Z(z),dz, \qquad g(y,a,m) = \frac{y - a\cdot m}{\sqrt{1-a^2}}, \qquad a < 1 $$

or

$$ F(y) = Prob ,(Y < y) = \int_{-\infty}^\infty D_Z(z),dz: \int_{-\infty}^{h(y,a,z)} D_M(m),dm, \qquad h(y,a,z) = \frac{y - \sqrt{1 - a^2}\cdot z}{a}, \qquad a > 0. $$

In general, $ F_Y(y) $ needs to be computed numerically.

todo

Improve on simple Euler integration

Hierarchy

Implements

Index

Constructors

constructor

  • Parameters

    • correlation: Handle<Quote>
    • Default value maximum: Real = 5
    • Default value integrationSteps: Size = 50
    • Default value minimum: Real = -5.0

    Returns OneFactorCopula

Properties

_alwaysForward

_alwaysForward: boolean = false

_calculated

_calculated: boolean = false

Protected _correlation

_correlation: Handle<Quote>

Protected _cumulativeY

_cumulativeY: Real[]

_frozen

_frozen: boolean = false

_isDisposed

_isDisposed: boolean = false

Protected _max

_max: Real

Protected _min

_min: Real

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

Protected _steps

_steps: Size

Protected _y

_y: Real[]

dispose

dispose: () => void

Type declaration

    • (): void
    • Returns void

isDisposed

isDisposed: boolean

notifyObservers

notifyObservers: () => 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

unregisterObserver

unregisterObserver: (o: Observer) => void

Type declaration

unregisterWith

unregisterWith: (h: Observable) => Size

Type declaration

unregisterWithAll

unregisterWithAll: () => void

Type declaration

    • (): void
    • Returns void

Methods

alwaysForwardNotifications

  • alwaysForwardNotifications(): void
  • This method causes the object to forward all notifications, even when not calculated. The default behavior is to forward the first notification received, and discard the others until recalculated; the rationale is that observers were already notified, and don't need further notification until they recalculate, at which point this object would be recalculated too. After recalculation, this object would again forward the first notification received.

    warning Forwarding all notifications will cause a performance hit, and should be used only when discarding notifications cause an incorrect behavior.

    Returns void

calculate

  • calculate(): void
  • This method performs all needed calculations by calling the performCalculations method.

    warning Objects cache the results of the previous calculation. Such results will be returned upon later invocations of calculate. When the results depend on arguments which could change between invocations, the lazy object must register itself as observer of such objects for the calculations to be performed again when they change.

    warning Should this method be redefined in derived classes, LazyObject.calculate() should be called in the overriding method.

    Returns void

checkMoments

  • Check moments (unit norm, zero mean and unit variance) of the distributions of M, Z, and Y by numerically integrating the respective density. Parameter tolerance is the maximum tolerable absolute error.

    Parameters

    Returns Integer

conditionalProbability1

  • Conditional probability

    $$ \hat p(m) = F_Z \left( \frac{F_Y^{-1}(p)-a,m}{\sqrt{1-a^2}}\right) $$

    Parameters

    Returns Real

conditionalProbability2

  • Vector of conditional probabilities

    $$ \hat p_i(m) = F_Z \left( \frac{F_Y^{-1}(p_i)-a,m}{\sqrt{1-a^2}} \right) $$

    Parameters

    Returns Real[]

correlation

  • correlation(): Real
  • Single correlation parameter

    Returns Real

cumulativeY

  • Cumulative distribution of Y.

    This is the default implementation based on tabulated data. The table needs to be filled by derived classes. If analytic calculation is feasible, this method can also be overridden.

    Parameters

    Returns Real

cumulativeZ

  • Cumulative distribution of Z.

    Derived classes must override this method and ensure zero mean and unit variance.

    Parameters

    Returns Real

deepUpdate

  • deepUpdate(): void

density

  • Density function of M.

    Derived classes must override this method and ensure zero mean and unit variance.

    Parameters

    Returns Real

Protected densitydm

  • Parameters

    Returns Real

Protected dm

  • Parameters

    Returns Real

freeze

  • freeze(): void
  • This method constrains the object to return the presently cached results on successive invocations, even if arguments upon which they depend should change.

    Returns void

integral1

  • Integral over the density $ \rho(m) $ of M and the conditional

    probability related to p:

    $$ \int_{-\infty}^\infty,dm,\rho(m), F_Z \left( \frac{F_Y^{-1}(p)-a,m}{\sqrt{1-a^2}}\right) $$

    Parameters

    Returns Real

integral2

  • Integral over the density $ \rho(m) $ of M and a one-dimensional function $ f $ of conditional probabilities related to the input vector of probabilities p:

    $$ \int_{-\infty}^\infty,dm,\rho(m), f (\hat p_1, \hat p_2, \dots, \hat p_N), \qquad \hat p_i (m) = F_Z \left( \frac{F_Y^{-1}(p_i)-a,m}{\sqrt{1-a^2}} \right) $$

    Parameters

    Returns Real

integral3

  • Integral over the density $ \rho(m) $ of M and a multi-dimensional function $ f $ of conditional probabilities related to the input vector of probabilities p:

    $$ \int_{-\infty}^\infty,dm,\rho(m), f (\hat p_1, \hat p_2, \dots, \hat p_N), \qquad \hat p_i = F_Z \left( \frac{F_Y^{-1}(p_i)-a,m}{\sqrt{1-a^2}}\right) $$

    Parameters

    Returns Distribution

inverseCumulativeY

  • Inverse cumulative distribution of Y.

    This is the default implementation based on tabulated data. The table needs to be filled by derived classes. If analytic calculation is feasible, this method can also be overridden.

    Parameters

    Returns Real

Protected m

  • Parameters

    Returns Real

performCalculations

  • performCalculations(): void
  • This method must implement any calculations which must be (re)done in order to calculate the desired results.

    Returns void

recalculate

  • recalculate(): void
  • This method force the recalculation of any results which would otherwise be cached. It is not declared as const since it needs to call the non-const notifyObservers method.

    note Explicit invocation of this method is not necessary if the object registered itself as observer with the structures on which such results depend. It is strongly advised to follow this policy when possible.

    Returns void

Protected steps

  • Returns Size

unfreeze

  • unfreeze(): void
  • This method reverts the effect of the freeze method, thus re-enabling recalculations.

    Returns void

update

  • update(): void