Skip to main content

Rank-based tests for independent one-way factorial designs

Project description

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:

python3 -m pip install rankFD

To 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.

Usage

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:

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

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

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

rankfd-0.1.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

rankfd-0.1.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rankfd-0.1.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for rankfd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13ca966f1c6e922ddf42fa7600a8cd58b17446c5a32e05f6fc352ee5d8dd4235
MD5 75308bf5f599df56dc53dd316af186e4
BLAKE2b-256 b5845df1a6782d775cf6029465389305349b9fb773ee1fded4d07f78214b63fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rankfd-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on okumuralab/rankFD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: rankfd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for rankfd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7936d1c0e548e1b31cd956e97debf114afea10476a1867b8c312731acb093ccf
MD5 5c6b016b89e3508697300741d310f287
BLAKE2b-256 8e09c00a5a38db875c5d74f2181855106c0bc4e51beefb077fa891ce03d835f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rankfd-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on okumuralab/rankFD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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