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.
🔗 日本語の解説
Install the latest release from PyPI:
python3 -m pip install rankFDTo install the current development version directly from GitHub:
python3 -m pip install "git+https://github.com/okumuralab/rankFD.git"To install an editable copy for development:
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.
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(...).
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.
Run the Python tests with:
python3 -m unittest discover -s tests -vThe cross-language suite invokes the installed R rankFD package as an oracle
and is skipped automatically when R or the R package is unavailable.
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
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
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
rankFD: Rank-Based Tests for General Factorial Designs.
https://cran.r-project.org/package=rankFD