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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

copulae-0.5.1-cp38-cp38-manylinux2010_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

copulae-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl (902.5 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

copulae-0.5.1-cp37-cp37m-manylinux2010_x86_64.whl (2.6 MB view details)

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

copulae-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl (898.0 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.5.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b726e4f661824c93fc87249491af0b56dba30b58af633e82459405d340d16aea
MD5 242ab66315b9eb0b2ea70621f14d3bfc
BLAKE2b-256 86a430fe6ae7fce7cb311e812fa567d6337dc0853cba318098af04fb9cd961d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.1-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/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c7abff2be7d2cc6d864b3fbb3fc0cf158fd89ec9ee6f3c9de5cc4452a5dd8ef1
MD5 b4fa0d62ccbe04a39f3464114e1bd19c
BLAKE2b-256 767ff8afc996784771f826c41b9bfad381079b9cacd10e44b77e55b6b1c85593

See more details on using hashes here.

File details

Details for the file copulae-0.5.1-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: copulae-0.5.1-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2c1cda10e100225c8599ef5de205ce91181fce217028c061c92ee3f6a7c5c530
MD5 10430dc5515af7469fe30b5d55b4610e
BLAKE2b-256 5d69346dcd7ee2a0f87572828437703785b684a958f28c40f65c5b23f81db958

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 902.5 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for copulae-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 985ab64fcdf620cac8cb37b1ae96a02652f4f8d97ec8da820fc41f5a2873d6c6
MD5 852f7ecbb2140df89730278b75192d03
BLAKE2b-256 42c1cc009a968921780cadc1b688593616fab4692452dee0c95656ce61bbd567

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.1-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8a71cb7b78e2e166562bce52b86e1b5eb19853a23844ce4f240e9f631a298540
MD5 7562aab8222dd4c43da923ece57868f0
BLAKE2b-256 d7f9dadc524dcb5444da7488cc8ea17122f49fe76bd36e51545c4a73d0d26b11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.1-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 418b36b4dfd665b46278017512ca84ecf3707193ec6661b9989d27de3fdaee6b
MD5 bd9e88160651affa9428c4efce752d3a
BLAKE2b-256 eb057f856cd0714f210fa7820969f9fe9ef20d30f199d4bda6fbaa82d053e5e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 898.0 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for copulae-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 34ca356f46adb86c4dc7d8782f5ea485a177576f8423cd9503fe36d5c1eb191d
MD5 ef9fff002d28dc6d3d7516eac4c06f5b
BLAKE2b-256 6a58049bdd603415ab63fa77fa6da23bad2ac3af03d58d29d87b2dba49cde91d

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