effect_size_t

0th

Percentile

Simple Effect Size Calculation for t-Tests

Calculates Cohen's d for two sample comparisons.

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

A data.frame.

response

The response variable (dependent).

group

The group variable, usually a factor.

absolute

If set to TRUE, the absolute effect size is returned.

paired

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

na.rm

If TRUE (default), missing values are dropped.

Details

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).

Value

numeric of length 1.

Aliases
• effect_size_t
Examples
# NOT RUN {
set.seed(42)
df <- data.frame(x = runif(100), group = sample(c("A", "B"), 100, TRUE))
effect_size_t(df, "x", "group")
# }