| Title: | 'R6'-Based Flexible Framework for Permutation Tests |
|---|---|
| Description: | Implements non-parametric tests from Higgins (2004, ISBN:0534387756), including tests for one sample, two samples, k samples, paired comparisons, blocked designs, trends and association. Built with 'Rcpp' for efficiency and 'R6' for flexible, object-oriented design, the package provides a unified framework for performing or creating custom permutation tests. |
| Authors: | Yan Du [aut, cre] (ORCID: <https://orcid.org/0009-0009-1169-921X>) |
| Maintainer: | Yan Du <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.3.0 |
| Built: | 2026-05-11 17:19:40 UTC |
| Source: | https://github.com/qddyy/learnnonparam |
Performs two-sample Anderson-Darling test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleDistributionTest -> AndersonDarling
new()
Create a new AndersonDarling object.
AndersonDarling$new(
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A AndersonDarling object.
pmt( "distribution.ad", n_permu = 0 )$test(Table2.8.1)$print()pmt( "distribution.ad", n_permu = 0 )$test(Table2.8.1)$print()
Performs Ansari-Bradley test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> AnsariBradley
new()
Create a new AnsariBradley object.
AnsariBradley$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A AnsariBradley object.
pmt( "twosample.ansari", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()pmt( "twosample.ansari", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()
Performs statistical inference on population cumulative distribution function.
LearnNonparam::PermuTest -> LearnNonparam::OneSampleTest -> CDF
new()
Create a new CDF object.
CDF$new(method = c("binomial", "dkw"), conf_level = 0.95)methoda character string specifying whether to use a confidence band based on the binomial distribution or the Dvoretzky-Kiefer-Wolfowitz inequality.
conf_levela number specifying confidence level of the confidence bounds.
A CDF object.
plot()
Plot the estimate and confidence bounds for population cumulative distribution function.
CDF$plot(style = c("graphics", "ggplot2"))stylea character string specifying which package to use.
The object itself (invisibly).
pmt("onesample.cdf")$test(Table1.2.1)$plot(style = "graphic")pmt("onesample.cdf")$test(Table1.2.1)$plot(style = "graphic")
Performs chi-square test on contingency tables.
LearnNonparam::PermuTest -> LearnNonparam::ContingencyTableTest -> ChiSquare
new()
Create a new ChiSquare object.
ChiSquare$new(type = c("permu", "asymp"), n_permu = 10000)typea character string specifying the way to calculate the p-value.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A ChiSquare object.
t <- pmt( "table.chisq", n_permu = 0 )$test(Table5.4.2)$print() t$type <- "asymp" tt <- pmt( "table.chisq", n_permu = 0 )$test(Table5.4.2)$print() t$type <- "asymp" t
Abstract class for tests on contingency tables.
LearnNonparam::PermuTest -> ContingencyTableTest
Performs correlation coefficient based two-sample association test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSamplePairedTest -> LearnNonparam::TwoSampleAssociationTest -> Correlation
new()
Create a new Correlation object.
Correlation$new(
type = c("permu", "asymp"),
method = c("pearson", "kendall", "spearman"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
methoda character string specifying the correlation coefficient to be used.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Correlation object.
pmt( "association.corr", method = "pearson", alternative = "greater", n_permu = 10000 )$test(Table5.1.2)$print() t <- pmt( "association.corr", method = "spearman", alternative = "two_sided", n_permu = 10000 )$test(Table5.1.2)$print() t$type <- "asymp" t t <- pmt( "association.corr", method = "kendall", alternative = "greater", n_permu = 0 )$test(Table5.2.2)$print() t$type <- "asymp" tpmt( "association.corr", method = "pearson", alternative = "greater", n_permu = 10000 )$test(Table5.1.2)$print() t <- pmt( "association.corr", method = "spearman", alternative = "two_sided", n_permu = 10000 )$test(Table5.1.2)$print() t$type <- "asymp" t t <- pmt( "association.corr", method = "kendall", alternative = "greater", n_permu = 0 )$test(Table5.2.2)$print() t$type <- "asymp" t
Performs two-sample Cramer-Von Mises test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleDistributionTest -> CramerVonMises
new()
Create a new CramerVonMises object.
CramerVonMises$new(
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A CramerVonMises object.
pmt( "distribution.cvm", n_permu = 0 )$test(Table2.8.1)$print()pmt( "distribution.cvm", n_permu = 0 )$test(Table2.8.1)$print()
Performs mean/median based two-sample test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleLocationTest -> Difference
new()
Create a new Difference object.
Difference$new(
method = c("mean", "median"),
alternative = c("two_sided", "less", "greater"),
null_value = 0,
n_permu = 10000
)methoda character string specifying whether to use the mean or the median.
alternativea character string specifying the alternative hypothesis.
null_valuea number indicating the true value of the location shift.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Difference object.
pmt( "twosample.difference", method = "mean", alternative = "greater", n_permu = 0 )$test(Table2.1.1)$print()$plot( style = "graphic", breaks = seq(-20, 25, length.out = 9) ) pmt( "twosample.difference", method = "mean", alternative = "greater", n_permu = 1000 )$test(Table2.3.1)$print()pmt( "twosample.difference", method = "mean", alternative = "greater", n_permu = 0 )$test(Table2.1.1)$print()$plot( style = "graphic", breaks = seq(-20, 25, length.out = 9) ) pmt( "twosample.difference", method = "mean", alternative = "greater", n_permu = 1000 )$test(Table2.3.1)$print()
Performs Friedman test on samples collected in a randomized complete block design.
LearnNonparam::PermuTest -> LearnNonparam::RCBDTest -> Friedman
new()
Create a new Friedman object.
Friedman$new(type = c("permu", "asymp"), n_permu = 10000)typea character string specifying the way to calculate the p-value.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Friedman object.
t <- pmt( "rcbd.friedman", n_permu = 0 )$test(Table4.5.3)$print() t$type <- "asymp" tt <- pmt( "rcbd.friedman", n_permu = 0 )$test(Table4.5.3)$print() t$type <- "asymp" t
Performs Jonckheere-Terpstra test on samples.
LearnNonparam::PermuTest -> LearnNonparam::KSampleTest -> JonckheereTerpstra
new()
Create a new JonckheereTerpstra object.
JonckheereTerpstra$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A JonckheereTerpstra object.
t <- pmt( "ksample.jt", alternative = "greater" )$test(Table3.4.1)$print() t$type <- "asymp" tt <- pmt( "ksample.jt", alternative = "greater" )$test(Table3.4.1)$print() t$type <- "asymp" t
Performs two-sample Kolmogorov-Smirnov test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleDistributionTest -> KolmogorovSmirnov
new()
Create a new KolmogorovSmirnov object.
KolmogorovSmirnov$new(
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A KolmogorovSmirnov object.
pmt( "distribution.ks", n_permu = 0 )$test(Table2.8.1)$print()pmt( "distribution.ks", n_permu = 0 )$test(Table2.8.1)$print()
Performs Kruskal-Wallis test on samples.
LearnNonparam::PermuTest -> LearnNonparam::KSampleTest -> KruskalWallis
new()
Create a new KruskalWallis object.
KruskalWallis$new(
type = c("permu", "asymp"),
scoring = c("rank", "vw", "expon"),
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
scoringa character string specifying the scoring system.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A KruskalWallis object.
pmt( "ksample.kw", type = "asymp" )$test(Table3.2.2)$print() t <- pmt( "ksample.kw", type = "permu" )$test(Table3.2.3)$print() t$type <- "asymp" tpmt( "ksample.kw", type = "asymp" )$test(Table3.2.2)$print() t <- pmt( "ksample.kw", type = "permu" )$test(Table3.2.3)$print() t$type <- "asymp" t
Abstract class for k-sample tests.
LearnNonparam::PermuTest -> KSampleTest
Performs two-sample Kuiper test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleDistributionTest -> Kuiper
new()
Create a new Kuiper object.
Kuiper$new(alternative = c("two_sided", "less", "greater"), n_permu = 10000)alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Kuiper object.
pmt( "distribution.kuiper", n_permu = 0 )$test(Table2.8.1)$print()pmt( "distribution.kuiper", n_permu = 0 )$test(Table2.8.1)$print()
Abstract class for multiple comparisons.
LearnNonparam::PermuTest -> LearnNonparam::KSampleTest -> MultipleComparison
Abstract class for one-sample tests.
LearnNonparam::PermuTest -> OneSampleTest
plot()
OneSampleTest$plot(...)
...ignored.
Performs F statistic based one-way test on samples.
LearnNonparam::PermuTest -> LearnNonparam::KSampleTest -> OneWay
new()
Create a new OneWay object.
OneWay$new(type = c("permu", "asymp"), n_permu = 10000)typea character string specifying the way to calculate the p-value.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A OneWay object.
t <- pmt( "ksample.oneway", n_permu = 0 )$test(Table3.1.2)$print() t$type <- "asymp" tt <- pmt( "ksample.oneway", n_permu = 0 )$test(Table3.1.2)$print() t$type <- "asymp" t
Performs Page test on samples collected in a randomized complete block design.
LearnNonparam::PermuTest -> LearnNonparam::RCBDTest -> Page
new()
Create a new Page object.
Page$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Page object.
t <- pmt( "rcbd.page", alternative = "less" )$test(Table4.4.3)$print() t$type <- "asymp" tt <- pmt( "rcbd.page", alternative = "less" )$test(Table4.4.3)$print() t$type <- "asymp" t
Performs differences based paired comparison on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSamplePairedTest -> PairedDifference
correctWhether to apply continuity correction when scoring is set to "rank".
new()
Create a new PairedDifference object.
PairedDifference$new(
type = c("permu", "asymp"),
method = c("with_zeros", "without_zeros"),
scoring = c("none", "rank", "vw", "expon"),
alternative = c("two_sided", "less", "greater"),
null_value = 0,
n_permu = 10000,
correct = TRUE
)typea character string specifying the way to calculate the p-value.
methoda character string specifying the method of ranking data in computing adjusted signed scores for tied data, must be one of "with_zeros" (default) or "without_zeros".
scoringa character string specifying the scoring system.
alternativea character string specifying the alternative hypothesis.
null_valuea number indicating the true value of the location shift.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
correcta logical indicating whether to apply continuity correction in the normal approximation for the p-value when scoring is set to "rank".
A PairedDifference object.
pmt( "paired.difference", alternative = "greater", scoring = "none", n_permu = 0 )$test(Table4.1.1)$print() pmt( "paired.difference", n_permu = 0 )$test(Table4.1.3)$print() t <- pmt( "paired.difference", scoring = "rank", alternative = "greater", n_permu = 0 )$test(Table4.1.1)$print() t$type <- "asymp" tpmt( "paired.difference", alternative = "greater", scoring = "none", n_permu = 0 )$test(Table4.1.1)$print() pmt( "paired.difference", n_permu = 0 )$test(Table4.1.3)$print() t <- pmt( "paired.difference", scoring = "rank", alternative = "greater", n_permu = 0 )$test(Table4.1.1)$print() t$type <- "asymp" t
Abstract class for permutation tests.
typeThe way to calculate the p-value.
methodThe method used.
scoringThe scoring system used.
alternativeThe alternative hypothesis.
null_valueThe hypothesized value of the parameter in the null hypothesis.
conf_levelThe confidence level of the interval.
n_permuThe number of permutations used.
dataThe data.
statisticThe test statistic.
p_valueThe p-value.
estimateThe estimated value of the parameter.
conf_intThe confidence interval of the parameter.
test()
Perform test on sample(s).
PermuTest$test(...)
...sample(s). Can be numeric vector(s) or a data.frame or list containing them.
A progress bar is shown by default. Use options(LearnNonparam.pmt_progress = FALSE) to disable it.
The object itself (invisibly).
print()
Print the results of the test.
PermuTest$print()
The object itself (invisibly).
plot()
Plot histogram(s) of the permutation distribution. Note that this method only works if type is set to "permu".
PermuTest$plot(style = c("graphics", "ggplot2"), ...)stylea character string specifying which package to use.
...passed to graphics::hist.default() or ggplot2::stat_bin().
The object itself (invisibly).
Construct test objects in a unified way.
pmt(key, ...) pmts( which = c("all", "onesample", "twosample", "distribution", "association", "paired", "ksample", "multcomp", "rcbd", "table") ) define_pmt( method = c("twosample", "distribution", "association", "paired", "ksample", "rcbd", "table"), statistic, rejection = c("<>", "<", ">"), scoring = "none", n_permu = 10000, name = "User-Defined Permutation Test", alternative = NULL, quickr = FALSE, depends = character(), plugins = character(), includes = character() )pmt(key, ...) pmts( which = c("all", "onesample", "twosample", "distribution", "association", "paired", "ksample", "multcomp", "rcbd", "table") ) define_pmt( method = c("twosample", "distribution", "association", "paired", "ksample", "rcbd", "table"), statistic, rejection = c("<>", "<", ">"), scoring = "none", n_permu = 10000, name = "User-Defined Permutation Test", alternative = NULL, quickr = FALSE, depends = character(), plugins = character(), includes = character() )
key |
a character string specifying the test. Check |
... |
extra parameters passed to the constructor. |
which |
a character string specifying the desired tests. |
method |
a character string specifying the permutation scheme. |
statistic |
definition of the test statistic. See details. |
rejection |
a character string specifying the rejection region relative to the test statistic. |
scoring |
one of:
- a character string in |
n_permu |
an integer indicating number of permutations for the permutation distribution. If set to |
name, alternative
|
character strings specifying the name of the test and the alternative hypothesis, used for printing purposes only. |
quickr |
a logical indicating whether to use |
depends, plugins, includes
|
passed to |
The test statistic can be defined using either R or Rcpp, with the statistic parameter specified as:
R: a closure returning one of
a double (the test statistic).
a closure returning a double.
Rcpp: a character string defining a captureless lambda (since C++11) returning another lambda that captures by value, accepts parameters of the same type, and returns a double.
This design aims to pre-calculate potential constants that remain invariant during permutation.
When using Rcpp, the parameters for different method are listed as follows. Note that the names can be customized, and the types can be replaced with auto (thanks to the support for generic lambdas in C++14). See examples.
method |
Parameter 1 | Parameter 2 |
"twosample" |
const NumericVector& sample_1 |
const NumericVector& sample_2 |
"distribution" |
const NumericVector& cumulative_prob_1 |
const NumericVector& cumulative_prob_2 |
"association" |
const NumericVector& sample_1 |
const NumericVector& sample_2 |
"paired" |
const NumericVector& sample_1 |
const NumericVector& sample_2 |
"ksample" |
const NumericVector& combined_sample |
const IntegerVector& one_based_group_index |
"rcbd" |
const NumericMatrix& block_as_column_data |
|
"table" |
const IntegerMatrix& contingency_table |
When using R, statistic and the parameters should be the R equivalents of the above. If no constants exist during permutation, statistic may simply be an R closure returning a double.
If quickr = TRUE and statistic returns a double, it will be compiled to Fortran via quickr::quick() with base::declare() calls for all arguments inserted automatically. Otherwise, statistic will be compiled using compiler::cmpfun().
a test object corresponding to the specified key.
a data frame containing keys and corresponding tests implemented in this package.
a test object based on the specified statistic.
To improve performance when calling R closures from C++, this package repeatedly evaluates the closure's body in an environment whose enclosing environment is the closure's own, with its formal arguments pre-assigned to the data. This imposes the following restrictions on the closure returning the test statistic when statistic is written in R:
Do not re-assign its formal arguments or any pre-computed symbols in its environment.
Do not use default arguments or variadic arguments.
It's also worth noting that the data is permuted in-place. Therefore, modifications to the data within statistic may lead to incorrect results. It is recommended to avoid modifying the data when using R and pass const references as in the table above when using Rcpp.
pmt("twosample.wilcoxon") pmts("ksample") x <- rnorm(5) y <- rnorm(5, 1) t <- define_pmt( method = "twosample", rejection = "<", scoring = base::rank, # equivalent to "rank" statistic = function(x, y) sum(x) )$test(x, y)$print() t$scoring <- function(x) qnorm(rank(x) / (length(x) + 1)) # equivalent to "vw" t$print() t$n_permu <- 0 t$print() r <- define_pmt( method = "twosample", n_permu = 1e5, statistic = function(x, y) { m <- length(x) n <- length(y) function(x, y) sum(x) / m - sum(y) / n } ) quickr <- define_pmt( method = "twosample", n_permu = 1e5, quickr = TRUE, statistic = function(x, y) sum(x) / length(x) - sum(y) / length(y) ) rcpp <- define_pmt( method = "twosample", 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; }; }" ) # equivalent # rcpp <- define_pmt( # method = "twosample", n_permu = 1e5, # statistic = "[](const NumericVector& x, const NumericVector& y) { # R_xlen_t m = x.length(); # R_xlen_t n = y.length(); # return [m, n](const NumericVector& x, const NumericVector& y) -> double { # return sum(x) / m - sum(y) / n; # }; # }" # ) set.seed(0) r$test(x, y)$print() set.seed(0) quickr$test(x, y)$print() set.seed(0) rcpp$test(x, y)$print() options(LearnNonparam.pmt_progress = FALSE) system.time(r$test(x, y)) system.time(quickr$test(x, y)) system.time(rcpp$test(x, y))pmt("twosample.wilcoxon") pmts("ksample") x <- rnorm(5) y <- rnorm(5, 1) t <- define_pmt( method = "twosample", rejection = "<", scoring = base::rank, # equivalent to "rank" statistic = function(x, y) sum(x) )$test(x, y)$print() t$scoring <- function(x) qnorm(rank(x) / (length(x) + 1)) # equivalent to "vw" t$print() t$n_permu <- 0 t$print() r <- define_pmt( method = "twosample", n_permu = 1e5, statistic = function(x, y) { m <- length(x) n <- length(y) function(x, y) sum(x) / m - sum(y) / n } ) quickr <- define_pmt( method = "twosample", n_permu = 1e5, quickr = TRUE, statistic = function(x, y) sum(x) / length(x) - sum(y) / length(y) ) rcpp <- define_pmt( method = "twosample", 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; }; }" ) # equivalent # rcpp <- define_pmt( # method = "twosample", n_permu = 1e5, # statistic = "[](const NumericVector& x, const NumericVector& y) { # R_xlen_t m = x.length(); # R_xlen_t n = y.length(); # return [m, n](const NumericVector& x, const NumericVector& y) -> double { # return sum(x) / m - sum(y) / n; # }; # }" # ) set.seed(0) r$test(x, y)$print() set.seed(0) quickr$test(x, y)$print() set.seed(0) rcpp$test(x, y)$print() options(LearnNonparam.pmt_progress = FALSE) system.time(r$test(x, y)) system.time(quickr$test(x, y)) system.time(rcpp$test(x, y))
Performs quantile test on a single sample. In addition, an estimation and a confidence interval for the desired quantile will be calculated.
LearnNonparam::PermuTest -> LearnNonparam::OneSampleTest -> Quantile
probThe probability associated with the quantile.
correcta logical indicating whether to apply continuity correction.
new()
Create a new Quantile object.
Quantile$new(
type = c("asymp", "exact"),
alternative = c("two_sided", "less", "greater"),
null_value = 0,
conf_level = 0.95,
prob = 0.5,
correct = TRUE
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
null_valuea number indicating the hypothesized value of the quantile.
conf_levela number between zero and one indicating the confidence level to use.
proba number between zero and one indicating the probability associated with the quantile.
correcta logical indicating whether to apply continuity correction in the normal approximation for the p-value.
A Quantile object.
pmt( "onesample.quantile", prob = 0.5, null_value = 75, alternative = "greater", type = "asymp", correct = FALSE )$test(Table1.1.1)$print() pmt( "onesample.quantile", prob = 0.25, conf_level = 0.90 )$test(Table1.2.1)$conf_intpmt( "onesample.quantile", prob = 0.5, null_value = 75, alternative = "greater", type = "asymp", correct = FALSE )$test(Table1.1.1)$print() pmt( "onesample.quantile", prob = 0.25, conf_level = 0.90 )$test(Table1.2.1)$conf_int
Performs ratio mean deviance test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> RatioMeanDeviance
new()
Create a new RatioMeanDeviance object.
RatioMeanDeviance$new(
alternative = c("two_sided", "less", "greater"),
n_permu = 10000
)alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A RatioMeanDeviance object.
pmt( "twosample.rmd", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()pmt( "twosample.rmd", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()
Performs F statistic based one-way test on samples collected in a randomized complete block design.
LearnNonparam::PermuTest -> LearnNonparam::RCBDTest -> RCBDOneWay
new()
Create a new RCBDOneWay object.
RCBDOneWay$new(type = c("permu", "asymp"), n_permu = 10000)typea character string specifying the way to calculate the p-value.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A RCBDOneWay object.
t <- pmt( "rcbd.oneway", n_permu = 5000 )$test(Table4.4.3)$print() t$type <- "asymp" tt <- pmt( "rcbd.oneway", n_permu = 5000 )$test(Table4.4.3)$print() t$type <- "asymp" t
Abstract class for tests on samples collected in randomized complete block designs.
LearnNonparam::PermuTest -> RCBDTest
Performs Siegel-Tukey test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleLocationTest -> LearnNonparam::Wilcoxon -> SiegelTukey
new()
Create a new SiegelTukey object.
SiegelTukey$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000,
correct = TRUE
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
correcta logical indicating whether to apply continuity correction in the normal approximation for the p-value.
A SiegelTukey object.
pmt( "twosample.siegel", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()pmt( "twosample.siegel", alternative = "greater", n_permu = 0 )$test(Table2.8.1)$print()
Performs two-sample sign test on samples.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSamplePairedTest -> Sign
correcta logical indicating whether to apply continuity correction.
new()
Create a new Sign object.
Sign$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
n_permu = 10000,
correct = TRUE
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
correcta logical indicating whether to apply continuity correction in the normal approximation for the p-value.
A Sign object.
t <- pmt( "paired.sign", alternative = "greater", n_permu = 0 )$test( rep(c(+1, -1), c(12, 5)), rep(0, 17) )$print() t$type <- "asymp" tt <- pmt( "paired.sign", alternative = "greater", n_permu = 0 )$test( rep(c(+1, -1), c(12, 5)), rep(0, 17) )$print() t$type <- "asymp" t
Performs studentized statistic based multiple comparison on samples.
LearnNonparam::PermuTest -> LearnNonparam::KSampleTest -> LearnNonparam::MultipleComparison -> Studentized
new()
Create a new Studentized object.
Studentized$new(
type = c("permu", "asymp"),
method = c("bonferroni", "tukey"),
scoring = c("none", "rank", "vw", "expon"),
conf_level = 0.95,
n_permu = 10000
)typea character string specifying the way to calculate the p-value.
methoda character string specifying whether to use Bonferroni's method or Tukey's HSD method.
scoringa character string specifying the scoring system.
conf_levela number between zero and one indicating the family-wise confidence level to use.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
A Studentized object.
t <- pmt( "multcomp.studentized", method = "bonferroni" )$test(Table3.3.1)$print() t$type <- "asymp" t t$scoring <- "rank" t t$method <- "tukey" t t$scoring <- "none" t t$type <- "permu" tt <- pmt( "multcomp.studentized", method = "bonferroni" )$test(Table3.3.1)$print() t$type <- "asymp" t t$scoring <- "rank" t t$method <- "tukey" t t$scoring <- "none" t t$type <- "permu" t
Sodium contents (in mg) of 40 servings of a food product.
Table1.1.1Table1.1.1
An object of class numeric of length 40.
Table 1.1.1
The number of cycles (in thousands) that it takes for 20 door latches to fail.
Table1.2.1Table1.2.1
An object of class numeric of length 20.
Table 1.2.1
Test scores of 7 employees for comparison of methods of instruction.
Table2.1.1Table2.1.1
An object of class list of length 2.
Table 2.1.1
The numbers of minutes it took to obtain various amounts of runoff on each plot.
Table2.3.1Table2.3.1
An object of class data.frame with 8 rows and 2 columns.
Table 2.3.1
The numbers of hours that 2 brands of laptop computers function before battery recharging is necessary.
Table2.6.1Table2.6.1
An object of class data.frame with 4 rows and 2 columns.
Table 2.6.1
The amounts of cerium measured in samples of granite and basalt.
Table2.6.2Table2.6.2
An object of class data.frame with 6 rows and 2 columns.
Table 2.6.2
The amounts of liquid in randomly selected beverage containers before and after the filling process has been repaired.
Table2.8.1Table2.8.1
An object of class data.frame with 5 rows and 2 columns.
Table 2.8.1
Observations randomly sampled from normal populations with means 15, 25 and 30, respectively, and standard deviation 9.
Table3.1.2Table3.1.2
An object of class data.frame with 5 rows and 3 columns.
Table 3.1.2
Logarithms of counts of bacteria in 4 samples, which respectively were treated with 3 kills and left untreated for the control.
Table3.2.2Table3.2.2
An object of class list of length 4.
Table 3.2.2
Saltiness scores, on a scale of 1 to 5, assigned by a taste expert to samples of 3 food products that differ in the amounts of soymeal they contain.
Table3.2.3Table3.2.3
An object of class list of length 3.
Table 3.2.3
The percentages of clay in 6 samples of soil selected from 4 locations.
Table3.3.1Table3.3.1
An object of class data.frame with 6 rows and 4 columns.
Table 3.3.1
Phosphorus contents of plants under 4 mowing treatments.
Table3.4.1Table3.4.1
An object of class data.frame with 6 rows and 4 columns.
Table 3.4.1
The estimated daily caloric intake from dietary information provided using 2 methods by a group of college women.
Table4.1.1Table4.1.1
An object of class data.frame with 5 rows and 2 columns.
Table 4.1.1
Reduction in cholesterol after twins were given 2 drugs separately.
Table4.1.3Table4.1.3
An object of class data.frame with 17 rows and 2 columns.
Table 4.1.3
Yield data for a randomized complete block design in which 4 different types of tractors were used in tilling the soil. The blocking factor is location of the fields.
Table4.4.3Table4.4.3
An object of class data.frame with 4 rows and 6 columns.
Table 4.4.3
A randomized complete block design with 4 treatments and 3 blocks.
Table4.5.3Table4.5.3
An object of class data.frame with 4 rows and 3 columns.
Table 4.5.3
Counts of the heterophils and lymphocytes in blood samples from 18 healthy rabbits.
Table5.1.2Table5.1.2
An object of class data.frame with 18 rows and 2 columns.
Table5.1.2
Scores of 10 projects at a science fair.
Table5.2.2Table5.2.2
An object of class data.frame with 10 rows and 2 columns.
Table5.2.2
Patients' responses with 2 methods of relieving postoperative pain.
Table5.4.2Table5.4.2
An object of class data.frame with 2 rows and 3 columns.
Table5.4.2
Abstract class for two-sample association tests.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSamplePairedTest -> TwoSampleAssociationTest
Abstract class for two-sample distribution tests.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> TwoSampleDistributionTest
Abstract class for two-sample location tests.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> TwoSampleLocationTest
Abstract class for paired two-sample tests.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> TwoSamplePairedTest
Abstract class for two-sample tests.
LearnNonparam::PermuTest -> TwoSampleTest
Performs two-sample wilcoxon test on samples. In addition, an estimation and a confidence interval for the location shift will be calculated.
LearnNonparam::PermuTest -> LearnNonparam::TwoSampleTest -> LearnNonparam::TwoSampleLocationTest -> Wilcoxon
correcta logical indicating whether to apply continuity correction.
new()
Create a new Wilcoxon object.
Wilcoxon$new(
type = c("permu", "asymp"),
alternative = c("two_sided", "less", "greater"),
null_value = 0,
conf_level = 0.95,
n_permu = 10000,
correct = TRUE
)typea character string specifying the way to calculate the p-value.
alternativea character string specifying the alternative hypothesis.
null_valuea number indicating the true value of the location shift.
conf_levela number between zero and one indicating the confidence level to use.
n_permuan integer indicating number of permutations for the permutation distribution. If set to 0, all permutations will be used.
correcta logical indicating whether to apply continuity correction in the normal approximation for the p-value.
A Wilcoxon object.
pmt( "twosample.wilcoxon", alternative = "greater", n_permu = 0 )$test(Table2.1.1)$print() pmt( "twosample.wilcoxon", alternative = "less", n_permu = 0 )$test(Table2.6.1)$print() pmt( "twosample.wilcoxon", conf_level = 0.90 )$test(Table2.6.2)$conf_intpmt( "twosample.wilcoxon", alternative = "greater", n_permu = 0 )$test(Table2.1.1)$print() pmt( "twosample.wilcoxon", alternative = "less", n_permu = 0 )$test(Table2.6.1)$print() pmt( "twosample.wilcoxon", conf_level = 0.90 )$test(Table2.6.2)$conf_int