View source: R/discrete.DRPT.R
discrete.DRPT | R Documentation |
A function that implements the discrete version of the DRPT for discrete data with finite support as defined in Section 2.1 in \insertCiteBB2025DRPT;textualDRPT.
discrete.DRPT(X, Y, r, H = 99, type = "V")
X |
A numeric vector containing the first sample. |
Y |
A numeric vector containing the second sample. |
r |
A numeric vector of positive values specifying the hypothesised density ratio in the discrete setting. |
H |
An integer specifying the number of permutations to use. Defaults to 99. |
type |
A character string indicating the test statistic to use. See the Details section for more information.
Defaults to |
Counts for the permuted samples are drawn using rMFNCHypergeo
from the package BiasedUrn
.
When type="U"
the test statistic is the U-statistic (12); when type="V"
the test statistic is the V-statistic (11); setting type="D"
gives the test statistic (56) in Appendix B of the paper.
The p-value of the DRPT as defined in (2) in \insertCiteBB2025DRPT;textualDRPT.
BB2025DRPTDRPT
n = 100; m = n
X = sample(0:3, n, prob = c(1/8, 1/8, 3/8, 3/8), replace = TRUE)
Y = sample(0:3, m, prob = c(1/43, 3/43, 16/43, 23/43), replace = TRUE)
r = c(1, 3, 3, 10)
discrete.DRPT(X,Y,r,H=19)
discrete.DRPT(X,Y,r, type = "U", H=19)
discrete.DRPT(X,Y,r, type = "D", H=19)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.