Skip to contents

[Stable]

GetWeights returns the synthetic control weights as a data frame for a given test set-up.

Usage

GetWeights(
  Y_id = "Y",
  time_id = "time",
  location_id = "location",
  X = c(),
  data,
  locations,
  pretreatment_end_time,
  model = "none",
  fixed_effects = TRUE
)

Arguments

Y_id

Name of the outcome variable (String).

time_id

Name of the time variable (String).

location_id

Name of the location variable (String).

X

List of names of covariates.

data

A data.frame containing the historical conversions by geographic unit. It requires a "locations" column with the geo name, a "Y" column with the outcome data (units), a time column with the indicator of the time period (starting at 1), and covariates.

locations

List of test locations.

pretreatment_end_time

Time index of the last pre-treatment period.

model

A string indicating the outcome model used to augment the Augmented Synthetic Control Method. Augmentation through a prognostic function can improve fit and reduce L2 imbalance metrics.

"None":

ASCM is not augmented by a prognostic function. Defualt.

"Ridge":

Augments with a Ridge regression. Recommended to improve fit for smaller panels (less than 40 locations and 100 time-stamps.))

"GSYN":

Augments with a Generalized Synthetic Control Method. Recommended to improve fit for larger panels (more than 40 locations and 100 time-stamps.

"best":

Fits "none", "ridge" and (with more than one treatment location) "GSYN", and keeps the one with the lowest Scaled L2 Imbalance. Ties go to the simpler model.

fixed_effects

A logic flag indicating whether to include unit fixed effects in the model. Set to TRUE by default.

Value

Data frame with the locations and weights.

Examples

geo_pre <- GeoDataRead(GeoLift_PreTest, date_id = "date", location_id = "location",
  Y_id = "Y", format = "yyyy-mm-dd")
weights <- GetWeights(data = geo_pre, locations = c("chicago", "portland"),
  pretreatment_end_time = 90)
head(weights[order(-weights$weight), ])
#>       location     weight
#> 6   cincinnati 0.22717823
#> 20       miami 0.20276981
#> 4  baton rouge 0.13353723
#> 22 minneapolis 0.08997993
#> 9       dallas 0.07392303
#> 23   nashville 0.06853182