starSampler: A function implementing the star-sampler for the DRPT.

View source: R/starSampler.R

starSamplerR Documentation

A function implementing the star-sampler for the DRPT.

Description

A function implementing Algorithm 2 in \insertCiteBB2025DRPT;textualDRPT.

Usage

starSampler(X, Y, r, H = 99, S = 50)

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.

H

An integer specifying the number of permutations to use. Defaults to 99.

S

An integer specifying the number of steps for the Markov-Chain defined in Algorithm 2 in \insertCiteBB2025DRPT;textualDRPT. Defaults to 50.

Value

A list of H+1 rearrangements of the whole sample. The first element of the list is the original dataset. The other H elements are permutations of the original dataset, where permutations are generated using Algorithm 2 in the paper.

References

\insertRef

BB2025DRPTDRPT

Examples

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

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)))

starSampler(X, Y, r, H = 3, S = 20)

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

Related to starSampler in DRPT...