Final Project: Regork Grocery

October 5, 2023

Caylee Rosa

Introduction

As data scientists for the national grocery chain Regork we have been tasked with identifying a potential area of growth where the company can invest future resources to increase revenue and profits.

Business Problem

As will become clear in our exploration of the The Complete Journey data set throughout this report, there is a consistent pattern of decreased sales after major holidays throughout the year. Although this drop in sales is not unexpected considering the natural purchasing habits of customers leading up to a holiday, it raises an important question and exposes a potential growth opportunity for Regork:

How do we get customers back in stores faster following a major holiday?

Extensive analysis of Regork’s historical data will expose potential growth opportunities in this area.

Analytical Approach

To address this problem, we started by validating our assumptions to solidify addressing the drop in sales immediately following a holiday were both founded and worth investing time in. To complete this validation, we explored the Transactions data over time to understand the lowest occurrences of sales.

Once validated, we moved to analyzing the relationship between transactions and Campaigns throughout the year to determine what kind of campaigns were occurring and what type of value they were bringing. This, tied in with Campaign Descriptions, provided insight to the relationships between holidays and campaign events.

Using the Transactions, Products, Coupons, Campaign Descriptions, and Demographics data sets, we explored the relationship between these components to understand what products were selling the most and how that information was impacted by demographics.

For a more focused approach, our initial analysis led us to focus in on the busiest times of the year, Q4, for deeper analysis of how changes in campaign approach could help bring customers back into stores faster following a major holiday.

Proposed Solution & Value

We have determined through detailed analysis of the data available in The Complete Journey data set that Regork can capitalize on an opportunity for growth by:

Implementing a new targeted campaign type directly following the conclusion of a major holiday.

Although today there is a solid distribution of campaign types throughout the year that target both individual customer needs and event driven scenarios such as holidays, there is an opportunity to introduce a new campaign type that targets the most purchased products during the lowest sales days following a major holiday.

Packages Required

The following packages are required to execute the code in this project:

library(completejourney)    # Grocery store transaction data from a group of 2,469 households
library(ggplot2)            # A system for 'declaratively' creating graphics, based on "The Grammar of Graphics"
library(tidyverse)          # Makes it easy to install and load multiple 'tidyverse' packages in a single step
library(lubridate)          # Provides tools that make it easier to parse and manipulate dates
library(scales)             # Map data to aesthetics
library(kableExtra)         # This is a very simple table generator
library(gt)                 # This is a helpful tables formatting package
library(gtExtras)           # Additional functions for creating beautiful tables with 'gt'
library(grid)               # Adds an nx by ny rectangular grid to an existing plot
library(gridExtra)          # Provides a number of user-level functions to work with "grid" graphics
library(wesanderson)        # Fun color palettes based on Wes Anderson

Data Preparation

The Complete Journey data set was used to complete this analysis. This provides access to data sets characterizing household level transactions over one year from a group of 2,469 households who are frequent shoppers at a grocery store.

Data Sets

Below outlines the Complete Journey data sets used for this report:

# get transactions data
transactions <- get_transactions()
transactions
## # A tibble: 1,469,307 × 11
##    household_id store_id basket_id   product_id quantity sales_value retail_disc
##    <chr>        <chr>    <chr>       <chr>         <dbl>       <dbl>       <dbl>
##  1 900          330      31198570044 1095275           1        0.5         0   
##  2 900          330      31198570047 9878513           1        0.99        0.1 
##  3 1228         406      31198655051 1041453           1        1.43        0.15
##  4 906          319      31198705046 1020156           1        1.5         0.29
##  5 906          319      31198705046 1053875           2        2.78        0.8 
##  6 906          319      31198705046 1060312           1        5.49        0.5 
##  7 906          319      31198705046 1075313           1        1.5         0.29
##  8 1058         381      31198676055 985893            1        1.88        0.21
##  9 1058         381      31198676055 988791            1        1.5         1.29
## 10 1058         381      31198676055 9297106           1        2.69        0   
## # ℹ 1,469,297 more rows
## # ℹ 4 more variables: coupon_disc <dbl>, coupon_match_disc <dbl>, week <int>,
## #   transaction_timestamp <dttm>
# get campaigns data
campaigns
## # A tibble: 6,589 × 2
##    campaign_id household_id
##    <chr>       <chr>       
##  1 1           105         
##  2 1           1238        
##  3 1           1258        
##  4 1           1483        
##  5 1           2200        
##  6 1           293         
##  7 1           529         
##  8 1           536         
##  9 1           568         
## 10 1           630         
## # ℹ 6,579 more rows
# get campaign description data 
campaign_descriptions
## # A tibble: 27 × 4
##    campaign_id campaign_type start_date end_date  
##    <chr>       <ord>         <date>     <date>    
##  1 1           Type B        2017-03-03 2017-04-09
##  2 2           Type B        2017-03-08 2017-04-09
##  3 3           Type C        2017-03-13 2017-05-08
##  4 4           Type B        2017-03-29 2017-04-30
##  5 5           Type B        2017-04-03 2017-05-07
##  6 6           Type C        2017-04-19 2017-05-21
##  7 7           Type B        2017-04-24 2017-05-28
##  8 8           Type A        2017-05-08 2017-06-25
##  9 9           Type B        2017-05-31 2017-07-02
## 10 10          Type B        2017-06-28 2017-07-30
## # ℹ 17 more rows
# get demographics data 
demographics
## # A tibble: 801 × 8
##    household_id age   income    home_ownership marital_status household_size
##    <chr>        <ord> <ord>     <ord>          <ord>          <ord>         
##  1 1            65+   35-49K    Homeowner      Married        2             
##  2 1001         45-54 50-74K    Homeowner      Unmarried      1             
##  3 1003         35-44 25-34K    <NA>           Unmarried      1             
##  4 1004         25-34 15-24K    <NA>           Unmarried      1             
##  5 101          45-54 Under 15K Homeowner      Married        4             
##  6 1012         35-44 35-49K    <NA>           Married        5+            
##  7 1014         45-54 15-24K    <NA>           Married        4             
##  8 1015         45-54 50-74K    Homeowner      Unmarried      1             
##  9 1018         45-54 35-49K    Homeowner      Married        5+            
## 10 1020         45-54 25-34K    Homeowner      Married        2             
## # ℹ 791 more rows
## # ℹ 2 more variables: household_comp <ord>, kids_count <ord>
# get coupon redemption data 
coupon_redemptions
## # A tibble: 2,102 × 4
##    household_id coupon_upc  campaign_id redemption_date
##    <chr>        <chr>       <chr>       <date>         
##  1 1029         51380041013 26          2017-01-01     
##  2 1029         51380041313 26          2017-01-01     
##  3 165          53377610033 26          2017-01-03     
##  4 712          51380041013 26          2017-01-07     
##  5 712          54300016033 26          2017-01-07     
##  6 2488         51200092776 26          2017-01-10     
##  7 2488         51410010050 26          2017-01-10     
##  8 1923         53000012033 26          2017-01-14     
##  9 1923         54300021057 26          2017-01-14     
## 10 1923         57047091041 26          2017-01-14     
## # ℹ 2,092 more rows
# get product data 
products
## # A tibble: 92,331 × 7
##    product_id manufacturer_id department    brand  product_category product_type
##    <chr>      <chr>           <chr>         <fct>  <chr>            <chr>       
##  1 25671      2               GROCERY       Natio… FRZN ICE         ICE - CRUSH…
##  2 26081      2               MISCELLANEOUS Natio… <NA>             <NA>        
##  3 26093      69              PASTRY        Priva… BREAD            BREAD:ITALI…
##  4 26190      69              GROCERY       Priva… FRUIT - SHELF S… APPLE SAUCE 
##  5 26355      69              GROCERY       Priva… COOKIES/CONES    SPECIALTY C…
##  6 26426      69              GROCERY       Priva… SPICES & EXTRAC… SPICES & SE…
##  7 26540      69              GROCERY       Priva… COOKIES/CONES    TRAY PACK/C…
##  8 26601      69              DRUG GM       Priva… VITAMINS         VITAMIN - M…
##  9 26636      69              PASTRY        Priva… BREAKFAST SWEETS SW GDS: SW …
## 10 26691      16              GROCERY       Priva… PNT BTR/JELLY/J… HONEY       
## # ℹ 92,321 more rows
## # ℹ 1 more variable: package_size <chr>

Data Frames

Below outlines the data frames created using the Complete Journey data sets for this report:

Validation of Assumptions

# total sales transactions by day
trans_by_day <- transactions %>% 
   mutate(transaction_timestamp = ymd_hms(transaction_timestamp),
          transaction_timestamp = as_date(transaction_timestamp)) %>% 
   group_by(transaction_timestamp) %>% 
   summarize(daily_total_sales = sum(sales_value))
trans_by_day
## # A tibble: 364 × 2
##    transaction_timestamp daily_total_sales
##    <date>                            <dbl>
##  1 2017-01-01                       10477.
##  2 2017-01-02                       12775.
##  3 2017-01-03                       13311.
##  4 2017-01-04                       12194.
##  5 2017-01-05                       12273.
##  6 2017-01-06                       12313.
##  7 2017-01-07                       14566.
##  8 2017-01-08                       15939.
##  9 2017-01-09                       12709.
## 10 2017-01-10                        8885.
## # ℹ 354 more rows
# holidays for 2017
holidays <- ymd(c("2017-01-01", "2017-02-05", "2017-02-14", "2017-03-17",  
                   "2017-04-16", "2017-05-05", "2017-05-14", "2017-05-29",
                   "2017-06-18", "2017-07-04", "2017-09-04", "2017-10-31",
                   "2017-11-23", "2017-12-25")) 
holidays
##  [1] "2017-01-01" "2017-02-05" "2017-02-14" "2017-03-17" "2017-04-16"
##  [6] "2017-05-05" "2017-05-14" "2017-05-29" "2017-06-18" "2017-07-04"
## [11] "2017-09-04" "2017-10-31" "2017-11-23" "2017-12-25"
# holidays grouped by quarter

# New Years, Super Bowl, Valentine's Day, St. Patrick's Day
q1_holiday_date <- ymd(c("2017-01-01", "2017-02-05", "2017-02-14", "2017-03-17"))

# Easter Sunday, Cinco de Mayo, Mother's Day, Memorial Day 
q2_holiday_date <- ymd(c("2017-04-16", "2017-05-05", "2017-05-14", 
                 "2017-05-29")) 

# Father's Day, Independence Day, Labor Day 
q3_holiday_date <- ymd(c("2017-06-18", "2017-07-04", "2017-09-04"))

# Halloween, Thanksgiving Day, Christmas Day 
q4_holiday_date <- ymd(c("2017-10-31", "2017-11-23", "2017-12-25"))

q1_holiday_date
## [1] "2017-01-01" "2017-02-05" "2017-02-14" "2017-03-17"
q2_holiday_date
## [1] "2017-04-16" "2017-05-05" "2017-05-14" "2017-05-29"
q3_holiday_date
## [1] "2017-06-18" "2017-07-04" "2017-09-04"
q4_holiday_date
## [1] "2017-10-31" "2017-11-23" "2017-12-25"
# Top 25 sales days in 2017
top_sales_days <- transactions %>% 
 mutate(transaction_timestamp = ymd_hms(transaction_timestamp), 
        transaction_timestamp = as_date(transaction_timestamp)) %>%
 group_by(transaction_timestamp) %>% 
 summarize(daily_total_sales = sum(sales_value)) %>% 
 slice_max(daily_total_sales, n = 25) 
top_sales_days
## # A tibble: 25 × 2
##    transaction_timestamp daily_total_sales
##    <date>                            <dbl>
##  1 2017-12-23                       24760.
##  2 2017-11-22                       20145.
##  3 2017-12-03                       19612.
##  4 2017-12-22                       19095.
##  5 2017-11-05                       18949.
##  6 2017-02-04                       18881.
##  7 2017-12-30                       17882.
##  8 2017-04-15                       17780.
##  9 2017-11-04                       17723.
## 10 2017-08-06                       17580.
## # ℹ 15 more rows
# Bottom 25 sales days in 2017
bottom_sales_days <- transactions %>% 
  mutate(transaction_timestamp = ymd_hms(transaction_timestamp),
         transaction_timestamp = as_date(transaction_timestamp)) %>% 
  group_by(transaction_timestamp) %>% 
  summarize(daily_total_sales = sum(sales_value)) %>%
  slice_min(daily_total_sales, n = 25)
bottom_sales_days
## # A tibble: 25 × 2
##    transaction_timestamp daily_total_sales
##    <date>                            <dbl>
##  1 2017-11-23                        6963.
##  2 2017-04-11                        8515.
##  3 2017-03-21                        8556.
##  4 2017-07-19                        8735.
##  5 2017-01-18                        8808.
##  6 2017-10-19                        8829.
##  7 2017-01-10                        8885.
##  8 2017-11-24                        8997.
##  9 2017-02-23                        9123.
## 10 2017-06-22                        9132.
## # ℹ 15 more rows

Understanding Campaigns

# Number of campaigns by quarter 
camp_typ_qtr <- campaigns %>% 
 inner_join(campaign_descriptions, by = "campaign_id") %>% 
 mutate(camp_qtr = case_when( 
   start_date >= "2017-01-01" & start_date <= "2017-03-31" ~ "Q1", 
   start_date >= "2017-04-01" & start_date <= "2017-06-30" ~ "Q2", 
   start_date >= "2017-07-01" & start_date <= "2017-09-30" ~ "Q3",
   start_date >= "2017-10-01" & start_date <= "2017-12-31" ~ "Q4", 
   TRUE ~ "N/A" 
 )) %>% 
 filter(camp_qtr != "N/A") %>% # remove dates outside of specified quarters
 group_by(campaign_type, camp_qtr)  %>% 
 summarize(campaign_count = n()) %>% 
 arrange(camp_qtr)
camp_typ_qtr
## # A tibble: 12 × 3
## # Groups:   campaign_type [3]
##    campaign_type camp_qtr campaign_count
##    <ord>         <chr>             <int>
##  1 Type A        Q1                  361
##  2 Type B        Q1                  142
##  3 Type C        Q1                   12
##  4 Type A        Q2                 1076
##  5 Type B        Q2                  663
##  6 Type C        Q2                   65
##  7 Type A        Q3                 1077
##  8 Type B        Q3                  384
##  9 Type C        Q3                  241
## 10 Type A        Q4                 1133
## 11 Type B        Q4                 1044
## 12 Type C        Q4                  244
# Number of campaigns by week for Q4 (campaign start)
camp_typ_week <- campaigns %>% 
 inner_join(campaign_descriptions, by = "campaign_id") %>%
 filter(start_date >= "2017-10-01") %>% 
 mutate(week_of_year = isoweek(start_date)) %>% 
 group_by(campaign_type, week_of_year)  %>% 
 summarize(campaign_count = n()) %>% 
 arrange(week_of_year) 
camp_typ_week
## # A tibble: 7 × 3
## # Groups:   campaign_type [3]
##   campaign_type week_of_year campaign_count
##   <ord>                <dbl>          <int>
## 1 Type B                  40            188
## 2 Type B                  42            202
## 3 Type A                  44           1133
## 4 Type B                  46            130
## 5 Type C                  48            244
## 6 Type B                  49            341
## 7 Type B                  52            183
# Total sales each week by campaign type 
weekly_campaign_sales <- transactions %>% 
 mutate(transaction_timestamp = ymd_hms(transaction_timestamp),  
        transaction_timestamp = as_date(transaction_timestamp)) %>% 
 filter(coupon_disc > 0 | retail_disc > 0 | coupon_match_disc > 0) %>% 
 filter(week > 1) %>% #removing outliers 
 inner_join(campaigns, by = "household_id") %>% 
 inner_join(campaign_descriptions, by = "campaign_id") %>% 
 group_by(campaign_type, week) %>% 
 summarize(total_sales = sum(sales_value))
weekly_campaign_sales
## # A tibble: 156 × 3
## # Groups:   campaign_type [3]
##    campaign_type  week total_sales
##    <ord>         <int>       <dbl>
##  1 Type A            2     111130.
##  2 Type A            3     102626.
##  3 Type A            4     103600.
##  4 Type A            5     101706.
##  5 Type A            6     107574.
##  6 Type A            7     103955.
##  7 Type A            8      91009.
##  8 Type A            9     107696.
##  9 Type A           10     113033.
## 10 Type A           11     114503.
## # ℹ 146 more rows
# Total sales each week for Q4 by campaign type 
weekly_campaign_sales_q4 <- transactions %>% 
 mutate(transaction_timestamp = ymd_hms(transaction_timestamp),  
        transaction_timestamp = as_date(transaction_timestamp)) %>% 
 filter(coupon_disc > 0 | retail_disc > 0 | coupon_match_disc > 0) %>% 
 filter(week >= 40) %>% 
 inner_join(campaigns, by = "household_id") %>% 
 inner_join(campaign_descriptions, by = "campaign_id") %>% 
 group_by(campaign_type, week) %>% 
 summarize(total_sales = sum(sales_value))
weekly_campaign_sales_q4
## # A tibble: 42 × 3
## # Groups:   campaign_type [3]
##    campaign_type  week total_sales
##    <ord>         <int>       <dbl>
##  1 Type A           40      96477.
##  2 Type A           41     101620.
##  3 Type A           42     101292.
##  4 Type A           43      99382.
##  5 Type A           44      98932.
##  6 Type A           45     119821.
##  7 Type A           46     104640.
##  8 Type A           47     110437.
##  9 Type A           48     109563.
## 10 Type A           49     108985.
## # ℹ 32 more rows

Opportunity for Growth

# products by campaign type 
product_campaign <- products %>%
  inner_join(coupons, by = "product_id") %>%
  inner_join(campaign_descriptions, by = "campaign_id") %>%
  group_by(campaign_type, product_category) %>%
  summarize(count = n()) 
product_campaign
## # A tibble: 403 × 3
## # Groups:   campaign_type [3]
##    campaign_type product_category     count
##    <ord>         <chr>                <int>
##  1 Type A        ADULT INCONTINENCE     150
##  2 Type A        AIR CARE                86
##  3 Type A        ANALGESICS            1023
##  4 Type A        ANTACIDS               545
##  5 Type A        APPAREL                  6
##  6 Type A        APPLES                 468
##  7 Type A        AUDIO/VIDEO PRODUCTS     4
##  8 Type A        AUTOMOTIVE PRODUCTS      4
##  9 Type A        BABY FOODS            1366
## 10 Type A        BABY HBC               697
## # ℹ 393 more rows
# Lowest sales dates following a holiday (within 10 days)
bottom_dates <- c("2017-03-21", "2017-01-10", "2017-11-24", "2017-02-23", 
                  "2017-06-22", "2017-03-23", "2017-03-22", "2017-11-30")
bottom_dates
## [1] "2017-03-21" "2017-01-10" "2017-11-24" "2017-02-23" "2017-06-22"
## [6] "2017-03-23" "2017-03-22" "2017-11-30"
# Top products sold on lowest sales days (post holiday)
top_prod_lowest_days <- transactions %>% 
  inner_join(products, by = "product_id") %>%
  mutate(transaction_timestamp = ymd_hms(transaction_timestamp),
         transaction_timestamp = as_date(transaction_timestamp)) %>%
  filter(transaction_timestamp %in% bottom_dates) %>%
  group_by(transaction_timestamp, product_category) %>% 
  summarize(sales_count = n()) %>%
  slice_max(sales_count, n = 10) %>%
  arrange(transaction_timestamp, desc(sales_count))
top_prod_lowest_days
## # A tibble: 83 × 3
## # Groups:   transaction_timestamp [8]
##    transaction_timestamp product_category       sales_count
##    <date>                <chr>                        <int>
##  1 2017-01-10            SOFT DRINKS                    133
##  2 2017-01-10            FLUID MILK PRODUCTS             98
##  3 2017-01-10            BAKED BREAD/BUNS/ROLLS          85
##  4 2017-01-10            CHEESE                          83
##  5 2017-01-10            FRZN MEAT/MEAT DINNERS          81
##  6 2017-01-10            SOUP                            75
##  7 2017-01-10            YOGURT                          69
##  8 2017-01-10            BAG SNACKS                      65
##  9 2017-01-10            BEEF                            60
## 10 2017-01-10            COLD CEREAL                     58
## # ℹ 73 more rows
# The most common products purchased after a holiday 
total_top_prods <- top_prod_lowest_days %>%
  group_by(product_category) %>%
  summarize(product_occurance = sum(sales_count)) %>% 
  slice_max(product_occurance, n = 10) %>%
  arrange(desc(product_occurance))
total_top_prods
## # A tibble: 10 × 2
##    product_category       product_occurance
##    <chr>                              <int>
##  1 SOFT DRINKS                         1029
##  2 FLUID MILK PRODUCTS                  875
##  3 BAKED BREAD/BUNS/ROLLS               733
##  4 CHEESE                               649
##  5 BAG SNACKS                           590
##  6 SOUP                                 418
##  7 FRZN MEAT/MEAT DINNERS               417
##  8 CANDY - CHECKLANE                    355
##  9 BEEF                                 341
## 10 YOGURT                               241
# top product categories for Type A campaigns 
camp_a_top_prod <- products %>%
  inner_join(coupons, by = "product_id") %>%
  inner_join(campaign_descriptions, by = "campaign_id") %>%
  filter(campaign_type == "Type A") %>%
  group_by(product_category) %>%
  summarize(product_occurance = n()) %>%
  slice_max(product_occurance, n = 10) %>%
  arrange(desc(product_occurance))
camp_a_top_prod
## # A tibble: 10 × 2
##    product_category       product_occurance
##    <chr>                              <int>
##  1 MAKEUP AND TREATMENT                4807
##  2 FRZN MEAT/MEAT DINNERS              4208
##  3 HAIR CARE PRODUCTS                  3831
##  4 BEEF                                3314
##  5 FROZEN PIZZA                        2996
##  6 ICE CREAM/MILK/SHERBTS              2637
##  7 CHEESE                              2428
##  8 LUNCHMEAT                           2425
##  9 YOGURT                              2234
## 10 ORAL HYGIENE PRODUCTS               2226
# top product categories for Type B campaigns 
camp_b_top_prod <- products %>%
  inner_join(coupons, by = "product_id") %>%
  inner_join(campaign_descriptions, by = "campaign_id") %>%
  filter(campaign_type == "Type B") %>%
  group_by(product_category) %>%
  summarize(product_occurance = n()) %>%
  slice_max(product_occurance, n = 10) %>%
  arrange(desc(product_occurance))
camp_b_top_prod
## # A tibble: 10 × 2
##    product_category               product_occurance
##    <chr>                                      <int>
##  1 GREETING CARDS/WRAP/PARTY SPLY              1343
##  2 MAKEUP AND TREATMENT                         777
##  3 BABY FOODS                                   672
##  4 FRZN MEAT/MEAT DINNERS                       586
##  5 CHEESE                                       532
##  6 COLD CEREAL                                  407
##  7 REFRGRATD JUICES/DRNKS                       381
##  8 FROZEN PIZZA                                 351
##  9 DIAPERS & DISPOSABLES                        266
## 10 REFRGRATD DOUGH PRODUCTS                     249
# top product categories for Type C campaigns 
camp_c_top_prod <- products %>%
  inner_join(coupons, by = "product_id") %>%
  inner_join(campaign_descriptions, by = "campaign_id") %>%
  filter(campaign_type == "Type C") %>%
  group_by(product_category) %>%
  summarize(product_occurance = n()) %>%
  slice_max(product_occurance, n = 10) %>%
  arrange(desc(product_occurance))
camp_c_top_prod
## # A tibble: 10 × 2
##    product_category          product_occurance
##    <chr>                                 <int>
##  1 HAIR CARE PRODUCTS                     2155
##  2 DRY BN/VEG/POTATO/RICE                  792
##  3 SOAP - LIQUID & BAR                     665
##  4 PASTA SAUCE                             637
##  5 DEODORANTS                              534
##  6 SALD DRSNG/SNDWCH SPRD                  526
##  7 LAUNDRY DETERGENTS                      433
##  8 TEAS                                    337
##  9 LAUNDRY ADDITIVES                       304
## 10 HAND/BODY/FACIAL PRODUCTS               197
# Daily sales count for top products sold on low sales day (post holiday) 
avg_low_count <- transactions %>%
  inner_join(products, by = "product_id") %>%
  filter(product_category %in% c("BAG SNACKS", "BAKED BREAD/BUNS/ROLLS", 
                                 "FLUID MILK PRODUCTS", "SOFT DRINKS", "SOUP",
                                 "CANDY - CHECKLANE")) %>%
  group_by(week, product_category) %>%
  summarize(purchase_count = n())
avg_low_count
## # A tibble: 318 × 3
## # Groups:   week [53]
##     week product_category       purchase_count
##    <int> <chr>                           <int>
##  1     1 BAG SNACKS                        102
##  2     1 BAKED BREAD/BUNS/ROLLS            105
##  3     1 CANDY - CHECKLANE                  48
##  4     1 FLUID MILK PRODUCTS               103
##  5     1 SOFT DRINKS                       231
##  6     1 SOUP                               96
##  7     2 BAG SNACKS                        860
##  8     2 BAKED BREAD/BUNS/ROLLS            930
##  9     2 CANDY - CHECKLANE                 404
## 10     2 FLUID MILK PRODUCTS              1086
## # ℹ 308 more rows
# Household type for product categories 
house_comp_purchase <- transactions %>%
  inner_join(demographics, by = "household_id") %>%
  inner_join(products, by = "product_id") %>%
  filter(product_category %in% c("BAG SNACKS", "BAKED BREAD/BUNS/ROLLS", 
                                 "FLUID MILK PRODUCTS", "SOFT DRINKS", "SOUP",
                                 "CANDY - CHECKLANE")) %>%
  group_by(household_comp, product_category) %>%
  summarize(purchase_count = n())
house_comp_purchase
## # A tibble: 24 × 3
## # Groups:   household_comp [4]
##    household_comp  product_category       purchase_count
##    <ord>           <chr>                           <int>
##  1 1 Adult Kids    BAG SNACKS                       2306
##  2 1 Adult Kids    BAKED BREAD/BUNS/ROLLS           3200
##  3 1 Adult Kids    CANDY - CHECKLANE                1044
##  4 1 Adult Kids    FLUID MILK PRODUCTS              3177
##  5 1 Adult Kids    SOFT DRINKS                      4560
##  6 1 Adult Kids    SOUP                             1367
##  7 1 Adult No Kids BAG SNACKS                       5830
##  8 1 Adult No Kids BAKED BREAD/BUNS/ROLLS           7572
##  9 1 Adult No Kids CANDY - CHECKLANE                3251
## 10 1 Adult No Kids FLUID MILK PRODUCTS              8049
## # ℹ 14 more rows
# Household income for product categories
house_income_purchase <- transactions %>%
  inner_join(demographics, by = "household_id") %>%
  inner_join(products, by = "product_id") %>%
  filter(product_category %in% c("BAG SNACKS", "BAKED BREAD/BUNS/ROLLS", 
                                 "FLUID MILK PRODUCTS", "SOFT DRINKS", "SOUP",
                                 "CANDY - CHECKLANE")) %>%
  mutate(income = fct_lump(income, n = 8)) %>% # Condensing income groups
  group_by(income, product_category) %>%
  summarize(purchase_count = n())
house_income_purchase
## # A tibble: 54 × 3
## # Groups:   income [9]
##    income    product_category       purchase_count
##    <ord>     <chr>                           <int>
##  1 Under 15K BAG SNACKS                       1803
##  2 Under 15K BAKED BREAD/BUNS/ROLLS           2104
##  3 Under 15K CANDY - CHECKLANE                 925
##  4 Under 15K FLUID MILK PRODUCTS              1890
##  5 Under 15K SOFT DRINKS                      3606
##  6 Under 15K SOUP                             1073
##  7 15-24K    BAG SNACKS                       1809
##  8 15-24K    BAKED BREAD/BUNS/ROLLS           2008
##  9 15-24K    CANDY - CHECKLANE                1015
## 10 15-24K    FLUID MILK PRODUCTS              2035
## # ℹ 44 more rows

Exploratory Data Analysis

Validation of Assumptions

Transactions over Time by Quarter

Our analysis began with the validation of our assumptions that there is a decrease in sales following a major holiday. To do this, we started by analyzing sales trends over time by quarter while indicating major holidays on the line graphs to visualize decreases in relation to major holidays.

The below line graph outlines transaction activity over time for each quarter. The vertical lines highlighted in yellow represent major holidays throughout the year.

# Graph of Q1 transactions by day
 q1_day <- trans_by_day %>% 
   filter(transaction_timestamp <= "2017-03-31") %>% 
   ggplot(aes(x = transaction_timestamp, y = daily_total_sales)) + 
   geom_line(size = .5) + 
   geom_vline(xintercept = q1_holiday_date, color = "#D67236") + 
   scale_color_manual(values = "#5B1A18") +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   scale_y_continuous(labels = scales::dollar) +
   labs(title = "Q1 Total Daily Sales", 
        x = "Total Sales", 
        y = "Time (days)") +
  geom_text(aes(x = as.Date("2017-01-01"), label = "\n New Years", y = 9, angle = 090, 
            color = "#FD6467"), nudge_y = 17500, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-02-05"), label = "\n Super Bowl", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 17500, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-02-14"), label = "\n Valentine's Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 17000, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-03-17"), label = "\n St. Patty's Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 17300, show.legend = FALSE, size = 2.5) 

# Graph of Q2 transactions by day 
q2_day <- trans_by_day %>% 
  filter(transaction_timestamp <= "2017-06-30" 
          & transaction_timestamp > "2017-03-31") %>% 
   ggplot(aes(x = transaction_timestamp, y = daily_total_sales)) +
   geom_line(size = .5) +
   geom_vline(xintercept = q2_holiday_date, color = "#D67236") +
   scale_color_manual(values = "#5B1A18") +
   scale_y_continuous(labels = scales::dollar) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Q2 Total Daily Sales", 
        x = "Total Sales", 
        y = "Time (days)") +
  geom_text(aes(x = as.Date("2017-04-16"), label = "\n Easter Sunday", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16000, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-05-05"), label = "\n Cinco de Mayo", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 10000, show.legend = FALSE, size = 2.5) +
  geom_text(aes(x = as.Date("2017-05-14"), label = "\n Mother's Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16500, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-05-29"), label = "\n Memorial Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16400, show.legend = FALSE, size = 2.5)

# Graph of Q3 transactions by day
q3_day <- trans_by_day %>% 
   filter(transaction_timestamp <= "2017-09-30" 
          & transaction_timestamp > "2017-06-30") %>% 
   ggplot(aes(x = transaction_timestamp, y = daily_total_sales)) + 
   geom_line(size = .5) +
   geom_vline(xintercept = q3_holiday_date, color = "#D67236") + 
   scale_color_manual(values = "#5B1A18") +
   scale_y_continuous(labels = scales::dollar) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Q3 Total Daily Sales", 
        x = "Total Sales", 
        y = "Time (days)") +
  geom_text(aes(x = as.Date("2017-06-18"), label = "\n Father's Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16300, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-07-04"), label = "\n 4th of July", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16600, show.legend = FALSE, size = 2.5) +
  geom_text(aes(x = as.Date("2017-09-04"), label = "\n Labor Day", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 16500, show.legend = FALSE, size = 3) 

# Graph of Q4 transactions by day 
 q4_day <- trans_by_day %>% 
   filter(transaction_timestamp <= "2017-12-31" 
          & transaction_timestamp > "2017-09-30") %>% 
   ggplot(aes(x = transaction_timestamp, y = daily_total_sales)) + 
   geom_line(size = .5) +
   geom_vline(xintercept = q4_holiday_date, color = "#D67236") + 
   scale_color_manual(values = "#5B1A18") +
   scale_y_continuous(labels = scales::dollar) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Q4 Total Daily Sales", 
        x = "Total Sales", 
        y = "Time (days)") +
  geom_text(aes(x = as.Date("2017-10-31"), label = "\n Halloween", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 22500, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-11-23"), label = "\n Thanksgiving", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 22000, show.legend = FALSE, size = 3) +
  geom_text(aes(x = as.Date("2017-12-25"), label = "\n Christmas", y = 9, angle = 90, 
            color = "#FD6467"), nudge_y = 22500, show.legend = FALSE, size = 3) 

 gridExtra::grid.arrange(q1_day, q2_day, q3_day, q4_day, ncol = 2) 

Top 25 and Bottom 25 Transaction Days

Once validated, we solidified the value in pursuing this opportunity by looking at the top 25 sales days and the bottom 25 sales days for the data provided. As highlighted below, for the lowest transaction days there are 8 that fall within 10 days following a given holiday. Additionally, we see a correlate between tops sales days and holidays (as expected).

Based on the information determined here, we decided to focus in on Q4 to narrow the scope of our exploration.

# Create a table for the top 25 
top_sales_table <- top_sales_days %>%
  as.data.frame() %>%
  select(transaction_timestamp, daily_total_sales) %>%
  arrange(daily_total_sales) %>%
  gt() %>%
  gt_highlight_rows(rows = grepl("2017-12-30|2017-12-22|2017-11-22|2017-12-23|2017-04-15|2017-02-05|2017-02-12|2017-03-12|2017-04-15|2017-05-21|2017-06-11|2017-07-04|2017-07-01|2017-10-22|2017-11-21|2017-12-31", transaction_timestamp), 
                    fill = "#F1BB7B") %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  fmt_date(columns = 'transaction_timestamp') %>%
  fmt_currency(columns = 'daily_total_sales') %>%
  cols_label(transaction_timestamp = "Date",
             daily_total_sales = "Total Sales") %>%
  cols_align(align = "left") %>%
  tab_header("Top 25 Total Sales Days", 
             subtitle = html("Top sales days leading up to and including a holiday <br> are highlighted in yellow (within 10 days)")) %>%
  tab_options(heading.background.color = "#5B1A18") %>%
  opt_horizontal_padding(scale = 3) 
 
# Create a table for the bottom 25
bottom_sales_table <- bottom_sales_days %>%
  as.data.frame() %>%
  select(transaction_timestamp, daily_total_sales) %>%
 gt() %>%
  gt_highlight_rows(rows = grepl("2017-01-10|2017-02-23|2017-03-21|2017-03-22|2017-03-23|2017-06-22|2017-11-24|2017-11-30", transaction_timestamp), 
                    fill = "#F1BB7B") %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  fmt_date(columns = 'transaction_timestamp') %>%
  fmt_currency(columns = 'daily_total_sales') %>%
  cols_label(transaction_timestamp = "Date",
             daily_total_sales = "Total Sales") %>%
  cols_align(align = "left") %>%
  tab_header("Bottom 25 Total Sales Days", 
             subtitle = html("Bottom sales days following a holiday are highlighted <br> in yellow (within 10 days)")) %>%
  tab_options(heading.background.color = "#5B1A18") %>%
  opt_horizontal_padding(scale = 3)

 gt_two_column_layout(list(top_sales_table, bottom_sales_table))
Top 25 Total Sales Days
Top sales days leading up to and including a holiday
are highlighted in yellow (within 10 days)
Date Total Sales
2017-06-11 $16,410.19
2017-12-16 $16,449.13
2017-04-02 $16,482.90
2017-12-31 $16,574.57
2017-05-21 $16,783.00
2017-07-04 $16,868.78
2017-06-04 $16,873.89
2017-10-01 $16,906.69
2017-10-22 $16,915.08
2017-02-05 $16,997.21
2017-02-12 $17,013.48
2017-03-12 $17,021.89
2017-07-01 $17,068.73
2017-05-07 $17,098.94
2017-11-21 $17,403.48
2017-08-06 $17,580.16
2017-11-04 $17,722.95
2017-04-15 $17,779.79
2017-12-30 $17,882.26
2017-02-04 $18,881.38
2017-11-05 $18,949.29
2017-12-22 $19,095.37
2017-12-03 $19,612.10
2017-11-22 $20,144.70
2017-12-23 $24,760.10
Bottom 25 Total Sales Days
Bottom sales days following a holiday are highlighted
in yellow (within 10 days)
Date Total Sales
2017-11-23 $6,962.69
2017-04-11 $8,515.04
2017-03-21 $8,555.63
2017-07-19 $8,734.51
2017-01-18 $8,807.68
2017-10-19 $8,829.11
2017-01-10 $8,885.30
2017-11-24 $8,996.58
2017-02-23 $9,123.08
2017-06-22 $9,131.61
2017-03-23 $9,206.23
2017-09-26 $9,251.59
2017-01-27 $9,264.53
2017-03-07 $9,281.16
2017-01-19 $9,311.91
2017-03-22 $9,340.74
2017-05-25 $9,379.18
2017-04-06 $9,420.08
2017-08-30 $9,439.23
2017-12-13 $9,486.49
2017-09-21 $9,491.98
2017-11-30 $9,499.69
2017-07-26 $9,504.61
2017-01-17 $9,516.80
2017-01-26 $9,581.30

Understanding Campaigns

Campaign Types Over Time

With our focused data set, we next evaluated the relationship of promotions and how the type and frequency related to the dips in sales we observed. To understand the following graphs, it is important to note the differences between campaign types.

Type A: Customers participating in this type of campaign received 16 coupons based on the customer’s prior purchase behavior.
Type B & C: Customers participating in this type of campaign received all coupons pertaining to that campaign.

Per the data sets provided, there is no given distinction between Type B & C campaigns.

The important distinction between Type A and Type B and C campaigns is that Type A campaigns target customers based on their purchasing habits where Type B and C target customers based on the type of campaign being run.

# Bar graph of campaign count by quarter by type  
 camp_typ_qtr_graph <- camp_typ_qtr %>% 
   ggplot(aes(x = camp_qtr, y = campaign_count, fill = campaign_type)) + 
   geom_bar(position = "dodge", stat = "identity") +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Campaign Count by Quarter", x = "Quarter", 
        y = "Campaign Count", fill = "Campaign Type") +
   scale_fill_manual(values = wes_palette("GrandBudapest1", n = 3))

# Bar graph of campaign start date count by quarter by type (Q4)
camp_typ_week_graph <- camp_typ_week %>% 
   ggplot(aes(x = week_of_year, y = campaign_count, fill = campaign_type)) + 
   geom_bar(position = "dodge", stat = "identity") +
   # geom_text(aes(label = camp_typ_week$campaign_count),
   #          size = 3) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Q4 Campaign Count by Week", x = "Week", 
        y = "Campaign Count", fill = "Campaign Type") +
   scale_fill_manual(values = wes_palette("GrandBudapest1", n = 3))

# Graph of promotion types throughout the year (Q4)
 weekly_campaign_sales_q4_graph <- weekly_campaign_sales_q4 %>% 
   ggplot(aes(x = week, y = total_sales, color = campaign_type)) + 
   geom_line() + 
   scale_y_continuous(labels = scales::dollar) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Q4 Campaign Sales by Week", x = "Week", 
        y = "Campaign Sales",  color = "Campaign Type") +
   scale_color_manual(values = c("#F1BB7B", "#FD6467", "#5B1A18"))
 
# line graph of promotion types throughout the year
 weekly_campaign_sales_graph <- weekly_campaign_sales %>%
   ggplot(aes(x = week, y = total_sales, color = campaign_type)) +
   geom_line() +
   scale_y_continuous(labels = scales::dollar) +
   theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
   labs(title = "Campaign Sales by Week", x = "Week", 
        y = "Campaign Sales", color = "Campaign Type") +
   scale_color_manual(values = c("#F1BB7B", "#FD6467", "#5B1A18"))

gridExtra::grid.arrange(camp_typ_qtr_graph, camp_typ_week_graph,
                        weekly_campaign_sales_graph, weekly_campaign_sales_q4_graph,
                        ncol = 2) 

As outlined above, there are a number of Type A, B, and C campaigns that occur through the the year and heavily in Q4. Type A campaigns continue from October through December and Type B & C campaigns occur leading up to holidays and events.

With the validation of low sales following a holiday and the understanding of campaigns before, during, and after holidays, we can now dive into the opportunity for growth for Regork.

Opportunity for Growth

Top Product Categories Sold

Circling back to our lowest purchase days following a major holiday, we began by evaluating what product categories customers are purchasing from on those low sale days. Taking it a step further, we evaluated what the top product categories are for each of the lowest sales days following a holiday (within 10 days).

We then evaluated the top product categories of each of the 3 types of campaigns to determine which product categories were selling the most across these campaigns.

Finally, we compared across the different campaign types to understand any commonalities existed between each of the groups.

Top product categories for lowest sales days (highlighted in yellow) do not exist in any of the top product categories for the 3 campaign types.

# Table for top type A products 
camp_a_top_prod_table <- camp_a_top_prod %>%
  as.data.frame() %>%
  gt() %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  cols_label(product_category = "Product Category",
             product_occurance = "Frequency") %>%
  cols_align(align = "left") %>%
  tab_header(title = "Top Product Categories: Type A Campaigns",
             subtitle = "Most frequently purchased product categories for Type A campaigns") %>%
  tab_options(table.align = 'left', heading.background.color = "#5B1A18")

# Table for top type B products 
camp_b_top_prod_table <- camp_b_top_prod %>%
  as.data.frame() %>%
  gt() %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  cols_label(product_category = "Product Category",
             product_occurance = "Frequency") %>%
  cols_align(align = "left") %>%
  tab_header(title = "Top Product Categories: Type B Campaigns",
             subtitle = "Most frequently purchased product categories for Type B campaigns") %>%
  tab_options(table.align = 'right', heading.background.color = "#5B1A18")

# Table for top type C products 
camp_c_top_prod_table <- camp_c_top_prod %>%
  as.data.frame() %>%
  gt() %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  cols_label(product_category = "Product Category",
             product_occurance = "Frequency") %>%
  cols_align(align = "left") %>%
  tab_header(title = "Top Product Categories: Type C Campaigns",
             subtitle = "Most frequently purchased product categories for Type C campaigns") %>%
  tab_options(table.align = 'left', heading.background.color = "#5B1A18")

# Table for top products on lowest sales days 
total_top_prods_table <- total_top_prods %>%
  as.data.frame() %>%
  gt() %>%
  gt_highlight_rows(rows = grepl("SOFT DRINKS|FLUID MILK PRODUCTS|BAKED BREAD/BUNS/ROLLS|BAG SNACKS|SOUP|CANDY - CHECKLANE", 
                                 product_category), 
                    fill = "#F1BB7B") %>%
  tab_style(style = cell_fill(color = "#D67236"), locations = cells_column_labels()) %>%
  opt_stylize(style = 5) %>%
  cols_label(product_category = "Product Category",
             product_occurance = "Frequency") %>%
  cols_align(align = "left") %>%
  tab_header(title = "Top Product Categories: Lowest Sales Days",
             subtitle = "Most frequently purchased product categories for lowest sales days") %>%
  tab_options(table.align = 'right', heading.background.color = "#5B1A18")


gt_two_column_layout(list(total_top_prods_table, camp_a_top_prod_table))
Top Product Categories: Lowest Sales Days
Most frequently purchased product categories for lowest sales days
Product Category Frequency
SOFT DRINKS 1029
FLUID MILK PRODUCTS 875
BAKED BREAD/BUNS/ROLLS 733
CHEESE 649
BAG SNACKS 590
SOUP 418
FRZN MEAT/MEAT DINNERS 417
CANDY - CHECKLANE 355
BEEF 341
YOGURT 241
Top Product Categories: Type A Campaigns
Most frequently purchased product categories for Type A campaigns
Product Category Frequency
MAKEUP AND TREATMENT 4807
FRZN MEAT/MEAT DINNERS 4208
HAIR CARE PRODUCTS 3831
BEEF 3314
FROZEN PIZZA 2996
ICE CREAM/MILK/SHERBTS 2637
CHEESE 2428
LUNCHMEAT 2425
YOGURT 2234
ORAL HYGIENE PRODUCTS 2226
gt_two_column_layout(list(camp_b_top_prod_table, camp_c_top_prod_table))
Top Product Categories: Type B Campaigns
Most frequently purchased product categories for Type B campaigns
Product Category Frequency
GREETING CARDS/WRAP/PARTY SPLY 1343
MAKEUP AND TREATMENT 777
BABY FOODS 672
FRZN MEAT/MEAT DINNERS 586
CHEESE 532
COLD CEREAL 407
REFRGRATD JUICES/DRNKS 381
FROZEN PIZZA 351
DIAPERS & DISPOSABLES 266
REFRGRATD DOUGH PRODUCTS 249
Top Product Categories: Type C Campaigns
Most frequently purchased product categories for Type C campaigns
Product Category Frequency
HAIR CARE PRODUCTS 2155
DRY BN/VEG/POTATO/RICE 792
SOAP - LIQUID & BAR 665
PASTA SAUCE 637
DEODORANTS 534
SALD DRSNG/SNDWCH SPRD 526
LAUNDRY DETERGENTS 433
TEAS 337
LAUNDRY ADDITIVES 304
HAND/BODY/FACIAL PRODUCTS 197

Top Product Categories Evaluated

The above tables indicates there are multiple product categories sold during the lowest sales days following a holiday that do not appear in the top product categories for the 3 campaign types (highlighted in yellow).

This introduces an opportunity to create a new campaign type targeted for post holidays.

Below continues to explore the proposed growth opportunity.

# Graph of product category sales over time
avg_low_count %>%
  ggplot(aes(x = week, y = purchase_count, color = product_category)) +
  geom_point(bins = 60, size = 1) +
  theme(plot.title = element_text(size = 15, hjust = 0.5, face = "bold", vjust = -1),
        plot.subtitle = element_text(size = 10, hjust = 0.5, face = "italic")) +
  labs(color = "Product Category") +
  xlab("Week of the Year") +
  ylab("Product Count") +
  scale_color_manual(values = c("#F1BB7B", "#FD6467", "#D67236", "#5B1A18", "#D8A499", "#7294D4")) +
  geom_smooth() +
  ggtitle("Product Count",
          subtitle = "Total purchased by product category") +
  guides(fill = "none") +
  # scale_y_continuous(labels = scales::dollar) +
  scale_x_continuous(breaks = seq(0, 52, 4)) +
  viridis::scale_fill_viridis(option = "D")

Outside of the small dip we see for soup purchase counts throughout the summer months and the slow start we see for soft drinks at the beginning of the year (likely resulting from health trends we commonly see after New Years), the product categories sales explored above tend to stay fairly consistent during the year.

# Compare this for household and income ranges
house_comp_purchase %>%
  ggplot(aes(x = product_category, y = purchase_count, fill = household_comp)) +
  geom_bar(position = "dodge", stat = "identity") + 
  theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
  labs(title = "Household Composition Purchases", x = "Product Category", 
        y = "Purchase Count", fill = "House Composition") +
  coord_flip() +
  scale_fill_manual(values = wes_palette("GrandBudapest1", n = 4))

The product categories remain fairly consistent as well across different household compositions as indicated above. Although we see a variation in the amount being purchased, all compositions seems to purchase regularly from these categories.

# Compare this for household and income ranges

house_income_purchase %>%
  ggplot(aes(x = product_category, y = purchase_count, fill = income)) +
  geom_bar(position = "dodge", stat = "identity") + 
  theme(plot.title = element_text(hjust = 0.5, face = "bold")) +
  labs(title = "Household Income Purchases", x = "Product Category", 
        y = "Purchase Count", fill = "Household Income") +
  coord_flip() +
  scale_fill_manual(values = c("#F1BB7B", "#FD6467", "#5B1A18", "#D67236", 
                               "#E6A0C4", "#C6CDF7", "#D8A499", "#7294D4", 
                               "#02401B", "#81A88D"))

We see the same consistency when reviewing household incomes. The quantity of product categories purchased vary based on income but we see the consistency of purchasing regardless of the different incomes levels.

This insight is important as it shows the value of creating a new campaign type.

Through the introduction of a new campaign type, these consistently purchased items can be targeted to help drive short-term sales increases during the time following a holiday where we normally we see sales decrease. Seeing that these products are purchased by all household compositions and incomes indicates that a campaign targeting these products would appeal to wide spread of customers. Targeting this campaign for the 10 days following a major holiday can help bridge the gap between the end of a holiday and normal shopping patterns returning to normal.

Summary

Problem Statement Summary

The goal of this report was to analyze how Regork can bring customers back to stores faster following a holiday. Through the data provided by The Complete Journey set we were able to identify and propose an opportunity to do just that through the implementation of a new campaign type aiming to bring shoppers in following a holiday.

Solution Methodology & Data Used

Using the Transactions data set we were able to definitively establish a pattern of low transaction days following holidays. We found that of the 25 lowest sales days across 2017, 8 days were within the first 10 days following a holiday; 32% of the 25 lowest sales days.

Next, we evaluated the Campaigns and the Campaign Descriptions data sets to understand how campaigns vary during these post holiday low sales days. We discovered that all 3 campaign types occur in every quarter and while Type A campaigns are long lasting and targeted on consumer habits, Type B and C campaigns are event driven and are more common around holidays.

With the information above, we then evaluated the top 10 most frequently purchased product categories for each campaign type using the Transactions, Products, Coupons, and Campaign Descriptions data sets. We then independently evaluated the top 10 products most frequently purchased across all of the lowest transaction days following a holiday. We then cross referenced the tables to understand how they compare.

We the looked at general sales for these product categories behave over time, how they vary across income levels, and how they vary across household compositions using the Demographics, Transactions, and Products data sets.

Interesting Insights

From our data exploration, we uncovered a few key insights that led us to our proposal. The first was how the product categories sold on lowest transaction days compared to those of campaigns. We found that 6 of the top 10 product categories sold on the lowest sales days were not present in the top 10 product categories sold across Type A, B, and C campaign types.

Additionally, we found through the evaluation of the 6 product categories that they have relatively consistent sales throughout the year regardless of the time of year or holiday occurring. We found similar insights for household income and household composition. Although the quantity purchased varied, we saw that almost each category had a relatively consistent purchasing habit. The combination of consistent purchasing behavior across all types of households and incomes make it a great candidate for a new campaign as it would appeal to all customer types.

Proposal

From our discovery, we propose that Regork focus on creating a targeted campaign type that focuses on frequently purchased items for low sales days following a holiday. This campaign can help drive customers back to stores faster and in turn decrease the drop in sales we consistently see following a holiday.

Analysis Limitations

There are a few limitations that should be considered from the analysis we completed. First, our data set consisted of one year of information which limits our ability to analyze trends year over year. Additionally, we know very little information about each of the campaign types. More information on the design of these campaigns would allow us to better evaluate the different approaches and how they might be improved or changed. Additional information in these areas would improve the overall quality of the conclusions we can draw from our investigation.