Calculates Cohen's d for two sample comparisons.

effect_size_t( data, response, group, absolute = FALSE, paired = FALSE, na.rm = TRUE )

data | A |
---|---|

response | The response variable (dependent). |

group | The group variable, usually a |

absolute | If set to |

paired | Whether the effect should be calculated for a paired
t-test, default is |

na.rm | If |

`numeric`

of length 1.

The effect size here is Cohen's d as calculated by \(d = \frac{m_{diff}}{S_p}\), where \(m_{diff} = \bar{x}_1 - \bar{x}_2\) and \(S_p = \sqrt{ \frac{n_1 - 1 \cdot {s_{x_1}}^2 + n_2 - 1 \cdot {s_{x_2}}^2} {n_1 + n_2 - 2} } \).

For `paired = TRUE`

, \(S_p\) is substituted by \(S_D = S_{x_1 - x_2}\)
via `sd(x1 - x2)`

.

set.seed(42) df <- data.frame(x = runif(100), group = sample(c("A", "B"), 100, TRUE)) effect_size_t(df, "x", "group")#> [1] 0.115138