Metadata-Version: 2.4
Name: rankFD
Version: 0.1.0
Summary: Rank-based tests for independent one-way factorial designs
Author: Okumura Lab
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/okumuralab/rankFD
Project-URL: Source, https://github.com/okumuralab/rankFD
Project-URL: Issues, https://github.com/okumuralab/rankFD/issues
Keywords: anova,nonparametric statistics,rank tests,statistics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.9
Dynamic: license-file

# rankFD for Python

This repository contains a pure Python implementation of the independent
one-way calculation in R package `rankFD` 0.1.1. It estimates weighted or
unweighted nonparametric relative effects and provides the Wald-type and
ANOVA-type global tests.

## Installation

Install the latest release from PyPI:

```sh
python3 -m pip install rankFD
```

To install the current development version directly from GitHub:

```sh
python3 -m pip install "git+https://github.com/okumuralab/rankFD.git"
```

To install an editable copy for development:

```sh
git clone https://github.com/okumuralab/rankFD.git
cd rankFD
python3 -m pip install -e .
```

Python 3.10 or newer is required. NumPy and SciPy are installed automatically
as dependencies.

## Usage

```python
from rankfd import rankFD

x = [1, 2, 3, 4, 5]
y = [2, 3, 4, 5, 6]
z = [7, 8, 8, 9, 10]

result = rankFD(x, y, z)
print(result)                  # SciPy-style concise result
print(result.statistic)        # ANOVA-type statistic
print(result.pvalue)           # ANOVA-type p-value
print(result.wald)
print(result.anova)
print(result.relative_effects)
print(result.confidence_interval)

groups = [x, y, z]
same_result = rankFD(*groups)
```

The R defaults are preserved:

- `effect="unweighted"` uses pseudo-ranks.
- `hypothesis="H0F"` tests equality of distribution functions.
- `ci_method="logit"` computes range-preserving pointwise intervals.

For the more general null hypothesis stated in relative effects, use
`hypothesis="H0p"`. For classical global ranks and sample-size-weighted
effects, use `effect="weighted"`.

With `effect="weighted"` and `hypothesis="H0F"`, the nested
`result.kruskal` agrees with SciPy's tie-corrected Kruskal-Wallis test.
With the R default `effect="unweighted"`, rankFD applies its pseudo-rank
version instead, which can differ in unbalanced designs.

`RankFDResult.statistic` and `.pvalue` refer to the ANOVA-type test, which is
the small-sample global procedure recommended by the rankFD methodology.
The full results are in `.anova` and `.wald`. The returned object can also be
unpacked as `statistic, pvalue = rankFD(...)`.

## Scope

The API intentionally follows SciPy's independent-sample style:
`rankFD(*groups)`. Inputs are one-dimensional numeric arrays. NaNs can be
handled with `nan_policy="propagate"`, `"omit"`, or `"raise"`.

This port implements the one-factor calculation. It does not parse R formulas,
construct crossed multi-factor designs, perform multiple contrast procedures,
or create plots.

## Tests

Run the Python tests with:

```sh
python3 -m unittest discover -s tests -v
```

The cross-language suite invokes the installed R `rankFD` package as an oracle
and is skipped automatically when R or the R package is unavailable.

## References

Edgar Brunner, Frank Konietschke, Markus Pauly, and Madan L. Puri (2016).
“Rank-Based Procedures in Factorial Designs: Hypotheses About Non-Parametric
Treatment Effects.”
[https://doi.org/10.1111/rssb.12222](https://doi.org/10.1111/rssb.12222)

Edgar Brunner, Frank Konietschke, Arne C. Bathke, and Markus Pauly (2018).
“Ranks and Pseudo-Ranks - Paradoxical Results of Rank Tests -.”
[https://arxiv.org/abs/1802.05650](https://arxiv.org/abs/1802.05650)

Georg Zimmermann, Edgar Brunner, Werner Brannath, Martin Happ, and Arne C.
Bathke (2021). “Pseudo-Ranks: The Better Way of Ranking?”
[https://doi.org/10.1080/00031305.2021.1972836](https://doi.org/10.1080/00031305.2021.1972836)

`rankFD`: Rank-Based Tests for General Factorial Designs.
[https://cran.r-project.org/package=rankFD](https://cran.r-project.org/package=rankFD)
