Calculate the difference in event rates between two groups of a stacked
hierarchical ARD created with ard_stack_hierarchical(). For every node in
the hierarchy (e.g. each system organ class and each preferred term), the
rate (p statistic) of a second group is subtracted from the rate of a first
group and returned under a new statistic named "estimate".
The input ARD must contain the p statistic and at least one by variable.
The by (grouping) dimension is collapsed in the result---only the estimate
rows are returned.
diff_ard_hierarchical(x, levels = NULL)an ARD data frame of class 'card'
(card)
a stacked hierarchical ARD of class 'card' created using
ard_stack_hierarchical(). Must contain the p statistic and at least one
by variable.
(list)
a list specifying the two groups being differenced, p(group 1) - p(group 2).
Required unless x has a single by variable with exactly two levels, in
which case the difference defaults to the first level minus the second level
(in the order the levels appear in the source data). Two forms are accepted:
a flat named list keyed by a single by variable whose name is repeated
to give its two levels in order, e.g.
list(TRTA = "Xanomeline High Dose", TRTA = "Placebo"). When x has more
than one by variable, every other by variable must also be named once
to pin it to a single level.
a list of two named lists, each fully specifying one group's combination
of by variable levels, e.g.
list(list(TRTA = "Xanomeline High Dose"), list(TRTA = "Placebo")) or, with
two by variables,
list(list(TRTA = "Xanomeline High Dose", SEX = "F"), list(TRTA = "Placebo", SEX = "F")).
This form is required when x has more than one by variable.
Defaults to NULL.
Rates are stored on the [0, 1] scale (as p is), so the returned estimate
values lie in [-1, 1]. A hierarchy node observed in only one of the two
groups is treated as a rate of 0 in the group where it is absent.
sort_ard_hierarchical(), filter_ard_hierarchical()