## Examples taken and adapted from function t.test
t.test(1:10, y = c(7:20)) # P = .00001855
t.test(1:10, y = c(7:20, 200)) # P = .1245 -- NOT significant anymore
xiao.t.test(1:10, y = c(7:20))
xiao.t.test(1:10, y = c(7:20, 200))
## Traditional interface
with(mtcars, t.test(mpg[am == 0], mpg[am == 1]))
with(mtcars, xiao.t.test(mpg[am == 0], mpg[am == 1]))
## Formula interface
t.test(mpg ~ am, data = mtcars)
xiao.t.test(mpg ~ am, data = mtcars)
## Example 6.1 in Xiao (2018)
x <- c(134, 146, 104, 119, 124, 161, 107, 83, 113, 129, 97, 123)
y <- c(70, 118, 101, 85, 107, 132, 94)
xiao.t.test(x, y, alternative = "greater")
t.test(x, y, var.equal = TRUE, alternative = "greater")
t.test(x, y, alternative = "greater")
hsu.t.test(x, y, alternative = "greater")
Run the code above in your browser using DataLab