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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

copulae-0.5.2-cp38-cp38-manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

copulae-0.5.2-cp38-cp38-manylinux1_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.8

copulae-0.5.2-cp38-cp38-macosx_10_9_x86_64.whl (902.6 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

copulae-0.5.2-cp37-cp37m-manylinux2010_x86_64.whl (2.1 MB view details)

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

copulae-0.5.2-cp37-cp37m-manylinux1_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.7m

copulae-0.5.2-cp37-cp37m-macosx_10_9_x86_64.whl (898.1 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: copulae-0.5.2.tar.gz
  • Upload date:
  • Size: 753.5 kB
  • 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.2.tar.gz
Algorithm Hash digest
SHA256 20e650bd59bf869c5b173daf398ea823f59c5f0d732c8eb0044ae0d9225485b1
MD5 c24c228cf3d2146ffea06b06c0b4b8d7
BLAKE2b-256 f5ac5156518c74e3d30df8e1a989b4bb4987b7875618081563490e1db2836d47

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 66dcd67e9ca71cbec8a872793fb2c303251555c4d57301a3195e78a9cd5319c7
MD5 a49a1f4807c739d10b1a7b9c1431204a
BLAKE2b-256 faec6c9021e98836bbeccc67d93f1a2ccc9be95df2e12219b5b84486656bded8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.1 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.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b4aa1fdb3311f5a9212269692c1bcb19e0172a99e601f579b4ec82b5effd4db6
MD5 64011118262b4e033772dcf65989a1fc
BLAKE2b-256 f96c726a8b4e60e6d81c19792f3ccdcca00e2aeff6a4d343bfb79ebcd0d5b14a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.1 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/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 19962c8c0905be7bea8c5eadfdee8a2e113f5a372248f2940246af9e368d1c50
MD5 65e50d4489687042c8192ecee2dd78d2
BLAKE2b-256 359a41a3a920fa38662c44be6881781e687f58182f92840687e87cbca7453a92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 902.6 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.23.0 setuptools/46.0.0.post20200311 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for copulae-0.5.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4594092bf0037873ae9b628075e0278486cdff21f6d9816c85e2181e6a93c714
MD5 c9e1f4f96c5a5e4567bbc90a07998f53
BLAKE2b-256 5cec3ed32e7f5f99d644b800cfebf8e1b70b5e731a6a90db3584e791a02f3e56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-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.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f58265f9d3eebf364f0a2c9f25b263b1054cb7110b27192cb7c742f2a449583b
MD5 4c223004b0ddb7558a672680a19b7753
BLAKE2b-256 0a0b4fc710cb0f84100b934240ac719a58d42ad4e9623846fb60bfb82400d5f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.1 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.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e80ae9d3eb6b96d5caed367a2420a619ab8c7c00a661f7b356fc9dcb862164e2
MD5 b24f7d4da7b1c3c6192fa036612f42ee
BLAKE2b-256 df64ba4b8dbc6ad19bf28f266211869b4572b1e9c51d871cc63518e8f07e81e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.1 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/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c75dc8d50fec7fb79426f23d70269d30beed9ebea62aa74a45d53e539a143aa7
MD5 3c9c256ed7ef49a29c6131f258115076
BLAKE2b-256 400c97738b1c4bcb6a9cf7d3f8d310c1c475fea99f4303a3bfe0df32705e5bda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copulae-0.5.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 898.1 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.23.0 setuptools/46.0.0.post20200311 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for copulae-0.5.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 92603aaa2a5f3f793feae03262630ee50c2c9b4cb26b44884a09b59e4eef9fd9
MD5 1a7f86d82d38ccf6231b783e3864e25d
BLAKE2b-256 22f15ecb0defe1ac96542bd086d7f7a7e636df15371552716cdb0327889de475

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