effect_size_t: Simple Effect Size Calculation for t-Tests

Description Usage Arguments Details Value Examples

View source: R/effect_size.R

Description

Calculates Cohen's d for two sample comparisons.

Usage

1
2
3
4
5
6
7
8
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 = √{ \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.

Examples

1
2
3
set.seed(42)
df <- data.frame(x = runif(100), group = sample(c("A", "B"), 100, TRUE))
effect_size_t(df, "x", "group")

tadaatoolbox documentation built on July 2, 2020, 2:30 a.m.