usek1d: Apply k-sample tests for two univariate samples

View source: R/utility_usek1d.R

usek1dR 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-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


### 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=""))



kisungyou/SHT documentation built on Oct. 15, 2022, 3:18 p.m.