pyscenarios: Python Scenario Generator

This package offers several modules used in Monte Carlo simulations:

copula

Gaussian Copula, Student T* Copula and IT Copula samples generators

sobol

Joe/Kuo Sobol series generator

stats

Tail dependence measures

All modules fully support and are optimized for dask and are compatible with dask distributed.

Index

Installation

Required dependencies

Testing

To run the test suite after installing pyscenarios, first install (via pypi or conda)

  • py.test: Simple unit testing library

and run py.test.

What’s New

v0.2.0 (2019-04-29)

  • Type annotations

  • ‘rng’ parameter in copula functions is now case insensitive

  • Work around regression in IT copula with dask >= 1.1 (dask#4739)

  • Smaller binary package; simplified setup

  • Explicit CI tests for Windows, Python 3.5.0, and Python 3.7

  • Mandatory flake8 and mypy in CI

  • Changed license to Apache 2.0

v0.1.0 (2018-05-27)

Initial release.

copula

sobol

stats

Statistical functions

pyscenarios.stats.tail_dependence(x: Any, y: Any, q: Any) → Union[numpy.ndarray, dask.array.core.Array]

Calculate tail dependence between vectors x and y.

Parameters
  • x – 1D array-like or dask array containing samples from a uniform (0, 1) distribution.

  • y – other array to compare against

  • q – quantile(s) (0 < q < 1). Either a scalar or a ND array-like or dask array.

Returns

array of the same shape and type as q, containing:

\[\cases{ P(y < q | x < q) | q < 0.5 \cr P(y \geq q | x \geq q) | q \geq 0.5 }\]

License

pyscenarios is available under the open source Apache License.