Reliability, factor analysis and SEM for psychologists with an R-like API
Project description
psymetrics
Reliability, factor analysis and SEM for psychologists, with an R-like functional API. Part of the ANOVA Methods family (psystats, psymetrics, psyreport).
Free and open (MIT). Results print R-style summaries and render to APA-7 through
psyreport.report().
Install
pip install psymetrics
What's inside
Reliability — alpha (Cronbach's alpha with the Feldt confidence interval,
corrected item-total correlations, alpha-if-dropped, reverse keying), like
psych::alpha.
Factorability — kmo (Kaiser-Meyer-Olkin, overall and per item) and bartlett
(test of sphericity).
Exploratory factor analysis — efa with selectable estimator (minres, ml,
principal) and rotation (varimax, promax, oblimin, quartimax, ...);
returns loadings, communalities, eigenvalues, variance explained, and the factor
correlation matrix for oblique rotations.
Confirmatory factor analysis and SEM — cfa using lavaan-style syntax;
returns standardized loadings and the usual fit indices (χ², df, p, CFI, TLI,
RMSEA).
Example
import pandas as pd
from psymetrics import alpha, kmo, efa, cfa
df = pd.read_csv("scale.csv")
items = df[[f"q{i}" for i in range(1, 11)]]
print(alpha(items)) # like psych::alpha
print(kmo(items)) # sampling adequacy
print(efa(items, 3, method="minres", rotation="promax"))
model = """
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
"""
print(cfa(model, df)) # lavaan-style CFA
EFA is validated against factor_analyzer and CFA fit indices against semopy.
Note:
factor_analyzer(0.5.x) requiresscikit-learn < 1.6; this pin is declared as a dependency soefaworks out of the box.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file psymetrics-0.1.0.tar.gz.
File metadata
- Download URL: psymetrics-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a88f58259e38aac6e98c995a75d6594d727e0b44f0de954f7110275a2a9e2ae4
|
|
| MD5 |
a43dad0b783c7a1b76bd35b3a46ac8f5
|
|
| BLAKE2b-256 |
b29f0324b0fab07461d121eac4df7c8a43648c0e4084dd2ec52838d41cd48b87
|
File details
Details for the file psymetrics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: psymetrics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c7e18e582b08c08e6140442158c42004717710fb4373cfe33465d9bf2e30980
|
|
| MD5 |
0d80d768bb3d849207d46ba7e3af8d16
|
|
| BLAKE2b-256 |
050d611efe72c0fd44dbe4e5349e829f7ec98b375251746f2098a6581ec08b20
|