This function takes two variables that are representing paired data and
calculates a paired samples t.test
. It then also calculates and prints
Cohen's d as a measure of effect size and shows a clearer data label than
the t.test function.
paired_t_test_d(data, x, y)
Invisibly returns a list including the t.test() output and Cohen's D
paired_t_test_d(iris, "Sepal.Width", "Petal.Length")
#>
#> Paired t-test
#>
#> data: Sepal.Width vs. Petal.Length
#> t = -4.3093, df = 149, p-value = 2.961e-05
#> alternative hypothesis: true mean difference is not equal to 0
#> 95 percent confidence interval:
#> -1.0219565 -0.3793768
#> sample estimates:
#> mean difference
#> -0.7006667
#>
#> [1] "Cohen's d: -0.352"