Review: Effect of starting metformin on severe and long COVID-19 among people living with type 2 diabetes in England: a new user cohort study in OpenSAFELY-TPP · CheckPaper
Review by CheckPaper · Reviewed 27 Nov 2026
Effect of starting metformin on severe and long COVID-19 among people living with type 2 diabetes in England: a new user cohort study in OpenSAFELY-TPP
Alain Amstutz, Venexia Walker, Paul Madley-Dowd, Rachel Denholm, Mengxuan Zou, Tom Palmer, OpenSAFELY Collaborative, Sophie V Eastwood +2
Well-designed new-user cohort with internally consistent numbers. However, the authors read the positive control (HR 1.41) as upward confounding, and under that reading the primary HR of 1.17 is compatible with a 15-38% benefit. The 'no clinically meaningful benefit' conclusion is therefore not supported, and the per-protocol analysis does not estimate the strategy it describes.
Soundness
2/4
Presentation
2/4
Contribution
3/4
Confidence
4/5
✓ 8 confirmed✕ 8 discrepancy◐ 1 inconclusive
Summary
The paper uses OpenSAFELY-TPP primary-care records linked to hospital, testing and death data to emulate a trial of starting metformin. The cohort is 52,341 adults aged 18-85 newly diagnosed with type 2 diabetes between August 2018 and August 2019. People who started metformin monotherapy within 6 months of diagnosis (19,599, 37.4%) are compared with people who started no glucose-lowering drug. Follow-up starts at a 6-month landmark, which always falls before February 2020. This design avoids immortal time and the prevalent-user bias that affected earlier observational studies.
In the intention-to-treat analysis, metformin initiation was associated with a slightly higher hazard of COVID-19 hospitalisation or death (maximally adjusted HR 1.17, 95% CI 1.02-1.35; IPTW 2-year risk difference +0.36 percentage points). The per-protocol HR was 1.11 (0.96-1.29). The secondary outcomes were COVID-19 diagnosis (HR 1.07) and Long COVID (HR 1.39, 0.83-2.33). The negative-control outcome (fracture) was null, while the positive-control outcome (diabetes-related death, HR 1.41) was raised. The authors read this as evidence of unmeasured confounding.
The authors conclude that the results align with randomised trials and "argue against a clinically meaningful benefit" of starting metformin to prevent severe or Long COVID. They also argue more generally that new-user designs can reconcile conflicting observational and trial evidence.
Strengths
Design removes the main biases of earlier work
Methods p.5; Figure 1 p.18
Treatment is assigned in a 6-month window after a new T2D diagnosis, and follow-up starts at a landmark that always precedes 1 Feb 2020. This rules out immortal time and prevalent-user bias by construction. I checked the date logic against the code (landmark = diagnosis + 183 d): the latest landmark is 2020-01-31, so the core claim holds (check 13). This is a clear advance over the prevalent-user studies that dominate the meta-analyses (refs 5-8).
Reported numbers are internally consistent
Results p.7-8; Table 1 p.14-15; Figure 3 p.19
All 7 reported HRs sit at the geometric midpoint of their CIs within rounding (check 03). The RD 0.36 (0.09-0.62) and RR 1.19 (1.05-1.35) can be re-derived from the arm-level IPTW risks (recomputed 0.36 (0.09-0.63), 1.19 (1.05-1.35); check 02). The per-protocol RD, RR and HR agree with each other (check 07). All 10 categorical blocks of Table 1 sum to the arm totals within midpoint-6 rounding, and no percentage deviates by more than 0.05 pp (check 09). 157 of 158 transcribed counts satisfy the disclosure-control rule x≡3(mod6) (check 11).
Triangulation with control outcomes and several estimands
Methods p.6-7; Figure 3 p.19
Weaknesses
Main conclusion conflicts with the authors' own reading of the positive control
The Abstract and Discussion read the positive-control HR of 1.41 (1.09-1.81) as unmeasured confounding toward harm. They then use the primary HR of 1.17 to "argue against a clinically meaningful benefit" and to claim "convergence" with trials. These two positions are inconsistent. If confounding of the size seen in the positive control is divided out, the ITT HR becomes 0.83 (95% CI 0.62-1.11 with propagated uncertainty), the PP HR 0.79 (0.59-1.06) and the PS-overlap HR 0.79 (0.59-1.06). Any bias factor ≥1.20 makes the ITT interval include HR 0.85-0.90 (check 01). The E-value of the primary estimate is only 1.62 (1.16 for the lower bound). So the data cannot rule out a benefit similar to the 30-40% reported in observational studies or the RR 0.76 point estimate in the RCT meta-analysis (ref 4, check 14). The data are compatible with no benefit, but they do not argue against one. Fix: report a formal quantitative bias analysis or negative/positive-control calibration, and rephrase the Conclusions, Key messages and final paragraph ("should not be expected to reduce severe COVID-19 risk") as "no evidence of benefit, with benefit not excluded".
Per-protocol analysis does not estimate the stated strategy and conditions on a post-treatment variable
major · Methods p.5 (treatment strategies), p.6-7 (per-protocol); Results p.8
Methods p.5 defines the strategy as "start metformin ... and continue unless a contraindication occurs". The released code never censors the metformin arm. treat is set to 1 for every metformin person-month (PPA_02_add_events.R:71-73), and a code comment states the target is start vs never start, with no interest in what happens after initiation. There is no handling of discontinuation or add-on therapy. In addition, the stabilised-weight numerator and the outcome model include cov_cat_hba1c rebuilt monthly from HbA1c measured the landmark (; ), whereas p.7 says baseline HbA1c is used. Metformin lowers HbA1c, so adjusting for it can block part of the effect under study. Non-COVID death is also censored without comment (check 04). relabel the analysis honestly (for example, "effect of starting versus never starting"). Use baseline-only covariates in the numerator and outcome model, add artificial censoring of metformin discontinuers if the continuation strategy is the target, and state how competing death is handled.
Questions for the authors
If the positive-control HR of 1.41 reflects confounding, what HR for the primary outcome do you obtain after empirical calibration (or a quantitative bias analysis), and does its CI exclude a 20-30% reduction? If it does not, would you agree to rephrase the conclusion as 'benefit not excluded'?
Why does metformin initiation count as a positive control for diabetes-related death within 2 years? What true effect did you expect, and would a null or protective expected effect change your reading of HR 1.41?
The per-protocol code adjusts the numerator and outcome model for monthly post-landmark HbA1c. Was this intended, and how does the PP estimate change with baseline HbA1c only and with artificial censoring of metformin discontinuers?
Were the 357 deaths and 1,143 losses to follow-up before the landmark overlapping (the flow reconciles only with 1,377 combined)? Is '54,341' in Results a typo for 54,429?
How do the primary HRs differ between people whose follow-up ended before vs after the start of the vaccination roll-out (diagnosis month or follow-up period interaction)?
What were the Cochran's Q statistic and the subgroup HRs for BMI, and does the BMI heterogeneity point to effect modification or to confounding?
Which diabetes-algo version (v0.0.10 in project.yaml or the cited v0.0.14) produced the reported cohort?
Verification
I ran 17 checks: 7 confirmed, 9 discrepancies and 1 inconclusive. Patient-level data are held in OpenSAFELY and the repository contains no released outputs, so no estimate could be reproduced. Instead I tested the internal arithmetic of every reported HR, CI, RD/RR, event percentage and Table 1 cell, the disclosure-rounding rule, the participant flow and the design dates. I also inspected the public analysis code (opensafely/metformin_covid @ 0a6ed18, cox-ipw v0.0.37) without executing it, since R was unavailable. The arithmetic is sound. The discrepancies concern interpretation: the bias calibration with the authors' own positive control and the precision of the Long COVID estimate. They also concern the per-protocol estimand and its time-updated HbA1c adjustment in the code, plus several reporting inconsistencies (participant flow, eligibility wording, adjustment set, software versions). The literature search for the novelty claim found no counter-example but cannot prove absence.
[4] Chowdhury SR, et al. Metformin for covid-19: systematic review and meta-analysis of randomised controlled trials. BMJ Med 2025.
The PMID field contains the DOI (10.1136/bmjmed-2024-001126); the actual PMID is 40433308. On content, the abstract reports mortality RR 0.76 (0.30-1.90) and hospital admission RR 0.74 (0.28-1.95). These are imprecise and do not show absence of benefit, so they do not support the claimed 'convergence' against benefit.
[18] Bramante CT, et al. Metformin on the Presence of COVID-19 Symptoms 6 Months After Infection: The ACTIV-6 Randomized Clinical Trial. Clin Infect Dis 2026.
Cited as having 'demonstrated' that metformin reduced incident Long COVID. Per its abstract, the primary outcome (RR 0.79, 95% CrI 0.474-1.230) did not meet the efficacy threshold. Only the secondary outcome of clinician-diagnosed long COVID (RR 0.495) favoured metformin.
The URL resolves, but the released project.yaml runs diabetes-algo:v0.0.10, so the cited version does not match the code.
Suggestions
Add a formal quantitative bias analysis or empirical calibration using the negative and positive control outcomes, and base the conclusion on the calibrated range rather than on the uncorrected HR being above 1.
Rewrite the Abstract Conclusions, Key messages and closing paragraph to 'no evidence that starting metformin reduces severe COVID-19; a modest benefit cannot be excluded', and drop Long COVID from the directional statements.
Re-specify the per-protocol analysis: baseline-only covariates in the weight numerator and outcome model, artificial censoring of metformin discontinuation and add-on therapy if 'start and continue' is the target, and an explicit estimand statement for competing deaths.
Add a sensitivity analysis by pandemic period or vaccination status (for example, censoring at first vaccine dose), given the 12-24 months of pandemic exposure depending on diagnosis date.
Correct the participant flow (54,341 → 54,429; overlapping death/LTFU categories) and redraw Figure 2 as a sequential flow including all exclusions that were applied.
List the full adjustment set (including BMI; 14 comorbidities) in Methods and the Figure 3 footnote, and change 'weighted Cox' in the Abstract to 'covariate-adjusted Cox'.
Report the PS-overlap population size, the subgroup interaction statistics (Cochran's Q) and the number of bootstrap replicates (300) in the main text.
Align the renal exclusion wording (CKD 4/5, eGFR <30), the administrative end date, and the diabetes-algo version between paper and code.
Justify the choice of diabetes-related death as a positive control (expected direction and size of the true effect) or rename it, for example 'tracer outcome for confounding by indication'.
Scope of this review
Only the main PDF was available. The appendix (text S1-S3, tables S1-S5, figures S1-S6) was not included, so the PS distributions, subgroup results, untruncated-weight analysis and characteristics of excluded people could not be assessed. Patient-level data are accessible only inside OpenSAFELY-TPP, and the public repository contains no released aggregate outputs, so no estimate was reproduced. The code was inspected statically (R was not available) and not run, even on dummy data. NHS England Digital web references (23-27) returned HTTP 403 to automated lookup and were not verified. The novelty search was targeted rather than systematic.
The paper reports both hazard ratios and marginal IPTW risk differences. It adds an ITT and a per-protocol-style analysis, a propensity-score overlap restriction (0.1-0.8, confirmed in ps.R:126), and a negative and a positive control outcome. This set of analyses is unusually rich for the question, and the control outcomes are what make the critical reading below possible.
Open, versioned protocol and analysis code
Data access p.11-12; repository commit 0a6ed18
The protocol (with tracked amendments) and all ehrQL/R code are public at opensafely/metformin_covid. Because of this, I could confirm that the adjustment set includes BMI (check 05), that the eligibility filters match the Methods (check 12), and that the Cox models use a calendar time scale with delayed entry (check 16). Few observational studies allow this level of audit.
Candid acknowledgement of residual confounding
Discussion p.9-10
The authors do not read the raised HR as harm. They identify mild dysglycaemia in the untreated arm (Table 1: 90.9% of the comparator arm at HbA1c 42-58 mmol/mol; check 09) as a plausible source of bias, and they note that covariates were measured at diagnosis rather than at the landmark.
after
PPA_02:323,358
PPA_03:141,178
Fix:
Long COVID results are overstated in the Abstract and Key messages
major · Abstract; What this study adds / How this study might affect research p.2; Discussion p.9
Long COVID is based on 33 vs 33 events, HR 1.39 (0.83-2.33), p = 0.21. With 66 events, the power to detect HR 0.80 is 0.14, and the minimum detectable protective HR at 80% power is 0.49 (check 10). Discussion p.9 correctly calls the estimates "too imprecise to draw meaningful conclusions". Yet the Abstract says "risks of severe and long COVID were slightly higher", and the Key messages say the findings "argue against a clinically meaningful benefit ... for preventing severe or Long COVID". Fix: remove Long COVID from the directional conclusions.
'Convergence with randomised evidence' overstates what the trials show
minor · Introduction p.4; Discussion p.8-9; refs 4, 18
The cited RCT meta-analysis (ref 4) reports mortality RR 0.76 (0.30-1.90) and hospital admission RR 0.74 (0.28-1.95). These estimates are imprecise and similar in size to the observational reductions, so they do not show an absence of benefit. Ref 18 (ACTIV-6) is cited as having "demonstrated" a reduction in Long COVID, but its primary outcome did not meet the efficacy threshold (RR 0.79, CrI 0.474-1.230). The trials also studied treatment of acute infection, mostly in people without diabetes, which is a different question from pre-pandemic initiation in T2D. Fix: describe the trial evidence by its point estimates and uncertainty, and limit the convergence claim accordingly.
Participant-flow numbers do not reconcile
minor · Results p.7; Figure 2 p.17; Discussion p.9
Results p.7 gives 54,341 people meeting the inclusion criteria, while Figure 2 gives 54,429. Neither number minus the listed exclusions (357 died + 1,143 LTFU + 711 other drug = 2,211) equals 52,341: the gaps are 211 and 123, both well beyond the ±12 rounding bound. 54,341 is the only one of 158 counts that is not ≡3(mod6), so it cannot be a released midpoint-6 count and is almost certainly a typo (check 11). The flow does reconcile exactly as 54,429 − 1,377 − 711 = 52,341, using the 1,377 deaths/LTFU quoted in Discussion p.9. This implies 123 people appear in both the death and the LTFU category (check 06). Figure 2 also omits 11 exclusions that were applied (prior antidiabetic classes, metformin allergy, care home; check 12). Its Level-2 exclusions sum to 24,285 against a drop of 20,958. Fix: correct 54,341, make the exclusion categories mutually exclusive or say they overlap, and add the missing rows.
Abstract describes the Cox models as 'weighted', but they are covariate-adjusted
minor · Abstract (Research design and methods); Methods p.6
All 23 cox-ipw actions in project.yaml run with --ipw=FALSE, so the HRs come from covariate-adjusted, not weighted, Cox models. IPT weights are used only for the Kaplan-Meier cumulative incidence (check 16). Methods p.6 is correct, but the Abstract ("weighted Cox") is not. The distinction matters because conditional HRs and marginal RDs answer different questions.
Adjustment set misreported; vaccination and calendar heterogeneity not addressed
minor · Methods p.6; Figure 3 footnote p.16
BMI category is adjusted in every Cox and PS model, but Methods p.6 and the Figure 3 footnote do not list it. The code has 14 comorbidity indicators, not fifteen (check 05). COVID-19 vaccination (NIMS is linked) is used nowhere. Pandemic exposure within the 2-year window ranges from about 12 months for August-2018 diagnoses, whose follow-up ends before most vaccination, to about 24 months, spanning the Alpha, Delta and Omicron periods, for August-2019 diagnoses (check 13). The calendar time scale partly handles this, but differential vaccine uptake or shielding by arm was not explored. Fix: report the true adjustment set, and add a sensitivity analysis censoring at vaccination or stratifying by period.
Competing risk of death not discussed
minor · Methods p.6; Results p.7
Non-COVID death censors follow-up (data_process.R:475-476), so the HRs are cause-specific and the IPTW cumulative incidence is 1−KM rather than a competing-risk cumulative incidence (check 16). At about 2% risk the bias is small, but competing mortality is age-dependent and the arms differ by 6 years in median age. Fix: report Aalen-Johansen cumulative incidences or say explicitly that the estimand is cause-specific.
Eligibility text and reproducibility details inconsistent with the code
minor · Methods p.5; Acknowledgments p.10; project.yaml
Methods p.5 excludes "moderate to severe renal impairment", but the code excludes CKD stage 4/5 / eGFR <30 only (dataset_definition_t2dm.py:199-202). This fits the 7.7%/12.7% CKD history in Table 1 (check 12). The administrative end date is 1 Mar 2022 in the paper but study_stop = 2022-04-01 in the code, and in any case it can never bind because the latest 2-year end is 2022-01-30 (check 13). The Acknowledgments cite diabetes-algo v0.0.14, but project.yaml:19 runs v0.0.10 (check 17). The PP bootstrap uses 300 replicates, which the paper does not state (check 05).
Key supporting results only in an appendix that was not available
minor · Results p.7-8; Discussion p.9
The PS density plots (Fig S2), the subgroup forest plot with the reported BMI heterogeneity (Fig S6), the untruncated-weight analysis (Table S5) and the characteristics of excluded people (Table S3) are all cited as support but were not in the reviewed PDF. The main text gives no Cochran's Q value or p-value for the BMI interaction, and no denominators for the PS-overlap population (implied about 16,684/30,165; check 08). Discussion p.9 calls the PS distribution "bimodal", while Results p.7 describes single peaks at 0.30 and 0.25. Fix: report the interaction statistics and the overlap-population N in the main text, and reconcile how the PS distribution is described.
Small reporting slips
minor · Figure 3 p.19; p.3; Table 1; ref 4
Three Figure 3 percentages differ by 0.01 pp from count/N (375/19,599 = 1.913% reported as 1.92%; 1,863/19,599 = 9.506% reported as 9.52%; 2,565/32,739 = 7.835% reported as 7.84%). This is consistent with computation from unrounded counts and should be footnoted (check 08). The lay summary p.3 lists outcomes ungrammatically. Table 1 labels the TC/HDL ratio as "TC/Chol ratio". The PMID field of ref 4 contains the DOI.
Long COVID 33 vs 33 events, aHR 1.39 (0.83-2.33) is imprecise / too imprecise to draw meaningful conclusions (p.2, p.9), yet the Abstract and Conclusions state risks of long COVID were slightly higher and the findings argue against a clinically meaningful benefit for prevention of severe or long COVID
CI 0.83-2.33 includes 1 (p = 0.21). With 66 events, power to detect HR 0.80 / 0.70 / 0.59 is 0.14 / 0.29 / 0.55, and the minimum detectable protective HR at 80% power is 0.49. The CI does exclude 0.59 when taken at face value, but it is compatible with a 17% reduction, and with the positive-control bias of check 01 it would not exclude larger benefits. The Abstract (risks of severe and long COVID were slightly higher) and the Conclusions (argue against a clinically meaningful benefit ... for prevention of severe or long COVID) contradict the authors own statement on p.9 that the estimates were too imprecise to draw meaningful conclusions. The RCT setting (treatment of acute infection) also differs from pre-pandemic initiation in T2D.
SE and p from the CI; Schoenfeld power with 66 events (allocation 37.4%); comparison with the COVID-OUT effect (HR 0.59, 0.39-0.89, verified from the ref 21 abstract in check 14)
All counts are midpoint-6 rounded (Methods p.4); under the repo rule fn_roundmid_any every nonzero count is congruent to 3 mod 6
157 of 158 counts satisfy x mod 6 = 3, including all 110 Table 1 cells, all Figure 2 and 3 counts, and the Discussion 1,377. The single exception is the Results p.7 statement We identified 54,341 people (54,341 mod 6 = 5). That number cannot be a released midpoint-6 count. Together with check 06, this shows it is a transcription error for the Figure 2 value 54,429.
Printed the rounding function from analysis/functions/utility.R; tested 158 transcribed counts for x mod 6 == 3
Eligibility criteria in Methods p.5 (moderate to severe renal impairment; HbA1c >75 in the 2 years prior; prior antidiabetic use; hypersensitivity; nursing home) match the cohort derivation in Figure 2 and the code
The code applies all exclusions stated in Methods (18 filters, fn_elig_criteria_midpoint6.R:134-151). So the analysis follows the text, but the reporting is inconsistent in two ways. (1) The renal exclusion is CKD stage 4/5 / eGFR <30 only (dataset_definition_t2dm.py:199-202), i.e. severe impairment, not moderate to severe as Methods p.5 says. People with CKD stage 3 were retained, consistent with Table 1 CKD history of 7.7%/12.7%. (2) Figure 2 omits 11 applied exclusions: prior metformin, 8 other glucose-lowering classes, metformin allergy and care home. That partly explains why its listed Level-2 exclusions do not reconcile (check 06). The HbA1c exclusion uses the most recent value within 2 years (line 450), matching the Figure 2 wording more closely than the Methods wording.
Grepped dataset_definition_t2dm.py and fn_elig_criteria_midpoint6.R at commit 0a6ed18
Design timing: diagnosis window 1 Aug 2018 - 1 Aug 2019, 6-month landmark before pandemic start 1 Feb 2020 (no COVID outcomes before follow-up, no immortal time); follow-up to 2 years or administrative end 1 Mar 2022
The latest landmark is 2020-01-31, before 2020-02-01, so the core no-immortal-time claim holds. Two details. (1) The administrative end can never bind: the latest 2-year end is 2022-01-30, before both the paper date (1 Mar 2022) and the code date (study_stop 2022-04-01, metadates.R:21). The paper and code also disagree on that date. (2) Pandemic exposure within the 2-year window ranges from 364 days (12 months, 50% of follow-up; diagnosis Aug 2018, follow-up ends 2021-01-30, before most vaccination) to 729 days (24 months; diagnosis Aug 2019, spanning the vaccination, Delta and Omicron periods). The calendar time scale and diagnosis-month covariate partly address this. Vaccination is not adjusted (check 05).
Date arithmetic using the code definitions (landmark = diagnosis + 183 d, max follow-up = landmark + 730 d; data_process.R:238-239; metadates.R)
References exist and support the statements they are cited for (ref 4 RCT meta-analysis; refs 18, 21 RCTs reduced long COVID; ref 22 English EHR study of starting metformin after COVID; ref 8)
All 22 DOI references resolve to the cited titles. Ref 8 is not on Crossref but resolves via doi.org and PubMed 37695186. Refs 23-27 are web pages (digital.nhs.uk returns 403 to automated clients; the archived ref 24 resolves). Ref 4 abstract: mortality RR 0.76 (0.30-1.90), hospital admission RR 0.74 (0.28-1.95), long COVID RR 0.6 (0.4-0.9). This supports little/no effect on mortality and uncertain severe outcomes, but the point estimates are similar in size to the observational 30-40% reductions. Ref 21: HR 0.59 (0.39-0.89). Ref 18 (ACTIV-6): the primary PASC outcome did not meet the efficacy threshold (RR 0.79, CrI 0.474-1.230); clinician-diagnosed long COVID RR 0.495 (0.155-0.995) was secondary. Ref 22: CPRD target-trial emulation, initiation within 90 days of COVID, HR 0.36, in overweight/obese adults. Ref 4 has a DOI in its PMID field (actual PMID 40433308).
tools/check_refs.py (Crossref) for all 27 references; doi.org/PubMed resolution of ref 8; PubMed abstracts of refs 4, 18, 21, 22
No large observational study focusing on adults with T2D has used a new-user design to estimate the effect of starting vs not starting metformin on severe and Long COVID outcomes
No counter-example was found. The closest new-user studies concern metformin initiation at or after SARS-CoV-2 infection in people mostly without diabetes (N3C target trial emulation, J Med Virol 2026; IDWeek 2024) or in overweight/obese adults (ref 22, CPRD). The N3C T2D comparisons (PLOS ONE 2022; Clin Epidemiol) used prevalent users. The claim appears reasonable as worded, but a non-exhaustive search cannot confirm absence. The authors could cite the infection-time new-user emulations for context.
Two targeted web literature searches (log in work/verify/15_novelty_search.md)
ITT Cox models use a calendar time scale with follow-up from the landmark, region strata and 2-year HRs; IPTW Kaplan-Meier gives marginal cumulative incidence; Abstract: weighted Cox
Time origin is study_start 2018-08-01 with entry at the landmark (calendar time scale, delayed entry). Region is a stratum. The single 0-730-day post-exposure episode spans the whole 2-year follow-up. The weighted KM uses baseline stabilised, truncated IPT weights (data_process.R:703,725; project.yaml:573). Two precision points. (1) All 23 cox-ipw actions run with --ipw=FALSE, so the Cox HRs are covariate-adjusted, not weighted as the Abstract says (Methods p.6 is correct). (2) Non-COVID death censors follow-up (data_process.R:475-476), so HRs are cause-specific and the KM cumulative incidence is 1-KM rather than a competing-risk cumulative incidence. The paper does not discuss this. The bias is small at about 2% risk, but competing mortality differs by age between arms.
Inspected cox-ipw v0.0.37 survival setup (fn-survival_data_setup.R, fn-fit_model.R) and the study project.yaml / data_process.R
The diabetes algorithm reusable action v0.0.14 (Acknowledgments p.10) is central to the work; ehrQL v1.0
project.yaml:19 runs diabetes-algo:v0.0.10, not the v0.0.14 linked in the Acknowledgments. ehrQL v1 is consistent. This is a minor reproducibility detail: either the released code differs from the version used for the reported results, or the citation is wrong. T2D case definition differences between versions could change cohort membership.
Grepped project.yaml at commit 0a6ed18
Findings argue against a clinically meaningful benefit of starting metformin, while the positive-control HR 1.41 (1.09-1.81) indicates unmeasured confounding
If the positive-control excess (1.41) is read as confounding bias, as the authors do, the calibrated ITT HR is 0.83 (95% CI 0.62-1.11 with propagated uncertainty; 0.72-0.96 treating the bias as fixed); PP 0.79 (0.59-1.06); PS-overlap 0.79 (0.59-1.06). A 15-38% reduction remains compatible, and any bias factor >=1.20 makes the ITT CI include HR 0.85-0.90. E-value for the primary HR 1.17 is 1.62 (1.16 for the lower bound 1.02), so modest confounding explains the excess. The conclusion that the data argue against a clinically meaningful benefit is not supported under the authors own reading of the positive control. Caveat: the calibration assumes no true metformin effect on 2-year diabetes-related death and equal bias across outcomes; it is an illustration, not a corrected estimate.
Quantitative bias calibration: divide primary/PP/PS-overlap HRs by the positive-control HR on the log scale (SEs back-calculated from CIs, propagated assuming independence; also point-bias-only), E-values, and sensitivity over bias factors 1.0-1.41
ITT 2-year IPTW cumulative incidence 2.23% (2.02-2.45) vs 1.87% (1.72-2.03); RD 0.36% (0.09-0.62); RR 1.19 (1.05-1.35)
Recomputed RD 0.36 (0.09 to 0.63) vs claimed 0.36 (0.09 to 0.62); RR 1.193 (1.05 to 1.35) vs claimed 1.19 (1.05 to 1.35). Agreement within 0.01 (2-dp rounding).
Back-calculated arm SEs from the arm CIs (linear and log scales), recombined assuming independent arms
All reported HRs and 95% CIs are internally consistent: primary 1.17 (1.02-1.35), PP 1.11 (0.96-1.29), COVID dx 1.07 (1.01-1.15), Long COVID 1.39 (0.83-2.33), fracture 1.00 (0.81-1.22), diabetes death 1.41 (1.09-1.81), PS-overlap 1.12 (0.97-1.30)
All 7 point estimates lie at the geometric CI midpoint within rounding (max |dlog| 0.0072 vs tolerance 0.0093, COVID dx). CI-implied SEs are 1.07-1.12 times the event-count SE, as expected for adjusted models. Implied p: primary 0.028, PP 0.17, COVID dx 0.041, Long COVID 0.21, fracture 1.00, diabetes death 0.008, PS overlap 0.13.
Geometric midpoint of each CI vs the point estimate (2-dp rounding tolerance); CI-implied SE(log HR) vs event-count SE sqrt(1/a+1/b); implied Wald p-values
Per-protocol analysis estimates the effect of start metformin monotherapy within 6 months and continue metformin unless a contraindication occurs vs never start any antidiabetic drug (numerator model uses baseline HbA1c)
Code sets treat = 1 for every metformin-arm person-month (PPA_02_add_events.R:71-73) and zeroes weights only for controls who start treatment (PPA_03:162-163). The code comment (PPA_02:69) states the PP question is start metformin vs never start metformin, and we are not interested in what happens after initiation. No discontinuation or add-on handling exists for the metformin arm (0 matches). So the estimand is not the Methods strategy start and continue metformin. In addition, the stabilised-weight numerator and the outcome model include cov_cat_hba1c (PPA_03:141,178), which is rebuilt monthly from HbA1c measured from the landmark onwards (PPA_02:323,358; dataset_definition_ppa.py:259). That is time-updated, post-treatment HbA1c, not baseline HbA1c as stated on p.7. Conditioning the outcome model on a variable that metformin lowers can block part of the effect. Non-COVID death is treated as censoring (controlled direct effect, PPA_01:60), which the paper does not state.
Inspected public code opensafely/metformin_covid @ 0a6ed18: PPA_02_add_events.R, PPA_03_pooled_log_reg.R, dataset_definition_ppa.py, PPA_01_add_intervals.R
Maximally adjusted Cox and PS models use the confounders listed in Methods p.6 / Figure 3 footnote (age splines with knots at 10/50/90 percentiles, region as stratum, fifteen comorbidities); PS overlap 0.1-0.8; weights truncated at 1st/99th percentile
Settings match the text: knots at 0.10/0.50/0.90 (ps.R:32), region strata, PS overlap filter ps>=0.1 & ps<=0.8 (ps.R:126), truncation at 0.01/0.99. The adjustment set differs from the paper in two reporting respects. (1) BMI category (cov_cat_bmi_groups) is adjusted in every Cox and PS model but is not named in Methods p.6 or the Figure 3 footnote. This is a reporting omission, and it resolves the concern that obesity was unadjusted. (2) The code has 14 binary comorbidity indicators, not fifteen. No COVID-19 vaccination covariate is used anywhere, although NIMS is linked. The PP bootstrap uses R=300 (project.yaml:548), a number not stated in the paper. Code study_stop is 2022-04-01 (see check 13).
Parsed the cox_primary action in project.yaml (cox-ipw v0.0.37) and grepped covariates.R, ps.R, fn_truncate_by_percentile.R
54,341 - (357+1,143+711) = 52,130, which is 211 short of 52,341. 54,429 - 2,211 = 52,218, which is 123 short. Both gaps exceed the rounding bound of +-12. The only consistent reading: 54,429 - 1,377 - 711 = 52,341 exactly, with the Discussion figure of 1,377 deaths/LTFU. That implies 123 people are counted both as died and as LTFU, so the 357 and 1,143 categories are not mutually exclusive, and the 54,341 in Results is a typo for 54,429. Percentages: 1,377/52,341 = 2.63% (Discussion 2.6% uses the analysed N, not the eligible N). Metformin share 37.44% (claimed 37.4%) and arms 19,599 + 32,739 = 52,338 are fine. Figure 2 Level-2 exclusions sum to 24,285 against a drop of 20,958 (overlapping, non-sequential). There are no rows for prior antidiabetic use, hypersensitivity or care home.
Arithmetic reconciliation with a midpoint-6 rounding bound (+-3 per count)
Per-protocol RD 0.21% (-0.08 to 0.51), RR 1.11 (0.96-1.29), HR 1.11 (0.96-1.29) are mutually consistent
Implied comparator 2-year risk 0.21/0.11 = 1.91% (1.78-2.05% allowing for rounding), compatible with the ITT comparator 1.87% (1.72-2.03). z for RD 1.40 vs z for log RR 1.38. HR implied by risks 1.91% vs 2.12% under PH = 1.111 vs reported 1.11. The RR upper bound maps to RD 0.55 vs the reported 0.51. That is a modest asymmetry, expected from separate bootstrap percentile intervals. Identical RR and HR CIs are plausible at a risk of about 2%.
Implied comparator risk RD/(RR-1), mapping of RR bounds to the RD scale, z-statistics, PH-implied HR from the cumulative risks
8 of 10 full-cohort percentages match exactly to 2 dp. Primary metformin 375/19,599 = 1.913% (claimed 1.92), COVID dx metformin 9.506% (claimed 9.52) and no-drug 7.835% (claimed 7.84) differ by 0.01 pp. All are within the range allowed by midpoint-6 rounding of the counts, so they were probably computed from unrounded counts. The PS-overlap row implies denominators of about 16,684 / 30,165 (about 46,849, 89.5% of the cohort), which the paper never reports. Crude vs adjusted: primary 1.05 -> 1.17; positive control 1.05 -> 1.41; fracture 0.76 -> 1.00; COVID dx 1.21 -> 1.07; Long COVID 1.67 -> 1.39. Adjustment moves the severe outcomes (COVID hosp/death, diabetes death, fracture) upward, consistent with strong age confounding (metformin users 6 years younger).
Recomputed 100*count/N; feasibility range under midpoint-6 rounding of counts and N; crude risk ratios; implied denominators
Table 1 category counts sum to the arm totals, percentages equal count/N, and Results p.7 quotes Table 1 correctly
All 10 blocks sum to 19,599 / 32,739 within the midpoint-6 rounding bound (max deviation 6, BMI metformin arm and HbA1c no-drug arm). No percentage deviates by more than 0.05 pp from count/N. Results quotes (age 58 vs 64; hypertension 48% vs 55%; TC/HDL >5:1 21% vs 15%; HbA1c 59-75 29% vs 5%) match Table 1 after rounding to integers. Side observation: 237 (1.2%) and 1,341 (4.1%) have HbA1c <42 mmol/mol at T2D diagnosis (normoglycaemic range), and 90.9% of the no-drug arm is in 42-58. This fits the authors description of mild dysglycaemia in the comparator.
Transcribed Table 1; summed 10 categorical blocks per arm; recomputed every percentage (tolerance 0.05 pp); compared text quotes