1 GOAL:

You are about to receive LiveAnalytics data on 10k fans in each of 25 markets across the USA.

Your goal is to decide which artist should be touring, which ten cities they should stop at, and in what order.

  • BE CREATIVE: Lean into external research to find the artist that makes the most sense. Who has the most upside by leveraging this type of data?

  • TOUR DATES: The dates for the tour must fall between September 1 and September 20. Be thoughtful about large events, like NFL games, that may take place on certain days in each market.

2 Import Data

2.1 City Files

 # Clear the workspace
  rm(list = ls()) # Clear environment
  gc()            # Clear unused memory
##          used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
## Ncells 525839 28.1    1167755 62.4         NA   669282 35.8
## Vcells 968112  7.4    8388608 64.0      32768  1840419 14.1
  cat("\f")       # Clear the console
  if(!is.null(dev.list())) dev.off() # Clear all plots
## null device 
##           1
getwd()
## [1] "/Users/arvindsharma/Library/CloudStorage/GoogleDrive-sharmaar@bc.edu/My Drive/MSAE/MIT_hackathon/drive-download-20240229T151622Z-001"
library(readr)

# Step 1: Create a list of filenames
file_names <- c(
    "Atlanta-Bhvr.txt",   "Atlanta-Cust.txt",
    "Boston_bhvr.txt",  "Boston_Cust.txt", 
    "Charlotte_Bhav.txt", "Charlotte_Cust.txt", 
    "Chicago_Bhav.txt", "Chicago_Cust.txt",
    "Dallas_Bhav.txt", "Dallas_Cust.txt", 
    "Denver_Bhav.txt", "Denver_Cust.txt",
    "Detroit_Bhav.txt", "Detroit_Cust.txt", 
    "Houston_Bhav.txt", "Houston_Cust.txt", 
    "Indianapolis_Bhav.txt", "Indianapolis_Cust.txt",
    "KansasCity_Bhav.txt", "KansasCity_Cust.txt", 
    "LasVegas_Bhav.txt", "LasVegas_Cust.txt", 
    "LosAngeles_Bhav.txt", "LosAngeles_Cust.txt",
    "Miami_Bhav.txt", "Miami_Cust.txt", 
    "minneapolis_bhvr.txt", "minneapolis_cust.txt", 
    "Nashville_bhvr.txt", "Nashville_cust.txt",
    "new_orleans_bhvr.txt", "new_orleans_cust.txt",
    "new_york_city_bhvr.txt", "new_york_city_cust.txt",
    "oklahoma_city_bhvr.txt", "Oklahoma_city_cust.txt",
    "Philadelphia_Bhvr.txt", "philadelphia_cust.txt", 
    "Phoenix_Bhvr.txt", "phoenix_cust.txt", 
    "Portland_Bhvr.txt", "portland_cust.txt",
    "SaltLakeCity_Bhav.txt", "SaltLakeCity_Cust.txt",
    "SanFrancisco_Bhav.txt", "SanFrancisco_Cust.txt", 
    "Seattle_Bhav.txt","Seattle_Cust.txt", 
    "WashingtonDC_Bhav.txt", "WashingtonDC_Cust.txt"
)

# Step 2 & 3: Loop over the filenames, read each file, and store the data

city_list <- list()

for (city in file_names) {
data <- read_delim(city, delim = "|", escape_double = FALSE, trim_ws = TRUE)
city_list[[city]] <- data
}


# Step 4: Combine or organize the data as needed
# For example, you can access the data for a specific file like this:
# data_for_Dallas_Bhav <- data_list[["Dallas_Bhav.txt"]]

2.2 Key Data: FINAL_MIT_Sloan_Hackathon_Data_20240227

library(readxl)

main_bhvr <- read_excel("FINAL MIT Sloan Hackathon Data 20240227.xlsx", 
                    sheet = "Behavioral")

main_cust <- read_excel("FINAL MIT Sloan Hackathon Data 20240227.xlsx",
                    sheet = "Customer")

3 EDA: Summary Statistics

3.1 Main

library("naniar")
naniar::gg_miss_var(main_bhvr)

naniar::gg_miss_var(main_cust)

library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
stargazer(as.data.frame(main_bhvr), type = "text")
## 
## ============================================================
## Statistic            N       Mean      St. Dev.  Min   Max  
## ------------------------------------------------------------
## UID               249,946 124,973.500 72,153.340  1  249,946
## behavior_score_05 247,670   534.848    153.867   210   895  
## behavior_score_06 247,670   455.216    154.940   200   949  
## behavior_score_07 247,670   528.292    133.122   200   956  
## behavior_score_09 247,670   530.680    162.881   200   955  
## behavior_score_10 247,670   503.027    127.391   200   895  
## behavior_score_11 247,670   484.322    152.709   200   943  
## behavior_score_12 247,671   614.042    145.143   308   900  
## behavior_score_13 247,670   595.931    163.474   286   882  
## behavior_score_22 247,671   577.826    139.034   249   905  
## behavior_score_23 247,670   619.220    142.256   368   870  
## behavior_score_24 247,671   521.244    188.318   200   958  
## dim_01_ind        230,417    0.371      0.483     0     1   
## dim_02_ind        230,417    0.340      0.474     0     1   
## dim_03_ind        230,417    0.171      0.377     0     1   
## dim_04_ind        119,578    0.407      0.491     0     1   
## dim_05_ind        119,578    0.012      0.110     0     1   
## dim_06_ind        119,578    0.020      0.140     0     1   
## dim_07_ind        119,578    0.037      0.188     0     1   
## dim_09_ind        180,796    0.097      0.296     0     1   
## dim_11_ind        202,411    0.228      0.419     0     1   
## dim_12_ind        233,649    0.634      0.482     0     1   
## dim_13_ind        233,649    0.258      0.437     0     1   
## dim_14_ind        233,649    0.415      0.493     0     1   
## dim_15_ind        233,649    0.096      0.295     0     1   
## dim_16_ind        233,649    0.336      0.472     0     1   
## dim_17_ind        233,649    0.538      0.499     0     1   
## dim_18_ind        233,649    0.583      0.493     0     1   
## dim_19_ind        228,827    0.355      0.479     0     1   
## dim_20_ind        228,827    0.453      0.498     0     1   
## dim_21_ind        233,649    0.177      0.382     0     1   
## dim_22_ind        233,649    0.044      0.204     0     1   
## dim_23_ind        232,333    0.050      0.217     0     1   
## dim_24_ind        213,148    0.147      0.354     0     1   
## dim_25_ind        223,781    0.099      0.299     0     1   
## ------------------------------------------------------------
stargazer(as.data.frame(main_cust), type = "text")
## 
## ==============================================================================
## Statistic                        N       Mean      St. Dev.   Min      Max    
## ------------------------------------------------------------------------------
## ult_party_id                  249,946 124,973.500 72,153.340   1     249,946  
## cust_postal_cd                211,755 53,487.460  30,686.210  299    99,928   
## age_two_yr_incr_input_indv    222,761   45.134      14.594    18       99     
## age_two_yr_incr_1st_indv      233,734   45.806      16.204     0       99     
## age_two_yr_incr_2nd_indv      131,397   46.920      19.739     0       99     
## adult_hh_num                  241,674    1.937      0.981      0        6     
## hh_male_18_24_ind             22,641     0.860      0.347      0        1     
## hh_female_18_24_ind           22,410     0.811      0.391      0        1     
## hh_unk_18_24_ind               9,908     0.409      0.492      0        1     
## hh_male_25_34_ind             38,682     0.867      0.340      0        1     
## hh_female_25_34_ind           38,996     0.803      0.398      0        1     
## hh_unk_25_34_ind              10,660     0.180      0.385      0        1     
## hh_male_35_44_ind             47,695     0.816      0.388      0        1     
## hh_female_35_44_ind           47,487     0.859      0.348      0        1     
## hh_unk_35_44_ind              10,862     0.281      0.450      0        1     
## hh_male_45_54_ind             42,318     1.000      0.000      1        1     
## hh_female_45_54_ind           42,147     1.000      0.000      1        1     
## hh_unk_45_54_ind               2,347     1.000      0.000      1        1     
## hh_male_55_64_ind             37,812     1.000      0.000      1        1     
## hh_female_55_64_ind           35,611     1.000      0.000      1        1     
## hh_unk_55_64_ind               1,778     1.000      0.000      1        1     
## hh_male_65_74_ind             20,502     1.000      0.000      1        1     
## hh_female_65_74_ind           17,738     1.000      0.000      1        1     
## hh_unk_65_74_ind                833      1.000      0.000      1        1     
## hh_male_75_plus_ind           12,047     1.000      0.000      1        1     
## hh_female_75_plus_ind         10,667     1.000      0.000      1        1     
## hh_unk_75_plus_ind              539      1.000      0.000      1        1     
## hh_male_00_02_ind               27       1.000      0.000      1        1     
## hh_female_00_02_ind             31       1.000      0.000      1        1     
## hh_unk_00_02_ind               1,906     1.000      0.000      1        1     
## hh_male_03_05_ind               133      1.000      0.000      1        1     
## hh_female_03_05_ind             177      1.000      0.000      1        1     
## hh_unk_03_05_ind               6,178     1.000      0.000      1        1     
## hh_male_06_10_ind               498      1.000      0.000      1        1     
## hh_female_06_10_ind             525      1.000      0.000      1        1     
## hh_unk_06_10_ind              15,106     1.000      0.000      1        1     
## hh_male_11_15_ind              1,444     1.000      0.000      1        1     
## hh_female_11_15_ind            2,879     1.000      0.000      1        1     
## hh_unk_11_15_ind              19,268     1.000      0.000      1        1     
## hh_male_16_17_ind              5,689     1.000      0.000      1        1     
## hh_female_16_17_ind            4,252     1.000      0.000      1        1     
## hh_unk_16_17_ind              18,943     1.000      0.000      1        1     
## len_of_resdnc_cd              195,466    9.776      5.334      0       15     
## income_est_hh_cd              219,936    6.505      2.188      1        9     
## est_hh_inc_cd_100pct_inc_cd   237,940    6.465      2.266      1        9     
## discretionary_income_index_cd 222,568   94.128     103.320     0      5,000   
## financial_pct_score           197,359   513.171    235.980    80      1,000   
## bank_card_hldr_cd             196,622    1.000      0.000      1        1     
## gas_dept_retail_card_hldr_cd  135,363    1.000      0.000      1        1     
## travel_ent_card_hldr_cd       36,074     1.000      0.000      1        1     
## credit_card_unk_type_hld_cd   212,730    1.000      0.000      1        1     
## prem_card_hldr_cd             54,208     1.000      0.000      1        1     
## upscale_dept_str_card_hldr_cd 135,870    1.000      0.000      1        1     
## e3_pmt_visa_ind               237,386    0.651      0.477      0        1     
## e3_pmt_mc_ind                 237,386    0.269      0.443      0        1     
## e3_pmt_amex_ind               237,386    0.136      0.343      0        1     
## e3_pmt_disc_ind               237,386    0.046      0.209      0        1     
## e3_pmt_other_ind              237,386    0.132      0.338      0        1     
## edu_input_indv_cd             205,880    1.546      0.716      1        4     
## edu_1st_indv_cd               204,750    1.571      0.726      1        4     
## edu_2nd_indv_cd               112,362    1.632      0.740      1        4     
## int_theatre_perf_arts_cd      40,447     1.000      0.000      1        1     
## int_arts_cd                   65,147     1.000      0.000      1        1     
## int_travel_domestic_cd        90,363     1.000      0.000      1        1     
## int_home_stereo_cd            49,511     1.000      0.000      1        1     
## int_music_player_cd           78,339     1.000      0.000      1        1     
## int_music_avid_lstnr_cd       103,128    1.000      0.000      1        1     
## int_music_clctr_cd            17,544     0.703      0.457      0        1     
## int_movie_clctr_cd            60,082     1.000      0.000      1        1     
## int_auto_motor_racing_cd      17,573     1.000      0.000      1        1     
## int_spectator_sport_footb_cd  70,946     1.000      0.000      1        1     
## int_spectator_sport_baseb_cd  57,292     1.000      0.000      1        1     
## int_spectator_sport_bsktb_cd  55,275     1.000      0.000      1        1     
## int_spectator_sport_hockey_cd 27,300     1.000      0.000      1        1     
## int_spectator_sport_soccer_cd  3,149     1.000      0.000      1        1     
## int_spectator_sport_tennis_cd  2,539     1.000      0.000      1        1     
## int_swpstake_contest_cd       107,246    1.000      0.000      1        1     
## int_sports_grp_cd             180,446    1.000      0.000      1        1     
## int_music_grp_cd              163,164    1.000      0.000      1        1     
## int_nascar_cd                 40,756     1.000      0.000      1        1     
## int_upscale_living_cd         57,270     1.000      0.000      1        1     
## int_cultural_living_cd         7,308     1.000      0.000      1        1     
## veh_truck_owner_cd            84,269     0.925      0.264      0        1     
## veh_mtrcyc_owner_cd           34,249     0.775      0.417      0        1     
## veh_rv_owner_cd               48,144     0.847      0.360      0        1     
## veh_known_owned_cd            127,418    2.093      0.868      1        3     
## psx_classic_clus_cd           238,618   20.858      19.723     1       70     
## psx_group_id                  238,618   11.152      5.116      1       21     
## brkr_ind                      238,237    0.005      0.070      0        1     
## e3_events_cnt                 238,237    2.861      9.928      1      1,432   
## e3_tkt_qty_avg                230,386    2.575      1.275    1.000   40.330   
## e3_spend_total                238,237   724.191   3,482.466  0.010 491,579.300
## e3_spend_per_event            238,237   231.675    303.532   0.010 14,400.000 
## e3_tkt_price_avg              230,386   94.410     115.340   0.010  7,200.000 
## e3_tkt_price_min              230,386   67.475      96.837   0.010  7,200.000 
## e3_tkt_price_max              230,386   135.369    202.902   0.010 10,900.000 
## e3_txpr_pctile                186,796    0.526      0.224    0.000    1.000   
## e3_tran_platinum_ind          238,237    0.059      0.236      0        1     
## e3_tran_type_primary_ind      238,237    0.861      0.346      0        1     
## e3_tran_type_resale_ind       238,237    0.312      0.463      0        1     
## e3_ancil_parking_ind          238,237    0.105      0.307      0        1     
## e3_ancil_upsell_ind           238,237    0.036      0.187      0        1     
## grp_buyer_ind                 238,237    0.003      0.052      0        1     
## e3_dist_to_ven                196,588   146.429    329.790     0      5,087   
## e3_dist_to_ven_local          180,427   29.161      32.255     0       200    
## e3_dist_201_plus_miles_ind    196,588    0.220      0.414      0        1     
## e3_spend_pe_m_concerts        143,941   229.914    291.558   3.000 11,981.840 
## e3_spend_pe_m_arts            55,029    234.865    219.947   2.000  5,196.000 
## e3_spend_pe_m_sports          100,870   275.885    439.481   0.010 18,140.000 
## e3_spend_pe_m_family          21,649    135.092    127.350   2.140  3,913.000 
## e3_spend_pe_m_misc             6,717    125.267    150.276   2.000  1,994.500 
## e3_sow_m_concerts             238,237    0.482      0.450    0.000    1.000   
## e3_sow_m_arts                 238,237    0.141      0.308    0.000    1.000   
## e3_sow_m_sports               238,237    0.312      0.423    0.000    1.000   
## e3_sow_m_family               238,237    0.052      0.202    0.000    1.000   
## e3_sow_m_misc                 238,237    0.013      0.102    0.000    1.000   
## e3_pref_tkt_qty_01_02         230,386    0.677      0.399    0.000    1.000   
## e3_pref_tkt_qty_03_04         230,386    0.245      0.360    0.000    1.000   
## e3_pref_tkt_qty_05_08         230,386    0.073      0.220    0.000    1.000   
## e3_pref_tkt_qty_09_plus       230,386    0.005      0.061    0.000    1.000   
## e3_pref_txpr_001_025          230,386    0.163      0.317    0.000    1.000   
## e3_pref_txpr_026_050          230,386    0.274      0.374    0.000    1.000   
## e3_pref_txpr_051_100          230,386    0.293      0.376    0.000    1.000   
## e3_pref_txpr_101_200          230,386    0.179      0.317    0.000    1.000   
## e3_pref_txpr_201_plus         230,386    0.091      0.243    0.000    1.000   
## e3_pref_txpr_pctile_00_25     186,796    0.150      0.305    0.000    1.000   
## e3_pref_txpr_pctile_25_49     186,796    0.379      0.415    0.000    1.000   
## e3_pref_txpr_pctile_50_74     186,796    0.232      0.356    0.000    1.000   
## e3_pref_txpr_pctile_75_89     186,796    0.131      0.284    0.000    1.000   
## e3_pref_txpr_pctile_90_100    186,796    0.108      0.267    0.000    1.000   
## e3_pref_purch_pd_presale      232,236    0.109      0.250    0.000    1.000   
## e3_pref_purch_pd_onsale       232,236    0.081      0.220    0.000    1.000   
## e3_pref_purch_pd_firstweek    232,235    0.051      0.179    0.000    1.000   
## e3_pref_purch_pd_inbetween    232,235    0.450      0.416    0.000    1.000   
## e3_pref_purch_pd_finalweek    232,235    0.310      0.399    0.000    1.000   
## e3_pref_channel_internet      238,047    0.427      0.443    0.000    1.000   
## e3_pref_channel_phone         238,047    0.014      0.108    0.000    1.000   
## e3_pref_channel_mobile        238,047    0.516      0.452    0.000    1.000   
## e3_pref_channel_box           238,047    0.037      0.175    0.000    1.000   
## e3_pref_channel_outlet        238,047    0.006      0.073    0.000    1.000   
## rfm_score                     238,236   521.353    127.421    194      993    
## propn_score_minor_101         239,933   334.527    181.144    58       983    
## propn_score_minor_102         239,933   414.041    220.969    58       977    
## propn_score_minor_103         239,933   504.612    218.798    58       991    
## propn_score_minor_104         239,933   201.515    171.138    58       976    
## propn_score_minor_105         239,933   484.457    226.211    58       994    
## propn_score_minor_106         239,933   286.159    152.761    58       971    
## propn_score_minor_107         239,933   266.965    211.918    58       994    
## propn_score_minor_108         239,933   284.449    214.643    58       979    
## propn_score_minor_109         239,933   356.707    216.463    58       990    
## propn_score_minor_110         239,933   593.142    211.687    94       966    
## propn_score_minor_111         239,933   260.442    150.828    58       969    
## propn_score_minor_199         239,933   452.884    162.013    83       969    
## propn_score_minor_201         239,933   260.615    211.920    58       977    
## propn_score_minor_202         239,933   400.506    198.040    58       967    
## propn_score_minor_203         239,932   197.130    139.215    58       966    
## propn_score_minor_204         239,932   214.137    154.578    58       966    
## propn_score_minor_205         239,932   229.584    151.461    58       972    
## propn_score_minor_206         239,923   327.848    151.871    58       979    
## propn_score_minor_207         239,932   298.712    176.288    58       981    
## propn_score_minor_299         239,932   316.923    166.192    58       983    
## propn_score_minor_301         239,932   276.692    185.215    58       982    
## propn_score_minor_302         239,932   269.449    189.870    58       979    
## propn_score_minor_399         239,932   331.087    169.741    58       971    
## propn_score_minor_401         239,932   380.929    232.175    58       987    
## propn_score_minor_402         239,932   460.696    210.870    58       988    
## propn_score_minor_403         239,932   509.610    203.983    58       990    
## propn_score_minor_410         239,932   516.298    206.516    58       987    
## propn_score_minor_412         239,902   415.233    221.721    58       989    
## propn_score_minor_420         239,932   581.551    210.477    118      985    
## propn_score_minor_423         239,932   439.711    204.350    58       990    
## propn_score_minor_430         239,932   553.563    202.229    84       984    
## propn_score_minor_432         239,932   416.739    183.062    58       981    
## propn_score_minor_440         239,932   576.972    194.734    58       993    
## propn_score_minor_442         239,932   412.148    194.373    58       979    
## propn_score_minor_450         239,932   400.780    200.525    58       991    
## propn_score_minor_460         239,932   452.641    217.792    58       992    
## propn_score_minor_470         239,932   450.413    177.090    58       986    
## propn_score_minor_480         239,932   332.652    186.990    58       968    
## propn_score_minor_491         239,932   282.543    186.044    58       980    
## propn_score_minor_499         239,932   456.807    159.778    59       981    
## client_event_cnt              239,370    1.015      9.426      0      1,140   
## client_tkt                    239,370    2.721      44.270     0      8,189   
## client_sp                     239,370   239.772   2,622.987  0.000 516,563.400
## client_pe_tkt_cnt             74,894     2.549      1.296    1.000   32.000   
## client_pe_sp                  75,481    268.079    403.504   0.440 19,760.000 
## client_tkt_price              74,894    106.507    142.869   0.110  7,200.000 
## client_tkt_price_max          74,894    139.140    194.921   0.110  8,470.000 
## client_tkt_price_min          74,894    85.218     132.262   0.110  7,200.000 
## client_walkup_buyer_ind        7,599     0.034      0.180      0        1     
## ------------------------------------------------------------------------------

3.2 City: Behavior

Relatively standard data.

library(visdat)

vis_dat(city_list[[1]])   # Atlanta

vis_dat(city_list[[49]])  # Washington DC

summary(duplicated(city_list[[1]]$ult_party_id))
##    Mode   FALSE    TRUE 
## logical    6314    3686
summary(duplicated(city_list[[1]]$acct_party_id))
## Warning: Unknown or uninitialised column: `acct_party_id`.
##    Mode 
## logical

3.3 City: Customer

stargazer(as.data.frame(city_list[[2]]), type = "text")
## 
## ===================================================================================
## Statistic                       N         Mean      St. Dev.     Min        Max    
## -----------------------------------------------------------------------------------
## ult_party_id                  10,000 75,005,860.000 2,894.637 75,000,836 75,010,835
## acct_id                       10,000 6,505,853.000  2,894.900 6,500,836  6,510,836 
## age_two_yr_incr_input_indv    9,183      45.715      14.258       18         99    
## age_two_yr_incr_1st_indv      9,248      47.521      13.498       18         99    
## age_two_yr_incr_2nd_indv      4,948      50.636      15.120       18         99    
## adult_hh_num                  9,482      2.009        0.979       1          6     
## hh_male_18_24_ind              512       1.000        0.000       1          1     
## hh_female_18_24_ind            546       1.000        0.000       1          1     
## hh_unk_18_24_ind                41       1.000        0.000       1          1     
## hh_male_25_34_ind             1,162      1.000        0.000       1          1     
## hh_female_25_34_ind           1,176      1.000        0.000       1          1     
## hh_unk_25_34_ind                56       1.000        0.000       1          1     
## hh_male_35_44_ind             1,479      1.000        0.000       1          1     
## hh_female_35_44_ind           1,499      1.000        0.000       1          1     
## hh_unk_35_44_ind                85       1.000        0.000       1          1     
## hh_male_45_54_ind             1,833      1.000        0.000       1          1     
## hh_female_45_54_ind           1,926      1.000        0.000       1          1     
## hh_unk_45_54_ind               129       1.000        0.000       1          1     
## hh_male_55_64_ind             1,615      1.000        0.000       1          1     
## hh_female_55_64_ind           1,537      1.000        0.000       1          1     
## hh_unk_55_64_ind                62       1.000        0.000       1          1     
## hh_male_65_74_ind              810       1.000        0.000       1          1     
## hh_female_65_74_ind            721       1.000        0.000       1          1     
## hh_unk_65_74_ind                25       1.000        0.000       1          1     
## hh_male_75_plus_ind            474       1.000        0.000       1          1     
## hh_female_75_plus_ind          387       1.000        0.000       1          1     
## hh_unk_75_plus_ind              22       1.000        0.000       1          1     
## hh_unk_00_02_ind                66       1.000        0.000       1          1     
## hh_male_03_05_ind               10       1.000        0.000       1          1     
## hh_female_03_05_ind             6        1.000        0.000       1          1     
## hh_unk_03_05_ind               289       1.000        0.000       1          1     
## hh_male_06_10_ind               31       1.000        0.000       1          1     
## hh_female_06_10_ind             20       1.000        0.000       1          1     
## hh_unk_06_10_ind               633       1.000        0.000       1          1     
## hh_male_11_15_ind               97       1.000        0.000       1          1     
## hh_female_11_15_ind            125       1.000        0.000       1          1     
## hh_unk_11_15_ind               777       1.000        0.000       1          1     
## hh_male_16_17_ind              240       1.000        0.000       1          1     
## hh_female_16_17_ind            144       1.000        0.000       1          1     
## hh_unk_16_17_ind               713       1.000        0.000       1          1     
## income_est_hh_cd              9,034      6.570        2.192       1          9     
## est_hh_inc_cd_100pct_inc_cd   9,711      6.526        2.263       1          9     
## financial_pct_score           8,158     509.934      235.478      80       1,000   
## bank_card_hldr_cd             8,063      1.000        0.000       1          1     
## gas_dept_retail_card_hldr_cd  5,498      1.000        0.000       1          1     
## travel_ent_card_hldr_cd       1,660      1.000        0.000       1          1     
## credit_card_unk_type_hld_cd   8,631      1.000        0.000       1          1     
## prem_card_hldr_cd             2,153      1.000        0.000       1          1     
## upscale_dept_str_card_hldr_cd 5,682      1.000        0.000       1          1     
## e3_pmt_visa_ind               9,937      0.614        0.487       0          1     
## e3_pmt_mc_ind                 9,937      0.227        0.419       0          1     
## e3_pmt_amex_ind               9,937      0.259        0.438       0          1     
## e3_pmt_disc_ind               9,937      0.042        0.201       0          1     
## e3_pmt_other_ind              9,937      0.129        0.335       0          1     
## edu_input_indv_cd             8,487      1.557        0.722       1          4     
## edu_1st_indv_cd               8,407      1.574        0.728       1          4     
## edu_2nd_indv_cd               4,559      1.619        0.739       1          4     
## int_theatre_perf_arts_cd      1,558      1.000        0.000       1          1     
## int_arts_cd                   2,597      1.000        0.000       1          1     
## int_travel_domestic_cd        3,647      1.000        0.000       1          1     
## int_home_stereo_cd            1,924      1.000        0.000       1          1     
## int_music_player_cd           2,995      1.000        0.000       1          1     
## int_music_avid_lstnr_cd       4,117      1.000        0.000       1          1     
## int_music_clctr_cd             711       0.626        0.484       0          1     
## int_movie_clctr_cd            2,452      1.000        0.000       1          1     
## int_auto_motor_racing_cd       642       1.000        0.000       1          1     
## int_spectator_sport_footb_cd  2,677      1.000        0.000       1          1     
## int_spectator_sport_baseb_cd  2,214      1.000        0.000       1          1     
## int_spectator_sport_bsktb_cd  1,992      1.000        0.000       1          1     
## int_spectator_sport_hockey_cd  659       1.000        0.000       1          1     
## int_spectator_sport_soccer_cd  107       1.000        0.000       1          1     
## int_spectator_sport_tennis_cd  130       1.000        0.000       1          1     
## int_swpstake_contest_cd       4,446      1.000        0.000       1          1     
## int_sports_grp_cd             7,299      1.000        0.000       1          1     
## int_music_grp_cd              6,593      1.000        0.000       1          1     
## int_nascar_cd                 1,652      1.000        0.000       1          1     
## int_upscale_living_cd         2,342      1.000        0.000       1          1     
## int_cultural_living_cd         235       1.000        0.000       1          1     
## veh_truck_owner_cd            2,061      0.828        0.378       0          1     
## veh_mtrcyc_owner_cd           1,411      0.719        0.450       0          1     
## veh_rv_owner_cd               1,636      0.758        0.428       0          1     
## veh_known_owned_cd            3,726      1.809        0.842       1          3     
## psx_group_id                  9,740      11.251       5.142       1          21    
## dist_to_client_ven_mi         1,342     478.958      622.797      0        4,487   
## dist_to_client_ven_km         1,342     770.311     1,002.285     0        7,221   
## brkr_ind                      9,969      0.004        0.060       0          1     
## e3_events_cnt                 9,969      2.829        5.033       1         176    
## e3_tkt_qty_avg                9,584      2.518        1.260     1.000      18.000  
## e3_spend_total                9,969     707.793     2,129.294   2.000    75,897.460
## e3_spend_per_event            9,969     231.264      320.049    2.000    5,334.000 
## e3_tkt_price_avg              9,584      95.022      112.729    1.000    2,357.000 
## e3_tkt_price_min              9,584      66.396      95.401     1.000    2,357.000 
## e3_tkt_price_max              9,584     138.546      192.637    1.000    3,000.000 
## e3_txpr_pctile                7,701      0.525        0.229     0.000      1.000   
## e3_tran_platinum_ind          9,969      0.058        0.234       0          1     
## e3_tran_type_primary_ind      9,969      0.830        0.376       0          1     
## e3_tran_type_resale_ind       9,969      0.368        0.482       0          1     
## e3_ancil_parking_ind          9,969      0.182        0.386       0          1     
## e3_ancil_upsell_ind           9,969      0.042        0.200       0          1     
## grp_buyer_ind                 9,969      0.002        0.045       0          1     
## e3_dist_to_ven                7,864     148.616      322.074      0        4,497   
## e3_dist_to_ven_local          7,178      25.600      25.758       0         200    
## e3_dist_201_plus_miles_ind    7,864      0.241        0.428       0          1     
## e3_spend_pe_m_concerts        6,129     235.102      317.541    10.000   5,618.000 
## e3_spend_pe_m_arts            1,955     218.052      234.669    10.000   3,388.000 
## e3_spend_pe_m_sports          4,643     264.993      446.192    2.000    6,540.000 
## e3_spend_pe_m_family           742      135.263      92.971     5.000     768.000  
## e3_spend_pe_m_misc             173      132.218      141.142    5.000    1,453.010 
## e3_sow_m_concerts             9,969      0.492        0.449     0.000      1.000   
## e3_sow_m_arts                 9,969      0.112        0.276     0.000      1.000   
## e3_sow_m_sports               9,969      0.344        0.432     0.000      1.000   
## e3_sow_m_family               9,969      0.043        0.185     0.000      1.000   
## e3_sow_m_misc                 9,969      0.008        0.080     0.000      1.000   
## e3_pref_tkt_qty_01_02         9,584      0.697        0.386     0.000      1.000   
## e3_pref_tkt_qty_03_04         9,584      0.232        0.347     0.000      1.000   
## e3_pref_tkt_qty_05_08         9,584      0.065        0.206     0.000      1.000   
## e3_pref_tkt_qty_09_plus       9,584      0.006        0.069     0.000      1.000   
## e3_pref_txpr_001_025          9,584      0.164        0.313     0.000      1.000   
## e3_pref_txpr_026_050          9,584      0.292        0.376     0.000      1.000   
## e3_pref_txpr_051_100          9,584      0.279        0.364     0.000      1.000   
## e3_pref_txpr_101_200          9,584      0.169        0.306     0.000      1.000   
## e3_pref_txpr_201_plus         9,584      0.096        0.246     0.000      1.000   
## e3_pref_txpr_pctile_00_25     7,701      0.164        0.316     0.000      1.000   
## e3_pref_txpr_pctile_25_49     7,701      0.372        0.409     0.000      1.000   
## e3_pref_txpr_pctile_50_74     7,701      0.225        0.349     0.000      1.000   
## e3_pref_txpr_pctile_75_89     7,701      0.120        0.269     0.000      1.000   
## e3_pref_txpr_pctile_90_100    7,701      0.118        0.280     0.000      1.000   
## e3_pref_purch_pd_presale      9,730      0.098        0.233     0.000      1.000   
## e3_pref_purch_pd_onsale       9,730      0.070        0.200     0.000      1.000   
## e3_pref_purch_pd_firstweek    9,730      0.052        0.181     0.000      1.000   
## e3_pref_purch_pd_inbetween    9,730      0.434        0.408     0.000      1.000   
## e3_pref_purch_pd_finalweek    9,730      0.346        0.408     0.000      1.000   
## e3_pref_channel_internet      9,965      0.416        0.437     0.000      1.000   
## e3_pref_channel_phone         9,965      0.012        0.096     0.000      1.000   
## e3_pref_channel_mobile        9,965      0.524        0.448     0.000      1.000   
## e3_pref_channel_box           9,965      0.038        0.179     0.000      1.000   
## e3_pref_channel_outlet        9,965      0.010        0.092     0.000      1.000   
## rfm_score                     9,969     518.234      127.759     194        993    
## propn_score_minor_101         10,000    311.213      167.861      58        940    
## propn_score_minor_102         10,000    412.230      216.104      60        971    
## propn_score_minor_103         10,000    505.898      217.366      77        977    
## propn_score_minor_104         10,000    206.538      173.034      58        976    
## propn_score_minor_105         10,000    474.476      216.537      58        993    
## propn_score_minor_106         10,000    291.714      152.464      58        942    
## propn_score_minor_107         10,000    283.902      217.739      58        988    
## propn_score_minor_108         10,000    306.617      235.270      58        979    
## propn_score_minor_109         10,000    372.060      254.340      58        986    
## propn_score_minor_110         10,000    595.034      210.100     146        957    
## propn_score_minor_111         10,000    258.756      146.993      58        960    
## propn_score_minor_199         10,000    432.367      166.502     102        955    
## propn_score_minor_201         10,000    220.768      175.907      58        959    
## propn_score_minor_202         10,000    357.082      207.823      58        952    
## propn_score_minor_203         10,000    202.057      162.596      58        966    
## propn_score_minor_204         10,000    196.396      144.635      58        966    
## propn_score_minor_205         10,000    231.850      154.800      58        951    
## propn_score_minor_206         9,999     319.913      163.448      58        941    
## propn_score_minor_207         10,000    271.026      156.885      58        932    
## propn_score_minor_299         10,000    274.923      148.119      58        958    
## propn_score_minor_301         10,000    262.507      195.681      58        978    
## propn_score_minor_302         10,000    259.351      182.994      58        976    
## propn_score_minor_399         10,000    325.715      158.859      58        955    
## propn_score_minor_401         10,000    401.875      241.727      58        970    
## propn_score_minor_402         10,000    487.515      214.619      58        976    
## propn_score_minor_403         10,000    499.904      205.202      58        976    
## propn_score_minor_410         10,000    583.791      224.044     106        979    
## propn_score_minor_412         9,990     448.226      245.325      58        970    
## propn_score_minor_420         10,000    599.136      217.514     135        970    
## propn_score_minor_423         10,000    481.624      206.756      59        979    
## propn_score_minor_430         10,000    575.020      195.689     114        965    
## propn_score_minor_432         10,000    456.276      178.705      58        964    
## propn_score_minor_440         10,000    568.119      202.531      87        983    
## propn_score_minor_442         10,000    406.950      181.774      58        954    
## propn_score_minor_450         10,000    451.157      232.592      71        977    
## propn_score_minor_460         10,000    443.566      216.500      58        988    
## propn_score_minor_470         10,000    420.192      172.570      62        960    
## propn_score_minor_480         10,000    366.571      198.625      58        968    
## propn_score_minor_491         10,000    310.705      193.406      58        952    
## propn_score_minor_499         10,000    476.058      155.209      98        957    
## client_event_cnt              9,993      1.064        3.112       0          70    
## client_tkt                    9,993      2.471        7.935       0         189    
## client_sp                     9,993     220.932      802.181    0.000    17,463.160
## client_pe_tkt_cnt             3,406      2.423        1.269     1.000      16.000  
## client_pe_sp                  3,441     224.443      352.674    2.000    8,944.000 
## client_tkt_price              3,406      91.622      99.874     1.000    1,455.500 
## client_tkt_price_max          3,406     126.422      144.947    1.000    1,455.500 
## client_tkt_price_min          3,406      70.165      92.062     1.000    1,455.500 
## client_walkup_buyer_ind        114       0.009        0.094       0          1     
## -----------------------------------------------------------------------------------
stargazer(as.data.frame(city_list[[50]]), type = "text")
## 
## ====================================================================================
## Statistic                       N         Mean      St. Dev.     Min         Max    
## ------------------------------------------------------------------------------------
## ult_party_id                  10,000 78,135,859.000 8,679.878 78,120,847 78,150,835 
## acct_id                       10,000 9,635,905.000  8,605.645 9,620,843   9,650,836 
## age_two_yr_incr_input_indv    9,237      44.935      14.360       18         99     
## age_two_yr_incr_1st_indv      9,363      47.442      13.949       18         99     
## age_two_yr_incr_2nd_indv      4,785      51.019      15.805       18         99     
## adult_hh_num                  9,690      1.979        0.976       1           6     
## hh_male_18_24_ind              573       1.000        0.000       1           1     
## hh_female_18_24_ind            505       1.000        0.000       1           1     
## hh_unk_18_24_ind                21       1.000        0.000       1           1     
## hh_male_25_34_ind             1,262      1.000        0.000       1           1     
## hh_female_25_34_ind           1,240      1.000        0.000       1           1     
## hh_unk_25_34_ind                66       1.000        0.000       1           1     
## hh_male_35_44_ind             1,456      1.000        0.000       1           1     
## hh_female_35_44_ind           1,496      1.000        0.000       1           1     
## hh_unk_35_44_ind                96       1.000        0.000       1           1     
## hh_male_45_54_ind             1,771      1.000        0.000       1           1     
## hh_female_45_54_ind           1,740      1.000        0.000       1           1     
## hh_unk_45_54_ind               114       1.000        0.000       1           1     
## hh_male_55_64_ind             1,584      1.000        0.000       1           1     
## hh_female_55_64_ind           1,460      1.000        0.000       1           1     
## hh_unk_55_64_ind                99       1.000        0.000       1           1     
## hh_male_65_74_ind              840       1.000        0.000       1           1     
## hh_female_65_74_ind            671       1.000        0.000       1           1     
## hh_unk_65_74_ind                45       1.000        0.000       1           1     
## hh_male_75_plus_ind            479       1.000        0.000       1           1     
## hh_female_75_plus_ind          463       1.000        0.000       1           1     
## hh_unk_75_plus_ind              29       1.000        0.000       1           1     
## hh_male_00_02_ind               1        1.000                    1           1     
## hh_female_00_02_ind             1        1.000                    1           1     
## hh_unk_00_02_ind                76       1.000        0.000       1           1     
## hh_male_03_05_ind               7        1.000        0.000       1           1     
## hh_female_03_05_ind             8        1.000        0.000       1           1     
## hh_unk_03_05_ind               227       1.000        0.000       1           1     
## hh_male_06_10_ind               17       1.000        0.000       1           1     
## hh_female_06_10_ind             18       1.000        0.000       1           1     
## hh_unk_06_10_ind               595       1.000        0.000       1           1     
## hh_male_11_15_ind               55       1.000        0.000       1           1     
## hh_female_11_15_ind            146       1.000        0.000       1           1     
## hh_unk_11_15_ind               676       1.000        0.000       1           1     
## hh_male_16_17_ind              211       1.000        0.000       1           1     
## hh_female_16_17_ind            141       1.000        0.000       1           1     
## hh_unk_16_17_ind               666       1.000        0.000       1           1     
## income_est_hh_cd              9,135      6.937        2.128       1           9     
## est_hh_inc_cd_100pct_inc_cd   9,980      6.950        2.174       1           9     
## financial_pct_score           8,317     495.779      236.884     132        1,000   
## bank_card_hldr_cd             8,383      1.000        0.000       1           1     
## gas_dept_retail_card_hldr_cd  5,811      1.000        0.000       1           1     
## travel_ent_card_hldr_cd       1,634      1.000        0.000       1           1     
## credit_card_unk_type_hld_cd   8,976      1.000        0.000       1           1     
## prem_card_hldr_cd             2,074      1.000        0.000       1           1     
## upscale_dept_str_card_hldr_cd 5,741      1.000        0.000       1           1     
## e3_pmt_visa_ind               9,945      0.676        0.468       0           1     
## e3_pmt_mc_ind                 9,945      0.241        0.428       0           1     
## e3_pmt_amex_ind               9,945      0.139        0.346       0           1     
## e3_pmt_disc_ind               9,945      0.040        0.195       0           1     
## e3_pmt_other_ind              9,945      0.158        0.364       0           1     
## edu_input_indv_cd             8,504      1.565        0.745       1           4     
## edu_1st_indv_cd               8,515      1.623        0.765       1           4     
## edu_2nd_indv_cd               4,430      1.662        0.762       1           4     
## int_theatre_perf_arts_cd      1,421      1.000        0.000       1           1     
## int_arts_cd                   2,901      1.000        0.000       1           1     
## int_travel_domestic_cd        3,221      1.000        0.000       1           1     
## int_home_stereo_cd            1,703      1.000        0.000       1           1     
## int_music_player_cd           2,926      1.000        0.000       1           1     
## int_music_avid_lstnr_cd       3,925      1.000        0.000       1           1     
## int_music_clctr_cd             735       0.717        0.451       0           1     
## int_movie_clctr_cd            2,447      1.000        0.000       1           1     
## int_auto_motor_racing_cd       619       1.000        0.000       1           1     
## int_spectator_sport_footb_cd  2,529      1.000        0.000       1           1     
## int_spectator_sport_baseb_cd  1,933      1.000        0.000       1           1     
## int_spectator_sport_bsktb_cd  1,896      1.000        0.000       1           1     
## int_spectator_sport_hockey_cd  827       1.000        0.000       1           1     
## int_spectator_sport_soccer_cd  153       1.000        0.000       1           1     
## int_spectator_sport_tennis_cd   93       1.000        0.000       1           1     
## int_swpstake_contest_cd       4,451      1.000        0.000       1           1     
## int_sports_grp_cd             7,515      1.000        0.000       1           1     
## int_music_grp_cd              6,619      1.000        0.000       1           1     
## int_nascar_cd                 1,565      1.000        0.000       1           1     
## int_upscale_living_cd         2,601      1.000        0.000       1           1     
## int_cultural_living_cd         294       1.000        0.000       1           1     
## veh_truck_owner_cd            2,501      0.888        0.315       0           1     
## veh_mtrcyc_owner_cd           1,188      0.748        0.434       0           1     
## veh_rv_owner_cd               1,325      0.774        0.418       0           1     
## veh_known_owned_cd            6,295      2.122        0.850       1           3     
## psx_group_id                  9,993      11.421       4.932       1          21     
## dist_to_client_ven_mi         2,011     364.349      656.298      0         4,833   
## dist_to_client_ven_km         2,011     585.890     1,056.191     0         7,777   
## brkr_ind                      9,969      0.003        0.056       0           1     
## e3_events_cnt                 9,969      3.166        9.633       1          303    
## e3_tkt_qty_avg                9,709      2.499        1.301     1.000      24.000   
## e3_spend_total                9,969     754.608     3,944.023   6.000    128,650.200
## e3_spend_per_event            9,969     220.807      263.971    6.000     5,888.000 
## e3_tkt_price_avg              9,709      90.815      89.094     4.000     1,472.000 
## e3_tkt_price_min              9,709      64.808      78.008     1.450     1,472.000 
## e3_tkt_price_max              9,709     131.683      175.202    4.000     4,751.000 
## e3_txpr_pctile                8,116      0.532        0.219     0.000       1.000   
## e3_tran_platinum_ind          9,969      0.062        0.242       0           1     
## e3_tran_type_primary_ind      9,969      0.874        0.331       0           1     
## e3_tran_type_resale_ind       9,969      0.305        0.461       0           1     
## e3_ancil_parking_ind          9,969      0.103        0.304       0           1     
## e3_ancil_upsell_ind           9,969      0.033        0.178       0           1     
## grp_buyer_ind                 9,969      0.002        0.039       0           1     
## e3_dist_to_ven                8,443     137.029      355.781      0         4,838   
## e3_dist_to_ven_local          7,839      29.061      31.271       0          200    
## e3_dist_201_plus_miles_ind    8,443      0.218        0.413       0           1     
## e3_spend_pe_m_concerts        6,224     204.075      225.214    9.000     3,039.500 
## e3_spend_pe_m_arts            2,688     221.739      188.622    12.000    2,076.000 
## e3_spend_pe_m_sports          3,771     285.598      395.035    5.000     7,444.000 
## e3_spend_pe_m_family          1,076     142.371      97.591     12.000    1,047.000 
## e3_spend_pe_m_misc             283      184.766      201.506    10.000    1,336.600 
## e3_sow_m_concerts             9,969      0.490        0.447     0.000       1.000   
## e3_sow_m_arts                 9,969      0.161        0.321     0.000       1.000   
## e3_sow_m_sports               9,969      0.271        0.402     0.000       1.000   
## e3_sow_m_family               9,969      0.064        0.224     0.000       1.000   
## e3_sow_m_misc                 9,969      0.014        0.105     0.000       1.000   
## e3_pref_tkt_qty_01_02         9,709      0.697        0.390     0.000       1.000   
## e3_pref_tkt_qty_03_04         9,709      0.230        0.352     0.000       1.000   
## e3_pref_tkt_qty_05_08         9,709      0.067        0.212     0.000       1.000   
## e3_pref_tkt_qty_09_plus       9,709      0.005        0.060     0.000       1.000   
## e3_pref_txpr_001_025          9,709      0.130        0.282     0.000       1.000   
## e3_pref_txpr_026_050          9,709      0.300        0.378     0.000       1.000   
## e3_pref_txpr_051_100          9,709      0.305        0.372     0.000       1.000   
## e3_pref_txpr_101_200          9,709      0.185        0.319     0.000       1.000   
## e3_pref_txpr_201_plus         9,709      0.080        0.224     0.000       1.000   
## e3_pref_txpr_pctile_00_25     8,116      0.128        0.281     0.000       1.000   
## e3_pref_txpr_pctile_25_49     8,116      0.414        0.421     0.000       1.000   
## e3_pref_txpr_pctile_50_74     8,116      0.212        0.340     0.000       1.000   
## e3_pref_txpr_pctile_75_89     8,116      0.133        0.280     0.000       1.000   
## e3_pref_txpr_pctile_90_100    8,116      0.112        0.271     0.000       1.000   
## e3_pref_purch_pd_presale      9,747      0.099        0.235     0.000       1.000   
## e3_pref_purch_pd_onsale       9,747      0.074        0.204     0.000       1.000   
## e3_pref_purch_pd_firstweek    9,747      0.054        0.176     0.000       1.000   
## e3_pref_purch_pd_inbetween    9,747      0.476        0.410     0.000       1.000   
## e3_pref_purch_pd_finalweek    9,747      0.297        0.387     0.000       1.000   
## e3_pref_channel_internet      9,965      0.459        0.446     0.000       1.000   
## e3_pref_channel_phone         9,965      0.013        0.104     0.000       1.000   
## e3_pref_channel_mobile        9,965      0.495        0.450     0.000       1.000   
## e3_pref_channel_box           9,965      0.030        0.160     0.000       1.000   
## e3_pref_channel_outlet        9,965      0.003        0.051     0.000       1.000   
## rfm_score                     9,969     524.750      126.893     194         993    
## propn_score_minor_101         10,000    315.422      171.805      58         972    
## propn_score_minor_102         10,000    400.594      222.516      58         972    
## propn_score_minor_103         10,000    486.304      223.087      58         982    
## propn_score_minor_104         10,000    214.873      187.564      58         952    
## propn_score_minor_105         10,000    490.515      226.958      58         992    
## propn_score_minor_106         10,000    308.908      166.494      58         944    
## propn_score_minor_107         10,000    278.452      210.811      58         982    
## propn_score_minor_108         10,000    324.510      232.912      58         976    
## propn_score_minor_109         10,000    444.902      241.123      58         988    
## propn_score_minor_110         10,000    579.192      220.512     116         951    
## propn_score_minor_111         10,000    306.591      165.941      58         931    
## propn_score_minor_199         10,000    453.642      169.069      87         940    
## propn_score_minor_201         10,000    247.625      198.420      58         965    
## propn_score_minor_202         10,000    454.943      211.000      67         959    
## propn_score_minor_203         10,000    190.160      130.224      58         915    
## propn_score_minor_204         10,000    223.681      159.107      58         954    
## propn_score_minor_205         10,000    226.948      161.993      58         939    
## propn_score_minor_206         10,000    337.014      149.756      58         915    
## propn_score_minor_207         10,000    296.119      178.457      58         937    
## propn_score_minor_299         10,000    332.431      166.634      58         945    
## propn_score_minor_301         10,000    311.811      205.172      58         973    
## propn_score_minor_302         10,000    273.628      193.623      58         970    
## propn_score_minor_399         10,000    322.462      155.894      58         968    
## propn_score_minor_401         10,000    440.478      246.442      58         987    
## propn_score_minor_402         10,000    463.756      213.402      58         965    
## propn_score_minor_403         10,000    540.869      201.416      58         978    
## propn_score_minor_410         10,000    455.384      205.011      58         968    
## propn_score_minor_412         10,000    363.095      204.518      58         959    
## propn_score_minor_420         10,000    572.647      211.436     146         978    
## propn_score_minor_423         10,000    393.465      199.528      58         968    
## propn_score_minor_430         10,000    546.413      195.141      98         974    
## propn_score_minor_432         10,000    390.473      170.179      58         960    
## propn_score_minor_440         10,000    533.698      210.451      66         984    
## propn_score_minor_442         10,000    402.268      198.178      58         965    
## propn_score_minor_450         10,000    388.209      207.254      58         980    
## propn_score_minor_460         10,000    443.192      199.772      58         979    
## propn_score_minor_470         10,000    423.849      172.215      58         953    
## propn_score_minor_480         10,000    305.274      175.369      58         962    
## propn_score_minor_491         10,000    300.178      184.853      58         930    
## propn_score_minor_499         10,000    420.342      153.918      70         959    
## client_event_cnt              9,989      0.884        3.138       0          190    
## client_tkt                    9,989      2.119       11.584       0         1,011   
## client_sp                     9,989     208.012     1,026.061   0.000    77,309.460 
## client_pe_tkt_cnt             3,067      2.503        1.227     1.000       9.500   
## client_pe_sp                  3,080     263.197      297.165    2.000     4,232.000 
## client_tkt_price              3,067     107.683      110.151    2.000     2,116.000 
## client_tkt_price_max          3,067     140.678      154.442    2.000     3,549.950 
## client_tkt_price_min          3,067      85.790      107.249    2.000     2,116.000 
## client_walkup_buyer_ind        992       0.030        0.171       0           1     
## ------------------------------------------------------------------------------------

4 Merge Data

## unique ID.
# merged <- merge(x = main_bhvr, 
#                 y = main_cust, 
#                 by.x = c("UID"), 
#                 by.y = c("ult_party_id")
#                 )
# dim(merged)

main <- merge(x = main_bhvr, 
                y = main_cust, 
                by.x = c("UID", "cust_source_cd" #, "acct_id", "la_id"
                         ), 
                by.y = c("ult_party_id", "cust_source_cd" #,  "acct_id", "la_id"
                         )
                )
dim(main)
## [1] 249946    253
# Calculate the average discretionary_income_index_cd for each cust_source_cd and city combination
avg_discretionary_income <- aggregate(x = main$discretionary_income_index_cd, 
                                      by = list(city = main$cust_source_cd), 
                                      FUN = mean, 
                                      na.rm = TRUE
                                      )

top_cities <- c("Portland", "Miami", "Minneapolis", "Chicago", "Seattle", "Los Angeles", "Philadelphia", "Washington DC", "New York City", "Boston")
library(openxlsx)

# Assuming your data frame is named "my_data"
write.xlsx(city_list[[1]], "../temp/Atlanta_bhvr.xlsx")
# Assuming your data frame is named "my_data"
write.xlsx(city_list[[2]], "../temp/Atlanta_cust.xlsx")