usek1d {SHT} | R Documentation |
Apply k-sample tests for two univariate samples
Description
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
.
Usage
usek1d(x, y, test.name, ...)
Arguments
x |
a length- |
y |
a length- |
test.name |
character string for the name of k-sample test to be used. |
... |
extra arguments passed onto the function |
Value
a (list) object of S3
class htest
containing:
- statistic
a test statistic.
- p.value
p
-value underH_0
.- alternative
alternative hypothesis.
- method
name of the test.
- data.name
name(s) of provided sample data.
Examples
### 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=""))
[Package SHT version 0.1.8 Index]