Copula modeling for Python (NumPy) and Rust: vines, pair copulas, and reference-tested pseudo-observation workflows
Project description
rscopulas
rscopulas is a Python package for fitting, evaluating, and sampling copula models on validated pseudo-observations, backed by a Rust core built with PyO3 and maturin.
Install
With uv, in a uv project (recommended):
uv add rscopulas
Optional plotting helpers (viz extra):
uv add "rscopulas[viz]"
If you are not using a uv project, install the same packages as with pip:
uv pip install rscopulas
uv pip install "rscopulas[viz]"
Included models
- Gaussian and Student t copulas
- Archimedean families including Clayton, Frank, and Gumbel
- Pair copulas, including Khoudraji constructions
- C-vine, D-vine, and R-vine copulas
- Hierarchical Archimedean copulas
Python example
import numpy as np
from rscopulas import GaussianCopula
data = np.array(
[
[0.12, 0.18],
[0.21, 0.25],
[0.82, 0.79],
],
dtype=np.float64,
)
fit = GaussianCopula.fit(data)
print("AIC:", fit.diagnostics.aic)
print("sample:\n", fit.model.sample(4, seed=7))
Sampling example
from rscopulas import GumbelCopula
model = GumbelCopula.from_params(2, 2.1)
samples = model.sample(5, seed=11)
print("family:", model.family)
print("samples:\n", samples)
print("log_pdf:\n", model.log_pdf(samples))
Advanced example: fit an R-vine
import numpy as np
from rscopulas import VineCopula
data = np.array(
[
[0.10, 0.14, 0.18, 0.22],
[0.18, 0.21, 0.24, 0.27],
[0.24, 0.29, 0.33, 0.31],
[0.33, 0.30, 0.38, 0.41],
[0.47, 0.45, 0.43, 0.49],
[0.52, 0.58, 0.55, 0.53],
[0.69, 0.63, 0.67, 0.71],
[0.81, 0.78, 0.74, 0.76],
],
dtype=np.float64,
)
fit = VineCopula.fit_r(
data,
family_set=["independence", "gaussian", "clayton", "frank", "gumbel"],
truncation_level=2,
max_iter=200,
)
print("structure kind:", fit.model.structure_kind)
print("order:", fit.model.order)
print("first-tree families:", [edge.family for edge in fit.model.trees[0].edges])
print("sample:\n", fit.model.sample(4, seed=13))
Project links
- Source: https://github.com/alexwox/rscopulas
- Documentation: https://github.com/alexwox/rscopulas/tree/master/docs
- Issue tracker: https://github.com/alexwox/rscopulas/issues
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rscopulas-0.2.1.tar.gz.
File metadata
- Download URL: rscopulas-0.2.1.tar.gz
- Upload date:
- Size: 94.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
956c78b283393900d9f68ee0b74616cdb35839e78805cd757e0cc89da00fc408
|
|
| MD5 |
a3c0f825cde7477b5b86efe903cc10ca
|
|
| BLAKE2b-256 |
f7229ba7a994af8140343922c275f3ba86dc1d1d17c4b47731c76bd7d07092ee
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1.tar.gz:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1.tar.gz -
Subject digest:
956c78b283393900d9f68ee0b74616cdb35839e78805cd757e0cc89da00fc408 - Sigstore transparency entry: 1342985250
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 526.6 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eac0ea65803f753f796ea52091f18e4fd5f78695789880c92336f8b0766fd282
|
|
| MD5 |
f70ff41234807e1dde60d68c71859aad
|
|
| BLAKE2b-256 |
88ccff3ad11ef969bc19ad4b8db9a1b7066537d57799503bd80fd998bf756059
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-win_amd64.whl -
Subject digest:
eac0ea65803f753f796ea52091f18e4fd5f78695789880c92336f8b0766fd282 - Sigstore transparency entry: 1342985311
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 830.4 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec0f16890706ace6f0d891e07cc389c0f470592c10f04717e8f94d84fed3388e
|
|
| MD5 |
4f9195fae09d6b2731f3b7e951270033
|
|
| BLAKE2b-256 |
f0632049ea28a0c394e95b17d56ed1723415349a2cb8cfcabc6f49ebdea2f80d
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
ec0f16890706ace6f0d891e07cc389c0f470592c10f04717e8f94d84fed3388e - Sigstore transparency entry: 1342985280
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 762.4 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4476710e05f4affeef44c834cfa84b4acd287a070c6594f10aae3809c993f40
|
|
| MD5 |
64a1cb1480ee3cc7d4d9b1d1b03da4e5
|
|
| BLAKE2b-256 |
c571e1e420c3afc4f1ce5158c2968038a82696b71af351fcf8de2623baf57746
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
f4476710e05f4affeef44c834cfa84b4acd287a070c6594f10aae3809c993f40 - Sigstore transparency entry: 1342985272
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 620.7 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
087b279156406b805c95c9ad2dbfd72381f166abc38a96e7be8db15d232184a2
|
|
| MD5 |
d2a1e8a4b6e1787a00c06cb7a8ff8be7
|
|
| BLAKE2b-256 |
713a783da0f61550b3843bd96d8db7eb1c9c4ced32551820a42b47f87e7d3e2a
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
087b279156406b805c95c9ad2dbfd72381f166abc38a96e7be8db15d232184a2 - Sigstore transparency entry: 1342985264
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 586.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d28875cdc8be708c226c9559d0afbfda158b334302818eca3979f9cf2c2e704
|
|
| MD5 |
a8c480510c97bc9af72ca356283137f3
|
|
| BLAKE2b-256 |
5402bf5eca2900fea48cf5c9d9de085a75facd7d205cb1fb2b875403b3dc7267
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
3d28875cdc8be708c226c9559d0afbfda158b334302818eca3979f9cf2c2e704 - Sigstore transparency entry: 1342985316
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 568.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66f7110a5b3cbc9bc3d4f711988247f478fa93eabbc2e5b186a986454d1113e3
|
|
| MD5 |
4615c481f9c181dc270e4699b3d44aa8
|
|
| BLAKE2b-256 |
734754f835f9aee05f8cbe282335890a4ef38d62fdf6cafde27725fc5e4e0f54
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
66f7110a5b3cbc9bc3d4f711988247f478fa93eabbc2e5b186a986454d1113e3 - Sigstore transparency entry: 1342985305
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rscopulas-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rscopulas-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 585.7 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b82eeba36b4000152d95bdf981401c626526370711183c3ae92d8d5548352cd
|
|
| MD5 |
5f047129be36dbedb858b3bab6289ce4
|
|
| BLAKE2b-256 |
05504ce492c788d2710167cc5aeff87b0fe7726141c66c87bb61fa8acaee7bdf
|
Provenance
The following attestation bundles were made for rscopulas-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on alexwox/rscopulas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rscopulas-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
2b82eeba36b4000152d95bdf981401c626526370711183c3ae92d8d5548352cd - Sigstore transparency entry: 1342985298
- Sigstore integration time:
-
Permalink:
alexwox/rscopulas@22ee1701fad87a78c14430cc802b0207cd204d8f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alexwox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22ee1701fad87a78c14430cc802b0207cd204d8f -
Trigger Event:
push
-
Statement type: