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
  • Mixture copulas
    • Gaussian Mixture Copula
    • Generic Mixture Copula
  • 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.6.0.tar.gz (569.2 kB view details)

Uploaded Source

Built Distributions

copulae-0.6.0-cp38-cp38-win_amd64.whl (897.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

copulae-0.6.0-cp38-cp38-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8

copulae-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl (900.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

copulae-0.6.0-cp37-cp37m-win_amd64.whl (892.9 kB view details)

Uploaded CPython 3.7m Windows x86-64

copulae-0.6.0-cp37-cp37m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m

copulae-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl (901.7 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

copulae-0.6.0-cp36-cp36m-win_amd64.whl (892.8 kB view details)

Uploaded CPython 3.6m Windows x86-64

copulae-0.6.0-cp36-cp36m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m

copulae-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl (903.7 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.6.0.tar.gz
  • Upload date:
  • Size: 569.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4ab4c21623c0f73c4bb29be35488e80afa827a9750bbb0c94ba0aa78f1353fa0
MD5 673b322dde7c72970dae2f66389396b1
BLAKE2b-256 e92f7551b6310db8f12855736a6501bf46c60c8f23fe7116c0f9f51f3f3e6837

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.6.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 897.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3afc79888ae337a1b1526ea043c30d7a99a972a6752d8dfdfb3df52d955f00c2
MD5 5f0d284c01fc95765ec7ba0c481a77a9
BLAKE2b-256 7ec9991ea8fe31e326b390c2e27d176899f12b74ed0d8dc9557ddafafc2cdc40

See more details on using hashes here.

File details

Details for the file copulae-0.6.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: copulae-0.6.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4c419a1bd7560707165dedc8a7b9bf81244d51c3dcdddf5e28ddff91ef8b3671
MD5 ff66278ff40bb3d421e609205d280a4a
BLAKE2b-256 44efa5546035f35d14ee6c776f7dd98207f251aa94ac14d1b65c31b0cb56a970

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 900.1 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84811b94574360af2c9ee766052548ab249dd3af759f46baa848c4ff7976aced
MD5 060ef70d2af3050deb28a7f5b1a2c98c
BLAKE2b-256 d6394e474bb177975f24a4fa67666819539c6faedb21997b3aa3d580b0b993e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.6.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 892.9 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3b5f14abc9e975b01993cad75d5c90659fba54e0570abb3cffe49dd038fe6a1c
MD5 6b84fb128fd93026d42e931286cd3fa2
BLAKE2b-256 c686cfc0df42ff6f8375e2e6037bb81793c58f6f9f556a2d4f97a299a3da6f6b

See more details on using hashes here.

File details

Details for the file copulae-0.6.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: copulae-0.6.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 580f4d2a2fccceb33002ea98ef648e89e4162935ce0dda45eadd675e78599911
MD5 f8ca1a1c64c96f74ae1f625abdef7384
BLAKE2b-256 95e9833bf8d51ef6268c536ce74d1805099d2357f4f3cdc90503b76cfe7a78bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 901.7 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff44dd58cc818369774e1f07d2db55129b9508afa7d309aade5cf470fd45fa55
MD5 638d8fdacf541a301d8b90e73a5a3438
BLAKE2b-256 00fd10b04adfcd66e755ccc238c60da154d0aa14ca799061db8458c2b33728a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.6.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 892.8 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c582842d34a545735226f2454f82ab7831ab5da2c167d242b5818813bde8691e
MD5 18e98f1f91a65cd14f999a75a4f997c7
BLAKE2b-256 288f1875bea32533ec6a25a0d4b5da43318870c234d58d025def0653895d6055

See more details on using hashes here.

File details

Details for the file copulae-0.6.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: copulae-0.6.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4cbf2484971dc0d16386868b464aae74df8b9858f600765e51f7ecf10a2884f0
MD5 c9689f368391d28b588cc8934c006ae0
BLAKE2b-256 254388eceab0a0ea9d445634cac963722552f23c92798a70a898755badb43fd8

See more details on using hashes here.

File details

Details for the file copulae-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: copulae-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 903.7 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.17

File hashes

Hashes for copulae-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2ac839972c1d102b241a653280cac06632e259f6bee42b895de31c8ce61d1024
MD5 ac68fd18c192181c77a950f719304df1
BLAKE2b-256 5795de130448e985ae95fa9ed125da2e9b1ef145e0dc8c5a159aa25227c8b583

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