| Version: | 0.1 |
| Date: | 2025-11-02 |
| Title: | New Nonparametric Tests for Multivariate Paired Data and Pair Matching |
| Maintainer: | Hao Chen <hxchen@ucdavis.edu> |
| Depends: | R (≥ 3.5.0) |
| Imports: | ade4 |
| Description: | Implements three nonparametric two-sample tests for multivariate paired data and pair matching. Methods are described in the associated preprint: <doi:10.48550/arXiv.2007.01497>. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: | no |
| Packaged: | 2025-11-11 20:39:51 UTC; hao |
| Author: | Jingru Zhang [aut], Hao Chen [aut, cre] |
| Repository: | CRAN |
| Date/Publication: | 2025-11-13 21:30:02 UTC |
A matrix representing observations in pair
Description
This is a n by 2p matrix, where n is the number of pairs and p is the dimension of observations. For each row, the first p columns represent the observation from sample 1, and the second p columns represent the paired observation from sample 2. The data is generated from a paired design with mean shift.
New Non-parametric Tests for Multivariate Paired Data and Pair Matching
Description
This function provides three non-parametric two-sample tests for paired data and pair matching.
Usage
g.tests_pair(E, n, test.type = "all", perm = 0)
Arguments
E |
An edge matrix representing a similarity graph on all observations with the number of edges in the similarity graph being the number of rows and 2 columns. Each row records the indices of the two ends of an edge in the similarity graph. |
n |
The number of pairs. |
test.type |
The default value is "all", which means all three tests, the orignial edge-count test, the scaled edge-count test, and the generalized edge-count test, are performed. Set this value to "original" or "o" to perform only the original edge-count test; set this value to "scaled" or "s" to perform only the scaled edge-count test; set this value to "generalized" or "g" to perform only the generalized edge-count test. |
perm |
The number of permutations performed to calculate the p-value of the test. The default value is 0, which means the permutation is not performed and only the approximate p-value based on asymptotic theory is provided. Doing permutation could be time consuming, so be cautious if you want to set this value to be larger than 10,000. |
Value
test.statistic |
The value of the test statistic. |
pval.approx |
The approximated p-value based on asymptotic theory. |
pval.perm |
The permutation p-value when the argument 'perm' is positive. |
References
Zhang J., Chen H., and Zhou XH. A new non-parametric test for multivariate paired data from pair matching or paired designs.
Examples
# The "example_pair" data contains the paired data 'data_pair'.
# It is a n by 2p matrix with n being the number of pairs and p being the dimension of
# observations.
# For each row, the first p columns represent the observation from sample 1, and the
# second p columns represent the paired observation from sample 2.
# The data is generated from a paired design with mean shift.
data(example_pair)
n = nrow(data_pair)
p = ncol(data_pair)/2
k = 5
data1 = data_pair[,1:p]
data2 = data_pair[,(p+1):(2*p)]
case = rbind(data1,data2)
dist1 = as.matrix(dist(case))
library("ade4")
E = mstree(as.dist(dist1),k)
g.tests_pair(E,n)
# Get permutation p-value with 300 permutations.
g.tests_pair(E, n, perm = 300)
New Non-parametric Tests for Multivariate Paired Data and Pair Matching
Description
This package includes three non-parametric two-sample tests for paired data and pair matching.
Author(s)
Jingru Zhang and Hao Chen
Maintainer: Hao Chen (hxchen@ucdavis.edu)
References
Zhang J., Chen H., and Zhou XH. A new non-parametric test for multivariate paired data from pair matching or paired designs.
See Also
Get intermediate results for g.tests_pair function
Description
This function calculates means and variances of R1 and R2 quantities under the paired- comparison permutation null.
Usage
getMV_pair(E,n)
Arguments
E |
An edge matrix representing a similarity graph on all observations with the number of edges in the similarity graph being the number of rows and 2 columns. Each row records the indices of the two ends of an edge in the similarity graph. |
n |
The number of pairs. |
See Also
Get intermediate results for g.tests_pair function
Description
This function calculates R1 and R2 quantities.
Usage
getR1R2_pair(E,group1)
Arguments
E |
An edge matrix representing a similarity graph on all observations with the number of edges in the similarity graph being the number of rows and 2 columns. Each row records the indices of the two ends of an edge in the similarity graph. |
group1 |
The indices of observations in the sample 1. |