es_from_2x2 function

Convert a 2x2 table into several effect size measures

Convert a 2x2 table into several effect size measures

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.

Returns

This function estimates and converts between several effect size measures.

natural effect size measureOR + RR + NNT
converted effect size measureD + G + R + Z
required input dataSee 'Section 7. Contingency (2x2) table or proportions'
https://metaconvert.org/input.html

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(n_cases_exp/n_cases_nexpn_controls_exp/n_controls_nexp) logor = log(\frac{n\_cases\_exp / n\_cases\_nexp}{n\_controls\_exp / n\_controls\_nexp}) logor_se=1n_cases_exp+1n_cases_nexp+1n_controls_exp+1n_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(n_cases_exp/n_expn_cases_nexp/n_nexp) logrr = log(\frac{n\_cases\_exp / n\_exp}{n\_cases\_nexp / n\_nexp}) logrr_se=1n_cases_exp1n_exp+1n_cases_nexp1n_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=n_cases_expn_cases_exp+n_controls_exp pt = \frac{n\_cases\_exp}{n\_cases\_exp + n\_controls\_exp} pc=n_cases_nexpn_cases_nexp+n_controls_nexp pc = \frac{n\_cases\_nexp}{n\_cases\_nexp + n\_controls\_nexp} AAR=pcpt AAR = pc - pt nnt=1AAR 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

Examples

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

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.

  • Maintainer: Corentin J. Gosling
  • License: GPL (>= 3)
  • Last published: 2025-04-11

Useful links