A Python package for Multivariate Convergent Cross Mapping (CCM) analysis of time series data. This implementation combines traditional CCM with multivariate analysis capabilities to identify causal relationships between multiple time series.
- Multivariate CCM analysis
- Support for both synthetic and real data
- Time series prediction with validation
- Automated visualization of results
- Comprehensive metric calculations
- Flexible configuration system
ccmMul/
├── config/
│ └── config.json # Configuration parameters
├── data/
│ └── sample_data.csv # Sample or user data
├── src/
│ ├── __init__.py # Package initialization
│ ├── analysis.py # Main analysis functions
│ ├── multivariate_ccm.py # Core CCM implementation
│ ├── plotting.py # Visualization functions
│ └── utils.py # Utility functions
├── plots/ # Generated plots
├── results/ # Analysis results
├── README.md
├── LICENSE
└── main.py # Main execution script
- Clone the repository:
git clone https://github.com/ShrathSPhD/ccmMul.git
cd ccmMul
- Install required packages:
pip install -r requirements.txt
Modify config/config.json
to customize the analysis:
{
"data": {
"type": "synthetic", // or "file"
"file_path": "data/sample_data.csv",
"datetime_column": "datetime",
"columns_to_keep": ["x", "y", "z"]
},
"analysis": {
"embedding_dimension": 3,
"tau": -1,
"train_size_ratio": 0.75
}
}
- For synthetic data:
python main.py
- For your own data:
- Place your CSV file in the
data/
directory - Update
config.json
with appropriate settings - Run
python main.py
The analysis generates three types of output:
-
Plots (
plots/
directory):- Correlation bar plots for variable combinations
- Time series plots of actual vs predicted values
-
Results (
results/
directory):- Metrics summary (correlations, MAE, RMSE)
- Detailed predictions
- Variable combination analysis
-
Console output:
- Analysis progress
- Summary statistics
- File save locations
Multivariate CCM Analysis
========================
Analyzing x as target variable...
Best combination results:
Variables: ('y', 'z')
Correlation (rho): 0.976
MAE: 0.167
RMSE: 0.216
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Python 3.8+
- numpy
- pandas
- scikit-learn
- matplotlib
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this code in your research, please cite:
@software{ccmMul2024,
author = Sharath S,
title = {Multivariate CCM Analysis},
year = {2024},
publisher = {GitHub},
url = {https://github.com/SharathSPhD/ccmMul}
}
Project Link: https://github.com/ShrathSPhD/ccmMul