A/B test group setup accounting for conversion rates

Viewed 36

I'm trying to create an A/B test with treatment and control group to balance conversion rates and sales count across the 50 states for an experiment.

Example of non-aggregated data:

Null would be considered not converted (0) and IDs with a first sale date would be considered converted (1)

id | state | first sale
-------------------------
 1 | VA    | 2022-02-07
 2 | CA    | Null
 3 | CA    | 2022-03-15
 4 | CA    | 2022-04-05
 5 | TX    | 2022-05-12
 6 | TX    | Null
 7 | TX    | Null
 8 | TX    | Null
 9 | NJ    | Null
10 | NY    | 2022-04-17
 11| AZ    | 2022-03-07
 12| AZ    | NULL
 13| AZ    | 2022-04-13

Example of aggregated data:

State| Sales | Conversion
-------------------------
| VA  | 25  | .15
| CA  | 30  | .2
| TX  | 27  | .17
| AZ  | 22. | .22

Ideal final output: Treatment and control each have 25 states. The conversion difference b/w treatment and control is < 1% and the sales count difference is also minimized. I can use the aggregated data above to create a column with "treatment" or "control"

Cohort.   | Sales Count | Conversion
Treatment | 250        | 0.2
Control.  | 248        | 0.195

Output: Based on minimizing the differences above we create a column to distinguish IDs with states for treatment and control.

id | state | first sale| Cohort|
-----------------------
 1 | VA    | 2022-02-07|Treatment
 2 | CA    | Null.     |Control
 3 | CA    | 2022-03-15|Control
 4 | CA    | 2022-04-05|Control
 5 | TX    | 2022-05-12|Treatment

Ideally I'd like to first reduce the conversion difference between the treatment and control, but also ensure the raw count of sales doesn't differ by more than a few percent. Any help for the code setup for this A/B test setup would be much appreciated. Thanks.

0 Answers
Related