| Title: | Ansari-Bradley Test with Arbitrarily Missing Data |
| Version: | 0.1.0 |
| Description: | Performs the two-sample Ansari–Bradley test (Ansari & Bradley, 1960 https://www.jstor.org/stable/2237814) for univariate, distinct data in the presence of missing values, as described in Zeng et al. (2025) <doi:10.48550/arXiv.2509.20332>. This method does not make any assumptions about the missingness mechanisms and controls the Type I error regardless of the missing values by taking all possible missing values into account. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Suggests: | gtools, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Imports: | stats |
| NeedsCompilation: | no |
| Packaged: | 2025-10-26 10:27:32 UTC; yijin |
| Author: | Yijin Zeng [aut, cre] |
| Maintainer: | Yijin Zeng <yijinzeng98@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-11-04 19:20:02 UTC |
abwm: Ansari-Bradley Test with Arbitrarily Missing Data
Description
Performs the two-sample Ansari–Bradley test (Ansari & Bradley, 1960 https://www.jstor.org/stable/2237814) for univariate, distinct data in the presence of missing values, as described in Zeng et al. (2025) doi:10.48550/arXiv.2509.20332. This method does not make any assumptions about the missingness mechanisms and controls the Type I error regardless of the missing values by taking all possible missing values into account.
Author(s)
Maintainer: Yijin Zeng yijinzeng98@gmail.com
Ansari-Bradley Test with Arbitrarily Missing Data
Description
Performs the two-sample Ansari-Bradley test for univariate, distinct data in the presence of missing values with controlled Type I error.
Usage
abwm.test(X, Y, alternative = c("two.sided", "less", "greater"))
Arguments
X, Y |
numeric vectors of data values with potential missing data. Inf and -Inf values will be omitted. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. |
Details
abwm.test() performs the Ansari-Bradley scale testing method
(Ansari & Bradley, 1960) in the presence of missing data, as described in Zeng et al. (2025).
Suppose X = \{x_{1}, \ldots, x_{n}\} and Y = \{y_{1}, \ldots, y_{m}\},
the Ansari-Bradley test statistic in Zeng et al. (2025) is defined as
\sum_{i = 1}^{n} \left|R(x_i, X \cup Y) - \frac{n + m + 1}{2}\right|,
where R(x_i, X \cup Y) denotes the rank of x_i in the set
X \cup Y. The function abwm.test() returns the tight bounds of
the Ansari-Bradley test statistic and its p-value obtained using the normal approximation.
The p-value of the test method proposed in Zeng et al. (2025) is then
returned as the maximum possible p-value of the Ansari-Bradley test.
This method (Zeng et al., 2025) does not make any missing data assumptions, and
controls the Type I error regardless of the values
of missing data.
Value
p.value |
the p-value for the test. |
bounds.statistic |
bounds of the value of the Ansari-Bradley test statistic. |
bounds.pvalue |
bounds of the p-value of the Ansari-Bradley test. |
alternative |
a character string describing the alternative hypothesis. |
data.name |
a character string giving the names of the data. |
References
Y. Zeng, N. M. Adams, D. A. Bodenham. Scale two-sample testing with arbitrarily missing data. arXiv preprint arXiv:2509.20332. 2025.
A. R. Ansari, R. A. Bradley. Rank-Sum Tests for Dispersions. The Annals of Mathematical Statistics, pages 1174–1189, 1960.
See Also
stats::ansari.test() when data are completely observed.
Examples
#### Assume all values are distinct.
X <- c(6.2, 3.5, NA, 7.6, 9.2)
Y <- c(0.2, 1.3, -0.5, -1.7)
## Perform the two-sided Ansari-Bradley testing with missing data.
abwm.test(X, Y, alternative = 'two.sided')
## Consider one-sided testing.
abwm.test(X, Y, alternative = 'less')