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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m

File details

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

File metadata

  • Download URL: copulae-0-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-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c92aa1c2a6d45b920054c535d6a0317e5bae30e85bcbafd0784d53d3f29a1914
MD5 a8452b85ea6669ae9d0ded8268dca1db
BLAKE2b-256 c9af49792519a80c07885bb5508c10e90d5198beb157e9e2cdde3f8226f9ffa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m
  • 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-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a262de3c057b42b2b165eabb8aa8d89f6047cc361206929866a437139aac6115
MD5 85be76b493037997b41ce152e58ab3dc
BLAKE2b-256 fee0c48a6b7b8589b129fa52f1ff61be25adac99172c7f0ff93d646ded502380

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