t_test | R Documentation |
t_test
Calculates the one, two and paired sample t-test.
t_test(y, x, formula, data, paired = FALSE, var_equal = TRUE)
y |
numeric response variable. |
x |
categorical variable with 2 groups. |
formula |
A formula object to specify the model as normally used by glm. |
data |
An objects of class |
paired |
a logical indicating whether you want a paired t-test (TRUE) or not (FALSE, default). |
var_equal |
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. |
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.
An object containing the following objects are extracted:
mdiff
the mean difference.
se
the standard error.
dfcom
the complete data degrees of freedom.
Martijn Heymans, 2022
with.milist
, pool_t_test
imp_dat <- df2milist(lbpmilr, impvar="Impnr") ra <- with(imp_dat, expr=t_test(Pain ~ Gender))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.