Given 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.

synthdid_est_per(Y, N0, T0, weights)

Arguments

Y

Data matrix with units as rows and time periods as columns.

N0

Number of control units.

T0

Number of pre-treatment periods.

weights

Output from synthdid, containing lambda and omega weights.

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) {
library(tidyverse)
library(synthdid)
library(fixest)

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'))
}