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

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.

Signature

MD = xbar_1 - xbar_2; V_MD = s_1^2 / n_1 + s_2^2 / n_2; SE_MD = sqrt(V_MD)
Inputs
InputsDefinitionUnit
xbar_1Mean outcome in the experimental groupoutcome units
xbar_2Mean outcome in the comparator groupoutcome units
s_1Standard deviation of the outcome among participants in the experimental group, above zero in a real sampleoutcome units
n_1Number of participants whose outcome was measured in the experimental group, above zeroparticipants
s_2Standard deviation of the outcome among participants in the comparator group, above zero in a real sampleoutcome units
n_2Number of participants whose outcome was measured in the comparator group, above zeroparticipants
Output
MDExperimental group mean minus comparator group meanoutcome units, for example mmHg or GBP
V_MDSampling variance of MD, the v_i of HE-FM-ADMA-001outcome units squared
SE_MDSquare root of V_MDoutcome units

Function

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

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.

Computational function

  • Computational function: pooled mean difference from the arm summaries of three trials

    Takes the arm summaries a trial report gives, for each trial the mean, standard deviation and size of two groups, and returns the pooled mean difference under common and random effects. HE-CF-ADMA-001 starts one step later, from study estimates and standard errors, so the inputs here differ from every formula's. The chain applies HE-FM-MEAD-001 to each trial, then the common-effect estimate HE-FM-ADMA-001, Cochran's Q HE-FM-ADMA-002, the DerSimonian and Laird estimate HE-FM-ADMA-004 and the random-effects mean HE-FM-ADMA-005, and it adds the interval HE-FM-AN-001 around the random-effects mean. The calculator line writes out three trials; the Excel rows and the R and Python code take any number.

    Inputs and outputs: xbar_1A, xbar_2A, s_1A, s_2A, n_1A, n_2A are the means, standard deviations and sizes of the experimental and comparator groups of trial A, with the same six inputs for trials B and C. z is the normal percentile for the interval, 1.96 for 95%. Each trial returns its mean difference MD_A, its variance V_A and its common-effect weight w_A, and r_A is its random-effects weight. The chain returns W, the common-effect estimate MD_F with SE_F, Q, the scaling term C_DL, tau2, W_R, the random-effects estimate MD_R with SE_R, and the limits L_R and U_R. All means and standard errors are in the outcome's units. The number 2 in tau2 is the degrees of freedom with three trials. The R and Python code also return each trial's share of the common-effect weight and I-squared, HE-FM-ADMA-003.

    Assumption: As in HE-AS-MEAD-001 to HE-AS-MEAD-004, with one scale and one order of subtraction across trials. A random-effects result equals the common-effect result when tau2 is 0.

    Worked example (three blood pressure trials): With xbar_1A = 138; xbar_2A = 144; s_1A = 14; s_2A = 15; n_1A = 50; n_2A = 50; xbar_1B = 136.5; xbar_2B = 141; s_1B = 16; s_2B = 17; n_1B = 120; n_2B = 118; xbar_1C = 139; xbar_2C = 142; s_1C = 18; s_2C = 18; n_1C = 300; n_2C = 300; z = 1.96 the chain gives W = 0.7999; MD_F = -3.8546; SE_F = 1.1181; Q = 0.9757; tau2 = 0; MD_R = -3.8546; SE_R = 1.1181; L_R = -6.046; U_R = -1.663. These match the article's illustrative results of -3.855 mmHg, standard error 1.118, Q of 0.98 and an interval of -6.05 to -1.66, with weight shares of 14.8%, 27.3% and 57.9%.

    Worked example (trial A changed to show heterogeneity): With trial A's treated mean moved to 128 for illustration, xbar_1A = 128, and all other inputs as above, the chain gives MD_A = -16; MD_F = -5.3392; Q = 16.1849; tau2 = 31.1857; MD_R = -7.4494; SE_R = 3.467; L_R = -14.2447; U_R = -0.6542 (computed here). The random-effects mean moves towards the discrepant trial because the between-study variance makes the weights more equal.

    Excel: With one trial per row in rows 2 to 4 and the means in columns B and C, standard deviations in D and E and sizes in F and G, enter =B2-C2 in H2, =D2^2/F2+E2^2/G2 in I2 and =1/I2 in J2, and copy down. Then enter =SUM(J2:J4) in SumWeight, =SUMPRODUCT(J2:J4,H2:H4)/SumWeight in PooledMeanDiff, =SQRT(1/SumWeight) in PooledSeMeanDiff, =SUMPRODUCT(J2:J4,(H2:H4-PooledMeanDiff)^2) in CochranQStat, =MAX(0,(CochranQStat-(COUNT(H2:H4)-1))/(SumWeight-SUMPRODUCT(J2:J4,J2:J4)/SumWeight)) in BetweenStudyVar, =SUMPRODUCT(H2:H4/(I2:I4+BetweenStudyVar))/SUMPRODUCT(1/(I2:I4+BetweenStudyVar)) in RandomMeanDiff and =SQRT(1/SUMPRODUCT(1/(I2:I4+BetweenStudyVar))) in RandomSeMeanDiff, with =RandomMeanDiff-1.96*RandomSeMeanDiff and =RandomMeanDiff+1.96*RandomSeMeanDiff as the limits. A row with a blank or zero size gives #DIV/0! in I and in everything after it.

    R: md_pool <- function(m1, m2, s1, s2, n1, n2, z = 1.96) { v <- s1^2/n1+s2^2/n2; if (!all(is.finite(v) & v > 0)) stop("each trial needs a finite variance above zero"); md <- m1-m2; w <- 1/v; W <- sum(w); k <- length(md); f <- sum(w*md)/W; Q <- sum(w*(md-f)^2); cc <- W-sum(w^2)/W; t2 <- if (k > 1) max(0, (Q-(k-1))/cc) else 0; I2 <- if (Q > 0) max(0, (Q-(k-1))/Q)*100 else 0; r <- 1/(v+t2); mr <- sum(r*md)/sum(r); sr <- sqrt(1/sum(r)); list(md = md, se = sqrt(v), share = w/W, fixed = f, se_fixed = sqrt(1/W), Q = Q, I2 = I2, tau2 = t2, random = mr, se_random = sr, lower = mr-z*sr, upper = mr+z*sr) } With md_pool(c(138, 136.5, 139), c(144, 141, 142), c(14, 16, 18), c(15, 17, 18), c(50, 120, 300), c(50, 118, 300)) it returns fixed and random -3.8546, se_fixed 1.1181, Q 0.9757, I2 0 and tau2 0. A single trial returns its own mean difference with Q, I2 and tau2 of 0. Two identical trials return Q 0 and tau2 0. A trial with zero variance or a zero size stops with the message in the code.

    Python: def md_pool(m1, m2, s1, s2, n1, n2, z=1.96): m1, m2, s1, s2, n1, n2 = map(lambda x: np.asarray(x, float), (m1, m2, s1, s2, n1, n2)); v = s1**2/n1+s2**2/n2; assert (np.isfinite(v) & (v > 0)).all(), "each trial needs a finite variance above zero"; md = m1-m2; w = 1/v; W = w.sum(); k = md.size; f = (w*md).sum()/W; Q = (w*(md-f)**2).sum(); cc = W-(w**2).sum()/W; t2 = max(0.0, (Q-(k-1))/cc) if k > 1 else 0.0; I2 = max(0.0, (Q-(k-1))/Q)*100 if Q > 0 else 0.0; r = 1/(v+t2); mr = (r*md).sum()/r.sum(); sr = (1/r.sum())**0.5; return {"md": md, "se": v**0.5, "share": w/W, "fixed": f, "se_fixed": (1/W)**0.5, "Q": Q, "I2": I2, "tau2": t2, "random": mr, "se_random": sr, "lower": mr-z*sr, "upper": mr+z*sr} Needs import numpy as np; returns the same values as the R function, including on the single trial and identical trial cases, and a trial with zero variance or a zero size raises AssertionError.

    Test (article's three trials): =AND(ABS(PooledMeanDiff+3.855)<0.001,ABS(PooledSeMeanDiff-1.118)<0.001,ABS(CochranQStat-0.98)<0.005,BetweenStudyVar=0) returns TRUE with the inputs of the first worked example. FALSE shows PooledMeanDiff doubled (-7.709) or halved (-1.927), or weights of one over the standard error in place of one over the variance (-4.162).

    Test (heterogeneity case): =AND(ABS(BetweenStudyVar-31.186)<0.001,ABS(RandomMeanDiff+7.449)<0.001,ABS(RandomSeMeanDiff-3.467)<0.001) returns TRUE with trial A's treated mean at 128. FALSE shows BetweenStudyVar doubled (62.371) or halved (15.593), or a chain that leaves tau2 out of the weights, which gives -5.339.

    Common error (variance for standard error): Weighting by one over the standard error in place of one over the variance gives trial shares of about 23.1%, 31.3% and 45.6% in the article's example, in place of 14.8%, 27.3% and 57.9%, and a pooled value of about -4.162 in place of -3.855 (computed here).

    Source: Deeks JJ, Higgins JPT, on behalf of the Cochrane Statistical Methods Group. Statistical algorithms in Review Manager. Cochrane; May 2022. Sections Difference in means (mean difference), inverse-variance methods and DerSimonian and Laird random-effects models.

    MD_A = xbar_1A - xbar_2A; V_A = s_1A^2 / n_1A + s_2A^2 / n_2A; w_A = 1 / V_A; MD_B = xbar_1B - xbar_2B; V_B = s_1B^2 / n_1B + s_2B^2 / n_2B; w_B = 1 / V_B; MD_C = xbar_1C - xbar_2C; V_C = s_1C^2 / n_1C + s_2C^2 / n_2C; w_C = 1 / V_C; W = w_A + w_B + w_C; MD_F = (w_A * MD_A + w_B * MD_B + w_C * MD_C) / W; SE_F = sqrt(1 / W); Q = w_A * (MD_A - MD_F)^2 + w_B * (MD_B - MD_F)^2 + w_C * (MD_C - MD_F)^2; C_DL = W - (w_A^2 + w_B^2 + w_C^2) / W; tau2 = max(0, (Q - 2) / C_DL); r_A = 1 / (V_A + tau2); r_B = 1 / (V_B + tau2); r_C = 1 / (V_C + tau2); W_R = r_A + r_B + r_C; MD_R = (r_A * MD_A + r_B * MD_B + r_C * MD_C) / W_R; SE_R = sqrt(1 / W_R); L_R = MD_R - z * SE_R; U_R = MD_R + z * SE_R

Try this function

Implementations

  • Excel

    Mean difference and standard error in three named Excel cells

    With the summaries in cells named MeanGroup1, MeanGroup2, SdGroup1, SdGroup2, SizeGroup1 and SizeGroup2, the three formulas go in cells named MeanDiff, VarMeanDiff and SeMeanDiff, in that order.

    =MeanGroup1-MeanGroup2; =SdGroup1^2/SizeGroup1+SdGroup2^2/SizeGroup2; =SQRT(VarMeanDiff)

Assumptions

  • Two independent groups on one scale for a mean difference

    Each participant belongs to one of two parallel groups and every study to be pooled measured the outcome on the same scale, the condition the Cochrane Handbook sets for this measure. Studies on different instruments need a standardised measure or a rescaling. Cluster-randomised and crossover trials raise the unit-of-analysis issues of Handbook sections 6.2.2 and 6.2.3, and HE-FM-ANDA-002 gives a crossover form on the log scale, so this standard error does not apply to them unchanged.

  • Approximately normal outcomes or a very large trial for a mean difference

    The Handbook states that analyses based on means are appropriate for data that are at least approximately normally distributed and for data from very large trials. HE-FM-MEAD-004 is its rough check for skew, and HE-AS-AN-001 gives the central limit argument for a difference in arithmetic means. Thompson and Barber advise checking t test results by bootstrap for small samples or extremely skewed data.

  • Standard deviations and group sizes as measured in a mean difference

    s_1 and s_2 are standard deviations of participants' outcomes, not standard errors of the group means, and n_1 and n_2 count the participants for whom the outcome was measured, the three statistics section 6.5.2 of the Handbook asks review authors to seek in each group. A blank or zero group size gives #DIV/0! in Excel.

  • Same order of subtraction in every study of a mean difference

    The experimental group is group 1 in every study, so all differences share one direction before they reach HE-FM-ADMA-001.

Worked examples

  • Trial A of the three blood pressure trials

    The article's illustrative trial A, 50 treated patients with mean systolic pressure 138.0 mmHg (SD 14) against 50 on placebo with mean 144.0 mmHg (SD 15). The weight 1/V_MD in HE-FM-ADMA-001 is about 0.1188, as in the article.

    xbar_1 = 138; xbar_2 = 144; s_1 = 14; s_2 = 15; n_1 = 50; n_2 = 50; MD = -6; V_MD = 8.42; SE_MD = 2.902
  • Trial B of the three blood pressure trials

    The article's illustrative trial B, with slightly unequal groups of 120 and 118. The weight is about 0.2182.

    xbar_1 = 136.5; xbar_2 = 141; s_1 = 16; s_2 = 17; n_1 = 120; n_2 = 118; MD = -4.5; V_MD = 4.5825; SE_MD = 2.141
  • Trial C of the three blood pressure trials

    The article's illustrative trial C, the largest, with equal standard deviations and equal groups. The weight is about 0.4630, 57.9% of the total. HE-FM-ADMA-001 on the three trials returns -3.855 mmHg with standard error 1.118, the article's pooled result.

    xbar_1 = 139; xbar_2 = 142; s_1 = 18; s_2 = 18; n_1 = 300; n_2 = 300; MD = -3; V_MD = 2.16; SE_MD = 1.47
  • Hospital costs after hip replacement in a table printed by Thompson and Barber

    The table in Thompson and Barber gives mean (SD) hospital costs over 3 months of GBP 515.42 (473.20) for 36 patients at home and GBP 776.30 (364.53) for 49 inpatients. The difference of means is -260.88 (the table prints -260.87). The standard error here is computed from those figures with separate standard deviations, and the table's own interval uses a common one (HE-ER-MEAD-005).

    xbar_1 = 515.42; xbar_2 = 776.30; s_1 = 473.20; s_2 = 364.53; n_1 = 36; n_2 = 49; MD = -260.88; V_MD = 8931.83; SE_MD = 94.51
  • Equal group means leave a standard error above zero

    Limiting case with illustrative inputs. Equal means give a difference of 0, while the standard error still reflects the spread and sizes, here 10 times the square root of 2/25.

    xbar_1 = 5; xbar_2 = 5; s_1 = 10; s_2 = 10; n_1 = 25; n_2 = 25; MD = 0; V_MD = 8; SE_MD = 2.828

Common errors

  • Entering group standard errors as standard deviations in a mean difference

    The Handbook calls misreading a standard error as a standard deviation a particularly misleading error. In trial C each group's standard error is 18 over the root of 300, about 1.039. Typing it as s_1 and s_2 gives SE_MD of about 0.0849 in place of 1.47, and a weight of about 138.9 in place of 0.463, 300 times too large (computed here).

  • Adding the group standard errors in place of their variances

    Variances add and standard errors do not. In trial A, 14 over the root of 50 plus 15 over the root of 50 gives about 4.101 in place of 2.902, about 41% too large (computed here).

  • Reversing the groups of one trial in a pooled mean difference

    If trial B is entered with placebo as group 1, its mean difference becomes +4.5 with an unchanged standard error. HE-FM-ADMA-001 then returns about -1.399 mmHg in place of -3.855, and HE-FM-ADMA-002 returns a Q of about 11.29 in place of 0.98 (computed here), so one reversed trial removes most of the pooled benefit and manufactures heterogeneity.

  • Replacing mean costs with medians when forming a cost difference

    Thompson and Barber note that only the arithmetic mean gives the total cost of treating all patients, the mean multiplied by the number treated. In the article's illustrative comparison the mean difference is GBP 850, and medians of GBP 3,100 and GBP 3,050 give GBP 50. Over 0.045 QALYs, HE-FM-ICER-001 returns GBP 18,889 from the means and GBP 1,111 from the medians, so the median ratio understates the extra spending seventeenfold.

  • Assuming a common standard deviation when the groups differ in spread and size

    For the hip replacement table of HE-EX-MEAD-004, the pooled standard deviation of HE-FM-CD-001 is about 413.85 and gives a standard error of about 90.85 in place of 94.51, about 3.9% smaller. The table's interval, half-width 180.69, is reproduced by the common form with the t value 1.989 on 83 degrees of freedom (derived here; the source says a t test was used, without saying which form). Thompson and Barber prefer methods that do not assume equal standard deviations for cost data.

Sources

  • Review Manager algorithm for the mean difference and its standard error

    Deeks JJ, Higgins JPT, on behalf of the Cochrane Statistical Methods Group. Statistical algorithms in Review Manager. Cochrane; May 2022. Section Individual study estimates: continuous outcomes, subsection Difference in means (mean difference), which gives MD_i = m_1i minus m_2i with standard error the square root of sd_1i squared over n_1i plus sd_2i squared over n_2i, and section Inverse-variance methods for combining results across studies, which weights each estimate by the reciprocal of its variance.

    View source →

  • Cochrane Handbook on the mean difference and the data to extract

    Higgins JPT, Li T, Deeks JJ (editors). Chapter 6: Choosing effect measures and computing estimates of effect. In: Higgins JPT, Thomas J, Chandler J, Cumpston M, Li T, Page MJ, Welch VA (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane; 2024. Section 6.5.1.1, which describes the mean difference as the absolute difference between the mean values in two groups of a randomised trial, usable in meta-analysis when all studies measure on the same scale, and section 6.5.2, which lists the means, standard deviations and numbers measured to seek in each group and calls misinterpreting a standard error as a standard deviation a particularly misleading error. Sections 6.2.2 and 6.2.3 cover cluster-randomised and crossover trials.

    View source →

  • Cochrane Handbook on inverse-variance weights and standard deviations in a mean difference analysis

    Deeks JJ, Higgins JPT, Altman DG, McKenzie JE, Veroniki AA, Simmonds M (editors). Chapter 10: Analysing data and undertaking meta-analyses (last updated November 2026). In: Higgins JPT, Thomas J, Chandler J, Cumpston M, Li T, Page MJ, Welch VA (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5.1. Cochrane; 2026. Section 10.3, on the weight as the inverse of the variance of the effect estimate, section 10.5.1, on standard deviations setting the weights in a mean difference analysis, and section 10.5.3, on means being appropriate for approximately normal data and very large trials.

    View source →

  • Thompson and Barber on arithmetic mean costs

    Thompson SG, Barber JA. How should cost data in pragmatic randomised trials be analysed? BMJ. 2000;320:1197-1200 (full text read). Section What aspect of cost data is important, where the total cost is the arithmetic mean multiplied by the number of patients; section Appropriate methods of analysis, where the authors prefer methods that do not assume equal standard deviations; section Conclusions, where results of a t test, especially for small samples or extremely skewed data, should be checked by bootstrap techniques; and the table, which gives the hip replacement costs and the interval -441.56 to -80.19 for the arithmetic mean difference.

    View source →

Canonical Identity

This formula 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/formula/mean-difference-of-one-study-and-its-standard-error-from-group-summaries

Mean difference of one study and its standard error from group summaries | HealthEconomics.wiki