Problem Description: The data in the Airlines data
file contains data from 3,999 airline customers enrolled in East-West
Airlines’ customer rewards program. (Note that while East-West Airlines
is clearly fictional, this is data from a real airlines reward program;
names have been changed to protect the innocent and not-so-innocent
alike.) East-West Airlines has two goals with this analysis: (1)
identifying if a customer will claim a travel award using their rewards,
and (2) identifying factors that lead to customers claiming a travel
award.
Data Preparation
(1) Set the seed 123.
# Load the data
library(readxl)
Airlines <- read_excel("~/Desktop/Airlines_Data.xlsx")
attach(Airlines)
set.seed(123)
(2) Randomly partition the data set into training,
validation, and testing data by:
First, splitting off 25% of the
data for testing.
# Calculate the size of the training set (75% of the data)
training_size <- floor(0.75 * nrow(Airlines))
# Sample indices for the training data
training_indices <- sample(seq_len(nrow(Airlines)), size = training_size)
# Create the training set
training_data <- Airlines[training_indices, ]
Second, splitting off 25% of the remaining data for validation.
Third, setting the remaining data as training data.
# Remaining data for testing (25% of the original data)
testing_data <- Airlines[-training_indices, ]
# Calculate the size of the validation set from the training set (33.33% of the training data)
validation_size <- floor(0.25 * nrow(training_data))
# Sample indices for the validation data from the training set
validation_indices <- sample(training_indices, size = validation_size)
# Create the validation set
validation_data <- Airlines[validation_indices, ]
# Update the training data to exclude the validation data
training_data <- Airlines[setdiff(training_indices, validation_indices), ]
summary(training_data)
## ID Balance Qual_miles cc1_miles
## Min. : 1.0 Min. : 50 Min. : 0.0 Min. :1.00
## 1st Qu.: 995.2 1st Qu.: 18934 1st Qu.: 0.0 1st Qu.:1.00
## Median :2011.5 Median : 41592 Median : 0.0 Median :1.00
## Mean :2016.1 Mean : 72244 Mean : 136.1 Mean :2.05
## 3rd Qu.:3038.5 3rd Qu.: 91420 3rd Qu.: 0.0 3rd Qu.:3.00
## Max. :4019.0 Max. :1199220 Max. :11148.0 Max. :5.00
## cc2_miles cc3_miles Bonus_miles Bonus_trans
## Min. :1.000 Min. :1.000 Min. : 0 Min. : 0.0
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.: 1221 1st Qu.: 3.0
## Median :1.000 Median :1.000 Median : 6938 Median :12.0
## Mean :1.015 Mean :1.013 Mean : 16936 Mean :11.5
## 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.: 23606 3rd Qu.:17.0
## Max. :3.000 Max. :5.000 Max. :263685 Max. :58.0
## Flight_miles_12mo Flight_trans_12 Days_since_enroll Award
## Min. : 0.0 Min. : 0.000 Min. : 8 Min. :0.0000
## 1st Qu.: 0.0 1st Qu.: 0.000 1st Qu.:2331 1st Qu.:0.0000
## Median : 0.0 Median : 0.000 Median :4117 Median :0.0000
## Mean : 435.5 Mean : 1.347 Mean :4129 Mean :0.3578
## 3rd Qu.: 297.2 3rd Qu.: 1.000 3rd Qu.:5812 3rd Qu.:1.0000
## Max. :16675.0 Max. :53.000 Max. :8296 Max. :1.0000
summary(validation_data)
## ID Balance Qual_miles cc1_miles
## Min. : 2 Min. : 68 Min. : 0.0 Min. :1.000
## 1st Qu.:1088 1st Qu.: 18497 1st Qu.: 0.0 1st Qu.:1.000
## Median :1974 Median : 44457 Median : 0.0 Median :1.000
## Mean :2024 Mean : 76038 Mean : 144.6 Mean :2.121
## 3rd Qu.:3024 3rd Qu.: 92843 3rd Qu.: 0.0 3rd Qu.:3.000
## Max. :4021 Max. :1704838 Max. :10098.0 Max. :5.000
## cc2_miles cc3_miles Bonus_miles Bonus_trans
## Min. :1.000 Min. :1.000 Min. : 0 Min. : 0.00
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.: 1450 1st Qu.: 3.00
## Median :1.000 Median :1.000 Median : 8253 Median :12.00
## Mean :1.015 Mean :1.017 Mean : 18130 Mean :11.75
## 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.: 25706 3rd Qu.:16.00
## Max. :3.000 Max. :4.000 Max. :190160 Max. :86.00
## Flight_miles_12mo Flight_trans_12 Days_since_enroll Award
## Min. : 0.0 Min. : 0.00 Min. : 2 Min. :0.0000
## 1st Qu.: 0.0 1st Qu.: 0.00 1st Qu.:2405 1st Qu.:0.0000
## Median : 0.0 Median : 0.00 Median :4023 Median :0.0000
## Mean : 505.7 Mean : 1.41 Mean :4083 Mean :0.3899
## 3rd Qu.: 350.0 3rd Qu.: 1.00 3rd Qu.:5678 3rd Qu.:1.0000
## Max. :30817.0 Max. :53.00 Max. :8296 Max. :1.0000
summary(testing_data)
## ID Balance Qual_miles cc1_miles
## Min. : 3.0 Min. : 0 Min. : 0.0 Min. :1.000
## 1st Qu.: 981.2 1st Qu.: 18162 1st Qu.: 0.0 1st Qu.:1.000
## Median :2033.5 Median : 43998 Median : 0.0 Median :1.000
## Mean :2004.9 Mean : 74831 Mean : 161.7 Mean :2.035
## 3rd Qu.:2983.2 3rd Qu.: 93711 3rd Qu.: 0.0 3rd Qu.:3.000
## Max. :4014.0 Max. :1302051 Max. :10074.0 Max. :5.000
## cc2_miles cc3_miles Bonus_miles Bonus_trans
## Min. :1.000 Min. :1.000 Min. : 0 Min. : 0.00
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.: 1369 1st Qu.: 3.00
## Median :1.000 Median :1.000 Median : 7024 Median :12.00
## Mean :1.014 Mean :1.006 Mean : 16877 Mean :11.72
## 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.: 23495 3rd Qu.:16.00
## Max. :3.000 Max. :4.000 Max. :230629 Max. :68.00
## Flight_miles_12mo Flight_trans_12 Days_since_enroll Award
## Min. : 0.0 Min. : 0.000 Min. : 25 Min. :0.000
## 1st Qu.: 0.0 1st Qu.: 0.000 1st Qu.:2274 1st Qu.:0.000
## Median : 0.0 Median : 0.000 Median :4066 Median :0.000
## Mean : 481.2 Mean : 1.407 Mean :4122 Mean :0.384
## 3rd Qu.: 350.0 3rd Qu.: 1.000 3rd Qu.:5807 3rd Qu.:1.000
## Max. :14050.0 Max. :46.000 Max. :8296 Max. :1.000
Appropriate Data Analysis Techniques
Consider the problem of analyzing the East-West Airlines travel award
data. Without running any analysis (yet), of all the methods we’ve
learned in class, choose three that you think would be appropriate for
this problem and for each method explain:
(1) Why
you think this method is appropriate for the problem
(2) How you would use this method to address either
Goal #1 for East-West Airlines, Goal #2 for East-West Airlines, or
both