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
    • 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.2.tar.gz (579.6 kB view details)

Uploaded Source

Built Distributions

copulae-0.4.2-cp37-cp37m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.7m Windows x86-64

copulae-0.4.2-cp37-cp37m-manylinux2010_x86_64.whl (2.8 MB view details)

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

copulae-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl (899.6 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

copulae-0.4.2-cp36-cp36m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.6m Windows x86-64

copulae-0.4.2-cp36-cp36m-manylinux2010_x86_64.whl (2.8 MB view details)

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

copulae-0.4.2-cp36-cp36m-macosx_10_7_x86_64.whl (906.2 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.4.2.tar.gz
  • Upload date:
  • Size: 579.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.7

File hashes

Hashes for copulae-0.4.2.tar.gz
Algorithm Hash digest
SHA256 6dbf02ccb7b1f45c6d8474449a8ad44fcf53741d72b7ae1b422c732cda059b9a
MD5 fcf27b640ffe9503ced0dce561762557
BLAKE2b-256 56ef53cc414988c9f40186625e497d3383344939933de8ee51b39c37b0c32c69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.3 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.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f465128f560bfa4615e5329ce65cd0de9a62d9ccfd4835fd652bced900944fdc
MD5 7ab4c9af7ccd837b756434e9b2b5e468
BLAKE2b-256 62c3b6367e76620c4b780f58eecf68e19e2163c00b5d3585b71ab37255b6938f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.8 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.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 789d6bd8310f56e3c012d26fe70054eaff0f58f70e127c72186760d48c849d2c
MD5 c381de72c1558bf6c74b51eccd14ab9c
BLAKE2b-256 6d92fef2475a6a1f216cfe05213366dcad4a4e56986eb602f71be19608d918f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 899.6 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.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for copulae-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e2575706651a17deacc2c56ada950ddc7e79a3b1570ec70b6db37fc9d3eb445
MD5 28476261bbbb4faf5c73ccbb852ea70d
BLAKE2b-256 eefaaa606748ba7c27ae1ac2fb85e88f477d9ce83c57dd548160876b11e01138

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.3 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.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 664c8cee04bed134999fd3875ee304073a786052890586b23e3c3cb348312302
MD5 62a89f73ba744e4446e69ada96f27c7d
BLAKE2b-256 e8dcb9ee129368cecf3568788ed42296c9e4f042304f972886741315a13cc918

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.8 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.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2e669b0f9ab857cbc71dc8191f94d8948504e80bf9c6197de5284bfc59b2c6e8
MD5 bd4bddf7b74ace7ace5956c916a7e0ea
BLAKE2b-256 8fa267b37d8a23c357eb7c74de1ba682f8545a2724eb6f63299ae1d61e254d0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.2-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 906.2 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.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.7

File hashes

Hashes for copulae-0.4.2-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 d3b4aaea79f81dd9c0e6c84f4f5f3829e750fd0f0f1f5114a1a664e80ef8d0ad
MD5 3a85bcb0985eefc50fe181a879872471
BLAKE2b-256 d2473d2aa226a89cbd316b5723dc7eab84fb291742d8d4a1fb2f673594597b03

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