gofMMDtest: Goodness-of-fit Two-Sample Test

View source: R/gofCopula.R

gofMMDtestR Documentation

Goodness-of-fit Two-Sample Test

Description

gofMMDtest() computes the two-sample goodness of fit test of Schrab et al. (2024), a multiplier bootstrap based on the squared MMD.

Usage

gofMMDtest(x, y, N = 1000, bandwidth2 = 10^c(-4, -3, -2, -3/2, -5/4, -9/8))

Arguments

x, y

n\times d-matrices of (typically copula) samples to be compare. The two matrices must have an equal number of rows n and columns d.

N

number of bootstrap replications.

bandwidth2

squared bandwidths of the underlying Gaussian mixture kernel based on the average norm (norm scaled by 1/d).

Details

The test is a multiplier bootstrap test, based on the squared MMD, where the underlying kernel is a Gaussian mixture kernel. The scaling of the norm in the kernel is done for comparison of test statistics in different dimensions.

Note that his is currently an experimental function, there are no known theoretical guarantees for applying this test to pseudo-observations, etc.

Value

An object of class htest which is a list with components

method

a method string identifying the type of test.

statistic

the realized test statistic.

statistics.H0

the bootstrapped test statistics.

p.value

the bootstrapped p-value.

data.name

a string identifying the data used.

Author(s)

Marius Hofert

References

Schrab, A., Kim, I. Albert, M., Laurent, B., Guedj, B., Gretton, A. (2023) MMD aggregated two-sample test. Journal of Machine Learning Research 24, 1–81.

See Also

gofT2stat() for another two-sample goodness-of-fit test statistic.

Examples

n <- 100
d <- 2
set.seed(271)
x <- matrix(runif(n * d), ncol = d)
y <- matrix(runif(n * d), ncol = d)
res <- gofMMDtest(x, y)
res$p.value

copula documentation built on Feb. 20, 2026, 5:07 p.m.