Skip to main content

Python implementation of the permuted brunner munzel

Project description

Introduction

This package is an implementation of the permuted version of the Brunner-Munzel test is a nonparametric test. The Permuted Brunner-Munzel is best suited to cases where the number of observations in one of the groups is below 10 and ideally above 7

This is a reimplementation of the R/Fortran implementation found here https://cran.r-project.org/web/packages/brunnermunzel/index.html . This is for cases where is it not possible or complicated to call R from python

Dependencies

The function requires the following Python packages:

  • numpy
  • scipy
  • math

Usage

The function takes five input arguments, x, y, alternative, nan_policy, est, and force.

  • x and y are lists of observations for the two samples to be tested.
  • alternative specifies the alternative hypothesis to be tested, and can take one of the following values: "two_sided", "greater", or "less". Default is "two_sided".
  • nan_policy specifies how to handle missing values in the input data, and can take one of the following values: "propagate", "raise", or "omit". Default is "propagate".
  • est specifies the estimator of the difference of the location shifts of the two distributions, and can take one of the following values: "original" or "difference". Default is "original".
  • force specifies whether to force the use of the permuted Brunner-Munzel test even in cases where the normal Brunner-Munzel test would be more appropriate. Default is False.

The function returns a tuple of two float values:

  • The first value is the estimated location shift between the two distributions (i.e., the P-value).
  • The second value is the P-value of the test.

Example

pip install permuted_brunnermunzel
from permuted_brunnermunzel import permuted_brunnermunzel

x = [0, 0, 0, 1, 1, 1, 0]
y = [30, 20, 19, 18, 15, 10, ]

result = permuted_brunnermunzel(x, y, alternative="less", nan_policy="propagate", est="original", force=False)
print(result)
(0.8571428571428571, 0.0005827505827505828)

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

permuted_brunnermunzel-0.0.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

permuted_brunnermunzel-0.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file permuted_brunnermunzel-0.0.2.tar.gz.

File metadata

  • Download URL: permuted_brunnermunzel-0.0.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for permuted_brunnermunzel-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0dde9288f149c12d91c85e1ceb7fa30a437a5e1199ec5e26a6026788cb126a5a
MD5 c808a323f57d2c0ac4fc7de71fe9c9ac
BLAKE2b-256 054966db4fa0eafa3fbeec803b1d5610418ba47cf488941b31c459fa29306be2

See more details on using hashes here.

File details

Details for the file permuted_brunnermunzel-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for permuted_brunnermunzel-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ef99bce8e857656f22f35929599d878c2dae4789384523fa2a55a87eb37c043
MD5 e4430b207c9375c142a65795018e0d56
BLAKE2b-256 436f7a39ba1f7928f97b43adf4e56d2af4a9e3453e33951d472f08d855ed3059

See more details on using hashes here.

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