Metadata-Version: 2.4
Name: sepa-kim
Version: 0.1.0
Summary: Segment Profile Extraction via Pattern Analysis
Author-email: Se-Kang Kim <se-kang.kim@bcm.edu>
License: MIT
Project-URL: Homepage, https://github.com/sekangakim/SEPA
Project-URL: CRAN, https://cran.r-project.org/package=SEPA
Keywords: SEPA,profile analysis,SVD,biplot,ipsatization,parallel analysis,bootstrap,BCa,direction cosines,psychometrics,Woodcock-Johnson,clinical
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Provides-Extra: full
Requires-Dist: pandas>=2.0; extra == "full"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pandas>=2.0; extra == "dev"
Dynamic: license-file

# sepa

**Segment Profile Extraction via Pattern Analysis**

Python port of the [R SEPA package](https://cran.r-project.org/package=SEPA) (CRAN, Kim 2026).

[![PyPI](https://img.shields.io/pypi/v/sepa)](https://pypi.org/project/sepa/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Tests](https://img.shields.io/badge/tests-36%20passing-brightgreen)]()
[![CRAN](https://img.shields.io/badge/R%20package-CRAN-276DC3)](https://cran.r-project.org/package=SEPA)

---

## Overview

SEPA implements SVD-based row-isometric biplot analysis for multivariate profile data.
After ipsatization (row-mean centering), SEPA provides:

- **Plane-fit rho** and **direction cosines** for every person × domain pair
- **BCa bootstrap CIs** for domain loading coordinates
- **Percentile bootstrap CIs** for per-person cosines
- **Parallel analysis** for dimensionality selection

Reference: Kim & Grochowalski (2019) doi:10.1007/s00357-018-9277-7

---

## Installation

pip install sepa

Requirements: Python >= 3.9, numpy >= 1.24, scipy >= 1.10

---

## Quick start

```python
from sepa import run_sepa, fake_wj, SEPA_DOMAINS

# Full pipeline on the built-in WJ-IV look-alike dataset (n=5127)
res = run_sepa(
    fake_wj,
    K=4,
    domain_names=SEPA_DOMAINS,
    target_ids=[724, 944],   # persons for per-person cosine CIs
    B_dom=2000, B_cos=2000,
    pa_B=2000, seed=1,
)

print(res["pa"]["sig_dims"])           # significant dimensions
print(res["sepa_stats"]["rho"].head()) # plane-fit rho
print(res["dom_coords"])               # domain coords with BCa CIs
print(res["cosine_tables"][724])       # person 724 cosine table
```

---

## Lower-level functions

```python
from sepa import (
    parallel_analysis_ipsatized,  # PA for ipsatized data
    sepa_stats_all,               # rho + direction cosines
    percentile_ci_mat,            # percentile CIs from bootstrap matrix
    boot_cis_all,                 # BCa CIs for all statistics
)
```

---

## Built-in dataset

fake_wj is a 5127 x 8 synthetic WJ-IV look-alike dataset (ID + 7 domains):
LT, ST, CP, AP, VP, CK, FR — all in standard score metric (mean~100, SD~15).

```python
from sepa import fake_wj, load_fake_wj, SEPA_DOMAINS
df = load_fake_wj()   # pandas DataFrame version
```

---

## R package

CRAN: https://cran.r-project.org/package=SEPA
GitHub: https://github.com/sekangakim/SEPA

---

## Citation

Kim, S.-K., & Grochowalski, J. H. (2019).
Segment Profile Extraction via Pattern Analysis.
doi:10.1007/s00357-018-9277-7

---

## License

MIT

## Author

Se-Kang Kim, Ph.D.
Baylor College of Medicine / Texas Children's Hospital
se-kang.kim@bcm.edu
