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.1.tar.gz (458.3 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.7m Windows x86-64

copulae-0.4.1-cp37-cp37m-manylinux2010_x86_64.whl (1.6 MB view details)

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

copulae-0.4.1-cp37-cp37m-macosx_10_9_x86_64.whl (700.5 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

copulae-0.4.1-cp36-cp36m-manylinux2010_x86_64.whl (1.6 MB view details)

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

copulae-0.4.1-cp36-cp36m-macosx_10_7_x86_64.whl (706.2 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.4.1.tar.gz
  • Upload date:
  • Size: 458.3 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.32.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.1.tar.gz
Algorithm Hash digest
SHA256 36376d906aed9b1d8de0d21f3bf6c2a31ec5d84cfa7f5335c4f37674acd7e1ea
MD5 3bf6d8012e2181fcc5acb8045dd0641a
BLAKE2b-256 da43dfe0b1005becfdb115653e09198f1adfa5d47582330f58e8a6a4b72aa0b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 227ecbcfdb978072c57e76d549990de78f5bace22033657dd8e74bd885965970
MD5 37b8a8b8616d550901066a2d7d123d51
BLAKE2b-256 a04323f3ab73d417b3ace6d7973af10e1e7d8f0a07fd22700dc694310d45e127

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.6 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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8ca48da7a1cc43400d30398da0d70f45e3326ec77edb9106c84f7e478fe8309e
MD5 987252a2dd75ca59f7760e60d958dd18
BLAKE2b-256 4bf06f558b2e984988a856d2a50f91688d3fd33e43458dcca832035d3d66dfd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 700.5 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.32.1 CPython/3.7.3

File hashes

Hashes for copulae-0.4.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c51d58a82b03c58ac43077594c4cd5bda60e025be91305046a78a4ca0fa912f5
MD5 90bc4770dbca459e1c74409e9d1dbb46
BLAKE2b-256 11d666a4cf02946b640e0893f489c9faa1b92f3112dd4d6d755b4b85a023ac26

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a6d902f5b71e416b9a730f6e12fd021cee94b3feb301618c7c691fc3749affce
MD5 339f5e32b138c6bfaa8e597e1c866a57
BLAKE2b-256 2f771d4674a47436a93d5d4a1e4de737e9a5f7d47fdc815a6fc37ca53f00d8b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.6 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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for copulae-0.4.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cab46a1a2985faf4bff8e46a60bb952938aa629a221a230c32a98cfd215f5a30
MD5 b7e7132137c9a3966cbdb4add48b83ec
BLAKE2b-256 43af39c226433a708c43d51e143f107bd9c55ad4681039105944c60c7d2b3521

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.4.1-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 706.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.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for copulae-0.4.1-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 912251d67a3a764420bed89bec99c03325fbcd9a550d88caadff66c84ecdc326
MD5 fcaf529c2c9595b115004d1e9e066e6e
BLAKE2b-256 2e29e13df6bb055d122fff7dd42ba58c0f1decdc1a2a0fc96d44f821af8bdc86

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