Prepare Forest plot data for relative risk

prepare_relative_risk_data(
  data,
  change_ref = c("Y", "N"),
  ci_method = c("Supplied", "Calculated")
)

Arguments

data

(data.frame) Effects table

change_ref

Change reference group ("Y" or "N)

ci_method

(character) confidence interval method, either Supplied (taken from the effect table) or Calculated (calculated within the program).

Value

data frame for specified type of analysis

Examples

forest_plot_src <- subset(brdata, !is.na(Prop1))
forest_plot_data <- prepare_relative_risk_data(
  forest_plot_src,
  "Y",
  "Supplied"
)
#> [2024-08-28 08:20:52] > Prepare Forest plot data for relative risk
head(forest_plot_data)
#>   treatment  factor   type                             outcome      diff
#> 1    Drug 1 Benefit Binary     A (Primary Clinical Assessment) 0.5555556
#> 2    Drug 1 Benefit Binary B (A Secondary Clinical Assessment) 0.4166667
#> 3    Drug 1    Risk Binary                     J (A Common AE) 0.4000000
#> 4    Drug 1    Risk Binary                      K (A Rare SAE) 0.0000000
#> 5    Drug 1    Risk Binary             L (Drug Class Toxicity) 0.3333333
#> 6    Drug 1 Benefit Binary     A (Primary Clinical Assessment) 0.4400000
#>       lower     upper group
#> 1 0.4639872 0.6651950     1
#> 2 0.3522856 0.4928136     2
#> 3 0.3466537 0.4615557     3
#> 4        NA        NA     4
#> 5 0.2481556 0.4477477     5
#> 6 0.3378116 0.5731005     6

forest_plot_data <- prepare_relative_risk_data(
  forest_plot_src,
  "Y",
  "Calculated"
)
#> [2024-08-28 08:20:52] >
#> CI for relative risk for binary outcomes is calculated
#> [2024-08-28 08:20:52] > Prepare Forest plot data for relative risk
head(forest_plot_data)
#>   treatment  factor   type                             outcome      diff
#> 1    Drug 1 Benefit Binary     A (Primary Clinical Assessment) 0.5555556
#> 2    Drug 1 Benefit Binary B (A Secondary Clinical Assessment) 0.4166667
#> 3    Drug 1    Risk Binary                     J (A Common AE) 0.4000000
#> 4    Drug 1    Risk Binary                      K (A Rare SAE) 0.0000000
#> 5    Drug 1    Risk Binary             L (Drug Class Toxicity) 0.3333333
#> 6    Drug 1 Benefit Binary     A (Primary Clinical Assessment) 0.4400000
#>           se     lower     upper group
#> 1 0.09189366 0.4639888 0.6651928     1
#> 2 0.08563488 0.3522867 0.4928120     2
#> 3 0.07302967 0.3466546 0.4615545     3
#> 4        Inf 0.0000000        NA     4
#> 5 0.15055453 0.2481570 0.4477453     5
#> 6 0.13483997 0.3378133 0.5730977     6