Skip to content

Instantly share code, notes, and snippets.

@avallecam
Last active August 13, 2024 13:45
Show Gist options
  • Save avallecam/559a9725c3748f805469e6b15ec8c6a8 to your computer and use it in GitHub Desktop.
Save avallecam/559a9725c3748f805469e6b15ec8c6a8 to your computer and use it in GitHub Desktop.
Estimate the Case Fatality Risk Ratio to complement stratified CFR calculations

We can estimate the relative risk for the causal interpretation of CFR estimates (Lipsitch et al.)

two-by-two table

non-death death
44-younger 311 768
45+older 51 299

CFR (stratified)

  • 44-younger: CFR = 768/(311+768) = 0.71
  • 45+older: CFR = 299/(51+299) = 0.85

Case Fatality Risk Ratio:

library(epitools)
rr_matrix <- matrix(c(311, 51, 768, 299),nrow = 2, ncol = 2)
epitools::riskratio(rr_matrix)
#> $data
#>           Outcome
#> Predictor  Disease1 Disease2 Total
#>   Exposed1      311      768  1079
#>   Exposed2       51      299   350
#>   Total         362     1067  1429
#> 
#> $measure
#>           risk ratio with 95% C.I.
#> Predictor  estimate    lower    upper
#>   Exposed1 1.000000       NA       NA
#>   Exposed2 1.200227 1.133086 1.271346
#> 
#> $p.value
#>           two-sided
#> Predictor    midp.exact fisher.exact   chi.square
#>   Exposed1           NA           NA           NA
#>   Exposed2 3.179312e-08 4.200177e-08 9.982161e-08
#> 
#> $correction
#> [1] FALSE
#> 
#> attr(,"method")
#> [1] "Unconditional MLE & normal approximation (Wald) CI"

following https://sphweb.bumc.bu.edu/otlt/MPH-Modules/PH717-QuantCore/PH717-Module8-CategoricalData/PH717-Module8-CategoricalData6.html

Created on 2024-08-13 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment