Skip to main content

Python implementation of the permuted Brunner-Munzel test for small sample sizes

Project description

Permuted Brunner-Munzel Test

PyPI version Tests Python 3.8+

A Python implementation of the permuted Brunner-Munzel test, a nonparametric test for comparing two independent samples.

When to Use

The permuted Brunner-Munzel test is best suited for:

  • Small sample sizes (7-10 observations per group)
  • When standard parametric assumptions don't hold
  • Comparing distributions that may differ in shape, not just location

For larger samples (>10 per group), consider using scipy.stats.brunnermunzel.

Installation

pip install permuted_brunnermunzel

Quick Start

from permuted_brunnermunzel import permuted_brunnermunzel

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

# Run the test
estimate, pvalue = permuted_brunnermunzel(x, y, alternative="less")

print(f"Effect size estimate: {estimate:.4f}")
print(f"P-value: {pvalue:.6f}")

Output:

Effect size estimate: 0.8571
P-value: 0.000583

Parameters

Parameter Type Default Description
x list required First sample observations
y list required Second sample observations
alternative str "two_sided" "two_sided", "greater", or "less"
nan_policy str "propagate" "propagate", "raise", or "omit"
est str "original" "original" or "difference"
force bool False Force test even for large samples

Returns

Value Description
estimate Effect size: P(X < Y) + 0.5*P(X = Y) for est="original", or P(X < Y) - P(X > Y) for est="difference"
pvalue The p-value for the test

Interpreting Results

  • estimate = 0.5: No difference between groups
  • estimate > 0.5: Values in Y tend to be larger than X
  • estimate < 0.5: Values in X tend to be larger than Y
  • pvalue < 0.05: Statistically significant difference (at alpha=0.05)

Dependencies

  • numpy >=1.20
  • scipy >=1.7

References

This is a Python reimplementation of the R package brunnermunzel.

Brunner, E. and Munzel, U. (2000). The nonparametric Behrens-Fisher problem: Asymptotic theory and a small-sample approximation.

License

MIT License - see LICENSE for details.

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.1.0.tar.gz (10.0 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.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: permuted_brunnermunzel-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for permuted_brunnermunzel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1038451529d60f10df5449738b21802322eaaa17d945d44d0d863433a3ac75c7
MD5 7f9dd5358cb9e9971a8af966421e897e
BLAKE2b-256 5a1822035df690a9dbf1c1cf0949ec319bd0857f711355ea6483d6f71b479599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for permuted_brunnermunzel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab537675b1290c13b7c89371b9b2a074d31312a5bfdf63247d7cda0d836909f
MD5 be27a4b0603032b8e6d893ed25138db0
BLAKE2b-256 baabf9a09fcf4a8ec8edb0ddbd437fb74dd27390b9d77ea6928e7b763a338524

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