Functions & Formulae

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

Mean difference between two groups and the study summaries behind its analysis

md(xbar_1, xbar_2, s_1, s_2, n_1, n_2) = (MD, SE_MD)

Maps the means, standard deviations and sizes of two groups on one continuous scale to the mean difference and its standard error, the pair that an inverse-variance meta-analysis takes for each study, and recovers or checks the summaries a report leaves out. The pooled mean difference is HE-FM-ADMA-001 with y_i equal to the study's mean difference and v_i equal to its squared standard error, and heterogeneity and random-effects pooling are HE-FM-ADMA-002 to HE-FM-ADMA-005, all run from estimates and standard errors by HE-CF-ADMA-001. A confidence interval is HE-FM-AN-001, and a standard error read back from a reported interval is that record solved for SE, the form HE-FM-HR-007 gives on the log scale. Differences in mean cost and mean QALYs enter the ratio HE-FM-ICER-001 and the net benefit records HE-FM-NMB-002 and HE-FM-AN-004. Dividing by a pooled standard deviation in place of leaving natural units gives Cohen's d, HE-FM-CD-001. Notation follows the Mean Difference article.

  • Mean difference of one study and its standard error from group summaries

    MD = xbar_1 - xbar_2; V_MD = s_1^2 / n_1 + s_2^2 / n_2; SE_MD = sqrt(V_MD)

    Subtracts the comparator group's mean from the experimental group's mean and takes the standard error from each group's own variance divided by its size. The sign follows the order of subtraction, so a negative value reads as benefit or harm according to the outcome. This is the Review Manager form, and it holds no assumption that the two standard deviations are equal. HE-CF-NBA-001 runs the same two steps inside its net benefit chain for QALYs and costs, and HE-VR-AN-002 describes this standard error in words; here they stand alone for any continuous outcome. For proportions, HE-FM-ACTR-001 holds the corresponding standard error with p times 1 minus p as each arm's variance. The formula is applied to each study in turn, so the study subscript i of the article is dropped. The function sqrt is the square root.

  • Within-group standard deviation recovered from the standard error of a mean difference

    SD = SE_MD / sqrt(1 / n_1 + 1 / n_2)

    Some reports give a mean difference with a standard error or interval and no group standard deviations. If the two groups share one standard deviation, HE-FM-MEAD-001 can be solved for it, and the Cochrane Handbook prints the result as the last step of its method for differences in means. A standard error taken from an interval comes first by HE-FM-AN-001 solved for SE, the width divided by 3.92 for a large trial with a 95% interval. The recovered value is entered for both groups, as the Handbook instructs for Review Manager. The function sqrt is the square root.

  • Correlation of baseline and final values and an imputed standard deviation of change

    Corr_D = (SD_bD^2 + SD_fD^2 - SD_cD^2) / (2 * SD_bD * SD_fD); SD_c = sqrt(SD_b^2 + SD_f^2 - 2 * Corr * SD_b * SD_f)

    A meta-analysis of mean differences in change from baseline needs each arm's standard deviation of change for V_MD in HE-FM-MEAD-001, and so for the weights in HE-FM-ADMA-001, and reports often leave it out. Where a donor group reports the standard deviations at baseline, at the final visit and of the change, the first part gives their correlation. The second part takes a correlation, from that calculation or from elsewhere, and imputes the standard deviation of change for a target group that reports only baseline and final values. HE-FM-AR1-004 takes the same form for a variance only when both visits share one variance and the correlation follows AR(1) (the agreement is derived); here the two standard deviations may differ and the correlation is entered directly. The function sqrt is the square root.

  • Rough check for skew from a mean, a standard deviation and a known bound

    R_skew = abs(xbar - B) / s; skew_lt2 = (R_skew < 2); skew_lt1 = (R_skew < 1)

    Divides the distance between a group's mean and the lowest or highest value the outcome can take by its standard deviation. The Cochrane Handbook, citing Altman and Bland, reads a ratio below 2 as suggesting skew and a ratio below 1 as strong evidence of a skewed distribution. Skew matters to a mean difference because the standard analysis assumes approximately normal outcomes or a very large trial (HE-AS-MEAD-002). The absolute value covers both forms the Handbook gives, the mean minus the lowest possible value and the highest possible value minus the mean. The function abs is the absolute value, and each flag returns 1 when its comparison holds and 0 otherwise.

  • Mean difference and standard error in minimal important difference units

    MD_U = MD / MID; SE_U = SE_MD / MID

    Divides a study's mean difference and its standard error by the minimal important difference (MID) of the instrument, so that the result reads as a multiple of the smallest change that patients regard as important. The Cochrane Handbook describes combining such results across studies in the same way as a standardised mean difference, dividing by the MID in place of the standard deviation of HE-FM-CD-001, which avoids the problem of standard deviations that vary across studies. MD and SE_MD come from HE-FM-MEAD-001 and the MID from a source such as HE-FM-MCID-001. Pooling then uses HE-FM-ADMA-001 with y_i equal to MD_U and v_i equal to SE_U squared. The division of the standard error by the same constant is derived.

This set of formulae is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/mean-difference/formulae