This function is for internal package use only. See smd for usage.

compute_smd_pairwise(smd_parts)

compute_smd(D, S)

Arguments

smd_parts

a list of components for from compute_smd_parts computing standardized mean differences

D

vector of differences for each level of a factor (will be length 1 for numeric values)

S

the covariance matrix

Value

a single numeric value

Details

Computes:

$$ d = \sqrt{D' S^{-1} D} $$

where \(D\) is a vector of differences between group 1 and 2 and \(S\) is the covariance matrix of these differences. If \(D\) is length 1, the result is multplied by \(sign(D)\).

In the case of a numeric or integer variable, this is equivalent to:

$$ d = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{(s^2_1 + s^2_2)/2}} $$ where \(\bar{x}_g\) is the sample mean for group \(g\) and \(s^2_g\) is the sample variance.

For a logical or factor with only two levels, the equation above is \(\bar{x}_g = \hat{p}_g\), i.e. the sample proportion and \(s^2_g = \hat{p}_g(1 - \hat{p}_g)\) (NOTE: interally smd uses the var function, which uses \(n-1\) as the denominator. Hence, in small samples, \(s^2_g\) will not be precisely \(\hat{p}_g(1 - \hat{p}_g)\)).

References

Yang, D., & Dalton, J. E. (2012, April). A unified approach to measuring the effect size between two groups using SAS®. In SAS Global Forum (Vol. 335, pp. 1-6)

See also