Classifier k-sample test

classifier_test(
  x,
  y,
  split = 0.7,
  thresh = 0,
  method = "knn",
  control = caret::trainControl(method = "cv"),
  ...
)

Arguments

x

Samples from the first distribution or a list of samples from k distribution

y

Samples from the second distribution. Only used if x is a vector.

split

How to split the data between training and test. Default to .7

thresh

Value to add to the null hypothesis. See details.

method

Which model(s) to use during training. Default to knn.

control

Control parameters when fitting the methods. See trainControl

...

Other parameters passed to train

Value

A list containing the following components:

  • statistic the value of the test statistic.

  • p.value the p-value of the test.

Details

See Lopez-Paz et .al for more background on those tests.

References

Lopez-Paz, D., & Oquab, M. (2016). Revisiting Classifier Two-Sample Tests, 1–15. Retrieved from http://arxiv.org/abs/1610.06545

Examples

x <- matrix(c(runif(100, 0, 1), runif(100, -1, 1)), ncol = 2) y <- matrix(c(runif(100, 0, 3), runif(100, -1, 1)), ncol = 2) classifier_test(x, y)
#> Loading required package: lattice
#> Loading required package: ggplot2
#> $statistic #> [1] 0.7166667 #> #> $p.value #> [1] 0.0001970216 #>