
Estimate Treatment Effects for Each Period
synthdid_est_per.RdGiven the output from the synthdid::synthdid_estimate method, this function computes the
treatment effects (TEs) for each post-treatment period, along with the cumulative
average treatment effect (ATE). It also provides observed and predicted outcomes
for treated units, synthetic control weights, and counts of treated and control units.
Value
A list containing:
- est
TEs for each post-treatment period and cumulative ATEs.
- y_obs
Observed outcomes for treated units.
- y_pred
Predicted outcomes for treated units.
- lambda.synth
Synthetic control lambda weights.
- Ntr
Number of treated units.
- Nco
Number of control units.
Examples
if (FALSE) { # \dontrun{
library(tidyverse)
library(synthdid)
setup <- base_did |>
mutate(
id = as.factor(id),
period = as.integer(period),
y = as.double(y),
post = as.integer(post)
) |>
# Correct treatment
dplyr::mutate(treatment = as.integer(if_else(treat == 0, 0, post))) |>
synthdid::panel.matrices(unit = "id", time = "period", outcome = "y", treatment = "treatment")
sdid <- synthdid::synthdid_estimate(setup$Y, setup$N0, setup$T0)
synthdid_est_per(setup$Y, setup$N0, setup$T0, weights = attr(sdid, 'weights'))
} # }