Usage
cumulative_lift(
data,
locations,
treatment_start_time,
treatment_end_time,
location_id = "location",
time_id = "time",
Y_id = "Y",
X = c(),
alpha = 0.1,
model = "none",
fixed_effects = TRUE,
method = "conformal",
grid_size = 250,
stat_test = "Total",
conformal_type = "iid",
ns = 1000
)Arguments
- 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.
- treatment_start_time
Time index of the start of the treatment.
- treatment_end_time
Time index of the end of the treatment.
- location_id
Name of the location variable (String).
- time_id
Name of the time variable (String).
- Y_id
Name of the outcome variable (String).
- X
List of names of covariates.
- alpha
Significance level. Set to 0.1 by default.
- 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.
- method
A string indicating the method used to calculate the aggregate ATT Confidence Intervals.
- "conformal":
Conformal Inference. Defualt.
- "jackknife+":
Jackknife+ (exclusively for stat_test = "Total").
- grid_size
Number of grid points to use when inverting the hypothesis test for Conformal Inference. Set to 250 by default.
- stat_test
A string indicating the test statistic.
- "Total":
The test statistic is the sum of all treatment effects, i.e. sum(abs(x)). Default.
- "Negative":
One-sided test against positive effects i.e. -sum(x). Recommended for Negative Lift tests.
- "Positive":
One-sided test against negative effects i.e. sum(x). Recommended for Positive Lift tests.
- conformal_type
Type of conformal inference used. Can be either "iid" for Independent and identically distributed or "block" for moving block permutations. Set to "iid" by default.
- ns
Number of resamples for "iid" permutations if
conformal_type = "iid. Set to 1000 by default.
Examples
# \donttest{
geo_test <- GeoDataRead(GeoLift_Test, date_id = "date", location_id = "location",
Y_id = "Y", format = "yyyy-mm-dd")
cumulative <- cumulative_lift(geo_test, locations = c("chicago", "portland"),
treatment_start_time = 91, treatment_end_time = 95, grid_size = 20, ns = 100)
#> Starting to run iterations of GeoLift to capture cumulative effect.
#> Currently missing 0 iterations.
tail(cumulative)
#> Time att att_lb att_ub incremental incremental_lb
#> 90 90 0.00000 0.00000 0.00000 0.0000 0.0000
#> 91 91 0.00000 0.00000 0.00000 0.0000 0.0000
#> 92 92 21.99930 -119.40309 163.40169 87.9972 -477.6123
#> 93 93 -17.32454 -162.18327 127.53419 -103.9473 -973.0996
#> 94 94 -67.64450 -110.31661 60.37183 -541.1560 -882.5329
#> 95 95 -41.81276 -80.95606 153.90370 -418.1276 -809.5606
#> incremental_ub
#> 90 0.0000
#> 91 0.0000
#> 92 653.6067
#> 93 765.2051
#> 94 482.9746
#> 95 1539.0370
# }