rstatspython 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rstats/__init__.py +11 -0
- rstats/_data.py +164 -0
- rstats/_posthoc.py +278 -0
- rstats/anova.py +422 -0
- rstats/categorical.py +180 -0
- rstats/descriptive.py +100 -0
- rstats/regression.py +302 -0
- rstats/result.py +68 -0
- rstats/visualization.py +180 -0
- rstatspython-0.1.0.dist-info/METADATA +177 -0
- rstatspython-0.1.0.dist-info/RECORD +13 -0
- rstatspython-0.1.0.dist-info/WHEEL +4 -0
- rstatspython-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rstatspython
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Familiar commands. Complete statistical reports.
|
|
5
|
+
Project-URL: Repository, https://github.com/drdanrb/Rstats
|
|
6
|
+
Author: Rstats contributors
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Education
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
14
|
+
Requires-Python: >=3.12
|
|
15
|
+
Requires-Dist: matplotlib>=3.9
|
|
16
|
+
Requires-Dist: numpy>=2.0
|
|
17
|
+
Requires-Dist: pandas<4,>=2.2
|
|
18
|
+
Requires-Dist: patsy>=1.0
|
|
19
|
+
Requires-Dist: pingouin<0.8,>=0.6
|
|
20
|
+
Requires-Dist: scipy>=1.16
|
|
21
|
+
Requires-Dist: seaborn>=0.13.2
|
|
22
|
+
Requires-Dist: statsmodels<0.16,>=0.14.4
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
25
|
+
Requires-Dist: ipykernel>=6; extra == 'dev'
|
|
26
|
+
Requires-Dist: nbclient>=0.10; extra == 'dev'
|
|
27
|
+
Requires-Dist: nbformat>=5.10; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
29
|
+
Requires-Dist: python-pptx>=1; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.11; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine>=6; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Rstats
|
|
35
|
+
|
|
36
|
+
**Familiar commands. Complete statistical reports.**
|
|
37
|
+
|
|
38
|
+
[Open the teaching notebook in Google Colab](https://colab.research.google.com/github/drdanrb/Rstats/blob/main/examples/quickstart.ipynb)
|
|
39
|
+
|
|
40
|
+
Rstats gives Python students and academics a short path from a pandas dataframe
|
|
41
|
+
to detailed, reusable statistical results. One analysis call includes the
|
|
42
|
+
tables, uncertainty, coding, sample accounting, and diagnostic notes that would
|
|
43
|
+
otherwise require several separate calls. Plot independently with `vis()`.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
Python 3.12+; see CI for tested versions. This is an early research/teaching
|
|
48
|
+
release, not a package published on PyPI. **Do not install the unrelated
|
|
49
|
+
`rstats` PyPI package.** Install directly from GitHub:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m pip install git+https://github.com/drdanrb/Rstats.git
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or from the root of the supplied source checkout:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python -m pip install -e ".[dev]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The distribution is named `rstatspython`; the import is `rstats`. No R runtime
|
|
62
|
+
is required to use the library. In Colab, prefix the installation command with
|
|
63
|
+
`%pip` instead of `python -m pip`, or open the teaching notebook above and choose
|
|
64
|
+
**Runtime → Run all**. The notebook installs Rstats if necessary and downloads
|
|
65
|
+
the synthetic example data automatically; no file uploads are needed.
|
|
66
|
+
|
|
67
|
+
PyPI publishing is prepared but awaits the owner's one-time Trusted Publisher
|
|
68
|
+
setup. After the first successful publication, students will be able to use
|
|
69
|
+
`pip install rstatspython` (or `%pip install rstatspython` in Colab).
|
|
70
|
+
Until then, use the working GitHub installation above. See the
|
|
71
|
+
[publishing instructions](docs/publishing.md).
|
|
72
|
+
|
|
73
|
+
## One-line analyses
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
import pandas as pd
|
|
77
|
+
import rstats as rs
|
|
78
|
+
|
|
79
|
+
df = pd.read_csv("https://raw.githubusercontent.com/drdanrb/Rstats/main/examples/students.csv")
|
|
80
|
+
|
|
81
|
+
rs.descriptives(data=df, columns=["score", "study_hours"], by="group")
|
|
82
|
+
rs.table("group ~ passed", data=df, percent="row")
|
|
83
|
+
rs.chisq("group ~ passed", data=df)
|
|
84
|
+
rs.aov("score ~ group", data=df, posthocifsig=True)
|
|
85
|
+
rs.aov("score ~ group", data=df, covariates=["study_hours"])
|
|
86
|
+
rs.lm("score ~ study_hours + group", data=df)
|
|
87
|
+
rs.logmodel("passed ~ study_hours + group", data=df)
|
|
88
|
+
rs.vis("score ~ group", data=df, type="box")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
In a notebook, leave a result as the cell's last expression to display its full
|
|
92
|
+
report. In a script use `print(result)` or `result.show()`.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
result = rs.lm("score ~ study_hours + group", data=df)
|
|
96
|
+
result.tables["coefficients"].to_csv("coefficients.csv")
|
|
97
|
+
result.model.predict(df) # underlying statsmodels model
|
|
98
|
+
result.show()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Small rules that keep things intuitive
|
|
102
|
+
|
|
103
|
+
- Formulas are strings: `"outcome ~ predictor + another"`.
|
|
104
|
+
- `+` adds terms; `*` includes main effects and interactions; `:` adds an
|
|
105
|
+
interaction alone. Backticks quote column names with spaces.
|
|
106
|
+
- In **ANOVA**, predictors are groups even if coded 1, 2, 3. Put continuous
|
|
107
|
+
adjustments in `covariates=["age"]`.
|
|
108
|
+
- In **regression**, numbers are continuous and text/category columns are
|
|
109
|
+
categorical. Use `categorical=["group"]` for numeric-coded categories.
|
|
110
|
+
- Set a regression reference with `reference={"group": "control"}`. Otherwise
|
|
111
|
+
the first declared pandas category, or sorted observed level, is the reference.
|
|
112
|
+
- `logmodel` models numeric outcome 1 by default. For text outcomes use
|
|
113
|
+
`event="passed"`; the report states exactly which event is modeled.
|
|
114
|
+
- `posthocifsig=True` means **Tukey**, not automatic method selection.
|
|
115
|
+
Use `posthocifsig="games-howell"` after Welch or `"holm"` for factorial,
|
|
116
|
+
covariate-adjusted, or repeated/mixed comparisons. Incompatible requests explain
|
|
117
|
+
the problem rather than silently changing the method.
|
|
118
|
+
|
|
119
|
+
## ANOVA without guessing
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
rs.aov("score ~ group * teaching", data=df, type=3, posthocifsig="holm")
|
|
123
|
+
rs.aov("score ~ group", data=df, method="welch", posthocifsig="games-howell")
|
|
124
|
+
rs.aov("score ~ time * group", data=long_df,
|
|
125
|
+
subject="student_id", within="time", posthocifsig="holm")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Study design, sums-of-squares **type**, and variance **method** are different
|
|
129
|
+
choices. Ordinary ANOVA defaults to Type II; Type I is sequential and Type III
|
|
130
|
+
uses sum contrasts. Repeated/mixed designs use effect-specific tests and report
|
|
131
|
+
Greenhouse–Geisser inference where applicable. They do not get an invented
|
|
132
|
+
overall model F. See the [ANOVA and post hoc guide](docs/anova.md).
|
|
133
|
+
|
|
134
|
+
## Independent plotting
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
rs.vis("score ~ study_hours", data=df) # numeric/numeric → scatter
|
|
138
|
+
rs.vis("score ~ group", data=df) # numeric/category → box
|
|
139
|
+
rs.vis("score", data=df) # numeric → histogram
|
|
140
|
+
rs.vis("group", data=df) # category → counts
|
|
141
|
+
rs.vis("score ~ group", data=df, type="violin", palette="colorblind")
|
|
142
|
+
rs.vis("passed ~ group", data=df, type="proportion", normalize="row")
|
|
143
|
+
rs.vis("score ~ time", data=long_df, type="line", estimator="mean")
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Each plot returns a Matplotlib Axes: `ax.figure.savefig("figure.png")`.
|
|
147
|
+
No global Seaborn theme is changed. Plot data are complete cases for the plotted
|
|
148
|
+
variables; analytic sample counts remain in statistical reports.
|
|
149
|
+
|
|
150
|
+
## Documentation and teaching
|
|
151
|
+
|
|
152
|
+
- [API reference](docs/api.md)
|
|
153
|
+
- [ANOVA types, assumptions, and comparison methods](docs/anova.md)
|
|
154
|
+
- [Statistical conventions and limitations](docs/statistics.md)
|
|
155
|
+
- [Five-slide PowerPoint](docs/Rstats-quickstart.pptx)
|
|
156
|
+
- [Teaching notebook](examples/quickstart.ipynb)
|
|
157
|
+
- [Example ANOVA report](examples/anova-report.html) and [regression report](examples/regression-report.html)
|
|
158
|
+
- [Validation and R reference fixtures](tests/reference/README.md)
|
|
159
|
+
|
|
160
|
+
The included datasets are deterministic synthetic teaching data, not research
|
|
161
|
+
evidence. Tests are two-sided unless a method states otherwise. Missingness,
|
|
162
|
+
study design, independence, model assumptions, and causal interpretation remain
|
|
163
|
+
the analyst's responsibility; reports surface relevant details and never switch
|
|
164
|
+
methods based on assumption tests.
|
|
165
|
+
|
|
166
|
+
## Development
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python -m pytest
|
|
170
|
+
python -m ruff check src tests tools
|
|
171
|
+
python -m build
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Python-version CI installs and tests on 3.12–3.15; platform/Colab smoke checks are
|
|
175
|
+
tracked separately. Do not infer passing environments from a workflow definition
|
|
176
|
+
alone. MANOVA/MANCOVA, arbitrary random effects, repeated-measures ANCOVA,
|
|
177
|
+
multinomial/ordinal logistic models, and SEM are outside this release.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
rstats/__init__.py,sha256=YYTi1y18Dw3Sqszym78KJ5bs6sGH3HAPfYrcdFwKD70,384
|
|
2
|
+
rstats/_data.py,sha256=JuZChcGaAFzl0lqXzLluNLGwg1a-P8FWPKMERc0ZYOY,6335
|
|
3
|
+
rstats/_posthoc.py,sha256=oXNZF25K9Ue1Yewaty806uc_CvYqIT2FKtpdd-GUHI8,10905
|
|
4
|
+
rstats/anova.py,sha256=jBYKZwHRVjNZ4XnufiZis4jn9vXh6RJQpHLRc59n9fo,18389
|
|
5
|
+
rstats/categorical.py,sha256=FdPtTJWkAJGvPmXY5LyuJg544HAuic41vBQN_GdBGo8,7563
|
|
6
|
+
rstats/descriptive.py,sha256=N8reqKq98IVifZ9S0ZZuLOlxrgtxNEM-3uLpdXPq5G4,4520
|
|
7
|
+
rstats/regression.py,sha256=JB3biAwyDBwkFbTFScDF6Q4Z9nKLF8j_qvqvK_9nhf0,11415
|
|
8
|
+
rstats/result.py,sha256=Kqfh4DhZdMOuTImOuJEZBpO7C9ZULblMcvsPQV9eGj4,2479
|
|
9
|
+
rstats/visualization.py,sha256=d_eCAIiYxv92qwnkhNpmn-wmAZ8rSL4xPsOc4zxQd14,6501
|
|
10
|
+
rstatspython-0.1.0.dist-info/METADATA,sha256=pudtDDYjFv-pseW_8VL5Vu9OVdxEY3oGDXUrgZK4VnM,7474
|
|
11
|
+
rstatspython-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
12
|
+
rstatspython-0.1.0.dist-info/licenses/LICENSE,sha256=0yeTcDCu3Tzp-Nohq_s8AuuGtQFumkZ7ABKvCpt4r-s,1076
|
|
13
|
+
rstatspython-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rstats contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|