Skip to main content

Basic statistics and biostatistics for psychologists with an R-like API

Project description

psystats

Basic statistics and biostatistics for psychologists, with an R-like functional API. Part of the ANOVA Methods family (psystats, psymetrics, psyreport).

Free and open (MIT). Every function returns a result object that prints an R-style summary and can be handed to psyreport.report() for APA-7 output.

Install

pip install psystats

What's inside

Descriptives and tables — describe, freq, corr_matrix (correlation matrix with significance stars), and table1 (group comparison with automatic test selection by variable type and distribution).

Inferential tests with effect sizes — ttest (Cohen's d), anova (η² and ω²), chisq (Cramér's V).

Regression — linreg (OLS with standardized betas, R²/adjusted R², F test) and logreg (odds ratios with confidence intervals, McFadden pseudo-R²).

Risk factors — riskratio, oddsratio, and attributable_risk (risk difference with CI, attributable risk percent, population attributable risk and PAR%, number needed to treat).

Example

import pandas as pd
from psystats import table1, corr_matrix, linreg, riskratio, attributable_risk

df = pd.read_csv("study.csv")

print(table1(df, group="condition"))            # auto t-test / chi-square / etc.
print(corr_matrix(df, ["age", "score", "rt"]))  # r with * significance stars
print(linreg(df, "score", ["age", "condition"]))

rr = riskratio(df, exposure="smoker", outcome="disease", exposed=1, positive=1)
ar = attributable_risk(df, exposure="smoker", outcome="disease",
                       exposed=1, positive=1)
print(rr); print(ar)

All estimates are validated in the test suite against scipy and statsmodels.

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

psystats-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

psystats-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for psystats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4cb47b4802adaa7f11524f1563556ff2b32a10531d96626df28468af2e5f3da2
MD5 d1997d1550951149a49d815d2fd956b1
BLAKE2b-256 7fdab80403104d50693e09fae76c96956ace3981929b9f5391137bfc1d48145a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for psystats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18cc9ebcba40fedaeec5b799e644134353c724e005123baa9f69598a31aa4ef8
MD5 7b51c75e76a63f6e5b6e841ac3df7579
BLAKE2b-256 44d93b037161242db6d2de4d7505e0bd08b0e220dcafd479f8ea634bb97193ec

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