Description Usage Arguments Author(s) Examples
Performs one and two sample t-tests on vectors of data. Displays results of normality test and two sample var.test.
1 |
mu |
a number indicating the true value of the mean (or difference in means if you are performing a two sample test). |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. |
paired |
a logical indicating whether you want a paired t-test. |
premise |
a logical indicating whether you want know results of normality test and two sample var.test are displayed. |
Chand Zhang
1 2 3 4 5 6 7 8 | # example 1
set.seed(3); v1 <- rnorm(5000, 0, 1); v2 <- rnorm(5000, 0.02, 1)
ttest(v1 = v1, v2 = v2, alternative = 'less')
# example 2
v1 <- c(2.41, 2.90, 2.75, 2.23, 3.67, 4.49, 5.16, 5.45, 2.06, 1.64, 1.06, 0.77)
v2 <- c(2.80, 3.04, 1.88, 3.43, 3.81, 4.00, 4.44, 5.41, 1.24, 1.83, 1.45, 0.92)
ttest(v1 = v1, v2 = v2, alternative = 'greater', paired = T, premise = T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.