Any \(k\)-sample method implies that it can be used for a special case of \(k=2\). usek1d lets any \(k\)-sample tests provided in this package be used with two univariate samples \(x\) and \(y\).

usek1d(x, y, test.name, ...)

Arguments

x

a length-\(n\) data vector.

y

a length-\(m\) data vector.

test.name

character string for the name of k-sample test to be used.

...

extra arguments passed onto the function test.name.

Value

a (list) object of S3 class htest containing:

statistic

a test statistic.

p.value

\(p\)-value under \(H_0\).

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

Examples

# \donttest{
### compare two-means via anova and t-test
### since they coincide when k=2
x = rnorm(50)
y = rnorm(50)

### run anova and t-test
test1 = usek1d(x, y, "meank.anova")
test2 = mean2.ttest(x,y)

## print the result
cat(paste("\n* Comparison of ANOVA and t-test \n","*\n",
"* p-value from ANOVA  : ", round(test1$p.value,5),"\n",
"*              t-test : ", round(test2$p.value,5),"\n",sep=""))
#> 
#> * Comparison of ANOVA and t-test 
#> *
#> * p-value from ANOVA  : 0.85374
#> *              t-test : 0.85374
# }