discreteT: Compute test statistics for the DRPT in discrete settings.

View source: R/discreteT.R

discreteTR Documentation

Compute test statistics for the DRPT in discrete settings.

Description

Computes the test statistics introduced in \insertCiteBB2025DRPT;textualDRPT for settings where the data support is discrete and finite.

Usage

discreteT(NX, NY, r, n, m, type = "V")

Arguments

NX

A vector of counts for the first sample. This corresponds to the sequence \mathrm{tot}_j - N_{Y,j}^p with p = \mathrm{id}, i.e. the identity permutation, as introduced in Section 2.1 of \insertCiteBB2025DRPT;textualDRPT.

NY

A vector of counts for the second sample. This corresponds to the sequence N_{Y,j}^p with p = \mathrm{id}, i.e. the identity permutation, as introduced in Section 2.1 of \insertCiteBB2025DRPT;textualDRPT.

r

A numeric vector of positive values specifying the hypothesised density ratio in the discrete setting.

n

The size of the first sample.

m

The size of the second sample.

type

A character string indicating which test statistic to compute. One of "U", "V", or "D". See the Details section for more information. Defaults to "V".

Details

When type = "U", the U-statistic (12) is calculated. When type = "V", the V-statistic (11) is computed. When type = "D", the test statistic (56) from Appendix B is returned.

Value

A numeric value representing the computed test statistic.

References

\insertRef

BB2025DRPTDRPT

Examples

n = 100; m = n
X = sample(0:3, n, prob = c(1/4, 1/4, 1/4, 1/4), replace = TRUE)
Y = sample(0:3, m, prob = c(1/17, 3/17, 3/17, 10/17), replace = TRUE)
r = c(1, 3, 3, 10)

NX = table(X)
NY = table(Y)

discreteT(NX, NY, r, sum(NX), sum(NY), type = "V")
discreteT(NX, NY, r, sum(NX), sum(NY), type = "D")

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

Related to discreteT in DRPT...