t_test
Calculates the one, two and paired sample t-test.
t_test(y, x, formula, data, paired = FALSE, var_equal = TRUE)
numeric response variable.
categorical variable with 2 groups.
A formula object to specify the model as normally used by glm.
An objects of class milist
, created by
df2milist
, list2milist
or mids2milist
.
a logical indicating whether you want a paired t-test (TRUE) or not (FALSE, default).
a logical, if TRUE equal variances are assumed, if FALSE (default) equal variances are not assumed and Welch correction is applied for the number of degrees of freedom. See detail.
An object containing the following objects are extracted:
mdiff
the mean difference.
se
the standard error.
dfcom
the complete data degrees of freedom.
For all t-tests the dataset must be in long format
(i.e. group data under each other). For the paired t-test x and y
must have the same length. When variances between groups are
unequal, the Welch df correction formula is used and eventually
averaged across multiply imputed datasets in the pool_t_test
function.