Skip to main content

Python copulas library for dependency modeling

Project description

Build Status

Screenshot

PyCopula is an easy-to-use Python library that allows you to study random variables dependencies with copulas. It comes with useful tools and features to plot, estimate or simulate on copulas.

Installation

Installation via pip always offers you the last stable version of the package.

pip install pycopula

However, if you are looking for latest updates, consider installation directly from sources.

git clone https://github.com/MaximeJumelle/pycopula.git
cd pycopula
python setup.py install

Features

PyCopula natively handle various families of copulas including :

  • Archimean Copulas
    • Clayton
    • Gumbel
    • Joe
    • Frank
    • Ali-Mikhail-Haq
  • Elliptic Copulas
    • Gaussian
    • Student

Estimation

Three methods of estimation, based on SciPy numerical optimization routines, are available to provide high flexibility during fitting process.

  • Moments estimation on particular copulas
  • Maximum Likelihood Estimation (MLE)
  • Inference For Margins (IFM)
  • Canonical Maximum Likelihood Estimation (CMLE)

Usage

PyCopula was designed to provide an easy-to-use interface that does not require a lot in both programming and computing. As a result, only a few lines are needed to properly fit any copulas, as demonstrated in the following code snippet.

import pandas as pd
from pycopula.copula import ArchimedeanCopula

data = pd.read_csv("data/classic.csv").values[:,1:]

archimedean = ArchimedeanCopula(family="gumbel", dim=2)
archimedean.fit(data, method="cmle")
Archimedean Copula (gumbel) :
*	Parameter : 1.605037

Visualization

3D PDF and CDF

Screenshot

Concentration Functions

Screenshot

Estimation

Simulation

Screenshot

Development

Currently, there are only a few features implemented in the library, which are the basics components for copula handling :

  • Creating Archimedean, Gaussian and Student copulas
  • 3D plot of PDF and CDF
  • Concentration functions and visualization
  • Estimation of copulas parameters (CMLE, MLE, IFM)

In the future, I plan to release the following features :

  • Goodness-of-fit
  • Copula selection with criterions and statistical testing
  • Examples of applications in real world with open data

Also, if you are interested in the project, I would be happy to collaborate with you since there are still quite a lot of improvements needed (computation, estimation methods, visualization) and that I don't have enough time on my hands to do it quickly.

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

pycopula-0.1.5.linux-x86_64.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

pycopula-0.1.5-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file pycopula-0.1.5.linux-x86_64.tar.gz.

File metadata

  • Download URL: pycopula-0.1.5.linux-x86_64.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for pycopula-0.1.5.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 68fad62f254707aae037d34832785f7322272aa193e5ccc7318a1aa3ad714e6a
MD5 9eb874bf52282d4729b2e9bcfdd0e201
BLAKE2b-256 ad85f8539e7338592522f8a5bef9b89a2cde009c93b4f38959d7e1d23635e70d

See more details on using hashes here.

File details

Details for the file pycopula-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pycopula-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for pycopula-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2270c82e4198597acd36cc17b2e4b4e70ba03c3055cb98c1bd0ddf8e47157f9d
MD5 a675c0976ea0bef38b37a4a956fb6b6e
BLAKE2b-256 965be275588c5aad08daa1a85517c3500b0ab20a948a2a3495300c1366ce5c3f

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