d_calc: Calculate Cohen's D or Glass's Delta

View source: R/d_calc.R

d_calcR Documentation

Calculate Cohen's D or Glass's Delta

Description

This function converts raw effect sizes into Cohen's D or Glass's Delta based on the measure of sample variance for standardization.

Usage

d_calc(stat_type, stat, sample_sd, n_t, n_c)

Arguments

stat_type

Category of statistical result reported or derived from the paper. Possible values are "d", "d_i_d", "d_i_m", "d_i_p", "f_test", "log_odds_ratio", "odds_ratio", "reg_coef", "s_m_d", "t_test", "unspecified null".

stat

Unstandardized effect size.

sample_sd

Standard deviation of the relevant sample (preferably of the control group).

n_t

Treatment group sample size.

n_c

Control group sample size.

Details

All calculations derived from Cooper, Hedges, and Valentine (2009), except for difference in proportions, which, to the best of our knowledge, Don Green came up with while we were working on Prejudice Reduction: Progress and Challenges. We elaborate more on this estimator in the paper's appendix.

Value

Cohen's D or Glass's Delta value.

Examples

# Example: Calculate d for a study that provides difference in means results
difference_in_means_result <- d_calc(stat_type = "d_i_m", stat = 1, sample_sd = 0.3)
# Example: Calculate d for a study that provides an F-test
f_test_result <- d_calc(stat_type = "f_test", stat = 1, n_t = 50, n_c = 40)
# Example: Use mapply to calculate d from rows in dataset
## Not run: 
library(dplyr)
PaluckMetaSOP::contact_data |>
select(-d) |>.# remove d in order to recalculate it
mutate(d = mapply(
FUN = d_calc,
stat_type = statistic,
stat =  unstand,
sample_sd = sd_c,
n_t = n_t,
n_c = n_c)) |> select(name_short, d)

## End(Not run)

setgree/PrejMetaFunctions documentation built on May 8, 2024, 6:38 p.m.