R/RcppExports.R

Defines functions bcdf PropToroShiftData NumToroShiftData

Documented in bcdf NumToroShiftData PropToroShiftData

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Apply a toroidal shift to the pooled samples using a number of points
#'
#' The `NumToroShiftData()` function produces a list of toroidal shifted
#' versions of the two-column input matrix. The number of toroidal shifts
#' is an integer passed to `numShifts`. The origins of the toroidal shifts are
#' randomly selected from the combined samples. The pooled `data` is assumed to
#' list all of the first sample of size `n1` before the second sample (of size
#' `n2`).
#'
#' @param data A two column matrix of the pooled samples
#' @param n1 An integer sample size for the first sample
#' @param n2 An integer sample size for the second sample
#' @param numShifts A numeric number of points to be used as toroidal shift origins
#' @return A list of toroidal shifted pooled sample matrices
#' @examples
#' data(iris)
#' sample1 <- as.matrix(iris[iris$Species == "setosa", 1:2])
#' sample2 <- as.matrix(iris[iris$Species == "virginica", 1:2])
#' pooled_data <- rbind(sample1, sample2)
#' n1 <- nrow(sample1)
#' n2 <- nrow(sample2)
#'
#' # Create a list of five toroidal shifts of the pooled data
#' output <- NumToroShiftData(pooled_data, n1, n2, 25)
#' summary(output)
#' @export
NumToroShiftData <- function(data, n1, n2, numShifts) {
    .Call(`_distdiffR_NumToroShiftData`, data, n1, n2, numShifts)
}

#' Apply a toroidal shift to the pooled samples using a proportion of points
#'
#' The `PropToroShiftData()` function produces a list of toroidal shifted
#' versions of the two-column input matrix. The number of toroidal shifts
#' is (the ceiling of) the proportion (`propPnts`) multiplied by the combined
#' sample size. The origins of the toroidal shifts are randomly selected from
#' the combined samples. The pooled `data` is assumed to list all of the first
#' sample of size `n1` before the second sample (of size `n2`).
#'
#' @param data A two column matrix of the pooled samples
#' @param n1 An integer sample size for the first sample
#' @param n2 An integer sample size for the second sample
#' @param propPnts A numeric proportion of points to be used as toroidal shift origins
#' @return A list of toroidal shifted pooled sample matrices
#' @examples
#' data(iris)
#' sample1 <- as.matrix(iris[iris$Species == "setosa", 1:2])
#' sample2 <- as.matrix(iris[iris$Species == "virginica", 1:2])
#' pooled_data <- rbind(sample1, sample2)
#' n1 <- nrow(sample1)
#' n2 <- nrow(sample2)
#'
#' # Creates a list of 0.1 times (n1 + n2) = 10 toroidal shifts of the pooled data
#' output <- PropToroShiftData(pooled_data, n1, n2, 0.1)
#' summary(output)
#' @export
PropToroShiftData <- function(data, n1, n2, propPnts = 1) {
    .Call(`_distdiffR_PropToroShiftData`, data, n1, n2, propPnts)
}

#' Construct and evaluate a bivariate empirical cumulative distribution function
#'
#' Construct a bivariate empirical cumulative distribution function (BECDF)
#' using `data` and pass each of the `eval` points through the BECDF.
#'
#' @param data A two column matrix for constructing the BECDF
#' @param eval A two column matrix for input into the BECDF
#' @return A numeric vector of output values from the BECDF
#' @examples
#' data(iris)
#' sample1 <- as.matrix(iris[iris$Species == "virginica", 1:2])
#' sample2 <- as.matrix(iris[iris$Species == "versicolor", 1:2])
#'
#' bcdf(sample1, sample2)
#' @export
bcdf <- function(data, eval) {
    .Call(`_distdiffR_bcdf`, data, eval)
}
EricMcKinney77/distdiffR documentation built on April 24, 2022, 9:03 p.m.