Python implementation of Checkerboard Copula Regression-based Visualization and Association Measure
Project description
ccrvam
Python implementation of Checkerboard Copula Regression-based Visualization and Association Measure (CCRVAM)
Overview
CCRVAM is a Python package for analyzing associations between categorical variables using Checkerboard Copula Regression. It provides tools for:
- Construction of CCRVAM objects from three forms of categorical data (case form, frequency form, table form)
- Calculation of marginal distributions and CDFs of categorical variables
- Computation of Checkerboard Copula Regression (CCR), its Prediction and Visualization
- Implementation of Checkerboard Copula Regression Association Measure (CCRAM) and Scaled CCRAM (SCCRAM)
- Bootstrap functionality for CCR-based prediction, CCRAM and SCCRAM
- Permutation testing functionality for CCRAM & SCCRAM
- Vectorized implementations for improved performance
- Rigorous Edge-case Handling & Unit Testing with Pytest
Authors
- Dhyey Mavani
- Daeyoung Kim
- Shu-Min Liao
Installation
Usage in Jupyter Notebook:
This package (ccrvam) is hosted on PyPi, so for installation add the following line at the top of your Jupyter notebook!
%pip install --upgrade ccrvam
Now, you should be all set to use it in a Jupyter Notebook!
Note: You might need to restart your kernel after installation in order to use the package. This is because of the way Jupyter handles package installations.
Usage in a Software Project Through Terminal (Virtual Environment):
Alternatively, if you would like to use it in a project, we recommend you to have a virtual environment for your use of this package, then follow the following workflow:
- First, create and activate a virtual environment (Python 3.10+ recommended):
# Create virtual environment
$ python -m venv ccrvam-env
# Activate virtual environment (Mac/Linux)
$ source ccrvam-env/bin/activate
# Verify you're in the virtual environment
$ which python
- Install package
$ pip install ccrvam
- To deactivate the virtual environment, when done:
$ deactivate
Documentation Structure
Visit Read the Docs for the full documentation, including overviews and several examples.
Examples
For detailed examples in Jupyter Notebooks and beyond (organized by functionality) please refer to our GitHub repository's examples folder.
Project Structure
This diagram illustrates the main components of the ccrvam package. Understanding this structure can help package users and developers navigate the codebase, locate specific functionalities (like data processing in utils.py or the core CCRVAM logic in genccrvam.py), and understand how different modules interact. The examples/ and tests/ directories provide practical usage scenarios and verification tests, respectively.
graph TD
A[ccrvam] --> B[checkerboard]
B --> B1[genccrvam.py<br/>GenericCCRVAM]
B --> B2[genstatsim.py<br/>Bootstrap/Permutation]
B --> B3[utils.py<br/>DataProcessor]
A --> F[docs/]
B1 --> F
B2 --> F
B3 --> F
A --> D[examples/]
A --> E[tests/]
E --> E1[test_genccrvam.py]
E --> E2[test_genstatsim.py]
E --> E3[test_utils.py]
User Workflow Overview
This flowchart outlines the typical steps involved when using the ccrvam package, from loading data to performing analyses like calculating CCRAM or generating predictions, and utilizing bootstrap/permutation functionalities. It provides a high-level view of how different functions connect and the expected data flow through the package.
flowchart TD
A[Raw Data / File Input] --> B[DataProcessor.load_data]
B --> C[Contingency Table]
C --> D[GenericCCRVAM.from_contingency_table]
C --> E[GenericCCRVAM.from_cases]
D --> F[GenericCCRVAM Instance]
E --> F
F --> G[calculate_CCRAM]
F --> H[get_predictions_ccr]
F --> I[plot_ccr_predictions]
F --> J[calculate_ccs]
F --> K[get_prediction_under_indep]
C --> L[bootstrap_ccram]
C --> M[permutation_test_ccram]
C --> N[bootstrap_predict_ccr_summary]
L --> O[CustomBootstrapResult]
M --> P[CustomPermutationResult]
N --> Q[Predictions Summary]
Q --> R[plot_prediction_heatmap]
Q --> S[save_predictions]
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation Guide
When using this package in your research, please follow these citation guidelines:
Software Citation
For citing the software package itself, use:
@software{ccrvam2025,
author = {Mavani, Dhyey and Kim, Daeyoung and Liao, Shu-Min},
title = {ccrvam: Checkerboard Copula Regression-based Visualization and Association Measure},
year = {2025},
publisher = {GitHub},
url = {https://github.com/DhyeyMavani2003/ccrvam}
}
Method Citations
For citing the underlying methodology, please cite both papers:
@article{wei2021exploratory,
title={On exploratory analytic method for multi-way contingency tables with an ordinal response variable and categorical explanatory variables},
author={Wei, Zheng and Kim, Daeyoung},
journal={Journal of Multivariate Analysis},
volume={186},
pages={104793},
year={2021},
publisher={Elsevier},
doi={10.1016/j.jmva.2021.104793}
}
@incollection{liao2024visualization,
title={Visualization of Dependence in Multidimensional Contingency Tables with an Ordinal Dependent Variable via Copula Regression},
author={Liao, Shu-Min and Wang, Li and Kim, Daeyoung},
booktitle={Dependent Data in Social Sciences Research: Forms, Issues, and Methods of Analysis},
edition={Second},
editor={Stemmler, Mark and Wiedermann, Wolfgang and Huang, Francis L.},
publisher={Springer New York LLC},
pages={517--538},
year={2024}
}
Citation in Text
When referring to the methodology in your text, you can use:
- For the original methodology: "Wei and Kim (2021) proposed the Checkerboard Copula Regression..."
- For the visualization extension: "Liao et al. (2024) extended the methodology to include visualization capabilities..."
1. Zheng Wei and Daeyoung Kim (2021). On exploratory analytic method for multi-way contingency tables with an ordinal response variable and categorical explanatory variables. *Journal of Multivariate Analysis*, 186, 104793. https://doi.org/10.1016/j.jmva.2021.104793
2. Shu-Min Liao, Li Wang, Daeyoung Kim (2024). Visualization of Dependence in Multidimensional Contingency Tables with an Ordinal Dependent Variable via Copula Regression. In *Dependent Data in Social Sciences Research: Forms, Issues, and Methods of Analysis*, Second edition, Mark Stemmler, Wolfgang Wiedermann, and Francis L. Huang, eds. Springer New York LLC, pp. 517-538
Version Information
When citing specific versions of the software, please include the version number and DOI (if available) in your citation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 ccrvam-1.2.1.tar.gz.
File metadata
- Download URL: ccrvam-1.2.1.tar.gz
- Upload date:
- Size: 72.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0af8885df1f30b769be83c880505707990bfb1fce604d41cf9ca7b599f6a7d2e
|
|
| MD5 |
1b8a53fd5d328dacad9b389a88a9735a
|
|
| BLAKE2b-256 |
45608513a58d0b833e3219ef721c1d6a922f4ba47100b204e373c8270cab103e
|
Provenance
The following attestation bundles were made for ccrvam-1.2.1.tar.gz:
Publisher:
publish.yml on DhyeyMavani2003/ccrvam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccrvam-1.2.1.tar.gz -
Subject digest:
0af8885df1f30b769be83c880505707990bfb1fce604d41cf9ca7b599f6a7d2e - Sigstore transparency entry: 772007632
- Sigstore integration time:
-
Permalink:
DhyeyMavani2003/ccrvam@95ad6d3cac26ad424233102fe4cec55ad3172a8d -
Branch / Tag:
refs/tags/v1.2.1-hotfix - Owner: https://github.com/DhyeyMavani2003
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95ad6d3cac26ad424233102fe4cec55ad3172a8d -
Trigger Event:
release
-
Statement type:
File details
Details for the file ccrvam-1.2.1-py3-none-any.whl.
File metadata
- Download URL: ccrvam-1.2.1-py3-none-any.whl
- Upload date:
- Size: 69.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b942e3b7d5a9d3191988c104632d7485590d64730af045a4d1e01b2e4ecb212
|
|
| MD5 |
0f73bc9d3546fa1f40408721d43f45e6
|
|
| BLAKE2b-256 |
3a2e64e866c055fea8b8442f8137b74621ddc26ad15d5dde0d120d9ef843c64e
|
Provenance
The following attestation bundles were made for ccrvam-1.2.1-py3-none-any.whl:
Publisher:
publish.yml on DhyeyMavani2003/ccrvam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccrvam-1.2.1-py3-none-any.whl -
Subject digest:
6b942e3b7d5a9d3191988c104632d7485590d64730af045a4d1e01b2e4ecb212 - Sigstore transparency entry: 772007633
- Sigstore integration time:
-
Permalink:
DhyeyMavani2003/ccrvam@95ad6d3cac26ad424233102fe4cec55ad3172a8d -
Branch / Tag:
refs/tags/v1.2.1-hotfix - Owner: https://github.com/DhyeyMavani2003
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95ad6d3cac26ad424233102fe4cec55ad3172a8d -
Trigger Event:
release
-
Statement type: