A Python package performing Wilcoxon-Mann-Whitney test in the presence of missing data with controlled Type I error
Project description
wmwm
This package performs the two-sample hypothesis test method proposed in (Zeng et al., 2024) for univariate data when data are not fully observed. This method is a theoretical extension of Wilcoxon-Mann-Whitney test in the presence of missing data, which controls the Type I error regardless of values of missing data.
Bounds of the Wilcoxon-Mann-Whitne test statistic and its p-value will be computed in the presence of missing data. The p-value of the test method proposed in (Zeng et al., 2024) is then returned as the maximum possible p-value of the Wilcoxon-Mann-Whitney test.
Installation
pip install wmwm
Example
This is a basic example which shows you how to perform the test with missing data:
import numpy as np
from wmwm import wmwm_test
#### Assume all samples are distinct.
X = np.array([6.2, 3.5, np.nan, 7.6, 9.2])
Y = np.array([0.2, 1.3, -0.5, -1.7])
## By default, when the sample sizes of both X and Y are smaller than 50,
## exact distribution will be used.
wmwm_test(X, Y, ties = False, alternative = 'two.sided')
## using normality approximation with continuity correction:
wmwm_test(X, Y, ties = False, alternative = 'two.sided', exact = False, correct = True)
#### Assume samples can be tied.
X = np.array([6, 9, np.nan, 7, 9])
Y = np.array([0, 1, 0, -1])
## When the samples can be tied, normality approximation will be used.
## By default, lower_boundary = -Inf, upper_boundary = Inf.
wmwm_test(X, Y, ties = True, alternative = 'two.sided')
## specifying lower_boundary and upper_boundary:
wmwm_test(X, Y, ties = True, alternative = 'two.sided', lower_boundary = -1, upper_boundary = 9)
References
Zeng Y, Adams NM, Bodenham DA. On two-sample testing for data with arbitrarily missing values. arXiv preprint arXiv:2403.15327. 2024 Mar 22.
Mann, Henry B., and Donald R. Whitney. “On a test of whether one of two random variables is stochastically larger than the other.” The annals of mathematical statistics (1947): 50-60.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wmwm-0.0.1.tar.gz.
File metadata
- Download URL: wmwm-0.0.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b71ed69069e3613118bb0e7924e1f0ec3255329dafac3eb094501540f20e1f0b
|
|
| MD5 |
02b983573b4b8804a7d74f0939b99238
|
|
| BLAKE2b-256 |
dd6b211ef173471bfa98f1bc757ddf7ef827ac5db1aa647310150575d69ca285
|
File details
Details for the file wmwm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: wmwm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c38525ab400e7860e8c78e83273dcc903263460178f86842cdad898a6f3e249
|
|
| MD5 |
764c8482372aa448925bf812c749445b
|
|
| BLAKE2b-256 |
a07765e474593cb1007fe3a3996493ab0e92fd658d3568064a7f02494ce84b8a
|