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.4.3.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

copulae-0.4.3-cp38-cp38-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.8

copulae-0.4.3-cp38-cp38-macosx_10_9_x86_64.whl (919.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

copulae-0.4.3-cp37-cp37m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.7m

copulae-0.4.3-cp37-cp37m-macosx_10_9_x86_64.whl (901.3 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

copulae-0.4.3-cp36-cp36m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

copulae-0.4.3-cp36-cp36m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.6m

copulae-0.4.3-cp36-cp36m-macosx_10_7_x86_64.whl (908.0 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.4.3.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • 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.4

File hashes

Hashes for copulae-0.4.3.tar.gz
Algorithm Hash digest
SHA256 b96f56ec038c7670b110c2a7c68f46fa93597cf152afcc20956d26ff33a56485
MD5 8abdc6e372733e9ff75c6ee0838db45c
BLAKE2b-256 0307ba368ae512bc4820eaca9fd598ffb486780f89bd59fa4ff5fa4205497b89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-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.4.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c725d69228782e2a12d4ef1ffd253edc2b95e5fe40979e89f5cc40e9e5d36411
MD5 cfd4e1c5d3716048e9278f54c8b770f1
BLAKE2b-256 7872d117adde7ecc98a1f0a0e67e6dd7a80487478a1e79324f3bfc70899cadb5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.8
  • 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.4.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2315faddb2ff259b8a5f32c93aafbc9ce102aaa22c0f9c47096d40731a6b276b
MD5 eee3a61f0cd2ee712a95e20bf02d96d3
BLAKE2b-256 18a0defc06a52051ef538cf1eae112465738ff1ad6e5c2febb7e7f2830544977

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 919.1 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1.post20191125 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for copulae-0.4.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 523a71eaa24d94d83a019bc447e0a7723c8b64619cfaf127631391d55c7b9dfb
MD5 4a69931ad1955bde9a40db360c058a88
BLAKE2b-256 44c681feb71b5d2be68f3ad1221ba5fa2a1a7b6654b61beb5dbc651bad24d79a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-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/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.4

File hashes

Hashes for copulae-0.4.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 68ee1556edb874c46b7d29ab4d6a089cdc63796af7ac5296071fb4678b3c31fe
MD5 76306d7e353e8ddab38f759b20043be1
BLAKE2b-256 de4c8c37af23a352939f15cb61f1bfe11e63e332885fd3e853660480843d5852

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m
  • 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.4

File hashes

Hashes for copulae-0.4.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 da92df7602364e4a0e53ed33adf8efca45e6f765209139647ef8d2e934555c39
MD5 cbfa464220521ee5c8d018eabc49a6ab
BLAKE2b-256 021a187d4c4bfea62076b0f8232a24beefe3b5ff45e4f22db505ad0c991a0904

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 901.3 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.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c8e489034a14672622d250b7de1c0a087dd53e57c3a1e9a572713a800eafc57a
MD5 904ec458379fc2a5c4e26733f5b1de60
BLAKE2b-256 61de8aba0474ef2d9a67526e511da50f1d993d2f32902ca4d3ea4b2eee4cfda0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a62387c069f0ab7c0f604bc2348182f1039161b15248b921380967c7af404a64
MD5 8a915442ba9ac9c0901bcb032bd36aaf
BLAKE2b-256 2c6ca8f395d4c787a79307dce4560ceb3935f61e30ead2f53d0c28a2467e67a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.6m
  • 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.4

File hashes

Hashes for copulae-0.4.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99abf34e2d8667788b68d29a8028daf2d260641083799221a4347cd98389d39f
MD5 18311f060b6c250f4fb2508f7472196d
BLAKE2b-256 3d5f3ec02cf038fe86159b2484cf843a4f19ab43d7ef97873ecd9fc5e5cffeba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.3-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 908.0 kB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.12.5 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for copulae-0.4.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 12125961130e26940f2d0c2d21c230cb5f122cef6218ea7b16e34446ab97b5c4
MD5 b70cf3ebd0469c550f262ecdcb79a683
BLAKE2b-256 46cfbc3e3ef0e3e8b694d630960258d1fe42d087b9ded7026cd8ed4904205855

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