Plotting function for historical correlations between the test market's and total markets KPI.
Source:R/plots.R
plotCorrels.RdplotCorrels takes a data frame used for GeoLift to generate
a plot that show historical similarities in KPI levels between the
test markets and the aggregation of all locations (total).
Usage
plotCorrels(data, locs = c(), scaled = TRUE, KPI_id = "", dtw = 0)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.
- locs
List of markets to use in the calculation of the correlations.
- scaled
A logic flag indicating whether to plot the scaled values of the KPI metric (standardized by the largest historical value). Set to FALSE by default to plot the observed KPI levels.
- KPI_id
Outcome variable.
- dtw
Emphasis on Dynamic Time Warping (DTW), dtw = 1 focuses exclusively on this metric while dtw = 0 (default) relies on correlations only.
Value
A plot of the historical values of the test market and the aggregation of all control markets.
Examples
geo_pre <- GeoDataRead(GeoLift_PreTest, date_id = "date", location_id = "location",
Y_id = "Y", format = "yyyy-mm-dd")
plotCorrels(geo_pre, locs = c("chicago", "portland"))