t_test function

Calculates the one, two and paired sample t-test

Calculates the one, two and paired sample t-test

t_test Calculates the one, two and paired sample t-test.

t_test(y, x, formula, data, paired = FALSE, var_equal = TRUE)

Arguments

  • 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 milist, created by df2milist, list2milist or mids2milist.
  • 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.

Returns

An object containing the following objects are extracted:

  • mdiff the mean difference.
  • se the standard error.
  • dfcom the complete data degrees of freedom.

Details

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.

Examples

imp_dat <- df2milist(lbpmilr, impvar="Impnr") ra <- with(imp_dat, expr=t_test(Pain ~ Gender))

See Also

with.milist, pool_t_test

Author(s)

Martijn Heymans, 2022

  • Maintainer: Martijn Heymans
  • License: GPL (>= 2)
  • Last published: 2022-10-02