Skip to main content

Python copulae library for dependency modelling

Project description

Copulae

Copulae is a package used to model complex dependency structures. Copulae implements common and popular copula structures to bind multiple univariate streams of data together. All copula implemented are multivariate by default.

Versions

Anaconda Version PyPI version

Continuous Integration

Build Status

Documentation

Documentation Status

Coverage

Coverage Status

Installing

Install and update using pip and on conda.

# conda
conda install -c conda-forge copulae 
# PyPI
pip install -U copulae

Documentation

The documentation is located at https://copulae.readthedocs.io/en/latest/. Please check it out. :)

Simple Usage

from copulae import NormalCopula
import numpy as np

np.random.seed(8)
data = np.random.normal(size=(300, 8))
cop = NormalCopula(8)
cop.fit(data)

cop.random(10)  # simulate random number

# getting parameters
p = cop.params
# cop.params = ...  # you can override parameters too, even after it's fitted!  

# get a summary of the copula. If it's fitted, fit details will be present too
cop.summary()

# overriding parameters, for Elliptical Copulae, you can override the correlation matrix
cop[:] = np.eye(8)  # in this case, this will be equivalent to an Independent Copula

Most of the copulae work roughly the same way. They share pretty much the same API. The difference lies in the way they are parameterized. Read the docs to learn more about them. 😊

Acknowledgements

Most of the code has been implemented by learning from others. Copulas are not the easiest beasts to understand but here are some items that helped me along the way. I would recommend all the works listed below.

Elements of Copula Modeling with R

I referred quite a lot to the textbook when first learning. The authors give a pretty thorough explanation of copula from ground up. They go from describing when you can use copulas for modeling to the different classes of copulas to how to fit them and more.

Blogpost from Thomas Wiecki

This blogpost gives a very gentle introduction to copulas. Before diving into all the complex math you'd find in textbooks, this is probably the best place to start.

Motivations

I started working on the copulae package because I couldn't find a good existing package that does multivariate copula modeling. Presently, I'm building up the package according to my needs at work. If you feel that you'll need some features, you can drop me a message. I'll see how I can schedule it. 😊

TODOS

  • Set up package for pip and conda installation
  • More documentation on usage and post docs on rtd
    • Add sample problems
  • Elliptical Copulas
    • Gaussian (Normal)
    • Student (T)
  • Implement in Archimedean copulas
    • Clayton
    • Gumbel
    • Frank
    • Empirical
    • Joe
    • AMH
    • Implement Rho finding via cubatures
  • Implement Copulae Tests
    • Radial Symmetry
    • Exchangeability
    • Goodness of Fit
      • Pairwise Rosenblatt
      • Multi-Independence
      • General GOF
    • Model Selection
      • Cross-Validated AIC/BIC
  • Implement mixed copulas
  • Implement more solvers
  • Implement convenient graphing functions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copulae-0.5.0.tar.gz (774.6 kB view details)

Uploaded Source

Built Distributions

copulae-0.5.0-cp38-cp38-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8 Windows x86-64

copulae-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl (908.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

copulae-0.5.0-cp37-cp37m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

copulae-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl (903.5 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file copulae-0.5.0.tar.gz.

File metadata

  • Download URL: copulae-0.5.0.tar.gz
  • Upload date:
  • Size: 774.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for copulae-0.5.0.tar.gz
Algorithm Hash digest
SHA256 494f2a070445b7a915bda8c7f5872d14ee3330e4f9e2a80a026dc30b43a0b25a
MD5 9dbc3660d24eb1cab1172f8194489bb8
BLAKE2b-256 0bb300723b63c2d985efaba8df6c48aaefdd7fc35bbf09b6ed4936fa0b6400c6

See more details on using hashes here.

File details

Details for the file copulae-0.5.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: copulae-0.5.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for copulae-0.5.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4ed84d272462988a6bcab884bcd077b48bd74c7718c2f4413f25c1c5f5cb47b3
MD5 96f5698330707f68e86f0cc717d585ff
BLAKE2b-256 897a1866a7138c2f7db7159f64b55973fd25857f234fc1b830ecde5074311ef5

See more details on using hashes here.

File details

Details for the file copulae-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: copulae-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 908.0 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for copulae-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bbf5b01fe8b4a7c56c37ebf98f582feb465b6d70a3a724c7e4fd08b1b132eb42
MD5 af14dd78c41e0d1b8c8904200ef3d012
BLAKE2b-256 318c14f69cce11fd6a8d4718b0e3f39ce7be8c9b505430a63421119c5414a3f8

See more details on using hashes here.

File details

Details for the file copulae-0.5.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: copulae-0.5.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ba4cbabc28ddcaa5c5e1a4d305f001875a58f2e2002b3f86fb2c74bbfef03bd4
MD5 e249ae288f996497e2da9fa6bc58d277
BLAKE2b-256 387ed5b7830416966386059fbeb7fe2a1be0322d6f6747730c7d1ebc9b8cf9ba

See more details on using hashes here.

File details

Details for the file copulae-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: copulae-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 903.5 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for copulae-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e9482b633c022be506952e0dc54fc80d9af903e079b64014f80618db1a77ae3a
MD5 95558b8c98da36b216eecfd1e6b69eec
BLAKE2b-256 7e3dd53d4687ff3186193782fe120f2a8bff59e55bade4b5723ece8d08146b49

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page