Mini Project:

Research Question: What factors explain the difference in price between an economy ticket and a premium-economy airline ticket?*

airline<- read.csv("SixAirlinesDataV2.csv")
View(airline)
#summary statistics
summary(airline)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance: 74   AirBus:151   Min.   : 1.250   Aug:127    
##  British  :175   Boeing:307   1st Qu.: 4.260   Jul: 75    
##  Delta    : 46                Median : 7.790   Oct:127    
##  Jet      : 61                Mean   : 7.578   Sep:129    
##  Singapore: 40                3rd Qu.:10.620              
##  Virgin   : 62                Max.   :14.660              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     : 40    Min.   : 78.0   Min.   : 8.00   Min.   :30.00  
##  International:418    1st Qu.:133.0   1st Qu.:21.00   1st Qu.:31.00  
##                       Median :185.0   Median :36.00   Median :31.00  
##                       Mean   :202.3   Mean   :33.65   Mean   :31.22  
##                       3rd Qu.:243.0   3rd Qu.:40.00   3rd Qu.:32.00  
##                       Max.   :389.0   Max.   :66.00   Max.   :33.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy 
##  Min.   :34.00   Min.   :17.00   Min.   :17.00   Min.   :  65  
##  1st Qu.:38.00   1st Qu.:18.00   1st Qu.:19.00   1st Qu.: 413  
##  Median :38.00   Median :18.00   Median :19.00   Median :1242  
##  Mean   :37.91   Mean   :17.84   Mean   :19.47   Mean   :1327  
##  3rd Qu.:38.00   3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:1909  
##  Max.   :40.00   Max.   :19.00   Max.   :21.00   Max.   :3593  
##   PricePremium    PriceRelative      SeatsTotal  PitchDifference 
##  Min.   :  86.0   Min.   :0.0200   Min.   : 98   Min.   : 2.000  
##  1st Qu.: 528.8   1st Qu.:0.1000   1st Qu.:166   1st Qu.: 6.000  
##  Median :1737.0   Median :0.3650   Median :227   Median : 7.000  
##  Mean   :1845.3   Mean   :0.4872   Mean   :236   Mean   : 6.688  
##  3rd Qu.:2989.0   3rd Qu.:0.7400   3rd Qu.:279   3rd Qu.: 7.000  
##  Max.   :7414.0   Max.   :1.8900   Max.   :441   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :0.000   Min.   : 4.71      
##  1st Qu.:1.000   1st Qu.:12.28      
##  Median :1.000   Median :13.21      
##  Mean   :1.633   Mean   :14.65      
##  3rd Qu.:3.000   3rd Qu.:15.36      
##  Max.   :4.000   Max.   :24.69
#number of instances
nrow(airline)
## [1] 458
#number of column
ncol(airline)
## [1] 18
library(psych)
describe(airline)
##                     vars   n    mean      sd  median trimmed     mad   min
## Airline*               1 458    3.01    1.65    2.00    2.89    1.48  1.00
## Aircraft*              2 458    1.67    0.47    2.00    1.71    0.00  1.00
## FlightDuration         3 458    7.58    3.54    7.79    7.57    4.81  1.25
## TravelMonth*           4 458    2.56    1.17    3.00    2.58    1.48  1.00
## IsInternational*       5 458    1.91    0.28    2.00    2.00    0.00  1.00
## SeatsEconomy           6 458  202.31   76.37  185.00  194.64   85.99 78.00
## SeatsPremium           7 458   33.65   13.26   36.00   33.35   11.86  8.00
## PitchEconomy           8 458   31.22    0.66   31.00   31.26    0.00 30.00
## PitchPremium           9 458   37.91    1.31   38.00   38.05    0.00 34.00
## WidthEconomy          10 458   17.84    0.56   18.00   17.81    0.00 17.00
## WidthPremium          11 458   19.47    1.10   19.00   19.53    0.00 17.00
## PriceEconomy          12 458 1327.08  988.27 1242.00 1244.40 1159.39 65.00
## PricePremium          13 458 1845.26 1288.14 1737.00 1799.05 1845.84 86.00
## PriceRelative         14 458    0.49    0.45    0.36    0.42    0.41  0.02
## SeatsTotal            15 458  235.96   85.29  227.00  228.73   90.44 98.00
## PitchDifference       16 458    6.69    1.76    7.00    6.76    0.00  2.00
## WidthDifference       17 458    1.63    1.19    1.00    1.53    0.00  0.00
## PercentPremiumSeats   18 458   14.65    4.84   13.21   14.31    2.68  4.71
##                         max   range  skew kurtosis    se
## Airline*               6.00    5.00  0.61    -0.95  0.08
## Aircraft*              2.00    1.00 -0.72    -1.48  0.02
## FlightDuration        14.66   13.41 -0.07    -1.12  0.17
## TravelMonth*           4.00    3.00 -0.14    -1.46  0.05
## IsInternational*       2.00    1.00 -2.91     6.50  0.01
## SeatsEconomy         389.00  311.00  0.72    -0.36  3.57
## SeatsPremium          66.00   58.00  0.23    -0.46  0.62
## PitchEconomy          33.00    3.00 -0.03    -0.35  0.03
## PitchPremium          40.00    6.00 -1.51     3.52  0.06
## WidthEconomy          19.00    2.00 -0.04    -0.08  0.03
## WidthPremium          21.00    4.00 -0.08    -0.31  0.05
## PriceEconomy        3593.00 3528.00  0.51    -0.88 46.18
## PricePremium        7414.00 7328.00  0.50     0.43 60.19
## PriceRelative          1.89    1.87  1.17     0.72  0.02
## SeatsTotal           441.00  343.00  0.70    -0.53  3.99
## PitchDifference       10.00    8.00 -0.54     1.78  0.08
## WidthDifference        4.00    4.00  0.84    -0.53  0.06
## PercentPremiumSeats   24.69   19.98  0.71     0.28  0.23
#Data Types
str(airline)
## 'data.frame':    458 obs. of  18 variables:
##  $ Airline            : Factor w/ 6 levels "AirFrance","British",..: 2 2 2 2 2 2 2 2 2 2 ...
##  $ Aircraft           : Factor w/ 2 levels "AirBus","Boeing": 2 2 2 2 2 2 2 2 2 2 ...
##  $ FlightDuration     : num  12.25 12.25 12.25 12.25 8.16 ...
##  $ TravelMonth        : Factor w/ 4 levels "Aug","Jul","Oct",..: 2 1 4 3 1 4 3 1 4 4 ...
##  $ IsInternational    : Factor w/ 2 levels "Domestic","International": 2 2 2 2 2 2 2 2 2 2 ...
##  $ SeatsEconomy       : int  122 122 122 122 122 122 122 122 122 122 ...
##  $ SeatsPremium       : int  40 40 40 40 40 40 40 40 40 40 ...
##  $ PitchEconomy       : int  31 31 31 31 31 31 31 31 31 31 ...
##  $ PitchPremium       : int  38 38 38 38 38 38 38 38 38 38 ...
##  $ WidthEconomy       : int  18 18 18 18 18 18 18 18 18 18 ...
##  $ WidthPremium       : int  19 19 19 19 19 19 19 19 19 19 ...
##  $ PriceEconomy       : int  2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 ...
##  $ PricePremium       : int  3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 ...
##  $ PriceRelative      : num  0.38 0.38 0.38 0.38 0.67 0.67 0.67 1.03 1.03 0.75 ...
##  $ SeatsTotal         : int  162 162 162 162 162 162 162 162 162 162 ...
##  $ PitchDifference    : int  7 7 7 7 7 7 7 7 7 7 ...
##  $ WidthDifference    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ PercentPremiumSeats: num  24.7 24.7 24.7 24.7 24.7 ...

Visualization of single variable

#Fligth Duration
boxplot(airline$FlightDuration, horizontal = TRUE, main="Flight Duration", xlab="Flight hours",col="seashell4")

#Visuzlize Seats 
boxplot(airline$SeatsEconomy, airline$SeatsPremium ,col=c("skyblue","darkgoldenrod1"),  horizontal = TRUE, main="Seats Economy vs Seats Premium", xlab="Seats ", names=c("Economy","Premium"))

#Visualize Pitch
boxplot(airline$PitchEconomy,airline$PitchPremium, col=c("skyblue","darkgoldenrod1"), horizontal = TRUE, main="Pitch Economy vs Pitch Premium"  ,xlab="Inch", names=c("Economy","Premium"))

#Vizualize Width
boxplot(airline$WidthEconomy,airline$WidthPremium, col=c("skyblue","darkgoldenrod1"), horizontal = TRUE, main="Width Economy vs Width Premium", xlab="Inch", names=c("Economy","Premium"))

#Vizualize Price
boxplot(airline$PriceEconomy, airline$PricePremium, col=c("skyblue","darkgoldenrod1"), horizontal = TRUE, main="Price Economy vs Price Premium", xlab="Ticke price",
names=c("Economy","Premium"))

#Relative Price distribution
boxplot(airline$PriceRelative, horizontal = TRUE, main="Relative Price", xlab="times", col="seashell4")

Scatter plot matrix resembles relationship between PricePrimium and other relevant factor.

library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplotMatrix(airline[,c("FlightDuration","PricePremium","SeatsPremium", "PriceEconomy")],  spread=FALSE, smoother.args=list(lty=20),pch = 20, main="Scatter Plot Matrix")

Subsetting two data frames

Subsetting of Airline dataset in two: One having relative price increases by more than 50 %, and other having relative price increases by less than 50%.[moreRelativePrice]

This is being done in order to visualize clearly on what factor explains the difference between economic class and premium class ticket prices.[lessRelativePrice]

moreRelativePrice<- airline[which(airline$PriceRelative > 0.5 ),] 
#airline having premium price greater by 50 % or more

lessRelativePrice<- airline[which(airline$PriceRelative < 0.5 ),]
#airline having premium price greater by 50% or less

View(moreRelativePrice)
View(lessRelativePrice)

Comparing two subsets

# Comparing two subsets

par(mfrow=c(1,2))
hist(moreRelativePrice$FlightDuration, xlab="hours of flight", main=" relativer price > 50 % ", ylim=c(0,40), col = "dodgerblue3")
hist(lessRelativePrice$FlightDuration, xlab="hours of flight", main="relative price < 50", col="dodgerblue4")

par(mfrow=c(1,1))


#Visuzlize Seats Economy between two sets
boxplot(moreRelativePrice$SeatsEconomy, lessRelativePrice$SeatsEconomy ,col=c("dodgerblue3","dodgerblue4"),  horizontal = TRUE, main="Seats Economy", xlab="Seats ", names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Visualize Seats Premium between two sets
  boxplot(moreRelativePrice$SeatsPremium,lessRelativePrice$SeatsPremium, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Seats Premium"  ,xlab="Inch", names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Pitch Economy between two sets
boxplot(moreRelativePrice$PitchEconomy, lessRelativePrice$PitchEconomy, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Pitch Economy", xlab="Inch", names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Pitch Premium between two sets
boxplot(moreRelativePrice$PricePremium, lessRelativePrice$PitchPremium, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Pitch Premium", xlab="Ticket price",
names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Width Economy between two sets
boxplot(moreRelativePrice$WidthEconomy, lessRelativePrice$WidthEconomy, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Width Economy", xlab="Inch", names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Width Premium between two sets
boxplot(moreRelativePrice$WidthPremium, lessRelativePrice$WidthPremium, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Width Premium", xlab="Inch",names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Price Economy between two sets
boxplot(moreRelativePrice$PriceEconomy, lessRelativePrice$PriceEconomy, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Price Economy", xlab="Ticket price", names=c("RltPrc > 0.5","RltPrc < 0.5"))

#Vizualize Price Premium between two sets
boxplot(moreRelativePrice$PricePremium, lessRelativePrice$PricePremium, col=c("dodgerblue3","dodgerblue4"), horizontal = TRUE, main="Price Premium", xlab="Ticket price",names=c("RltPrc > 0.5","RltPrc < 0.5"))

Corelation bewteen different variable

#airline dataframe

library(corrgram)
## Warning: replacing previous import by 'magrittr::%>%' when loading
## 'dendextend'
corrgram(airline, lower.panel=panel.shade,
         upper.panel=panel.pie,
         main="Corrgram of airplane intercorrelations")

Noted down Relative price correlated

Positively with- PitchDifference,WidthDifference, %ofPremiumSeat, widthPremium, PitchPremium, FlightDuration Negatively with- PriceEconomy, PitchEconomy

Price Premium is correlated:

Positively with- PriceEconomy, flightDuration, PitchEconomy,SeatsPremium, SeatsEconomy,WidthEconomy,PitchPremium, widthPremium,

Draw model from here that have link with PricePremium

Model E: \(PricePremium = \beta_0 WidthPremium+ \beta_1 PitchPremium + \beta_2 SeatsPreemium + \beta_3 PitchEconomy + \beta_4 FlightDuration + \beta_5 PriceEconomy + \epsilon\)

#fitting 

ModelE<- lm(PricePremium ~ WidthPremium + PitchPremium + SeatsPremium + PitchEconomy + FlightDuration + PriceEconomy  , data=airline)

moreRelativePrice subset corrgram

library(corrgram)
corrgram(moreRelativePrice, lower.panel=panel.shade,
         upper.panel=panel.pie,
         main="Corrgram of airplane having relative price greater by more than 50%")

lessRelativePrice subset corrgram

library(corrgram)
corrgram(lessRelativePrice, lower.panel=panel.shade,
         upper.panel=panel.pie,
         main="Corrgram of airplane where relative price is greater by less than 50%")

Describe Both subset to findout link between variable

library(psych)
describe(moreRelativePrice)[,1:8] # premium price greater by 50% or more 
##                     vars   n    mean      sd  median trimmed     mad
## Airline*               1 159    3.87    1.66    4.00    3.91    2.97
## Aircraft*              2 159    1.72    0.45    2.00    1.77    0.00
## FlightDuration         3 159    8.48    3.54    8.91    8.57    3.84
## TravelMonth*           4 159    2.51    1.14    3.00    2.51    1.48
## IsInternational*       5 159    2.00    0.00    2.00    2.00    0.00
## SeatsEconomy           6 159  207.41   79.44  198.00  199.26   75.61
## SeatsPremium           7 159   32.14   14.77   36.00   31.57   11.86
## PitchEconomy           8 159   30.97    0.69   31.00   30.97    0.00
## PitchPremium           9 159   38.50    0.87   38.00   38.39    0.00
## WidthEconomy          10 159   17.87    0.64   18.00   17.84    0.00
## WidthPremium          11 159   20.12    0.92   20.00   20.15    1.48
## PriceEconomy          12 159  983.81  708.60  794.00  932.48  929.59
## PricePremium          13 159 1902.48 1397.84 1619.00 1808.81 1810.25
## PriceRelative         14 159    1.00    0.37    0.98    0.97    0.36
## SeatsTotal            15 159  239.55   89.39  233.00  230.71   97.85
## PitchDifference       16 159    7.53    1.49    7.00    7.42    0.00
## WidthDifference       17 159    2.25    1.30    2.00    2.19    1.48
## PercentPremiumSeats   18 159   13.58    5.25   12.90   13.32    3.14
##                        min
## Airline*              1.00
## Aircraft*             1.00
## FlightDuration        2.50
## TravelMonth*          1.00
## IsInternational*      2.00
## SeatsEconomy        122.00
## SeatsPremium          8.00
## PitchEconomy         30.00
## PitchPremium         38.00
## WidthEconomy         17.00
## WidthPremium         19.00
## PriceEconomy        108.00
## PricePremium        228.00
## PriceRelative         0.51
## SeatsTotal          140.00
## PitchDifference       6.00
## WidthDifference       1.00
## PercentPremiumSeats   4.71
describe(lessRelativePrice)[,1:8] # premium price greater by less than 50%
##                     vars   n    mean      sd  median trimmed     mad   min
## Airline*               1 297    2.54    1.45    2.00    2.32    1.48  1.00
## Aircraft*              2 297    1.64    0.48    2.00    1.68    0.00  1.00
## FlightDuration         3 297    7.09    3.44    7.58    7.06    4.57  1.25
## TravelMonth*           4 297    2.59    1.19    3.00    2.61    1.48  1.00
## IsInternational*       5 297    1.87    0.34    2.00    1.95    0.00  1.00
## SeatsEconomy           6 297  199.86   74.81  185.00  193.95   85.99 78.00
## SeatsPremium           7 297   34.51   12.33   36.00   34.14   11.86  8.00
## PitchEconomy           8 297   31.35    0.59   31.00   31.35    0.00 30.00
## PitchPremium           9 297   37.58    1.40   38.00   37.85    0.00 34.00
## WidthEconomy          10 297   17.82    0.51   18.00   17.83    0.00 17.00
## WidthPremium          11 297   19.11    1.02   19.00   19.14    0.00 17.00
## PriceEconomy          12 297 1515.41 1066.39 1566.00 1465.93 1546.35 65.00
## PricePremium          13 297 1820.49 1228.70 1866.00 1803.03 1853.25 86.00
## PriceRelative         14 297    0.21    0.15    0.16    0.20    0.18  0.02
## SeatsTotal            15 297  234.37   83.22  227.00  228.42   90.44 98.00
## PitchDifference       16 297    6.23    1.72    7.00    6.46    0.00  2.00
## WidthDifference       17 297    1.29    0.97    1.00    1.19    0.00  0.00
## PercentPremiumSeats   18 297   15.23    4.53   13.21   14.79    1.91  4.71

By looking at descriptive statistics of both subsets (keepin in mind research question)

Independent variables: Airline, flight duration, international, preimum seats, pitchpremium, width premium

Model C: dependent variable PricePremium

Independent variables: Airline, flight duration, international, % preimum seats, pitchDiff, widthDiff

MOdel D: dependent variable PricePremium

#fitting
#ModelC
ModelC<- lm(data=airline, PricePremium ~ WidthPremium+PitchPremium+SeatsPremium+IsInternational+FlightDuration+Airline)

#ModelD
ModelD<- lm(data=airline, PricePremium ~ 
        WidthDifference + PitchDifference + PercentPremiumSeats + IsInternational +   FlightDuration + Airline)

Changing Dependent variable from “PricePremium” to “PriceRelative”

ModelA<- lm(data=airline,PriceRelative ~ WidthPremium+PitchPremium+SeatsPremium+IsInternational+FlightDuration+Airline)

ModelB<- lm(data=airline,PriceRelative ~ 
        WidthDifference + PitchDifference + PercentPremiumSeats + IsInternational +   FlightDuration + Airline)

To CHECK

Model A is similar to Model C, just independent variable is replaced with PriceRelative

Model B is similar to MOdel D, just independent variable is repalced with PriceRelative

Summary Of Models

summary(ModelA)
## 
## Call:
## lm(formula = PriceRelative ~ WidthPremium + PitchPremium + SeatsPremium + 
##     IsInternational + FlightDuration + Airline, data = airline)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.83411 -0.19613 -0.07034  0.10600  1.49599 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  -5.049968   2.605255  -1.938 0.053206 .  
## WidthPremium                  0.088042   0.105365   0.836 0.403832    
## PitchPremium                  0.102672   0.107413   0.956 0.339659    
## SeatsPremium                 -0.002909   0.002238  -1.300 0.194273    
## IsInternationalInternational -0.538517   0.319354  -1.686 0.092441 .  
## FlightDuration                0.032995   0.006485   5.088 5.34e-07 ***
## AirlineBritish                0.318163   0.061071   5.210 2.89e-07 ***
## AirlineDelta                  0.047813   0.262269   0.182 0.855424    
## AirlineJet                    0.524994   0.134652   3.899 0.000111 ***
## AirlineSingapore              0.200817   0.128960   1.557 0.120129    
## AirlineVirgin                 0.417242   0.224194   1.861 0.063389 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3596 on 447 degrees of freedom
## Multiple R-squared:  0.3771, Adjusted R-squared:  0.3632 
## F-statistic: 27.06 on 10 and 447 DF,  p-value: < 2.2e-16
summary(ModelB)
## 
## Call:
## lm(formula = PriceRelative ~ WidthDifference + PitchDifference + 
##     PercentPremiumSeats + IsInternational + FlightDuration + 
##     Airline, data = airline)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.88196 -0.21539 -0.05383  0.09694  1.45141 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  -0.050485   0.256814  -0.197 0.844243    
## WidthDifference               0.067328   0.074380   0.905 0.365853    
## PitchDifference               0.058924   0.061407   0.960 0.337794    
## PercentPremiumSeats          -0.012408   0.004371  -2.839 0.004735 ** 
## IsInternationalInternational -0.371244   0.232699  -1.595 0.111333    
## FlightDuration                0.035629   0.006111   5.830 1.06e-08 ***
## AirlineBritish                0.320360   0.105061   3.049 0.002430 ** 
## AirlineDelta                  0.056939   0.169423   0.336 0.736970    
## AirlineJet                    0.531661   0.136657   3.890 0.000115 ***
## AirlineSingapore              0.303967   0.077303   3.932 9.75e-05 ***
## AirlineVirgin                 0.433824   0.099631   4.354 1.66e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3564 on 447 degrees of freedom
## Multiple R-squared:  0.3881, Adjusted R-squared:  0.3744 
## F-statistic: 28.35 on 10 and 447 DF,  p-value: < 2.2e-16
summary(ModelC)
## 
## Call:
## lm(formula = PricePremium ~ WidthPremium + PitchPremium + SeatsPremium + 
##     IsInternational + FlightDuration + Airline, data = airline)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2085.9  -402.1    31.7   402.3  4301.1 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  -6601.360   5511.018  -1.198    0.232    
## WidthPremium                   168.890    222.885   0.758    0.449    
## PitchPremium                   122.550    227.215   0.539    0.590    
## SeatsPremium                    -3.310      4.734  -0.699    0.485    
## IsInternationalInternational   215.730    675.544   0.319    0.750    
## FlightDuration                 186.173     13.718  13.571  < 2e-16 ***
## AirlineBritish                -862.600    129.186  -6.677 7.24e-11 ***
## AirlineDelta                  -675.414    554.789  -1.217    0.224    
## AirlineJet                   -2232.487    284.835  -7.838 3.38e-14 ***
## AirlineSingapore             -2257.155    272.795  -8.274 1.50e-15 ***
## AirlineVirgin                 -677.676    474.247  -1.429    0.154    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 760.6 on 447 degrees of freedom
## Multiple R-squared:  0.659,  Adjusted R-squared:  0.6513 
## F-statistic: 86.37 on 10 and 447 DF,  p-value: < 2.2e-16
summary(ModelD)
## 
## Call:
## lm(formula = PricePremium ~ WidthDifference + PitchDifference + 
##     PercentPremiumSeats + IsInternational + FlightDuration + 
##     Airline, data = airline)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2182.8  -356.3    50.4   346.8  4426.9 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                    466.848    545.713   0.855 0.392742    
## WidthDifference                280.053    158.053   1.772 0.077094 .  
## PitchDifference                -32.619    130.486  -0.250 0.802719    
## PercentPremiumSeats             12.369      9.288   1.332 0.183605    
## IsInternationalInternational   535.579    494.470   1.083 0.279331    
## FlightDuration                 190.689     12.985  14.685  < 2e-16 ***
## AirlineBritish                -835.041    223.247  -3.740 0.000208 ***
## AirlineDelta                  -811.169    360.014  -2.253 0.024733 *  
## AirlineJet                   -2147.692    290.389  -7.396 6.99e-13 ***
## AirlineSingapore             -1991.787    164.263 -12.126  < 2e-16 ***
## AirlineVirgin                 -851.408    211.710  -4.022 6.79e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 757.3 on 447 degrees of freedom
## Multiple R-squared:  0.6619, Adjusted R-squared:  0.6544 
## F-statistic: 87.53 on 10 and 447 DF,  p-value: < 2.2e-16
summary(ModelE)
## 
## Call:
## lm(formula = PricePremium ~ WidthPremium + PitchPremium + SeatsPremium + 
##     PitchEconomy + FlightDuration + PriceEconomy, data = airline)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -818.4 -226.2  -58.5  110.7 3218.9 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    12828.5902  2048.2019   6.263 8.80e-10 ***
## WidthPremium     138.4292    31.0832   4.454 1.07e-05 ***
## PitchPremium    -151.7004    26.6887  -5.684 2.36e-08 ***
## SeatsPremium       8.0837     1.6563   4.881 1.47e-06 ***
## PitchEconomy    -327.9169    47.2049  -6.947 1.31e-11 ***
## FlightDuration    74.2077     7.7840   9.533  < 2e-16 ***
## PriceEconomy       1.1109     0.0281  39.530  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 458.7 on 451 degrees of freedom
## Multiple R-squared:  0.8749, Adjusted R-squared:  0.8732 
## F-statistic: 525.6 on 6 and 451 DF,  p-value: < 2.2e-16

INFERENCE

\(ModelE: PricePremium = \beta_0 WidthPremium + \beta_1 PitchPremium + \beta_2 SeatsPremium + \beta_3 PitchEconomy +\beta_4 FlightDuration + \beta_5 PriceEconomy\)

is best as it has maximum Adjusted R-squared value 87%

Hypothesis

\(H0: \beta_0 = \beta_1 = \beta_2 = \beta_3 = \beta_4 = \beta_5 = 0\)