PyStatsV1: applied statistics labs in Python.
Project description
PyStatsV1 — Applied Statistics (R ↔ Python)
PyStatsV1 provides plain, transparent Python scripts that mirror classical R textbook analyses, making it easy for students, tutors, and practitioners to:
- run statistical analyses from the command line,
- generate synthetic data for teaching,
- produce figures and JSON summaries,
- and compare outputs across R/Python.
⭐ Fastest start (PyPI + Workbook)
Install from PyPI (recommended: include the Workbook bundle so you can run pytest checks):
python -m pip install -U pip
python -m pip install "pystatsv1[workbook]"
Sanity-check your environment:
pystatsv1 doctor
Create a local Workbook starter and run Chapter 10:
pystatsv1 workbook init
cd pystatsv1_workbook
python scripts/psych_ch10_problem_set.py
pytest -q
Open the bundled local PDF docs (works offline):
pystatsv1 docs
# optional convenience script:
pystatsv1-docs
Tip: the online docs are always available via the ReadTheDocs badge at the top of this README.
Full repository (scripts, Makefile targets, tests, docs)
If you want the full chapter-by-chapter repo (simulators, analyzers, Makefile targets, tests, and the docs source), clone from GitHub and install in editable mode:
git clone https://github.com/pystatsv1/PyStatsV1.git
cd PyStatsV1
pip install -e .
pip install -r requirements-dev.txt
Project Structure
The project follows a chapter-based structure — each chapter includes a simulator, an analyzer, Makefile targets, and CI smoke tests.
Who is this for?
PyStatsV1 is designed for:
- Students who want to run textbook-style analyses in real Python code.
- Instructors / TAs who need reproducible demos and synthetic data for lectures, labs, or assignments.
- Practitioners who prefer plain scripts and command-line tools over large frameworks.
- R users who want a clear, line-by-line bridge from R examples into Python.
🚀 Using a Virtual Environment
Option A — Student mode (PyPI + Workbook)
macOS / Linux
python -m venv pystatsv1-env
source pystatsv1-env/bin/activate
python -m pip install -U pip
python -m pip install "pystatsv1[workbook]"
pystatsv1 doctor
pystatsv1 workbook init
Windows (Git Bash)
python -m venv pystatsv1-env
source pystatsv1-env/Scripts/activate
python -m pip install -U pip
python -m pip install "pystatsv1[workbook]"
pystatsv1 doctor
pystatsv1 workbook init
Option B — Repo dev install (contributors)
python -m venv .venv
# Git Bash first; PowerShell as fallback
source .venv/Scripts/activate 2>/dev/null || .venv\\Scripts\\Activate.ps1
python -m pip install -U pip
pip install -e .
pip install -r requirements-dev.txt
📊 Chapter Scripts
Chapter 1 — Introduction
python -m scripts.ch01_introduction
Chapter 13 — Within-subjects & Mixed Models
make ch13-ci # tiny CI smoke
make ch13 # full demo
Chapter 14 — Tutoring A/B Test (two-sample t-test)
make ch14-ci
make ch14
Chapter 15 — Reliability (Cronbach’s α, ICC, Bland–Altman)
make ch15-ci
make ch15
For an overview of what each chapter contains:
- CHAPTERS.md — coverage, commands, and outputs
- ROADMAP.md — planned chapters (e.g., Ch16 Epidemiology RR)
📚 Project Docs & Policies
PyStatsV1 is structured with a core set of documentation:
- CONTRIBUTING.md — environment setup, development workflow, Makefile usage, PR process.
- CODE_OF_CONDUCT.md — community expectations & enforcement.
- CHAPTERS.md — high-level description of all implemented chapters.
- ROADMAP.md — the future of the project: upcoming chapters & milestones.
- SECURITY.md — how to privately report vulnerabilities.
- SUPPORT.md — how to get help or ask questions.
- Case Study Template:
docs/case_study_template.md— structure for building new chapter teaching documentation.
If you want to contribute, start with CONTRIBUTING.md and check issues labeled
good first issue or help wanted.
🤝 Contribute in 5 minutes
Want to help but not sure where to start?
-
Browse issues labeled
good first issueorhelp wanted. -
Pick one small thing (typo, doc improvement, tiny refactor, or a missing test).
-
Fork & clone the repo.
-
Create and activate a virtual environment, then:
pip install -r requirements.txt make lint make test
-
Make your change, and ensure
make lintandmake testboth pass. -
Open a Pull Request and briefly describe:
- what you changed,
- how you tested it,
- which chapter(s) it touches, if any.
Maintainer promise: we’ll give constructive feedback and help first-time contributors land their PRs.
🗺️ Roadmap snapshot
High-level upcoming work (see ROADMAP.md for details):
- ✅ v0.17.0 — Onboarding and issue templates
- ⏳ Next steps:
- Additional regression chapters (logistic, Poisson, etc.)
- Power and sample size simulations
- Epidemiology-focused examples (risk ratios, odds ratios)
- More teaching case studies using
docs/case_study_template.md
If you’d like to champion a specific chapter or topic, open an issue and we can design it together.
🧪 Development Workflow
From the project root:
make lint # ruff check
make test # pytest
To run chapter smoke tests:
make ch13-ci
make ch14-ci
make ch15-ci
All synthetic data is written to:
data/synthetic/outputs/<chapter>/
…and ignored by Git.
🔀 Pull Requests
Every pull request should:
- pass
make lintandmake test, - avoid committing generated outputs,
- follow the structure described in CONTRIBUTING.md.
GitHub provides:
- 🐛 Bug report template
- 💡 Feature request template
- 📘 Good first issue template
- 🔀 Pull request template
🔒 Security
If you believe you’ve found a security issue, do not open a public GitHub issue.
Follow the private disclosure process described in SECURITY.md.
💬 Community & support
-
Questions?
Open a GitHub issue with thequestionlabel. -
Using PyStatsV1 in a course?
We’d love to hear about it — open an issue titledCourse report: <institution>or mention it in your PR description. -
Feature ideas / chapter requests?
Open an issue with theenhancementorchapter-idealabel.
As the project grows, we plan to enable GitHub Discussions and possibly a lightweight chat space for instructors and contributors.
python -m pip install --upgrade pip
python -m pip install "pystatsv1[workbook]"
pystatsv1 workbook init --dest pystatsv1_workbook
pystatsv1 workbook run ch10 --workdir pystatsv1_workbook
pystatsv1 workbook check ch10 --workdir pystatsv1_workbook
Notes:
- No
makerequired. The workbook commands work on Linux, macOS, and Windows. workbook checkrunspytest(installed via the[workbook]extra).- If you prefer, you can also run the chapter scripts directly under
pystatsv1_workbook/scripts/.
📜 License
MIT © 2025 Nicholas Elliott Karlson
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 pystatsv1-0.22.4.tar.gz.
File metadata
- Download URL: pystatsv1-0.22.4.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e15ccfda5809254fd377f04c743428d21c73b689c6ccb0994570b48885c5e01
|
|
| MD5 |
693ae3d0f2a8d792b1670fef660791e1
|
|
| BLAKE2b-256 |
f0f0746af388cdefd91d34a15f49a34fea7a42436d950ca0a4033c4f382f649c
|
Provenance
The following attestation bundles were made for pystatsv1-0.22.4.tar.gz:
Publisher:
pypi-publish.yml on pystatsv1/PyStatsV1
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystatsv1-0.22.4.tar.gz -
Subject digest:
2e15ccfda5809254fd377f04c743428d21c73b689c6ccb0994570b48885c5e01 - Sigstore transparency entry: 842530107
- Sigstore integration time:
-
Permalink:
pystatsv1/PyStatsV1@d8c3a3109c2ae16b0c11948d981d6e763b80447e -
Branch / Tag:
refs/tags/v0.22.4 - Owner: https://github.com/pystatsv1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@d8c3a3109c2ae16b0c11948d981d6e763b80447e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pystatsv1-0.22.4-py3-none-any.whl.
File metadata
- Download URL: pystatsv1-0.22.4-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74505a3a70d47ba38349357c5e9107d759a87dbfb28c3375c6be537b56005e8a
|
|
| MD5 |
8c2bce7112ca8179ba3c5ab7563cf4db
|
|
| BLAKE2b-256 |
b254f80556799c6c71bb972605f2ae4c458beb0db0934fba0f179849395d80f1
|
Provenance
The following attestation bundles were made for pystatsv1-0.22.4-py3-none-any.whl:
Publisher:
pypi-publish.yml on pystatsv1/PyStatsV1
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystatsv1-0.22.4-py3-none-any.whl -
Subject digest:
74505a3a70d47ba38349357c5e9107d759a87dbfb28c3375c6be537b56005e8a - Sigstore transparency entry: 842530109
- Sigstore integration time:
-
Permalink:
pystatsv1/PyStatsV1@d8c3a3109c2ae16b0c11948d981d6e763b80447e -
Branch / Tag:
refs/tags/v0.22.4 - Owner: https://github.com/pystatsv1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@d8c3a3109c2ae16b0c11948d981d6e763b80447e -
Trigger Event:
push
-
Statement type: