Jump-Diffusion Time Series Model

Jump-Diffustion continous time model by Christoffersen et al. (2016), “Time-varying Crash Risk: The Role of Market Liquiditiy”

class cde.density_simulation.JumpDiffusionModel(random_seed=None)[source]

Jump-Diffustion continous time model by Christoffersen et al. (2016), “Time-varying Crash Risk: The Role of Market Liquiditiy”

Parameters

random_seed – seed for the random_number generator

cdf(X, Y)[source]

Conditional cumulated probability density function P(Y < y | x) of the underlying probability model

Parameters
  • X – x to be conditioned on - numpy array of shape (n_points, ndim_x)

  • Y – y target values for witch the cdf shall be evaluated - numpy array of shape (n_points, ndim_y)

Returns

P(Y < y | x) cumulated density values for the provided X and Y - numpy array of shape (n_points, )

conditional_value_at_risk(x_cond, alpha=0.01, n_samples=1000000)

Computes the Conditional Value-at-Risk (CVaR) / Expected Shortfall of the fitted distribution. Only if ndim_y = 1

Parameters
  • x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

  • alpha – quantile percentage of the distribution

  • n_samples – number of samples for monte carlo model_fitting

Returns

CVaR values for each x to condition on - numpy array of shape (n_values)

covariance(x_cond, n_samples=1000000)

Covariance of the fitted distribution conditioned on x_cond

Parameters
  • x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

  • n_samples – number of samples for monte carlo model_fitting

Returns

Covariances Cov[y|x] corresponding to x_cond - numpy array of shape (n_values, ndim_y, ndim_y)

gamma_L = None

Starting values for the model variables (unconditional expectation except for log-return)

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

mapping of string to any

kurtosis(x_cond, n_samples=1000000)

Kurtosis of the fitted distribution conditioned on x_cond

Parameters

x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

Returns

Kurtosis Kurt[y|x] corresponding to x_cond - numpy array of shape (n_values, ndim_y, ndim_y)

log_pdf(X, Y)

Conditional log-probability log p(y|x). Requires the model to be fitted.

Parameters
  • X – numpy array to be conditioned on - shape: (n_samples, n_dim_x)

  • Y – numpy array of y targets - shape: (n_samples, n_dim_y)

Returns

conditional log-probability log p(y|x) - numpy array of shape (n_query_samples, )

mean_(x_cond, n_samples=1000000)

Mean of the fitted distribution conditioned on x_cond :param x_cond: different x values to condition on - numpy array of shape (n_values, ndim_x)

Returns

Means E[y|x] corresponding to x_cond - numpy array of shape (n_values, ndim_y)

pdf(X, Y)[source]

Conditional probability density function p(y|x) of the underlying probability model

Parameters
  • X – x to be conditioned on - numpy array of shape (n_points, ndim_x)

  • Y – y target values for witch the pdf shall be evaluated - numpy array of shape (n_points, ndim_y)

Returns

p(X|Y) conditional density values for the provided X and Y - numpy array of shape (n_points, )

plot(xlim=(-5, 5), ylim=(-5, 5), resolution=100, mode='pdf', show=False, numpyfig=False)

Plots the distribution specified in mode if x and y are 1-dimensional each

Parameters
  • xlim – 2-tuple specifying the x axis limits

  • ylim – 2-tuple specifying the y axis limits

  • resolution – integer specifying the resolution of plot

  • mode – spefify which dist to plot [“pdf”, “cdf”, “joint_pdf”]

plot2d(x_cond=[0, 1, 2], ylim=(-8, 8), resolution=100, mode='pdf', show=True, prefix='', numpyfig=False)

Generates a 3d surface plot of the fitted conditional distribution if x and y are 1-dimensional each

Parameters
  • xlim – 2-tuple specifying the x axis limits

  • ylim – 2-tuple specifying the y axis limits

  • resolution – integer specifying the resolution of plot

plot3d(xlim=(-5, 5), ylim=(-8, 8), resolution=100, show=False, numpyfig=False)

Generates a 3d surface plot of the fitted conditional distribution if x and y are 1-dimensional each

Parameters
  • xlim – 2-tuple specifying the x axis limits

  • ylim – 2-tuple specifying the y axis limits

  • resolution – integer specifying the resolution of plot

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns

Return type

self

simulate(n_samples=10000)[source]

Simulates a time-series of n_samples time steps

Parameters

samples – (int) number of samples to be drawn from the joint distribution P(X,Y)

Returns: (X,Y)
  • X: horizontal stack of simulated V (spot vol), L (illigudity) and Psi (latent state) - numpy array of shape (n_samples, 3)

  • Y: log returns drawn from P(Y|X) - numpy array of shape (n_samples, 1)

simulate_conditional(X)[source]

Draws random samples from the conditional distribution

Parameters

X – x to be conditioned on when drawing a sample from y ~ p(y|x) - numpy array of shape (n_samples, 3) thereby x is a horizontal stack of V, L and Psi -> x = (V, L, Psi)

Returns: (X,Y)
  • X: the x to of the conditional samples (identical with argument X)

  • Y: Conditional random samples y drawn from p(y|x) - numpy array of shape (n_samples, 1)

skewness(x_cond, n_samples=1000000)

Skewness of the fitted distribution conditioned on x_cond

Parameters

x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

Returns

Skewness Skew[y|x] corresponding to x_cond - numpy array of shape (n_values, ndim_y, ndim_y)

std_(x_cond, n_samples=1000000)

Standard deviation of the fitted distribution conditioned on x_cond

Parameters

x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

Returns

Standard deviations sqrt(Var[y|x]) corresponding to x_cond - numpy array of shape (n_values, ndim_y)

tail_risk_measures(x_cond, alpha=0.01, n_samples=1000000)

Computes the Value-at-Risk (VaR) and Conditional Value-at-Risk (CVaR)

Parameters
  • x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

  • alpha – quantile percentage of the distribution

  • n_samples – number of samples for monte carlo model_fitting

Returns

  • VaR values for each x to condition on - numpy array of shape (n_values)

  • CVaR values for each x to condition on - numpy array of shape (n_values)

value_at_risk(x_cond, alpha=0.01, n_samples=1000000)

Computes the Value-at-Risk (VaR) of the fitted distribution. Only if ndim_y = 1

Parameters
  • x_cond – different x values to condition on - numpy array of shape (n_values, ndim_x)

  • alpha – quantile percentage of the distribution

  • n_samples – number of samples for monte carlo model_fitting

Returns

VaR values for each x to condition on - numpy array of shape (n_values)