Skip to contents

[Superseded]

Development on GeoLiftPower.search() is complete. We recommend switching to GeoLiftMarketSelection() for new code, which is easier to use, more featureful, and still under active development.

GeoLiftPower.search provides power calculations for unknown test markets, number of test locations, and test duration.

Usage

GeoLiftPower.search(
  data,
  treatment_periods,
  N = 1,
  lookback_window = 1,
  X = c(),
  Y_id = "Y",
  location_id = "location",
  time_id = "time",
  top_results = 5,
  alpha = 0.1,
  type = "pValue",
  normalize = FALSE,
  model = "none",
  fixed_effects = TRUE,
  stat_func = NULL,
  dtw = 0,
  ProgressBar = FALSE,
  run_stochastic_process = FALSE,
  parallel = TRUE,
  parallel_setup = "sequential"
)

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.

treatment_periods

List of treatment periods to calculate power for.

N

List of number of test markets to calculate power for.

lookback_window

A number indicating how far back in time the simulations for the power analysis should go. For instance, a value equal to 5 will simulate power for the last five possible tests. By default lookback_window = 1 which will only execute the most recent test based on the data.

X

List of names of covariates.

Y_id

Name of the outcome variable (String).

location_id

Name of the location variable (String).

time_id

Name of the time variable (String).

top_results

Number of results to display.

alpha

Significance Level. By default 0.1.

type

Method of inference used in the analysis. pValue=Provides conformal inference to provide the aggregate p-value for the null hypothesis of no effect from the intervention. The Default type is pValue. Imbalance=Uses the model's Scaled L2 Imbalance metric.

normalize

A logic flag indicating whether to scale the outcome which is useful to accelerate computing speed when the magnitude of the data is large. The default is FALSE.

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.

fixed_effects

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

stat_func

Function to compute test statistic. NULL by default.

dtw

Emphasis on Dynamic Time Warping (DTW), dtw = 1 focuses exclusively on this metric while dtw = 0 (default) relies on correlations only.

ProgressBar

A logic flag indicating whether to display a progress bar to track progress. Set to FALSE by default.

run_stochastic_process

A logic flag indicating whether to select test markets through random sampling of the the similarity matrix. Given that interpolation biases may be relevant if the synthetic control matches the characteristics of the test unit by averaging away large discrepancies between the characteristics of the test and the units in the synthetic controls, it is recommended to only use random sampling after making sure all units are similar. This parameter is set by default to FALSE.

parallel

A logic flag indicating whether to use parallel computing to speed up calculations. Set to TRUE by default.

parallel_setup

A string indicating parallel workers set-up. Set to "sequential" by default.

Value

Data frame with the ordered list of best locations and their average power.

Examples

# \donttest{
geo_pre <- GeoDataRead(GeoLift_PreTest, date_id = "date", location_id = "location",
  Y_id = "Y", format = "yyyy-mm-dd")
set.seed(1)
GeoLiftPower.search(geo_pre, treatment_periods = 10, N = 2, top_results = 3,
  parallel = FALSE)
#> 
#> Deterministic setup with 2 locations in treatment.
#> [1] "Best 3 test markets:"
#> # A tibble: 3 × 1
#>   location             
#>   <chr>                
#> 1 chicago, portland    
#> 2 chicago, cincinnati  
#> 3 baton rouge, portland
#>                       location mean_pow mean_scaled_l2_imbalance
#> 1            chicago, portland        1                0.1682310
#> 2          chicago, cincinnati        1                0.1806790
#> 3        baton rouge, portland        1                0.2187082
#> 4    jacksonville, minneapolis        1                0.2278603
#> 5               dallas, denver        1                0.2585073
#> 6         nashville, san diego        1                0.3306865
#> 7      jacksonville, milwaukee        1                0.3336309
#> 8         detroit, new orleans        1                0.3420263
#> 9           dallas, washington        1                0.3522027
#> 10          columbus, new york        1                0.3597952
#> 11         orlando, saint paul        1                0.3667455
#> 12      honolulu, indianapolis        1                0.3697915
#> 13           cleveland, denver        1                0.3811979
#> 14      kansas city, milwaukee        1                0.4134998
#> 15         boston, new orleans        1                0.4539107
#> 16            atlanta, chicago        1                0.4547538
#> 17          houston, nashville        1                0.4839870
#> 18               atlanta, reno        1                0.4880339
#> 19             dallas, memphis        1                0.4881166
#> 20       philadelphia, phoenix        1                0.5353126
#> 21 new orleans, salt lake city        1                0.5821554
#> 22           columbus, phoenix        1                0.6494903
#> 23              miami, phoenix        1                0.6610263
#> 24        indianapolis, tucson        1                0.6775050
#> 25     baltimore, philadelphia        1                0.7043788
#> 26      oakland, oklahoma city        0                0.3098909
#> 27    cleveland, san francisco        0                0.3134414
#> 28             austin, oakland        0                0.3144527
#> 29       las vegas, saint paul        0                0.7340928
#> 30    los angeles, san antonio        0                0.7584850
#>    ProportionTotal_Y rank
#> 1         0.03306537    1
#> 2         0.03418832    2
#> 3         0.03289916    3
#> 4         0.03032910    4
#> 5         0.03307564    5
#> 6         0.03891756    6
#> 7         0.03967988    7
#> 8         0.04285185    8
#> 9         0.02813718    9
#> 10        0.04525993   10
#> 11        0.03739235   11
#> 12        0.03307948   12
#> 13        0.03952262   13
#> 14        0.05000573   14
#> 15        0.05194208   15
#> 16        0.04195217   16
#> 17        0.04384393   17
#> 18        0.04347870   18
#> 19        0.03775518   19
#> 20        0.09829630   20
#> 21        0.06650088   21
#> 22        0.05961587   22
#> 23        0.05337446   23
#> 24        0.04630831   24
#> 25        0.08680713   25
#> 26        0.12293073   26
#> 27        0.07954921   27
#> 28        0.09130958   28
#> 29        0.04571975   29
#> 30        0.03972353   30
# }