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] |
Maintainer: | Yan Du <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.2.5 |
Built: | 2024-11-27 06:28:54 UTC |
Source: | https://github.com/qddyy/learnnonparam |
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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
n_permu
an 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(conf_level = 0.95)
conf_level
a 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"))
style
a 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)
type
a character string specifying the way to calculate the p-value.
n_permu
an 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" t
t <- 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 )
type
a character string specifying the way to calculate the p-value.
method
a character string specifying the correlation coefficient to be used.
alternative
a character string specifying the alternative hypothesis.
n_permu
an 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" t
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" t
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 )
method
a character string specifying whether to use the mean or the median.
alternative
a character string specifying the alternative hypothesis.
null_value
a number indicating the true value of the location shift.
n_permu
an 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)
type
a character string specifying the way to calculate the p-value.
n_permu
an 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" t
t <- 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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
n_permu
an 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" t
t <- 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
-> KolmogorovSmirnov
new()
Create a new KolmogorovSmirnov
object.
KolmogorovSmirnov$new(n_permu = 10000)
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
A KolmogorovSmirnov
object.
pmt( "twosample.ks", n_permu = 0 )$test(Table2.8.1)$print()
pmt( "twosample.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 )
type
a character string specifying the way to calculate the p-value.
scoring
a character string specifying the scoring system.
n_permu
an 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" t
pmt( "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
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)
type
a character string specifying the way to calculate the p-value.
n_permu
an 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" t
t <- 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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
n_permu
an 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) t$type <- "asymp" t
t <- pmt( "rcbd.page", alternative = "less" )$test(Table4.4.3) t$type <- "asymp" t
Performs differences based paired comparison on samples.
LearnNonparam::PermuTest
-> LearnNonparam::TwoSampleTest
-> LearnNonparam::TwoSamplePairedTest
-> PairedDifference
correct
Whether 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 )
type
a character string specifying the way to calculate the p-value.
method
a 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"
.
scoring
a character string specifying the scoring system.
alternative
a character string specifying the alternative hypothesis.
null_value
a number indicating the true value of the location shift.
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
correct
a 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" t
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" t
Abstract class for permutation tests.
type
The way to calculate the p-value.
method
The method used.
scoring
The scoring system used.
alternative
The alternative hypothesis.
null_value
The hypothesized value of the parameter in the null hypothesis.
conf_level
The confidence level of the interval.
n_permu
The number of permutations used.
data
The data.
statistic
The test statistic.
p_value
The p-value.
estimate
The estimated value of the parameter.
conf_int
The 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.
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"), ...)
style
a 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", "ksample", "multcomp", "paired", "rcbd", "association", "table") ) define_pmt( inherit = c("twosample", "ksample", "paired", "rcbd", "association", "table"), statistic, rejection = c("lr", "l", "r"), scoring = "none", n_permu = 10000, name = "User-Defined Permutation Test", alternative = NULL, depends = character(), plugins = character(), includes = character() )
pmt(key, ...) pmts( which = c("all", "onesample", "twosample", "ksample", "multcomp", "paired", "rcbd", "association", "table") ) define_pmt( inherit = c("twosample", "ksample", "paired", "rcbd", "association", "table"), statistic, rejection = c("lr", "l", "r"), scoring = "none", n_permu = 10000, name = "User-Defined Permutation Test", alternative = NULL, 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. |
inherit |
a character string specifying the type of permutation test. |
statistic |
definition of the test statistic. See Details. |
rejection |
a character string specifying where the rejection region is. |
scoring |
one of:
- a character string in |
n_permu |
an integer indicating number of permutations for the permutation distribution. If set to |
name |
a character string specifying the name of the test. |
alternative |
a character string describing the alternative hypothesis. |
depends , plugins , includes
|
passed to |
The test statistic can be defined using either R
or Rcpp
, with the statistic
parameter specified as:
R
: a function returning a closure that returns 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 as const references, and returns a double.
When using Rcpp
, the parameters for different inherit
are listed as follows. Note that the parameter names are for illustration only.
"twosample"
: (Rcpp::NumericVector sample_1, Rcpp::NumericVector sample_2)
"ksample"
: (Rcpp::NumericVector combined_sample, Rcpp::IntegerVector one_based_group_index)
"paired"
: (Rcpp::NumericVector sample_1, Rcpp::NumericVector sample_2)
"rcbd"
: (Rcpp::NumericMatrix block_as_column_data)
"association"
: (Rcpp::NumericVector sample_1, Rcpp::NumericVector sample_2)
"table"
: (Rcpp::IntegerMatrix contingency_table)
Defining the test statistic using R
follows a similar approach. The purpose of this design is to pre-calculate certain constants that remain invariant during permutation.
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.
pmt("twosample.wilcoxon") pmts("ksample") x <- rnorm(5) y <- rnorm(5, 1) t <- define_pmt( inherit = "twosample", scoring = base::rank, # equivalent to "rank" statistic = function(...) 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( inherit = "twosample", n_permu = 1e5, statistic = function(x, y) { m <- length(x) n <- length(y) function(x, y) sum(x) / m - sum(y) / n } ) rcpp <- define_pmt( inherit = "twosample", n_permu = 1e5, statistic = "[](NumericVector x, NumericVector y) { R_len_t m = x.size(); R_len_t n = y.size(); return [=](const NumericVector& x, const NumericVector& y) -> double { return sum(x) / m - sum(y) / n; }; }" ) options(LearnNonparam.pmt_progress = FALSE) system.time(r$test(x, y)) system.time(rcpp$test(x, y))
pmt("twosample.wilcoxon") pmts("ksample") x <- rnorm(5) y <- rnorm(5, 1) t <- define_pmt( inherit = "twosample", scoring = base::rank, # equivalent to "rank" statistic = function(...) 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( inherit = "twosample", n_permu = 1e5, statistic = function(x, y) { m <- length(x) n <- length(y) function(x, y) sum(x) / m - sum(y) / n } ) rcpp <- define_pmt( inherit = "twosample", n_permu = 1e5, statistic = "[](NumericVector x, NumericVector y) { R_len_t m = x.size(); R_len_t n = y.size(); return [=](const NumericVector& x, const NumericVector& y) -> double { return sum(x) / m - sum(y) / n; }; }" ) options(LearnNonparam.pmt_progress = FALSE) system.time(r$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
prob
The probability associated with the quantile.
correct
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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
null_value
a number indicating the hypothesized value of the quantile.
conf_level
a number between zero and one indicating the confidence level to use.
prob
a number between zero and one indicating the probability associated with the quantile.
correct
a 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_int
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_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 )
alternative
a character string specifying the alternative hypothesis.
n_permu
an 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)
type
a character string specifying the way to calculate the p-value.
n_permu
an 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" t
t <- 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 sum of scores based two-sample test on samples. It is almost the same as two-sample wilcoxon rank sum test but uses more scoring systems.
LearnNonparam::PermuTest
-> LearnNonparam::TwoSampleTest
-> LearnNonparam::TwoSampleLocationTest
-> ScoreSum
new()
Create a new ScoreSum
object.
ScoreSum$new( scoring = c("rank", "vw", "expon"), alternative = c("two_sided", "less", "greater"), null_value = 0, n_permu = 10000 )
scoring
a character string specifying the scoring system.
alternative
a character string specifying the alternative hypothesis.
null_value
a number indicating the true value of the location shift.
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
A ScoreSum
object.
pmt( "twosample.scoresum", scoring = "expon", alternative = "greater", n_permu = 0 )$test(Table2.6.2)$print()
pmt( "twosample.scoresum", scoring = "expon", alternative = "greater", n_permu = 0 )$test(Table2.6.2)$print()
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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
correct
a 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
correct
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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
correct
a 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" t
t <- 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 )
type
a character string specifying the way to calculate the p-value.
method
a character string specifying whether to use Bonferroni's method or Tukey's HSD method.
scoring
a character string specifying the scoring system.
conf_level
a number between zero and one indicating the family-wise confidence level to use.
n_permu
an 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" t
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" t
Sodium contents (in mg) of 40 servings of a food product.
Table1.1.1
Table1.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.1
Table1.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.1
Table2.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.1
Table2.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.1
Table2.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.2
Table2.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.1
Table2.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.2
Table3.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.2
Table3.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.3
Table3.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.1
Table3.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.1
Table3.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.1
Table4.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.3
Table4.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.3
Table4.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.3
Table4.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.2
Table5.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.2
Table5.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.2
Table5.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 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
correct
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 )
type
a character string specifying the way to calculate the p-value.
alternative
a character string specifying the alternative hypothesis.
null_value
a number indicating the true value of the location shift.
conf_level
a number between zero and one indicating the confidence level to use.
n_permu
an integer indicating number of permutations for the permutation distribution. If set to 0
, all permutations will be used.
correct
a 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_int
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_int