diff --git a/README.Rmd b/README.Rmd
index 102c260..95651ff 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -23,7 +23,8 @@ options(
asciicast_knitr_svg = TRUE,
asciicast_padding_y = 0,
asciicast_start_wait = 0,
- asciicast_end_wait = 1
+ asciicast_end_wait = 1,
+ asciicast_timeout = Inf
)
```
@@ -58,7 +59,6 @@ remotes::install_github("qddyy/LearnNonparam")
```{r, library, eval = FALSE}
library(LearnNonparam)
-options(LearnNonparam.pmt_progress = TRUE)
```
- Construct a test object
@@ -130,34 +130,80 @@ LearnNonparam::pmts()
```
-`define_pmt` allows users to define new permutation tests. Take the two-sample Cramér-Von Mises test as an example:
+## Extending
-```{asciicast, define}
-t <- define_pmt(
+The `define_pmt` function allows users to define new permutation tests. Take the two-sample Wilcoxon test as an example:
+
+```{asciicast, define_r}
+t_custom <- define_pmt(
# this is a two-sample permutation test
inherit = "twosample",
statistic = function(x, y) {
# (optional) pre-calculate certain constants that remain invariant during permutation
- n_x <- length(x)
- n_y <- length(y)
- F_x <- seq_len(n_x) / n_x
- G_y <- seq_len(n_y) / n_y
+ m <- length(x)
+ n <- length(y)
# return a closure to calculate the test statistic
- function(x, y) {
- x <- sort.int(x)
- y <- sort.int(y)
- F <- approxfun(x, F_x, "constant", 0, 1)
- G <- approxfun(y, G_y, "constant", 0, 1)
- sum(c(F_x - G(x), G_y - F(y))^2)
- }
+ function(x, y) sum(x) / m - sum(y) / n
},
- # reject the null hypothesis when the test statistic is large
- rejection = "r",
- name = "Two-Sample Cramér-Von Mises Test",
- alternative = "samples are from different continuous distributions"
+ # reject the null hypothesis when the test statistic is too large or too small
+ rejection = "lr", n_permu = 1e5
+)
+```
+
+Also, the statistic can be written in C++. Leveraging Rcpp sugars and C++14 features, only minor modifications are needed to make it compatible with C++ syntax.
+
+```{asciicast, define_cpp}
+t_cpp <- define_pmt(
+ inherit = "twosample", rejection = "lr", n_permu = 1e5,
+ statistic = "[](const auto& x, const auto& y) {
+ auto m = x.length();
+ auto n = y.length();
+ return [=](const auto& x, const auto& y) {
+ return sum(x) / m - sum(y) / n;
+ };
+ }"
+)
+```
+
+The following demonstrates that `t_custom` and `t_cpp` are equivalent:
+
+```{asciicast, prepare_data}
+x <- rnorm(10, mean = 0)
+y <- rnorm(10, mean = 5)
+```
+
+```{asciicast, t_custom_res}
+set.seed(0)
+t_custom$test(x, y)$print()
+```
+
+```{asciicast, t_cpp_res}
+set.seed(0)
+t_cpp$test(x, y)$print()
+```
+
+## Performance
+
+The `coin` package is a commonly used R package for performing permutation tests. Below is a benchmark comparing the computational efficiency of `coin` and `LearnNonparam`:
+
+```{asciicast, benchmark}
+library(coin)
+
+data <- c(x, y)
+group <- factor(c(rep("x", length(x)), rep("y", length(y))))
+
+options(LearnNonparam.pmt_progress = FALSE)
+benchmark <- microbenchmark::microbenchmark(
+ R = t_custom$test(x, y),
+ Rcpp = t_cpp$test(x, y),
+ coin = wilcox_test(data ~ group, distribution = approximate(nresample = 1e5, parallel = "no"))
)
+```
-t$test(rnorm(10), runif(10))$print()
+```{asciicast, benchmark_res}
+benchmark
```
+It can be seen that C++ brings significantly better performance than pure R, even surpassing the `coin` package. However, all tests in this package are currently written in R with no plans for migration to C++ in the future. This is because the primary goal of this package is not to maximize performance but to offer a flexible framework for permutation tests.
+
## References
\ No newline at end of file
diff --git a/README.md b/README.md
index 0ef40d0..b4e58f0 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,6 @@ remotes::install_github("qddyy/LearnNonparam")
``` r
library(LearnNonparam)
-options(LearnNonparam.pmt_progress = TRUE)
```
- Construct a test object
@@ -162,42 +161,127 @@ See pmts() for tests implemented in this package.
-`define_pmt` allows users to define new permutation tests. Take the
-two-sample Cramér-Von Mises test as an example:
+## Extending
+
+The `define_pmt` function allows users to define new permutation tests.
+Take the two-sample Wilcoxon test as an example:
``` r
-t <- define_pmt(
+t_custom <- define_pmt(
# this is a two-sample permutation test
inherit = "twosample",
statistic = function(x, y) {
# (optional) pre-calculate certain constants that remain invariant during permutation
- n_x <- length(x)
- n_y <- length(y)
- F_x <- seq_len(n_x) / n_x
- G_y <- seq_len(n_y) / n_y
+ m <- length(x)
+ n <- length(y)
# return a closure to calculate the test statistic
- function(x, y) {
- x <- sort.int(x)
- y <- sort.int(y)
- F <- approxfun(x, F_x, "constant", 0, 1)
- G <- approxfun(y, G_y, "constant", 0, 1)
- sum(c(F_x - G(x), G_y - F(y))^2)
- }
+ function(x, y) sum(x) / m - sum(y) / n
},
- # reject the null hypothesis when the test statistic is large
- rejection = "r",
- name = "Two-Sample Cramér-Von Mises Test",
- alternative = "samples are from different continuous distributions"
+ # reject the null hypothesis when the test statistic is too large or too small
+ rejection = "lr", n_permu = 1e5
)
+```
+
+
+
+Also, the statistic can be written in C++. Leveraging Rcpp sugars and
+C++14 features, only minor modifications are needed to make it
+compatible with C++ syntax.
-t$test(rnorm(10), runif(10))$print()
+``` r
+t_cpp <- define_pmt(
+ inherit = "twosample", rejection = "lr", n_permu = 1e5,
+ statistic = "[](const auto& x, const auto& y) {
+ auto m = x.length();
+ auto n = y.length();
+ return [=](const auto& x, const auto& y) {
+ return sum(x) / m - sum(y) / n;
+ };
+ }"
+)
```
+The following demonstrates that `t_custom` and `t_cpp` are equivalent:
+
+``` r
+x <- rnorm(10, mean = 0)
+y <- rnorm(10, mean = 5)
+```
+
+
+
+``` r
+set.seed(0)
+t_custom$test(x, y)$print()
+```
+
+
+
+``` r
+set.seed(0)
+t_cpp$test(x, y)$print()
+```
+
+
+
+## Performance
+
+The `coin` package is a commonly used R package for performing
+permutation tests. Below is a benchmark comparing the computational
+efficiency of `coin` and `LearnNonparam`:
+
+``` r
+library(coin)
+
+data <- c(x, y)
+group <- factor(c(rep("x", length(x)), rep("y", length(y))))
+
+options(LearnNonparam.pmt_progress = FALSE)
+benchmark <- microbenchmark::microbenchmark(
+ R = t_custom$test(x, y),
+ Rcpp = t_cpp$test(x, y),
+ coin = wilcox_test(data ~ group, distribution = approximate(nresample = 1e5, parallel = "no"))
+)
+```
+
+
+
+``` r
+benchmark
+```
+
+
+
+It can be seen that C++ brings significantly better performance than
+pure R, even surpassing the `coin` package. However, all tests in this
+package are currently written in R with no plans for migration to C++ in
+the future. This is because the primary goal of this package is not to
+maximize performance but to offer a flexible framework for permutation
+tests.
+
## References
diff --git a/man/figures/README/benchmark-dark.svg b/man/figures/README/benchmark-dark.svg
new file mode 100644
index 0000000..f1af742
--- /dev/null
+++ b/man/figures/README/benchmark-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/benchmark.svg b/man/figures/README/benchmark.svg
new file mode 100644
index 0000000..db40986
--- /dev/null
+++ b/man/figures/README/benchmark.svg
@@ -0,0 +1 @@
+Loadingrequiredpackage:survival
\ No newline at end of file
diff --git a/man/figures/README/benchmark_res-dark.svg b/man/figures/README/benchmark_res-dark.svg
new file mode 100644
index 0000000..6fdd691
--- /dev/null
+++ b/man/figures/README/benchmark_res-dark.svg
@@ -0,0 +1 @@
+Unit:Unit:millisecondsexprminlqmeanmedianuqmaxnevalcldR85.288.692.590.392.6200.6100aRcpp12.713.513.913.714.117.1100bcoin17.218.219.818.619.381.6100cexprexprminexprminlqexprminlqmeanexprminlqmeanmedianexprminlqmeanmedianuqexprminlqmeanmedianuqmaxexprminlqmeanmedianuqmaxnevalRR85.2R85.288.6R85.288.692.5R85.288.692.590.3R85.288.692.590.392.6R85.288.692.590.392.6200.6R85.288.692.590.392.6200.6100RcppRcpp12.7Rcpp12.713.5Rcpp12.713.513.9Rcpp12.713.513.913.7Rcpp12.713.513.913.714.1Rcpp12.713.513.913.714.117.1Rcpp12.713.513.913.714.117.1100coincoin17.2coin17.218.2coin17.218.219.8coin17.218.219.818.6coin17.218.219.818.619.3coin17.218.219.818.619.381.6coin17.218.219.818.619.381.6100
\ No newline at end of file
diff --git a/man/figures/README/benchmark_res.svg b/man/figures/README/benchmark_res.svg
new file mode 100644
index 0000000..f9d22e2
--- /dev/null
+++ b/man/figures/README/benchmark_res.svg
@@ -0,0 +1 @@
+Unit:Unit:millisecondsexprminlqmeanmedianuqmaxnevalcldR85.288.692.590.392.6200.6100aRcpp12.713.513.913.714.117.1100bcoin17.218.219.818.619.381.6100cexprexprminexprminlqexprminlqmeanexprminlqmeanmedianexprminlqmeanmedianuqexprminlqmeanmedianuqmaxexprminlqmeanmedianuqmaxnevalRR85.2R85.288.6R85.288.692.5R85.288.692.590.3R85.288.692.590.392.6R85.288.692.590.392.6200.6R85.288.692.590.392.6200.6100RcppRcpp12.7Rcpp12.713.5Rcpp12.713.513.9Rcpp12.713.513.913.7Rcpp12.713.513.913.714.1Rcpp12.713.513.913.714.117.1Rcpp12.713.513.913.714.117.1100coincoin17.2coin17.218.2coin17.218.219.8coin17.218.219.818.6coin17.218.219.818.619.3coin17.218.219.818.619.381.6coin17.218.219.818.619.381.6100
\ No newline at end of file
diff --git a/man/figures/README/define_cpp-dark.svg b/man/figures/README/define_cpp-dark.svg
new file mode 100644
index 0000000..1d4b3b3
--- /dev/null
+++ b/man/figures/README/define_cpp-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/define_cpp.svg b/man/figures/README/define_cpp.svg
new file mode 100644
index 0000000..43d0d99
--- /dev/null
+++ b/man/figures/README/define_cpp.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/define_r-dark.svg b/man/figures/README/define_r-dark.svg
new file mode 100644
index 0000000..f1cc530
--- /dev/null
+++ b/man/figures/README/define_r-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/define_r.svg b/man/figures/README/define_r.svg
new file mode 100644
index 0000000..26747bb
--- /dev/null
+++ b/man/figures/README/define_r.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/histogram.svg b/man/figures/README/histogram.svg
index dc52984..a100f53 100644
--- a/man/figures/README/histogram.svg
+++ b/man/figures/README/histogram.svg
@@ -28,130 +28,130 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
-10000
-20000
-30000
+10000
+20000
+300005075100
diff --git a/man/figures/README/modify-dark.svg b/man/figures/README/modify-dark.svg
index b46df91..5991eda 100644
--- a/man/figures/README/modify-dark.svg
+++ b/man/figures/README/modify-dark.svg
@@ -1 +1 @@
-[1]0.00361[1]
\ No newline at end of file
+[1]0.00361[1]
\ No newline at end of file
diff --git a/man/figures/README/modify.svg b/man/figures/README/modify.svg
index c00c226..7a8723e 100644
--- a/man/figures/README/modify.svg
+++ b/man/figures/README/modify.svg
@@ -1 +1 @@
-[1]0.00361[1]
\ No newline at end of file
+[1]0.00361[1]
\ No newline at end of file
diff --git a/man/figures/README/p_value-dark.svg b/man/figures/README/p_value-dark.svg
index 10818f8..a81049f 100644
--- a/man/figures/README/p_value-dark.svg
+++ b/man/figures/README/p_value-dark.svg
@@ -1 +1 @@
-[1]0.002154[1]
\ No newline at end of file
+[1]0.002044[1]
\ No newline at end of file
diff --git a/man/figures/README/p_value.svg b/man/figures/README/p_value.svg
index 09ee90d..ca6fc61 100644
--- a/man/figures/README/p_value.svg
+++ b/man/figures/README/p_value.svg
@@ -1 +1 @@
-[1]0.002154[1]
\ No newline at end of file
+[1]0.002044[1]
\ No newline at end of file
diff --git a/man/figures/README/plot-dark.svg b/man/figures/README/plot-dark.svg
index ae2ae76..442fc89 100644
--- a/man/figures/README/plot-dark.svg
+++ b/man/figures/README/plot-dark.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/man/figures/README/plot.svg b/man/figures/README/plot.svg
index a3acb14..bf4bd72 100644
--- a/man/figures/README/plot.svg
+++ b/man/figures/README/plot.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/man/figures/README/prepare_data-dark.svg b/man/figures/README/prepare_data-dark.svg
new file mode 100644
index 0000000..40668a9
--- /dev/null
+++ b/man/figures/README/prepare_data-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/prepare_data.svg b/man/figures/README/prepare_data.svg
new file mode 100644
index 0000000..bb3b1a4
--- /dev/null
+++ b/man/figures/README/prepare_data.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/man/figures/README/print-dark.svg b/man/figures/README/print-dark.svg
index 5786b7d..061dd28 100644
--- a/man/figures/README/print-dark.svg
+++ b/man/figures/README/print-dark.svg
@@ -1 +1 @@
-Two-SampleWilcoxonTestscoring:rankscoring:ranktype:permu(1e+06)scoring:ranktype:permu(1e+06)method:defaultstatistic=144,p-value=0.00215(±9.09e-05at95%confidence)alternativehypothesis:alternativehypothesis:truelocationshiftisnotequalto0estimate:estimate:1.0395%confidenceinterval:(0.602,1.83)statistic=144statistic=144,
\ No newline at end of file
+Two-SampleWilcoxonTestscoring:rankscoring:ranktype:permu(1e+06)scoring:ranktype:permu(1e+06)method:defaultstatistic=144,p-value=0.00204(±8.85e-05at95%confidence)alternativehypothesis:alternativehypothesis:truelocationshiftisnotequalto0estimate:estimate:1.0395%confidenceinterval:(0.602,1.83)statistic=144statistic=144,
\ No newline at end of file
diff --git a/man/figures/README/print.svg b/man/figures/README/print.svg
index 954aad7..ec99de2 100644
--- a/man/figures/README/print.svg
+++ b/man/figures/README/print.svg
@@ -1 +1 @@
-Two-SampleWilcoxonTestscoring:rankscoring:ranktype:permu(1e+06)scoring:ranktype:permu(1e+06)method:defaultstatistic=144,p-value=0.00215(±9.09e-05at95%confidence)alternativehypothesis:alternativehypothesis:truelocationshiftisnotequalto0estimate:estimate:1.0395%confidenceinterval:(0.602,1.83)statistic=144statistic=144,
\ No newline at end of file
+Two-SampleWilcoxonTestscoring:rankscoring:ranktype:permu(1e+06)scoring:ranktype:permu(1e+06)method:defaultstatistic=144,p-value=0.00204(±8.85e-05at95%confidence)alternativehypothesis:alternativehypothesis:truelocationshiftisnotequalto0estimate:estimate:1.0395%confidenceinterval:(0.602,1.83)statistic=144statistic=144,
\ No newline at end of file
diff --git a/man/figures/README/statistic-dark.svg b/man/figures/README/statistic-dark.svg
index 6502b14..59dbc91 100644
--- a/man/figures/README/statistic-dark.svg
+++ b/man/figures/README/statistic-dark.svg
@@ -1 +1 @@
-[1]144[1]
\ No newline at end of file
+[1]144[1]
\ No newline at end of file
diff --git a/man/figures/README/statistic.svg b/man/figures/README/statistic.svg
index b25dc09..df2c462 100644
--- a/man/figures/README/statistic.svg
+++ b/man/figures/README/statistic.svg
@@ -1 +1 @@
-[1]144[1]
\ No newline at end of file
+[1]144[1]
\ No newline at end of file
diff --git a/man/figures/README/t_cpp_res-dark.svg b/man/figures/README/t_cpp_res-dark.svg
new file mode 100644
index 0000000..4fc30b3
--- /dev/null
+++ b/man/figures/README/t_cpp_res-dark.svg
@@ -0,0 +1 @@
+0%||User-DefinedPermutationTestscoring:nonescoring:nonetype:permu(1e+05)scoring:nonetype:permu(1e+05)method:defaultstatistic=-4.87,p-value=2e-05(±2.77e-05at95%confidence)1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|statistic=-4.87statistic=-4.87,
\ No newline at end of file
diff --git a/man/figures/README/t_cpp_res.svg b/man/figures/README/t_cpp_res.svg
new file mode 100644
index 0000000..82447d0
--- /dev/null
+++ b/man/figures/README/t_cpp_res.svg
@@ -0,0 +1 @@
+0%||User-DefinedPermutationTestscoring:nonescoring:nonetype:permu(1e+05)scoring:nonetype:permu(1e+05)method:defaultstatistic=-4.87,p-value=2e-05(±2.77e-05at95%confidence)1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|statistic=-4.87statistic=-4.87,
\ No newline at end of file
diff --git a/man/figures/README/t_custom_res-dark.svg b/man/figures/README/t_custom_res-dark.svg
new file mode 100644
index 0000000..0f67490
--- /dev/null
+++ b/man/figures/README/t_custom_res-dark.svg
@@ -0,0 +1 @@
+0%||User-DefinedPermutationTestscoring:nonescoring:nonetype:permu(1e+05)scoring:nonetype:permu(1e+05)method:defaultstatistic=-4.87,p-value=2e-05(±2.77e-05at95%confidence)1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|statistic=-4.87statistic=-4.87,
\ No newline at end of file
diff --git a/man/figures/README/t_custom_res.svg b/man/figures/README/t_custom_res.svg
new file mode 100644
index 0000000..fd0424f
--- /dev/null
+++ b/man/figures/README/t_custom_res.svg
@@ -0,0 +1 @@
+0%||User-DefinedPermutationTestscoring:nonescoring:nonetype:permu(1e+05)scoring:nonetype:permu(1e+05)method:defaultstatistic=-4.87,p-value=2e-05(±2.77e-05at95%confidence)1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|statistic=-4.87statistic=-4.87,
\ No newline at end of file
diff --git a/man/figures/README/test-dark.svg b/man/figures/README/test-dark.svg
index f74ce64..26814ea 100644
--- a/man/figures/README/test-dark.svg
+++ b/man/figures/README/test-dark.svg
@@ -1 +1 @@
-0%||1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|
\ No newline at end of file
+0%||1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|
\ No newline at end of file
diff --git a/man/figures/README/test.svg b/man/figures/README/test.svg
index a06c9fe..3f0e82c 100644
--- a/man/figures/README/test.svg
+++ b/man/figures/README/test.svg
@@ -1 +1 @@
-0%||1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|
\ No newline at end of file
+0%||1%||2%|>|3%|>|4%|->|5%|->|6%|-->|7%|-->|8%|--->|9%|--->|10%|---->|11%|---->|12%|----->|13%|----->|14%|------>|15%|------>|16%|------->|17%|------->|18%|-------->|19%|-------->|20%|--------->|21%|--------->|22%|---------->|23%|---------->|24%|----------->|25%|----------->|26%|------------>|27%|------------>|28%|------------->|29%|------------->|30%|-------------->|31%|-------------->|32%|--------------->|33%|--------------->|34%|---------------->|35%|---------------->|36%|----------------->|37%|----------------->|38%|------------------>|39%|------------------>|40%|------------------->|41%|------------------->|42%|-------------------->|43%|-------------------->|44%|--------------------->|45%|--------------------->|46%|---------------------->|47%|---------------------->|48%|----------------------->|49%|----------------------->|50%|------------------------>|51%|------------------------>|52%|------------------------->|53%|------------------------->|54%|-------------------------->|55%|-------------------------->|56%|--------------------------->|57%|--------------------------->|58%|---------------------------->|59%|---------------------------->|60%|----------------------------->|61%|----------------------------->|62%|------------------------------>|63%|------------------------------>|64%|------------------------------->|65%|------------------------------->|66%|-------------------------------->|67%|-------------------------------->|68%|--------------------------------->|69%|--------------------------------->|70%|---------------------------------->|71%|---------------------------------->|72%|----------------------------------->|73%|----------------------------------->|74%|------------------------------------>|75%|------------------------------------>|76%|------------------------------------->|77%|------------------------------------->|78%|-------------------------------------->|79%|-------------------------------------->|80%|--------------------------------------->|81%|--------------------------------------->|82%|---------------------------------------->|83%|---------------------------------------->|84%|----------------------------------------->|85%|----------------------------------------->|86%|------------------------------------------>|87%|------------------------------------------>|88%|------------------------------------------->|89%|------------------------------------------->|90%|-------------------------------------------->|91%|-------------------------------------------->|92%|--------------------------------------------->|93%|--------------------------------------------->|94%|---------------------------------------------->|95%|---------------------------------------------->|96%|----------------------------------------------->|97%|----------------------------------------------->|98%|------------------------------------------------>|99%|------------------------------------------------>|
\ No newline at end of file