Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Cohen's d standardisation and re-expression

d = (xbar_1 - xbar_2) / s_p; lnOR = (pi / sqrt(3)) * d

Maps a difference between two group means on a continuous outcome to standard deviation units, so that trials which measured the same construct on different instruments can be compared and pooled, and maps a standardised difference back to a quantity a decision model can use, here a log odds ratio for responding. A confidence interval for the standardised difference is the large-sample interval HE-FM-AN-001 applied with its standard error, and a comparator response probability combined with an odds ratio gives the intervention probability by HE-FM-NMA-004; neither is restated here. Hedges' small-sample correction and its standard error belong on the Hedges' g page.

  • Cohen's d from two group means and the pooled standard deviation

    s_p = sqrt(((n_1 - 1) * s_1^2 + (n_2 - 1) * s_2^2) / (n_1 + n_2 - 2)); d = (xbar_1 - xbar_2) / s_p

    Divides the difference between two observed group means by the pooled standard deviation of the two groups, the usual sample estimate of Cohen's d. The pooled standard deviation weights each group's variance by its degrees of freedom. The sign carries the direction of the effect, so instruments that run in opposite directions have to be aligned first. The function sqrt is the square root.

  • Log odds ratio from a standardised mean difference by the logistic conversion

    lnOR = 1.814 * d; OR = exp(lnOR)

    Re-expresses a standardised mean difference as a log odds ratio for responding by multiplying it by pi divided by the square root of 3, about 1.814, the factor Chinn derived from the logistic distribution. The odds ratio is the exponential of the log odds ratio. Combined with a comparator response probability, the odds ratio gives the intervention response probability by HE-FM-NMA-004, a quantity a decision model can use. The function exp is the exponential function.