Skip to main content

Adaptive Reference-Guided PCA for high-dimension low-sample size data

Project description

argpca: Adaptive Reference-Guided PCA for High-Dimension, Low-Sample Size Data

argpca is a Python implementation of Adaptive Reference-Guided PCA (ARG-PCA),
a method designed for high-dimension, low-sample-size (HDLSS) data when prior information about the true PC subspace is available, proposed in Yoon and Jung (2025).


Why ARG-PCA?

Classical PCA performs poorly in HDLSS settings: the sample PC subspace is inconsistent,
and the principal angles between the sample and true PC subspaces converge to a non-zero
random limit. When prior information is available---such as domain-specific directions
known (or believed) to be aligned with the true PC subspace---ARG-PCA leverages this to
improve estimation accuracy. A representative example is the normalized vector of ones,
often used in financial applications to reflect the common market factor,
as in the capital asset pricing model. The ARG PC subspace estimator asymptotically
outperforms the naive PCA based estimator. ARG-PCA is built based on ARG PC subspace estimator.


Features

  • ARG PC subspace estimator (compute_arg_pc_subspace)
  • ARG-PCA (ARGPCA) with a scikit-learn–compatible API
  • Fast PCA for HDLSS settings via Gram-matrix eigen-decomposition
  • Simulation and real-data examples reproducing the empirical results in Yoon and Jung (2025)

Installation

Clone the repository and install in editable mode:

git clone https://github.com/dsyoonstat/argpca.git
cd argpca
pip install -e .

Quick Start

ARG-PCA

import numpy as np
from argpca.pca import ARGPCA

# X: (n, p) data matrix
# V: (r, p) reference vectors (rows)
X = ...
V = ...

model = ARGPCA(n_components=2)
model.fit(X, reference_vectors=V)

scores     = model.transform(X)     # (n, 2)
components = model.components_      # (2, p)

ARG PC subspace estimator

from argpca.pca import compute_arg_pc_subspace

U_arg = compute_arg_pc_subspace(
    samples=X,
    reference_vectors=V,
    n_components=2,
)

Public API

from argpca import ARGPCA, compute_arg_pc_subspace

# advanced / low-level utilities
from argpca import utils
# or, more explicitly:
from argpca.utils import GramSpectrum, compute_gram_spectrum, recover_spike_directions

Repository Structure

argpca/
 ├── src/argpca/
 │    ├── pca.py               # ARGPCA + subspace logic
 │    ├── utils.py             # GramSpectrum, Gram PCA utilities
 │    └── __init__.py
 │
 ├── examples/
 │    ├── simulation/          # Monte Carlo experiments
 │    │     ├── simulation.py
 │    │     ├── dgps.py
 │    │     └── metrics.py
 │    ├── realdata/            # NASDAQ 2024-12 analysis
 │    │     ├── realdata.py
 │    │     └── *.csv
 │
 ├── tests/                    # pytest unit tests
 └── pyproject.toml

Running the Simulations

To reproduce the simulation results from of the paper, run:

python examples/simulation/simulation.py

Results are stored under:

examples/simulation/results/

Real Data Example (NASDAQ 2024-12)

To reproduce the real data analysis results of the paper, run:

python examples/realdata/realdata.py

This script generates a scatter plot comparing:

  • ARGPCA PC1–PC2 scores
  • Standard PCA PC1–PC2 scores

Saved as:

examples/realdata/nasdaq_2024_12_pc_scores.png

For reference vectors, normalized vector of ones and 2024 mean log-returns were used.


License

This project is released under the MIT License.


Citation

If you use this package in academic work, please cite:

@article{Yoon2025,
  author    = {Yoon, Dongsun and Jung, Sungkyu},
  title     = {Adaptive Reference-Guided Estimation of Principal Component Subspace in High Dimensions},
  journal   = {Stat},
  volume    = {14},
  number    = {3},
  pages     = {e70081},
  year      = {2025},
  doi       = {10.1002/sta4.70081},
  url       = {https://onlinelibrary.wiley.com/doi/abs/10.1002/sta4.70081}
}

Contributing

Pull requests and bug reports are welcome.
Please use GitHub Issues for questions or feature requests.

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

argpca-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

argpca-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file argpca-0.1.0.tar.gz.

File metadata

  • Download URL: argpca-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for argpca-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f455ec6240618492e96b6c143e432d54d2199d09d1261ba779c8d7a8fdbf77f
MD5 28891d598cc5a3b0cc5a00effee23ee4
BLAKE2b-256 38e608a6bd7a81c3fee9280d15fd6e42eb9929cdec97bdc8d5b1f003094c6c78

See more details on using hashes here.

File details

Details for the file argpca-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: argpca-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for argpca-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41c1102bf58456656e7e19eb223f1c0b49d21761393dbfc8c824330833d7f804
MD5 3b06ad731461fc1f7abe9cb470a08e54
BLAKE2b-256 d1938aa9f39fce8ebd1c9cb57e28add2305b975b17152cf1c520f007cd77a154

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