Skip to contents

Create APA-formatted text for the results of a paired-samples t-test in the following format:

A paired-samples t-test was conducted to compare {dv} between {level1} (M = {mean1}, SD = {sd1}) and {level2} (M = {mean2}, SD = {sd2}). There was a {non}significant difference; t({df}) = {t_value}, p = {p_value}.

Usage

apa_t_pair(
  x,
  y,
  dv = "the DV",
  level1 = "level 1",
  level2 = "level 2",
  alpha = 0.05
)

Arguments

x

A (non-empty) numeric vector of data values for level 1.

y

A (non-empty) numeric vector of data values for level 2.

dv

The text describing the DV in the output text.

level1

The text describing level 1 in the output text.

level2

The text describing level 2 in the output text.

alpha

The critical alpha for determining significance.

Value

A character string of the results text.

Examples

# use generic text
apa_t_pair(x = self_res_att$f_self,
           y = self_res_att$f_non)
#> A paired-samples t-test was conducted to compare the DV between level 1 (M = 3.5, SD = 1.6) and level 2 (M = 3.0, SD = 1.2). There was a significant difference; t(107) = 3.60, p = 0.000.

# specify the text for dv and levels
apa_t_pair(x = self_res_att$f_self,
           y = self_res_att$f_non,
           dv = "preferences for female faces",
           level1 = "participants who resembled those faces",
           level2 = "non-self participants")
#> A paired-samples t-test was conducted to compare preferences for female faces between participants who resembled those faces (M = 3.5, SD = 1.6) and non-self participants (M = 3.0, SD = 1.2). There was a significant difference; t(107) = 3.60, p = 0.000.