Convert assumed subgroup statistics into the
standardized format used by retrogroup.
Arguments
- data
Data frame with one row per subgroup level. Must have the columns named by the other arguments. Other columns are ignored.
- variable
Character string, name of the column in
datawith the name of the subgroup variable. The column must be character with non-empty, non-missing values.- level
Character string, name of the column in
datawith the level of the subgroup variable. The column must be character or factor with non-empty, non-missing values.- patients
Character string, name of the column in
datawith the number of patients to assign to each level of the reconstructed subgroup variable, usually taken from the publication. See the details section for when these counts may differ from the publication. The column must contain strictly positive integers with no missing values.- events
Character string, name of the column in
datawith the number of events to assign to each level of the reconstructed subgroup variable. The column must contain non-negative integers with no missing values, each at most the number of patients in the level. The event counts must have the same total for every subgroup variable. Alternatively,NULLto set everyeventsvalue toNAand approximate the event counts later withgroup_data_events().- hazard_ratio
Character string, name of the column in
datawith the assumed hazard ratio of treatment versus control in each subgroup level, on the natural scale (not the log scale). The column must be numeric, finite, and strictly positive with no missing values.
Value
A tibble with one row per subgroup level, in the same order as
data, and the following columns:
variable: character, name of the subgroup variable.level: character, level of the subgroup variable.patients: integer, number of patients \(n_k\) in the subgroup level.events: integer, number of events \(e_k\) in the subgroup level, orNAifeventsisNULL.hazard_ratio: numeric, assumed hazard ratio \(\exp(\beta_k)\) of treatment versus control in the subgroup level.
Details
Each row of data is one level of a subgroup variable, with
the number of patients \(n_k\), the number of events \(e_k\), and
the hazard ratio \(\exp(\beta_k)\) of treatment versus control
defined in vignette("framing", package = "retrogroup").
A subgroup variable must have at least two levels, the levels must be
unique within the subgroup variable, and every level must have a
strictly positive number of patients.
The patient counts must have the same total for every subgroup variable, because every subgroup variable partitions the same patients. The counts are the sizes of the levels of the reconstructed subgroup variables, so they need not copy the publication verbatim. Published counts are the natural starting point, but they sometimes do not add up to the total number of patients in the study, for example because of missing subgroup data or typographical errors. In that case, choosing counts that add up to the total number of patients is a decision about the reconstruction, not an attempt to recover the true counts from the clinical study. Please disclose that decision transparently wherever the reconstructed data or downstream results are reported.
Likewise, the event counts must have the same total for every
subgroup variable, and each level must satisfy
\(0 \le e_k \le n_k\). retrogroup uses the event counts to
estimate prognostic effects, as in
vignette("estimates", package = "retrogroup"). See the "Event
counts" section of vignette("framing", package = "retrogroup") for
how to choose event counts, and group_data_events() for
approximating them from confidence intervals when the publication
does not report them.
For that purpose, events = NULL skips the checks on event counts
and sets every events value to NA. Such a summary is only valid
input to group_data_events(). Every other function rejects it.
See also
Other data:
group_data_events(),
group_data_patient()
Examples
group_data_summary(
group_example_summary(),
variable = "variable",
level = "level",
patients = "patients",
events = "events",
hazard_ratio = "hazard_ratio"
)
#> # A tibble: 6 × 5
#> variable level patients events hazard_ratio
#> <chr> <chr> <int> <int> <dbl>
#> 1 age under 60 280 129 0.844
#> 2 age 60 or over 339 162 0.579
#> 3 node4 no 453 177 0.659
#> 4 node4 yes 166 114 0.732
#> 5 sex female 312 152 0.863
#> 6 sex male 307 139 0.519
