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 major different 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
    • 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.4.0.tar.gz (553.0 kB view details)

Uploaded Source

Built Distributions

copulae-0.4.0-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

copulae-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

copulae-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl (906.7 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

copulae-0.4.0-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

copulae-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

copulae-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl (912.4 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.4.0.tar.gz
  • Upload date:
  • Size: 553.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for copulae-0.4.0.tar.gz
Algorithm Hash digest
SHA256 66f0b015ff82ef9ec491a17cb314f02ddc46372eb1ab3cc75135ed0ea536008a
MD5 058f2e668c2b53e95c6faee9cf957965
BLAKE2b-256 8f9c284ab7876d63ccd11d03e8932c05fb13b9a21f699d89795dd00dbc469d2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7db04bac875e46a4d6cb056ca9aa6d5c763c44c8ae8cb9030552d8b3b8c17e0d
MD5 ae71f385962a90b3ed86290606b9a2e5
BLAKE2b-256 5692031fb19ac3fe052c873a6757fe02bf78139dd127dbea8661286d800883dd

See more details on using hashes here.

File details

Details for the file copulae-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: copulae-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 35b63be580f8b0c07898384335e17954cd2e4a00f2afe8bde3ed84820b6b9f11
MD5 902153e15ff9d35d00193194b14bfe21
BLAKE2b-256 54836710d648c26b94500e82bbf7fe95eb528c36d46be0acdc1dc3f699f13aec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 906.7 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1a32542878731b43c021d4731d281228ff26c4bb0f833a38a878fa4ea1000ccb
MD5 e44ee3fe5b285ad9b6b66f6c94d59367
BLAKE2b-256 b1fe7707a3780788e8d1d58164739f66e6abfc4b039178513f7f1d95c02cabae

See more details on using hashes here.

File details

Details for the file copulae-0.4.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: copulae-0.4.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 4e99646aefd1e482b3d42c01d67936af2f6d26de162bbed822be9f57f902f661
MD5 624c8ee506405b3794487a7efbc75861
BLAKE2b-256 a02943f83b0279e9361ce8251f3e80c6701d6f1c886f06f124f0498c196dc3e8

See more details on using hashes here.

File details

Details for the file copulae-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: copulae-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c763303dc4ff6b2cece3ef6759a45ee5ad72be173bc7d7337025334ae0cd288b
MD5 0990038f198fb768176d6dbdf5904917
BLAKE2b-256 87923fbb66a6bfed3c36e731be4a3f1f66b1c305d2d5c957fd25041402073c02

See more details on using hashes here.

File details

Details for the file copulae-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: copulae-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 912.4 kB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for copulae-0.4.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 841a211558030c04521b64def37e98e370a905105b81fb5000452afadfdbacfd
MD5 7b0bdba13d1a6beb2ec5c747ed686e37
BLAKE2b-256 29586b443ccb1ebabd604ec4039613d4a0bd78da8c559da5c172740467338dda

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