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
182 stars 55 forks source link

Pulling out control / treatment output data #71

Closed max-kozlowski closed 2 years ago

max-kozlowski commented 2 years ago

Is your feature request related to a problem? Please describe.

I am not sure how I can pull out control / treatment data produced by the model. Treatment I could easily recreate by just aggregating the geos, but treatment will not be a straight sum. I was trying to use the weights from summary() function but I couldn't make sense of it.

Describe the solution you'd like

Longer term: Would be great to have a function that just returns the data for treatment / control. Short term: I would appreciate any suggestion on how I could manually pull the data.

ArturoEsquerra commented 2 years ago

Hi @max-kozlowski, thanks for reaching out to us. While the control values can be easily calculated as a weighted sum of the areas in the pool of controls by the SCM weights, there are easier ways to obtain them. Namely, you could leverage the fact that we create a data frame of test and control values to plot them. You can easily access these values with the following steps:

  1. Run the GeoLift() function (let's say that you name the resulting object GeoTestResults).
  2. You can now access the test and control values with:
    • plot(GeoTestResults)$data$t_obs: Treatment observations
    • plot(GeoTestResults)$data$c_obs: Control/Counterfactual observations

Finally, knowing that the control values could be accessed through either of these approaches (by doing the weighted sum or by accessing them through the plotting function), do you think it would be valuable to add a function to retrieve this data?

max-kozlowski commented 2 years ago

HI @ArturoEsquerra, thanks a lot for this! That makes perfect sense - no need for a function, it's definitely simple enough. Thank you!