es_from_2x2: Convert a 2x2 table into several effect size measures

View source: R/es_from_2x2.R

es_from_2x2R Documentation

Convert a 2x2 table into several effect size measures

Description

Convert a 2x2 table into several effect size measures

Usage

es_from_2x2(
  n_cases_exp,
  n_cases_nexp,
  n_controls_exp,
  n_controls_nexp,
  table_2x2_to_cor = "tetrachoric",
  reverse_2x2
)

Arguments

n_cases_exp

number of cases/events in the exposed group

n_cases_nexp

number of cases/events in the non exposed group

n_controls_exp

number of controls/no-event in the exposed group

n_controls_nexp

number of controls/no-event in the non exposed group

table_2x2_to_cor

formula used to obtain a correlation coefficient from the contingency table (see details).

reverse_2x2

a logical value indicating whether the direction of generated effect sizes should be flipped.

Details

This function first computes (log) odds ratio (OR), (log) risk ratio (RR) and number needed to treat (NNT) from the 2x2 table. Note that if a cell is equal to 0, we applied the typical adjustment (add 0.5) to all cells. Cohen's d (D), Hedges' g (G) and correlation coefficients (R/Z) are then estimated from the OR.

To estimate an OR, the formulas used (Box 6.4.a in the Cochrane Handbook) are:

logor = log(\frac{n\_cases\_exp / n\_cases\_nexp}{n\_controls\_exp / n\_controls\_nexp})

logor\_se = \sqrt{\frac{1}{n\_cases\_exp} + \frac{1}{n\_cases\_nexp} + \frac{1}{n\_controls\_exp} + \frac{1}{n\_controls\_nexp}}

To estimate an RR, the formulas used (Box 6.4.a in the Cochrane Handbook) are:

logrr = log(\frac{n\_cases\_exp / n\_exp}{n\_cases\_nexp / n\_nexp})

logrr\_se = \sqrt{\frac{1}{n\_cases\_exp} - \frac{1}{n\_exp} + \frac{1}{n\_cases\_nexp} - \frac{1}{n\_nexp}}

To estimate a NNT, the formulas used are (Sedwick, 2013) :

pt = \frac{n\_cases\_exp}{n\_cases\_exp + n\_controls\_exp}

pc = \frac{n\_cases\_nexp}{n\_cases\_nexp + n\_controls\_nexp}

AAR = pc - pt

nnt = \frac{1}{AAR}

To convert the 2x2 table into a SMD, the function estimates an OR value from the 2x2 table (formula above) that is then converted to a SMD (see formula in es_from_or_se()).

To convert the 2x2 table into a correlation coefficient, For now, only the tetrachoric correlation is currently proposed

  • table_2x2_to_cor = "tetrachoric". Given the heavy calculations required for this effect size measure, we relied on the implementation of the formulas of the 'metafor' package. More information can be retrieved here (https://wviechtb.github.io/metafor/reference/escalc.html#-b-measures-for-two-dichotomous-variables).

Value

This function estimates and converts between several effect size measures.

natural effect size measure OR + RR + NNT
converted effect size measure D + G + R + Z
required input data See 'Section 7. Contingency (2x2) table or proportions'
https://metaconvert.org/input.html

References

Cooper, H., Hedges, L.V., & Valentine, J.C. (Eds.). (2019). The handbook of research synthesis and meta-analysis. Russell Sage Foundation.

Higgins JPT, Thomas J, Chandler J, Cumpston M, Li T, Page MJ, Welch VA (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.3 (updated February 2022). Available from www.training.cochrane.org/handbook.

Lipsey, M. W., & Wilson, D. B. (2001). Practical meta-analysis. Sage Publications, Inc.

Sedgwick, P. (2013). What is number needed to treat (NNT)? Bmj, 347.

Examples

es_from_2x2(n_cases_exp = 467, n_cases_nexp = 22087, n_controls_exp = 261, n_controls_nexp = 8761)

metaConvert documentation built on April 12, 2025, 1:09 a.m.