shiftedMMD: A function computing an estimate of the shifted-MMD.

View source: R/shiftedMMD.R

shiftedMMDR Documentation

A function computing an estimate of the shifted-MMD.

Description

A function computing the U-statistic (12). This serves as an estimator of the shifted-MMD defined in Section 3.2 of \insertCiteBB2025DRPT;textualDRPT.

Usage

shiftedMMD(X, Y, r, kernel)

Arguments

X

A numeric vector containing the first sample.

Y

A numeric vector containing the second sample.

r

A function specifying the hypothesised density ratio.

kernel

A function defining the kernel to be used for the U-statistic.

Value

The value of the U-statistic (12).

References

\insertRef

BB2025DRPTDRPT

Examples

n = 250; m = 250; d = 2
r = function(x,y) {
  return(4*x*y)
   }

gaussian.kernel = function(x, y, lambda = 1){
     return(lambda^(-d) * exp(-sum(((x - y) ^ 2) / (lambda ^ 2))))
     }

X = as.matrix(cbind(runif(n, 0, 1), runif(n, 0, 1)))
Y = as.matrix(cbind(rbeta(m, 0.5, 0.3), rbeta(m, 0.5, 0.4)))

shiftedMMD(X,Y, r, gaussian.kernel)

DRPT documentation built on Aug. 8, 2025, 7:40 p.m.

Related to shiftedMMD in DRPT...