
Function for calculating the proportion (or risk) difference and confidence interval between arm X (reference group) and arm Y. Risk difference is calculated by subtracting cumulative incidence in arm Y from cumulative incidence in arm X.
stat_propdiff_ci(
x,
y,
N_x,
N_y,
list_names = NULL,
conf_level = 0.95,
pct = TRUE
)
List of proportion differences and CIs corresponding to each pair of number of occurrences in x
and
y
. Each list element consists of 3 statistics: proportion difference, CI lower bound, and CI upper bound.
(list
of integer
)
list of number of occurrences in arm X (reference group).
(list
of integer
)
list of number of occurrences in arm Y. Must be of equal length to x
.
(numeric(1)
)
total number of records in arm X.
(numeric(1)
)
total number of records in arm Y.
(character
)
names of each variable/level corresponding to pair of proportions in
x
and y
. Must be of equal length to x
and y
.
(proportion
)
confidence level of the interval.
(flag
)
whether output should be returned as percentages. Defaults to TRUE
.
Split function add_riskdiff()
which, when used as split_fun
within rtables::split_cols_by()
with riskdiff
argument is set to TRUE
in subsequent analyze functions, adds a column containing
proportion (risk) difference to an rtables
layout.
stat_propdiff_ci(
x = list(0.375), y = list(0.01), N_x = 5, N_y = 5, list_names = "x", conf_level = 0.9
)
stat_propdiff_ci(
x = list(0.5, 0.75, 1), y = list(0.25, 0.05, 0.5), N_x = 10, N_y = 20, pct = FALSE
)
Run the code above in your browser using DataLab