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, ...)
a length-\(n\) data vector.
a length-\(m\) data vector.
character string for the name of k-sample test to be used.
extra arguments passed onto the function test.name
.
a (list) object of S3
class htest
containing:
a test statistic.
\(p\)-value under \(H_0\).
alternative hypothesis.
name of the test.
name(s) of provided sample data.
# \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
# }