ttestIS | R Documentation |
The Student's Independent samples t-test (sometimes called a two-samples t-test) is used to test the null hypothesis that two groups have the same mean. A low p-value suggests that the null hypothesis is not true, and therefore the group means are different.
ttestIS(data, vars, group, students = TRUE, bf = FALSE,
bfPrior = 0.707, welchs = FALSE, mann = FALSE,
hypothesis = "different", norm = FALSE, qq = FALSE, eqv = FALSE,
meanDiff = FALSE, ci = FALSE, ciWidth = 95, effectSize = FALSE,
ciES = FALSE, ciWidthES = 95, desc = FALSE, plots = FALSE,
miss = "perAnalysis", formula)
data |
the data as a data frame |
vars |
the dependent variables (not necessary when using a formula, see the examples) |
group |
the grouping variable with two levels (not necessary when using a formula, see the examples) |
students |
|
bf |
|
bfPrior |
a number between 0.01 and 2 (default 0.707), the prior width to use in calculating Bayes factors |
welchs |
|
mann |
|
hypothesis |
|
norm |
|
qq |
|
eqv |
|
meanDiff |
|
ci |
|
ciWidth |
a number between 50 and 99.9 (default: 95), the width of confidence intervals |
effectSize |
|
ciES |
|
ciWidthES |
a number between 50 and 99.9 (default: 95), the width of confidence intervals for the effect sizes |
desc |
|
plots |
|
miss |
|
formula |
(optional) the formula to use, see the examples |
The Student's independent t-test assumes that the data from each group are from a normal distribution, and that the variances of these groups are equal. If unwilling to assume the groups have equal variances, the Welch's t-test can be used in it's place. If one is additionally unwilling to assume the data from each group are from a normal distribution, the non-parametric Mann-Whitney U test can be used instead (However, note that the Mann-Whitney U test has a slightly different null hypothesis; that the distributions of each group is equal).
A results object containing:
results$ttest | a table containing the t-test results | ||||
results$assum$norm | a table containing the normality tests | ||||
results$assum$eqv | a table containing the homogeneity of variances tests | ||||
results$desc | a table containing the group descriptives | ||||
results$plots | an array of groups of plots | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$ttest$asDF
as.data.frame(results$ttest)
data('ToothGrowth')
ttestIS(formula = len ~ supp, data = ToothGrowth)
#
# INDEPENDENT SAMPLES T-TEST
#
# Independent Samples T-Test
# ----------------------------------------------------
# statistic df p
# ----------------------------------------------------
# len Student's t 1.92 58.0 0.060
# ----------------------------------------------------
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.