Skip to main content

Factor Analytic Profile Analysis of Ipsatized Data

Project description

fapa

Factor Analytic Profile Analysis of Ipsatized Data

Python port of the R FAPA package (CRAN, Kim 2026).

PyPI License: MIT Tests CRAN


Overview

FAPA is a metric inferential framework for pattern detection and person-level reconstruction in multivariate profile data. After row-centering (ipsatization) to remove profile elevation, FAPA applies SVD to recover shared core profiles and individual pattern weights via a three-stage bootstrap verification framework.

The FAPA workflow

  1. Ipsatization - remove person-level elevation to isolate within-person pattern structure
  2. Core estimation - SVD recovers core profiles, person weights, and variance decomposition
  3. Stage 1: Dimensionality - variance-matched Horn's parallel analysis
  4. Stage 2: Subspace stability - bootstrap principal angles (Procrustes)
  5. Stage 3: Profile replicability - Tucker's congruence coefficients
  6. Inference - BCa bootstrap confidence intervals for core-profile coordinates
  7. Reconstruction - person-level R2 and pattern weights

Installation

pip install fapa

For pandas support: pip install "fapa[full]"

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


Quick start

from fapa import (load_and_ipsatize, fapa_core, fapa_pa,
                  fapa_procrustes, fapa_tucker, fapa_bca,
                  fapa_person, print_pa, print_procrustes,
                  print_tucker, fapa_simdata)

# Step 1: Ipsatize
d = load_and_ipsatize(fapa_simdata)
Xt = d["ipsatized"]          # 500 x 22 EDI-2 matrix, row-sums = 0

# Stage 1: Parallel analysis
pa = fapa_pa(Xt, B=2000, seed=42)
print_pa(pa)
K = pa["n_retain"]           # e.g. 2

# Core estimation
fit = fapa_core(Xt, K=K)
print(f"Variance explained: {fit['cum_var'][-1]*100:.1f}%")

# Stage 2: Subspace stability
pr = fapa_procrustes(Xt, K=K, B=2000, angle_thresh=30, seed=42)
print_procrustes(pr, K_pa=K)

# Stage 3: Profile replicability
tc = fapa_tucker(Xt, K=K, B=2000, cc_thresh=0.85, seed=42)
print_tucker(tc, cc_thresh=0.85, K_pa=K)

# BCa confidence intervals
bca = fapa_bca(Xt, K=K, B=2000, alpha=0.05, seed=42)
print(bca["ci"][0].round(3))   # Core Profile 1 CI table

# Person reconstruction
person = fapa_person(Xt, fit, participants=[0, 1, 2])
print(f"Mean R2 = {person['R2_mean']:.3f}")

Built-in dataset

fapa_simdata is a 500 x 22 matrix of simulated EDI-2 (Eating Disorder Inventory-2) subscale scores, with 11 pre-treatment and 11 post-treatment columns. The latent structure approximates two components: a normative symptom gradient (CP1) and a pre/post treatment change contrast (CP2).

from fapa import fapa_simdata, FAPA_COLS, FAPA_PRE_COLS, FAPA_POST_COLS
print(fapa_simdata.shape)    # (500, 22)
print(FAPA_PRE_COLS[:3])     # ['Before_1_Dt', 'Before_2_Bu', 'Before_3_Bd']

R package

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


Citation

Kim, S.-K. (2024). Factorization of person response profiles to identify summative profiles carrying central response patterns. Psychological Methods, 29(4), 723-730. doi:10.1037/met0000568


License

MIT

Author

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

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

fapa-0.1.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

fapa-0.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fapa-0.1.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for fapa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ab3fa28b1c6d217a19ced24fce17ad5486b37dd3750cc0e4b77efebf87dcc1d
MD5 15c0851f0eec1beeb8bf05cb3869dba8
BLAKE2b-256 65ef53ba6555597e5f07381836390ef143e4e65e1f8f32f906543f7cec6f6999

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fapa-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for fapa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ac892bb46990ee574be7fb58eb2f95b327e9f5c60972946cf874d13b21b073a
MD5 b652b8facca09e9a928c14a99b6ad81b
BLAKE2b-256 7a78606a7e3d68b99914d6151369ac9ed7416b1f423fc4f5bcb699f35cc566e5

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