var_d_calc: Calculate Variance of Cohen's D or Glass's Delta

View source: R/var_d_calc.R

var_d_calcR Documentation

Calculate Variance of Cohen's D or Glass's Delta

Description

This function computes the variance of Cohen's D or Glass's Delta based on the provided effect size and sample sizes, following the equation from Cooper, Hedges, and Valentine (2009). You can calculate variance on an individual basis by manually putting in a d value from d_calc(), or you can do so in a batch way based on an entire dataset.

Usage

var_d_calc(d, n_t, n_c)

Arguments

d

Standardized effect size calculated using d_calc.R.

n_t

Treatment sample size.

n_c

Control group sample size.

Value

Variance of Cohen's D or Glass's Delta

Examples

#  example 1: calculating d, var_d, and se_d for a single study
ditullio_results <- d_calc(stat_type = "d_i_m", stat = 5.708 - 3.0798, sample_sd = 1.0381)
ditullio_variance <- var_d_calc(d = ditullio_results, n_t = 38, n_c = 38)
ditullio_se <- sqrt(ditullio_variance)

# example 2: calculating d, var_d, and se_d for an entire dataset
## Not run: 
PaluckMetaSOP::contact_data |>
select(-var_d)
mutate(var_d = mapply(
FUN = var_d_calc,
d = d,
n_t = n_t,
n_c = n_c)) |>
mutate(se_d = sqrt(var_d))

## End(Not run)

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