Skip to main content

A package for multiPCA

Project description

multipca

A Python package for Multi-way Principal Component Analysis (Multiway PCA) with confidence intervals.

Citation

If you use this package in your research, please cite:

@article{ouyang2023multiway,
  title={On the Multiway Principal Component Analysis},
  author={Ouyang, Jialin and Yuan, Ming},
  journal={Annals of Statistics (to appear)},
  year={2023},
  url={https://arxiv.org/abs/2302.07216}
}

Installation

Requires Python ≥ 3.9. We recommend using a virtual environment:

# Create and activate virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`

# Install package
pip install multipca

Quick Start

The package includes an example Citibike dataset that demonstrates multiway PCA analysis of bike sharing patterns in NYC. Here's how to get started:

import multipca
import matplotlib.pyplot as plt

# Load the example Citibike data (shape: 24 hours × 35 stations × 522 days)
array = multipca.load_citibike_example()

# MPCA with confidence intervals
results = multipca.mpca_CI(array, r=4)

# Plot the first component's daily pattern with confidence bands
multipca.CI_band_plot(results, rank=1, mode=1)
plt.show()

# If you only need components without confidence intervals
components = multipca.mpca(array, r=4)

For more examples including World Bank economic indicators analysis, check out examples/citibike_worldbank.ipynb in the GitHub repository.

Documentation

Full documentation is available in the GitHub repository.

Examples

Check out the example notebook for:

  • Detailed usage examples
  • Plotting functions
  • Real-world applications with Citibike and World Bank data

Features

  • Multiway PCA implementation
  • Confidence intervals for components
  • Visualization tools:
    • Component plots with confidence bands
    • Loading plots

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

multipca-0.1.1.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multipca-0.1.1-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file multipca-0.1.1.tar.gz.

File metadata

  • Download URL: multipca-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for multipca-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1fb4daca867c19cae967a929e4d91d0ef48d3b3332539c1230fbf98e229ab70f
MD5 6dfedd6d5e3d1279ecab733fba4fdcb2
BLAKE2b-256 a077bfc917ae97177e3773bf5a0d518f622e3fbdf1831d263918a0cfd5b858e9

See more details on using hashes here.

File details

Details for the file multipca-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: multipca-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for multipca-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1054d1c9eb0358296305c149d358bd2e129b9fbd3aacb2b1bab0ca7620855d4a
MD5 fc1553f20b368e0410f185cb26530130
BLAKE2b-256 4bf28030d9398d8411f2d0c2fe9c6dd697d222baf4205d6ed17c6bfae6ab9905

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page