MarketSelection helps calculate the best markets based
on Dynamic Time Warping between the locations' time-series.
Usage
MarketSelection(
data,
location_id = "location",
time_id = "time",
Y_id = "Y",
dtw = 0,
exclude_markets = c()
)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.
- location_id
Name of the location variable (String).
- time_id
Name of the time variable (String).
- Y_id
Name of the outcome variable (String).
- dtw
Emphasis on Dynamic Time Warping (DTW), dtw = 1 focuses exclusively on this metric while dtw = 0 (default) relies on correlations only.
- exclude_markets
A list of markets or locations that won't be considered for the test market selection, but will remain in the pool of controls. Empty list by default.
Value
Matrix of the best markets. The second to last columns show the best to worst market matches for the location in the first column.
Examples
geo_pre <- GeoDataRead(GeoLift_PreTest, date_id = "date", location_id = "location",
Y_id = "Y", format = "yyyy-mm-dd")
best_controls <- MarketSelection(geo_pre)
best_controls[1:3, 1:4]
#> [,1] [,2] [,3] [,4]
#> [1,] "atlanta" "chicago" "las vegas" "cleveland"
#> [2,] "austin" "oakland" "oklahoma city" "kansas city"
#> [3,] "baltimore" "philadelphia" "reno" "chicago"