Skip to contents

Mirrors the canonical aggregation schemes (overall ATT, by-cohort, by-calendar-time, by-event-time) and produces a tidy data.frame consumed by the rmorie / MRM downstream pipelines.

Usage

morie_did_aggregate_gt_att(
  gt_results,
  aggregation = "overall",
  time_col = "time",
  cohort_col = "cohort",
  att_col = "att",
  se_col = "std_error"
)

Arguments

gt_results

Output of morie_did_group_time_att.

aggregation

One of "overall" (default), "cohort", "calendar_time", "event_time".

time_col, cohort_col, att_col, se_col

Column-name overrides.

Value

A data frame with group, estimate, std_error, ci_lower, ci_upper.

Examples

gt <- data.frame(cohort = c(2, 2, 3, 3),
                 time   = c(2, 3, 3, 4),
                 att    = c(1.0, 1.5, 2.0, 2.5),
                 std_error = c(0.4, 0.4, 0.3, 0.3))
out <- morie_did_aggregate_gt_att(gt, aggregation = "overall")
out$estimate
#> [1] 1.75