CI_smd_contrast_bs: Estimate standardized mean difference (Cohen's d) for an...

Description Usage Arguments Value Details References See Also Examples

View source: R/CI_smd_contrast_bs.R

Description

\loadmathjax

CI_smd_contrast_bs returns the point estimate and confidence interval for a standardized mean difference (smd aka Cohen's d aka Hedges g). A standardized mean difference is a difference in means standardized to a standard deviation: \mjdeqnd = \frac \psi sd = psi/s

Usage

1
2
3
4
5
6
7
8
9
CI_smd_contrast_bs(
  means,
  sds,
  ns,
  contrast,
  conf_level = 0.95,
  assume_equal_variance = FALSE,
  correct_bias = TRUE
)

Arguments

means

A vector of 2 or more means

sds

A vector of standard deviations, same length as means

ns

A vector of sample sizes, same length as means

contrast

A vector of group weights, same length as means

conf_level

The confidence level for the confidence interval, in decimal form. Defaults to 0.95.

assume_equal_variance

Defaults to FALSE

correct_bias

Defaults to TRUE; attempts to correct the slight upward bias in d derived from a sample. Correction is not possible for 3 or more groups when equal variance is not assumed, though in such cases, correction should usually be trivial.

Value

Returns a list with these named elements:

Properties

Details

It's a bit complicated

A standardized mean difference turns out to be complicated.

First, it has many names:

Second, the choice of the standardizer requires thought:

The choice of standardizer is important, so it's noted in the subscript:

A third complication is the issue of bias: d estimated from a sample has a slight upward bias at smaller sample sizes. With total sample size > 30, this slight bias becomes fairly neglible (kind of like the small upward bias in a sample standard deviation).

This bias can be corrected when equal variance is assumed or when the design of the study is simple (2 groups). For complex designs (>2 groups) without the assumption of equal variance, bias cannot be corrected, but in these cases, sample sizes should typically be large enough for this not to matter much.

Corrections for bias produce a long-run reduction in average bias. Corrections for bias are approximate.

How are d and its CI calculated?

When equal variance is assumed

When equal variance is assumed, the standardized mean difference is d_s, defined in Kline, p. 196: \mjdeqn d_s = \frac \psi sd_pooled d_s = psi / sd_s

where psi is defined in Kline, equation 7.8 \mjdeqn \psi = \sum_i=1^ac_iM_i psi = sum(contrasts*means)

and where sd_pooled is defined in Kline, equation 3.11 \mjdeqn sd_pooled = \frac \sum_i=1^a (n_i -1) s_i^2 \sum_i=1^a (n_i-1) sqrt(sum(variances*dfs) / sum(dfs))

The CI for d_s is derived from lambda-prime transformation from Lecoutre, 2007 with coded adapted from Cousineau & Goulet-Pelletier, 2020. Kelley, 2007 explains the general approach for linear contrasts.

This approach to generating the CI is 'exact', meaning coverage should be as desired if all assumptions are met (ha!).

Correction of upward bias can be applied.

When equal variance is not assumed

When equal variance is not assumed, the standardized mean difference is d_avg, defined in Bonett, equation 6: \mjdeqn d_avg = \frac \psi sd_avg d_avg = psi / sd_avg

Where sd_avg is the square root of the average of the group variances, as given in Bonett, explanation of equation 6: \mjdeqn sd_avg = \sqrt \frac \sum_i=1^a s_i^2 a sqrt(mean(variances))

If only 2 groups
If more than 2 groups

References

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Example from Kline, 2013
#  Data in Table 3.4
#  Worked out in Chapter 7
#  See p. 202, non-central approach
# With equal variance assumed and no correction, should give:
#   d_s = -0.8528028 [-2.121155, 0.4482578]

CI_smd_contrast_bs(
  means = c(13, 11, 15),
  sds = c(2.738613, 2.236068, 2.000000),
  ns = c(5, 5, 5),
  contrast = contrast <- c(1, 0, -1),
  conf_level = 0.95,
  assume_equal_variance = TRUE,
  correct_bias = FALSE
)

# Example from Bonett, 2018, ci.lc.stdmean.bs, 
#  https://people.ucsc.edu/~dgbonett/psyc204.html
# Without correction, should give:
#                               Estimate        SE        LL         UL
# Equal Variances Not Assumed: -1.301263 0.3692800 -2.025039 -0.5774878
# Equal Variances Assumed:     -1.301263 0.3514511 -1.990095 -0.6124317

CI_smd_contrast_bs(
  means = c(33.5, 37.9, 38.0, 44.1),
  sds = c(3.84, 3.84, 3.65, 4.98),
  ns = c(10,10,10,10),
  contrast = contrast <- c(.5, .5, -.5, -.5),
  conf_level = 0.95,
  assume_equal_variance = FALSE,
  correct_bias = FALSE
)

rcalinjageman/esci2 documentation built on Dec. 22, 2021, 1:02 p.m.