twosample_test {CNPS}R Documentation

Comprehensive two-sample permutation tests

Description

Perform two-sample permutation test on vectors of data.

Usage


twosample_test (x , y , alternative = "greater" , score = "wilcoxon" ,
method_p = "sampling" , samplenum = 2000 ,samplemethod="R",
conf.level.sample = 0.95 , conf.diff = TRUE, conf.level.diff = 0.95)

Arguments

x

numeric vector of data values.

y

numeric vector of data values.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided", "greater"(default) or "less".

score

a discrete value indicating the type of score. There are "original", "Wilcoxon", "van" and "exp" to be selected.

method_p

a string indicating what method to use for p-value. "sampling" represents sampling; "asymptotic" represents using large sample approximations; "exact" represents Iterate through all combinations.

samplenum

The number of samples

samplemethod

a discrete value indicating the method of sampling. "S" represents sample function sampling; "W" represents Cistern Sampling; "R" represents Put-back sampling.

conf.level.sample

p-value confidence level for SRS sampling

conf.diff

a logical indicating whether to calculate the confidence interval of drift parameters.

conf.level.diff

the level of confidence of drift parameters.

Details

score has 4 options: "original", "Wilcoxon", "van" and "exp". When choosing "original", the test is based on the original data; if score = "Wilcoxon", the test is baesd on rank-sum; if score = "van", the test is based on Van der Waerden score; if score = "exp", the test is based on exponential score.

samplenum and samplemethod only work when method_p="sampling". Similarly, conf.level.diff only works when conf.diff =TRUE.

Value

method

the test used.

score

the score which is used.

stat

the statistic of the original data.

conf.int

the confidence interval for p-value(only if method_p = "sampling")

pval

p-value for the test

alternative

a character string describing the alternative hypothesis.

addition

a character string describing the Hodges-Lehmann estimate and the confidence interval of the drift parameter.

Author(s)

Jiasheng Zhang, Feng Yu, Yangyang Zhang, Siwei Deng. Tutored by YuKun Liu and Dongdong Xiang.

References

Higgins, J. J. (2004). An introduction to modern nonparametric statistics. Pacific Grove, CA: Brooks/Cole.

Examples

## A simple example
x = c(1,2,3,4,5)
y = c(2,3,4,5,6)
twosample_test(x,y,samplemethod = "R" )


[Package CNPS version 1.0.0 Index]