get_balanced_panel.Rd
This function extracts a balanced panel from the data for a specific adoption cohort. It drops units with missing observations at any point within its entire specified window (leads + adoption time, adoption time + lags). Units treated in the same period as the adoption cohort are marked as "treated," and units with their first treatment after the leads time of the specified adoption cohort are marked as "control."
get_balanced_panel(
data = data,
adoption_cohort,
lags,
leads,
time_var,
unit_id_var,
treated_period_var,
filter_units = TRUE
)
The dataset to be used.
Numeric, the specific adoption cohort.
Numeric, the number of lags.
Numeric, the number of leads.
String, the name of the time variable.
String, the name of the unit ID variable.
String, the name of the treated period variable.
Logical, whether to filter only units with data on all time periods within the specified time window. Defaults to TRUE.
A data frame with the balanced panel.
if (FALSE) {
get_balanced_panel(data = fixest::base_stagg,
adoption_cohort = 5,
lags = 2,
leads = 3,
time_var = "year",
unit_id_var = "id",
treated_period_var = "year_treated")
}