Aggregate the mean and variance of the estimated unit-level DiD effects
Description
Aggregate the mean and variance of the estimated unit-level DiD effects
Usage
aggregate_unitdid(
object,
agg = "full",
na.rm = TRUE,
by = NULL,
normalized = NULL,
allow_negative_var = FALSE,
only_full_horizon = TRUE
)
Arguments
object
|
unitdid object
|
agg
|
Aggregation method. One of c(“full”, “event”, “event_age”) and the default is full . If by is provided in the model, all the options will separately aggregate by its group. The event option aggregates by the group of the event timing. The event_age option aggregates by the group of the age at the event time. event_age requires the bname to be provided in the model.
|
na.rm
|
Logical. If TRUE , remove NA values for the aggregation. The default is TRUE .
|
by
|
A character vector of variables to aggregate separately by. Default is inherited from the unitdid object but you can override it here. You can estimate the unit-level DiD effects separately by by in unitdid but you can also aggregate the estimates by (higher-level) by here. You can use "rel_time" as the highest level of aggregation.
|
normalized
|
Logical. If TRUE , the function will normalize the aggregated mean and variance by the mean of the imputed outcome variable. Default is inherited from the unitdid object.
|
allow_negative_var
|
Logical. If FALSE , the function will return the estimated variance trimmed at zero. Default is FALSE .
|
only_full_horizon
|
Logical. If TRUE, when you aggregate the unit-level treatment effect, only the event year (ename ) with full horizon (k_min:k_max ) will be included. This is recommended in the case that you do not want to change the composition of the event year (or age for the child penalties) for each estimated point in k_min:k_max . Default is TRUE.
|
Value
A tibble
with the aggregated mean and variance of the estimated unit-level DiD effects