Skip to main content

Python copulae library for dependency modelling

Project description

Copulae

Probably the second most popular copula package in Python. 😣

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 Anaconda-Server Badge Downloads Anaconda-Server Badge

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 (Permanently in the works 😊)
  • Elliptical Copulas
    • Gaussian (Normal)
    • Student (T)
  • Implement in Archimedean copulas
    • Clayton
    • Gumbel
    • Frank
    • Empirical
    • Joe
    • AMH
    • Rho finding via Cubatures
  • Mixture copulas
    • Gaussian Mixture Copula
    • Generic Mixture Copula
    • Marginal Copula
  • Vine Copulas
  • Copula Tests
    • Radial Symmetry
    • Exchangeability
    • Goodness of Fit
      • Pairwise Rosenblatt
      • Multi-Independence
      • General GOF
    • Model Selection
      • Cross-Validated AIC/BIC

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.7.9.tar.gz (799.1 kB view hashes)

Uploaded Source

Built Distributions

copulae-0.7.9-cp312-cp312-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

copulae-0.7.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

copulae-0.7.9-cp312-cp312-macosx_10_9_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

copulae-0.7.9-cp311-cp311-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

copulae-0.7.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

copulae-0.7.9-cp311-cp311-macosx_10_9_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

copulae-0.7.9-cp310-cp310-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

copulae-0.7.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

copulae-0.7.9-cp310-cp310-macosx_10_9_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

copulae-0.7.9-cp39-cp39-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

copulae-0.7.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

copulae-0.7.9-cp39-cp39-macosx_10_9_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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