Combining two Hazard Ratios

Based on the van Dooren 2013 method

By Oskar Flygare in R meta-analysis

March 14, 2024

While doing a recent meta-analysis, we wanted to combine male/female disaggregated Hazard Ratios into one combined estimate for our synthesis.

This method is described in the supplement to van Dooren et al., 2013 and used by several later meta-analyses (Walker et al., 2015 and Chen et al., 2024). A typical example is when we have two hazard ratios from the same study (e.g., males and females) and want to combine them into one estimate. The function combine_hazard_ratios takes two HR with upper and lower 95% CI, and returns a combined HR with 95% CI.

Some additional information on obtaining standard errors from confidence intervals is available in the Cochrane handbook.

combine_hazard_ratios function

(requires the tidyverse package)


combine_hazard_ratios <- function(hr1, lower1, upper1, hr2, lower2, upper2) {
  dat <- tibble(
    hr = c(hr1, hr2),
    lower = c(lower1, lower2),
    upper = c(upper1, upper2)
  ) %>%
    mutate(
      hr_log = log(hr),
      std_error = (log(upper) - log(lower)) / (2 * 1.96),
      var = std_error^2,
      var_inv = 1 / var
    )

  log_combined <- (dat$var_inv[1] * dat$hr_log[1] + dat$var_inv[2] * dat$hr_log[2]) / (dat$var_inv[1] + dat$var_inv[2])

  combined_var <- 1 / (dat$var_inv[1] + dat$var_inv[2])
  combined_se <- sqrt(combined_var)

  log_combined_ci_lower <- log_combined - 1.96 * combined_se
  log_combined_ci_upper <- log_combined + 1.96 * combined_se

  return(list(
    combined = exp(log_combined),
    lower = exp(log_combined_ci_lower),
    upper = exp(log_combined_ci_upper)
  ))
}

Example usage


combine_hazard_ratios(
  hr1 = 0.3,
  lower1 = 0.104,
  upper1 = 0.635,
  hr2 = 0.928,
  lower2 = 0.157,
  upper2 = 1.56
)

References

Dooren, F. E. P. van, Nefs, G., Schram, M. T., Verhey, F. R. J., Denollet, J., & Pouwer, F. (2013). Depression and Risk of Mortality in People with Diabetes Mellitus: A Systematic Review and Meta-Analysis. PLOS ONE, 8(3), e57058. https://doi.org/10.1371/journal.pone.0057058

Walker, E. R., McGee, R. E., & Druss, B. G. (2015). Mortality in Mental Disorders and Global Disease Burden Implications: A Systematic Review and Meta-analysis. JAMA Psychiatry, 72(4), 334–341. https://doi.org/10.1001/jamapsychiatry.2014.2502

Chen, D., Ejlskov, L., Laustsen, L. M., Weye, N., Sørensen, C. L. B., Momen, N. C., Dreier, J. W., Zheng, Y., Damgaard, A. J., McGrath, J. J., Sørensen, H. T., & Plana-Ripoll, O. (2024). The Role of Socioeconomic Position in the Association Between Mental Disorders and Mortality: A Systematic Review and Meta-Analysis. JAMA Psychiatry, 81(2), 125–134. https://doi.org/10.1001/jamapsychiatry.2023.4316

Posted on:
March 14, 2024
Length:
2 minute read, 363 words
Categories:
R meta-analysis
See Also: