Skip to main content

apatools: a toolbox for statistical analysis and APA-compliant reporting

One convenient interface to the most common tools: apatools wraps statsmodels, spreg, linearmodels, semopy and psmpy and, optionally, the R packages lavaan, plm, splm and spdep, and returns tidy tables with the statistics a manuscript needs, together with the specification tests, effect conversions and reliability coefficients that go with them.

What sets it apart: no method is just linked to an engine and trusted. Methods are benchmarked against independent references (mostly R packages, otherwise the definition itself), and the documentation discloses the design decisions behind every module, its caveats, and where and why the numbers differ from R; the few methods without a benchmark are marked as such.

Install

pip install apatools                # calc and format: numpy and scipy only
pip install "apatools[lm,plm]"      # extras per module; "apatools[all]" installs everything

Python 3.10 or newer; the development version: pip install git+https://github.com/ellariel/apatools.git. Importing a module without its extra gives an ImportError that names the extra to install.

extra module brings in
(none) calc, format numpy, scipy
lm lm pandas, statsmodels
slm slm pandas, statsmodels, spreg, libpysal
plm plm pandas, spreg, libpysal, patsy
sem sem pandas, semopy
psm psm pandas, psmpy
lib lib pandas, scipy, statsmodels
linearmodels plm with the linearmodels backend the plm extra and linearmodels
graphviz / networkx sem_plot diagrams with Graphviz / with networkx and matplotlib the sem extra and the drawing packages
docs building the documentation sphinx, furo, myst-parser

Three engines run in R (sem(engine="lavaan"), sem_plot(engine="lavaan"), plm(backend="splm")): install R and, in R, install.packages(c("lavaan", "semPlot", "plm", "splm", "spdep")). Rscript is found on the PATH, in the usual install locations, through the environment variable APATOOLS_RSCRIPT or the argument rscript.

A first look

from apatools.lm import lm, lm_report, lm_tests
from apatools.plm import plm, plm_report, plm_tests, plm_effects

results, metrics = lm(data, "y", ["x1", "x2"], model=["ols", "rlm"])
print(lm_report(results, metrics))                              # APA table: b, SE, t, p, stars, CI, fit line
print(lm_tests(results, format_pval=True, decimal=3))           # diagnostics that suit each kind of model

results, metrics = plm(panel, "y", ["x1", "x2"], w=w, entity="county", time="year",
                       model=["pooled", "fe", "re", "slm_fe"], effects="twoway")
print(plm_report(results, metrics))
print(plm_tests(results))                                       # Hausman, Mundlak, F and LM tests
print(plm_effects(results))                                     # direct, indirect and total effects

What is in it

module does
apatools.calc conversions between r, d, t, z, F, p, odds ratios; confidence intervals
apatools.format APA formatting of p-values, correlations and stars
apatools.lm OLS, RLM, GLM, QuantReg, MixedLM (statsmodels): tables and diagnostic tests
apatools.slm OLS, spatial lag and error models (spreg): tables, spatial diagnostics, direct / indirect / total effects
apatools.plm pooled, FE, RE panel models, optionally spatial (spreg, linearmodels, R's plm / splm): tables, specification tests, effects
apatools.sem structural equation models (semopy, lavaan), reports, path diagrams (Graphviz, networkx, semPlot)
apatools.psm propensity score matching (psmpy) and covariate balance
apatools.lib bootstrap, Cronbach's alpha, McDonald's omega (robust, bifactor), Fleiss' kappa, Krippendorff's alpha, correlations, HTMT, Gini

Documentation

The documentation is at ellariel.github.io/apatools (GitHub Pages, built from the main branch). Its source is in docs/ (Sphinx; build it locally with pip install -e ".[all,docs]" and sphinx-build -W -b html docs docs/_build/html):

  • a user-guide page per module, each with the design choices and caveats of the module and where it differs from R;
  • the validation overview: what was compared with what, and where apatools intentionally does not mirror R;
  • the software page (what to cite for each engine), and the literature at the end of each module page;
  • the API reference, generated from the docstrings, and the changelog.

Citing

If you use apatools, please cite it (see CITATION.cff; GitHub offers the formatted citation under "Cite this repository"; the package is on PyPI) and, as the numbers come from the engines, also the software that produced them: the software page of the documentation says what to cite for each engine. Report the version you used (apatools.__version__).

License

MIT, see LICENSE.

Metadata

Release files for apatools 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apatools 0.3.0
File Size Uploaded Provenance Actions
apatools-0.3.0.tar.gz 234.4 kB With provenance Details for apatools-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apatools 0.3.0
File Interpreter ABI Platform Actions
apatools-0.3.0-py3-none-any.whl Python 3 none any Details for apatools-0.3.0-py3-none-any.whl

Total release size: 384.4 kB

Release files / apatools-0.3.0.tar.gz

Download URL apatools-0.3.0.tar.gz
Size 234.4 kB
Tags Source
SHA-256 checksum
How to use checksums
833d01d6fd152b16396c22f662c7523b27f219a5c8c5e30aa0ad6349543a2e9b
BLAKE2b-256 checksum
How to use checksums
ec94a41c1c2b7ba72c25756fade31b3efff0b9f5d5330729b774858f3c7fce68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / apatools-0.3.0-py3-none-any.whl

Download URL apatools-0.3.0-py3-none-any.whl
Size 150.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db8668c079d619d6de372837e94e85f521ce26e02ace4911c6aa80045e3646e4
BLAKE2b-256 checksum
How to use checksums
5e42f6a288359ce2db38d4cfca1dd727ce3bb19ac2644244d7990d3d7255a8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for apatools 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for apatools-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page