facebookincubator / GeoLift

GeoLift is an end-to-end geo-experimental methodology based on Synthetic Control Methods used to measure the true incremental effect (Lift) of ad campaign.
https://facebookincubator.github.io/GeoLift/
MIT License
181 stars 55 forks source link

[pre_processing_data] Integrating Commuting Zones #153

Closed NicolasMatrices-v2 closed 1 year ago

NicolasMatrices-v2 commented 1 year ago

This PR is a mirror for this PR, which I can't edit anymore. Forked the GL repo to my own and edited from there.

Unit test:

library(GeoLift)

data(GeoLift_PreTest)

data <- GeoLift_PreTest[
  GeoLift_PreTest$location %in% c('new york', 'chicago', 'washington') &
    GeoLift_PreTest$date %in% as.character(seq(
      as.Date('2021-02-04'),
      as.Date('2021-02-14'),
      1
    )),
]

data_test <- GeoDataRead(
  data = data,
  date_id = "date",
  location_id = "location",
  Y_id = "Y",
  X = c(), #empty list as we have no covariates
  format = "yyyy-mm-dd",
  summary = TRUE,
  cluster_locations = TRUE,
  find_location_lat_long = TRUE,
  country_name = 'United States')

head(data_test)