Package 'MATES'

Title: Multi-view Aggregated Two Sample Tests
Description: This package is an implementation of the estimation and inference procedure of a multi-view aggregated two-sample test of equal distribution.
Authors: Zexi Cai [aut, cre], Mingshuo Liu [aut, ctb], Wenbo Fei [aut, ctb], Doudou Zhou [aut, ctb]
Maintainer: Zexi Cai <[email protected]>
License: GPL (>= 3)
Version: 0.0.0.9000
Built: 2026-05-26 05:50:49 UTC
Source: https://github.com/zexicai/mates

Help Index


MATES

Description

This package is an implementation of the estimation and inference procedure of a multi-view aggregated two-sample test of equal distribution.

Author(s)

Maintainer: Zexi Cai [email protected]

Authors:

See Also

Useful links:


Find the permutation covariance

Description

This function takes a list of numeric matrices and uses a C++ backend to find the permutation covariance

Usage

asy_cov(R_list, m, n)

Arguments

R_list

A list of numeric matrices with length S

m

An integer representing the number of sample in X

n

An integer representing the number of sample in Y

Value

A numeric matrix with row and column 2*S


Find the permutation mean

Description

This function takes a list of numeric matrices and uses a C++ backend to find the permutation mean.

Usage

asy_mean(R_list, m, n)

Arguments

R_list

A list of numeric matrices with length S

m

An integer representing the number of sample in X

n

An integer representing the number of sample in Y

Value

A numeric vector with length 2*S


Auxiliary function to compute rank matrix

Description

This function is used in 'P_Knear_rank' to compute the degrees

Usage

degree_distribution(G, sampleIDs)

MATES test statistic with two samples (recommended for general use)

Description

This function takes two data matrices (m x d and n x d) and other parameters to compute the MATES test statistic. It only implements the same distance, graph, and weight options across all views. For other combinations, please compute the corresponding view matrices (R_list) and use the MATES_stat function directly.

Usage

MATES(
  X,
  Y,
  S = 4,
  dt = "manhattan",
  gh = "NNG",
  wt = "kernel",
  pow = 0.8,
  perm = NULL
)

Arguments

X

A numeric matrix of size m x d

Y

A numeric matrix of size n x d

S

An integer representing the number of moments to use

dt

A character string indicating the distance metric to use ("manhattan" or "Lp")

gh

A character string indicating the graph type to use ("NNG", "MST", or "rNNG")

wt

A character string indicating the weight function to use ("kernel", "rank", "distance", or "plain")

pow

A numeric representing the number of neighbors to use for graph, if pow = 0, then use default value 10; otherwise use round(N^pow)

perm

An integer indicating the number of permutation (default is NULL, which uses closed form)

Value

A list with the MATES test statistic (test.stat) and p-value (pval)

Examples

# MATES(X,Y,S=4,dt="manhattan",gh="NNG",wt="kernel",pow=0.8)

MATES test statistic with pre-computed view matrices

Description

This function takes a list of view matrices (R_list) and other parameters to compute the MATES test statistic.

Usage

MATES_test(UxUy, R_list, m, n, perm = NULL)

Arguments

UxUy

A numeric vector of length 2*S containing the Ux and Uy statistics for each view

R_list

A list of numeric matrices with length S

m

An integer representing the number of sample in X

n

An integer representing the number of sample in Y

perm

An integer indicating the number of permutation (default is NULL, which uses closed form)

Value

A list with the MATES test statistic (test.stat) and p-value (pval)


Auxiliary function to compute rank matrix

Description

This function is used in 'P_Knear_rank'

Usage

optimalwithrank_curnode(k, cur_neis, neighbor, degree, lambda, rowrank)

Auxiliary function to compute rank matrix

Description

get outdirect nodes for each node

Usage

Out_direct(K, nodes)

Compute k-rNNG graph

Description

This function builds penalized K nearest neighbor graphs with rank The output is a list containing the graph and the degree distribution

Usage

P_Knear_rank(M, K = round(nrow(M)^0.8), lambda = 0.3)

Arguments

M

A numeric matrix representing the distance matrix

K

An integer representing the number of neighbors to use

lambda

A numeric representing the penalty parameter

Value

A list containing the truncated KNN graph (trun_KNN) and the degree distribution (degree)

References

Zhu, Y., & Chen, H. (2023). A new robust graph for graph-based methods. arXiv preprint arXiv:2307.15205.


Compute rank matrix

Description

This function computes the rank matrix based on the specified graph type and number of neighbors.

Usage

rank_mats(S, Dd, gtype, k)

Arguments

S

A numeric matrix representing the similarity matrix

Dd

A dist object representing the distance matrix

gtype

A character string indicating the graph type to use ("NNG", "MST", or "rNNG")

k

A numeric representing the number of neighbors to use for graph

References

Zhu, Y., & Chen, H. (2023). A new robust graph for graph-based methods. arXiv preprint arXiv:2307.15205.


RISE rank matrix

Description

The rank function to calculate rank of elements of a matrix. Two possible methods: the overall rank and the row-wise rank.

Usage

Rise_Rank(S, method = "overall")

Arguments

S

A numeric matrix representing the similarity matrix

method

A character string indicating the ranking method to use ("overall" or "row")

Value

A numeric matrix representing the rank matrix