airline=read.csv(paste("SixAirlinesDataV2.csv",sep=""))
attach(airline)
View(airline)
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
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 ...
library(psych)
## Warning: package 'psych' was built under R version 3.4.3
describe(airline[,6:14])
## vars n mean sd median trimmed mad min
## SeatsEconomy 1 458 202.31 76.37 185.00 194.64 85.99 78.00
## SeatsPremium 2 458 33.65 13.26 36.00 33.35 11.86 8.00
## PitchEconomy 3 458 31.22 0.66 31.00 31.26 0.00 30.00
## PitchPremium 4 458 37.91 1.31 38.00 38.05 0.00 34.00
## WidthEconomy 5 458 17.84 0.56 18.00 17.81 0.00 17.00
## WidthPremium 6 458 19.47 1.10 19.00 19.53 0.00 17.00
## PriceEconomy 7 458 1327.08 988.27 1242.00 1244.40 1159.39 65.00
## PricePremium 8 458 1845.26 1288.14 1737.00 1799.05 1845.84 86.00
## PriceRelative 9 458 0.49 0.45 0.36 0.42 0.41 0.02
## max range skew kurtosis se
## 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
#describe(PricePremium)
library(car)
## Warning: package 'car' was built under R version 3.4.3
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
par(mfrow=c(1,2))
boxplot(PriceEconomy, main="Boxplot of PriceEconomy")
boxplot(PricePremium, main="Boxplot of PricePremium")
library(car)
par(mfrow=c(1,2))
hist(PriceEconomy,col="Grey")
hist(PricePremium,xlim = c(0,5000),col="Beige")
library(car)
par(mfrow=c(1,2))
hist(FlightDuration,col="lightblue",xlim=c(0,15),ylim = c(0,60))
boxplot(FlightDuration,main="Boxplot of flight duration",ylab="Fight Duration")
table(IsInternational)
## IsInternational
## Domestic International
## 40 418
by(PriceEconomy,IsInternational,mean)
## IsInternational: Domestic
## [1] 356.625
## --------------------------------------------------------
## IsInternational: International
## [1] 1419.943
by(PricePremium,IsInternational,mean)
## IsInternational: Domestic
## [1] 385.9
## --------------------------------------------------------
## IsInternational: International
## [1] 1984.909
par(mfrow=c(1,2))
boxplot(PriceEconomy~IsInternational,data=airline, ylab="PriceEconomy",col = c("purple","navy"))
boxplot(PricePremium~IsInternational,data=airline, ylab="PricePremium",col = c("purple","navy"))
From the above tables and boxplots, we can conclude that the Domestic Flights have a much lower price (both PricePremium and PriceEconomy) as compared to International Flights
table(Aircraft)
## Aircraft
## AirBus Boeing
## 151 307
by(PriceEconomy,Aircraft,mean)
## Aircraft: AirBus
## [1] 1369.954
## --------------------------------------------------------
## Aircraft: Boeing
## [1] 1305.987
by(PricePremium,Aircraft,mean)
## Aircraft: AirBus
## [1] 1869.503
## --------------------------------------------------------
## Aircraft: Boeing
## [1] 1833.332
par(mfrow=c(1,2))
boxplot(PriceEconomy~Aircraft,data=airline, ylab="PriceEconomy",col = c("purple","navy"))
boxplot(PricePremium~Aircraft,data=airline, ylab="PricePremium",col = c("purple","navy"))
It can be observed that Airbus aircrafts have slightly higher price than Boeing aircrafts. The differnce is higher when we consider only PricePremium
boxplot(PriceEconomy~Airline,data=airline, ylab="PriceEconomy",col = c("purple","navy"))
par(mfrow=c(1,1))
boxplot(PricePremium~Airline,data=airline, ylab="PricePremium",col = c("purple","navy","yellow","red","pink","darkgreen"))
On an average it can be seen that prices vary with Airlines, with AirFrance being the costliest and Jet and Delta being the cheaper ones of all Airlines
plot(TravelMonth,main = "Comparing Monthly Travels",col="pink",ylim=c(0,140),ylab="Number Of Flights",xlab="Month")
The number of fligts is relatively low in July as compared to Aug, Sept and Oct which have almost similar number of flights
par(mfrow=c(1,1))
boxplot(PriceEconomy~TravelMonth,data=airline, ylab="PriceEconomy",col = c("purple","navy","red","darkgreen"))
par(mfrow=c(1,1))
boxplot(PricePremium~TravelMonth,data=airline, ylab="PricePremium",col = c("purple","navy","red","darkgreen"))
par(mfrow=c(1,1))
boxplot(PriceRelative~WidthDifference,data=airline, ylab="PriceRelative",xlab="WidthDifference",col = c("purple","navy","red","darkgreen"))
scatterplot(WidthDifference,PriceRelative, main="PriceRelative vs WidthDifference")
par(mfrow=c(1,1))
boxplot(PriceRelative~PitchDifference,data=airline, ylab="PriceRelative",xlab="PitchDifference",col = c("purple","navy","red","darkgreen"))
scatterplot(PitchDifference,PriceRelative, main="PriceRelative vs PitchDifference")
scatterplot(FlightDuration,PriceEconomy,main="PriceEconomy vs FlightDuration")
scatterplot(FlightDuration,PricePremium,main="PricePremium vs FlightDuration")
scatterplot(SeatsEconomy,PriceEconomy,main="PriceEconomy vs SeatsEconomy")
scatterplot(SeatsPremium,PricePremium,main="PricePremium vs SeatsPremium")
scatterplot(PercentPremiumSeats,PricePremium,main="PricePremium vs PercentPremiumSeats")
scatterplot(SeatsPremium,PricePremium,main="PricePremium vs SeatsPremium")
library(corrgram)
## Warning: package 'corrgram' was built under R version 3.4.3
corrgram(airline,upper.panel = panel.pie,main="Corrgram of data",cex.labels =.6)
cor(airline[,c(3,6:18)])
## FlightDuration SeatsEconomy SeatsPremium PitchEconomy
## FlightDuration 1.00000000 0.195621187 0.161236400 0.29377174
## SeatsEconomy 0.19562119 1.000000000 0.625056587 0.14412692
## SeatsPremium 0.16123640 0.625056587 1.000000000 -0.03421296
## PitchEconomy 0.29377174 0.144126924 -0.034212963 1.00000000
## PitchPremium 0.09621471 0.119221250 0.004883123 -0.55060624
## WidthEconomy 0.45647720 0.373670252 0.455782883 0.29448586
## WidthPremium 0.10343747 0.102431959 -0.002717527 -0.53929285
## PriceEconomy 0.56664039 0.128167220 0.113642176 0.36866123
## PricePremium 0.64873981 0.177000928 0.217612376 0.22614179
## PriceRelative 0.12107501 0.003956939 -0.097196009 -0.42302204
## SeatsTotal 0.20023299 0.992607966 0.715171053 0.12373524
## PitchDifference -0.03749288 0.035318044 0.016365566 -0.78254993
## WidthDifference -0.11856070 -0.080670148 -0.216168666 -0.63557430
## PercentPremiumSeats 0.06051625 -0.330935223 0.485029771 -0.10280880
## PitchPremium WidthEconomy WidthPremium PriceEconomy
## FlightDuration 0.096214708 0.45647720 0.103437469 0.56664039
## SeatsEconomy 0.119221250 0.37367025 0.102431959 0.12816722
## SeatsPremium 0.004883123 0.45578288 -0.002717527 0.11364218
## PitchEconomy -0.550606241 0.29448586 -0.539292852 0.36866123
## PitchPremium 1.000000000 -0.02374087 0.750259029 0.05038455
## WidthEconomy -0.023740873 1.00000000 0.081918728 0.06799061
## WidthPremium 0.750259029 0.08191873 1.000000000 -0.05704522
## PriceEconomy 0.050384550 0.06799061 -0.057045224 1.00000000
## PricePremium 0.088539147 0.15054837 0.064020043 0.90138870
## PriceRelative 0.417539056 -0.04396116 0.504247591 -0.28856711
## SeatsTotal 0.107512784 0.40545860 0.091297500 0.13243313
## PitchDifference 0.950591466 -0.12722421 0.760121272 -0.09952511
## WidthDifference 0.703281797 -0.39320512 0.884149655 -0.08449975
## PercentPremiumSeats -0.175487414 0.22714172 -0.183312058 0.06532232
## PricePremium PriceRelative SeatsTotal PitchDifference
## FlightDuration 0.64873981 0.121075014 0.20023299 -0.03749288
## SeatsEconomy 0.17700093 0.003956939 0.99260797 0.03531804
## SeatsPremium 0.21761238 -0.097196009 0.71517105 0.01636557
## PitchEconomy 0.22614179 -0.423022038 0.12373524 -0.78254993
## PitchPremium 0.08853915 0.417539056 0.10751278 0.95059147
## WidthEconomy 0.15054837 -0.043961160 0.40545860 -0.12722421
## WidthPremium 0.06402004 0.504247591 0.09129750 0.76012127
## PriceEconomy 0.90138870 -0.288567110 0.13243313 -0.09952511
## PricePremium 1.00000000 0.031846537 0.19232533 -0.01806629
## PriceRelative 0.03184654 1.000000000 -0.01156894 0.46873025
## SeatsTotal 0.19232533 -0.011568942 1.00000000 0.03416915
## PitchDifference -0.01806629 0.468730249 0.03416915 1.00000000
## WidthDifference -0.01151218 0.485802437 -0.10584398 0.76089108
## PercentPremiumSeats 0.11639097 -0.161565556 -0.22091465 -0.09264869
## WidthDifference PercentPremiumSeats
## FlightDuration -0.11856070 0.06051625
## SeatsEconomy -0.08067015 -0.33093522
## SeatsPremium -0.21616867 0.48502977
## PitchEconomy -0.63557430 -0.10280880
## PitchPremium 0.70328180 -0.17548741
## WidthEconomy -0.39320512 0.22714172
## WidthPremium 0.88414965 -0.18331206
## PriceEconomy -0.08449975 0.06532232
## PricePremium -0.01151218 0.11639097
## PriceRelative 0.48580244 -0.16156556
## SeatsTotal -0.10584398 -0.22091465
## PitchDifference 0.76089108 -0.09264869
## WidthDifference 1.00000000 -0.27559416
## PercentPremiumSeats -0.27559416 1.00000000
cor.test(PriceEconomy,FlightDuration)
##
## Pearson's product-moment correlation
##
## data: PriceEconomy and FlightDuration
## t = 14.685, df = 456, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.5010266 0.6257772
## sample estimates:
## cor
## 0.5666404
Therefore, the PriceEconomy has a high positive correlation with FlightDuration
cor.test(PricePremium,FlightDuration)
##
## Pearson's product-moment correlation
##
## data: PricePremium and FlightDuration
## t = 18.204, df = 456, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.5923218 0.6988270
## sample estimates:
## cor
## 0.6487398
Therefore, the PricePremiuim has a high positive correlation with FlightDuration and it is higher than that of PriceEconomy Therefore with increasing FlightDuration, the PricePremium goes higher as compared to PriceEconomy
cor.test(PriceRelative,FlightDuration)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and FlightDuration
## t = 2.6046, df = 456, p-value = 0.009498
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.02977856 0.21036806
## sample estimates:
## cor
## 0.121075
As FlightDuration increases, the relative price also increases slightly
cor.test(PriceRelative,WidthDifference)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and WidthDifference
## t = 11.869, df = 456, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4125388 0.5528218
## sample estimates:
## cor
## 0.4858024
The WidthDifference is a statistically significant variable which is positively correlated with PriceRelative. As WidthDifference increases, PriceRelative increases
cor.test(PriceRelative,PitchDifference)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and PitchDifference
## t = 11.331, df = 456, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3940262 0.5372817
## sample estimates:
## cor
## 0.4687302
Similar to WidthDifference, PitchDifference is also positively correlated with PriceRelative with nearly same correlation coefficients
cor.test(PriceRelative,SeatsTotal)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and SeatsTotal
## t = -0.24706, df = 456, p-value = 0.805
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.10308648 0.08014282
## sample estimates:
## cor
## -0.01156894
Since p-value is greater than 0.05, therefore SeatsTotal is statistically insignificant for PriceRelative determination
cor.test(PriceRelative,PercentPremiumSeats)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and PercentPremiumSeats
## t = -3.496, df = 456, p-value = 0.0005185
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.24949885 -0.07098966
## sample estimates:
## cor
## -0.1615656
As PercentPremiumSeats increases, the PriceRelative decreases as they have a small negative correlation coefficient
cor.test(PriceRelative,PriceEconomy)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and PriceEconomy
## t = -6.4359, df = 456, p-value = 3.112e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.3704004 -0.2022889
## sample estimates:
## cor
## -0.2885671
cor.test(PriceRelative,PricePremium)
##
## Pearson's product-moment correlation
##
## data: PriceRelative and PricePremium
## t = 0.6804, df = 456, p-value = 0.4966
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.05995522 0.12311410
## sample estimates:
## cor
## 0.03184654
From the above two tests, it is clear that PriceEconomy is statistically significant in determining PriceRelative whereas PricePremium is not. Moreover, PriceEconomy is negatively correlated with PriceRelative.
model=lm((PricePremium-PriceEconomy)~Airline+TravelMonth+FlightDuration+PitchDifference+WidthDifference+PercentPremiumSeats+PriceRelative)
summary(model)
##
## Call:
## lm(formula = (PricePremium - PriceEconomy) ~ Airline + TravelMonth +
## FlightDuration + PitchDifference + WidthDifference + PercentPremiumSeats +
## PriceRelative)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1011.49 -137.89 -7.32 126.76 2639.76
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -415.6657 249.0686 -1.669 0.095846 .
## AirlineBritish 207.6631 101.8512 2.039 0.042053 *
## AirlineDelta 190.0222 123.7042 1.536 0.125226
## AirlineJet -470.4240 112.4894 -4.182 3.48e-05 ***
## AirlineSingapore -246.5516 77.6113 -3.177 0.001593 **
## AirlineVirgin 357.4502 97.9908 3.648 0.000296 ***
## TravelMonthJul 3.8222 51.8044 0.074 0.941217
## TravelMonthOct -24.8072 44.2275 -0.561 0.575149
## TravelMonthSep 1.9367 43.9993 0.044 0.964911
## FlightDuration 51.1047 5.9508 8.588 < 2e-16 ***
## PitchDifference 15.5345 54.4353 0.285 0.775490
## WidthDifference 0.1372 73.4688 0.002 0.998511
## PercentPremiumSeats 0.3384 4.3547 0.078 0.938101
## PriceRelative 781.1639 46.6975 16.728 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 351.8 on 444 degrees of freedom
## Multiple R-squared: 0.6475, Adjusted R-squared: 0.6371
## F-statistic: 62.72 on 13 and 444 DF, p-value: < 2.2e-16
Since this model has a very low p-value, therefore it is statistically significant.
model$coefficients
## (Intercept) AirlineBritish AirlineDelta
## -415.6656568 207.6631450 190.0221516
## AirlineJet AirlineSingapore AirlineVirgin
## -470.4240358 -246.5516353 357.4502082
## TravelMonthJul TravelMonthOct TravelMonthSep
## 3.8222104 -24.8071526 1.9367112
## FlightDuration PitchDifference WidthDifference
## 51.1047292 15.5344580 0.1372069
## PercentPremiumSeats PriceRelative
## 0.3383643 781.1638907
# Here is the PriceDifference, as predicted by the OLS model
fitted(model)
## 1 2 3 4 5 6
## 835.927537 832.105327 834.042038 807.298174 849.624513 851.561224
## 7 8 9 10 11 12
## 824.817360 1046.009663 1047.946374 1084.744131 1058.000267 934.386280
## 13 14 15 16 17 18
## 703.859324 907.228103 909.164814 882.420950 674.191714 676.128425
## 19 20 21 22 23 24
## 649.384561 519.782761 521.719472 494.975608 507.371696 509.308407
## 25 26 27 28 29 30
## 482.564544 629.803858 616.117291 589.373428 425.750059 427.686770
## 31 32 33 34 35 36
## 400.942906 436.872273 433.050063 434.986774 408.242910 1106.900489
## 37 38 39 40 41 42
## 1108.837200 1082.093336 296.262773 292.440562 294.377274 267.633410
## 43 44 45 46 47 48
## 318.504562 320.441273 293.697410 393.337243 395.273954 368.530090
## 49 50 51 52 53 54
## 967.020636 968.957347 942.213484 1020.796473 756.283479 758.220190
## 55 56 57 58 59 60
## 731.476326 485.136555 487.073266 460.329402 711.677611 690.617194
## 61 62 63 64 65 66
## 999.336014 1040.817367 1036.995157 1038.931868 1012.188004 817.638569
## 67 68 69 70 71 72
## 813.816359 815.753070 789.009206 622.831777 624.768488 598.024624
## 73 74 75 76 77 78
## 532.085723 3.446377 11.369726 -8.354691 -39.539290 -23.185777
## 79 80 81 82 83 84
## -47.632074 -23.346683 -27.336111 1095.926338 1092.104128 1094.040839
## 85 86 87 88 89 90
## 1067.296975 607.052868 608.989579 582.245716 610.875079 -188.304635
## 91 92 93 94 95 96
## -192.126846 -190.190135 -216.933998 -309.301429 -307.364718 -334.108582
## 97 98 99 100 101 102
## -360.160691 102.827994 862.994472 859.172261 861.108972 834.365109
## 103 104 105 106 107 108
## 1157.354184 1153.531974 1155.468685 1128.724821 941.670063 943.606775
## 109 110 111 112 113 114
## 916.862911 1470.416807 1443.672943 757.620955 163.387017 167.144496
## 115 116 117 118 119 120
## 169.081208 64.304340 158.091575 160.028286 151.521219 87.509354
## 121 122 123 124 125 126
## 68.293769 70.230480 115.163602 156.719339 136.214903 189.207177
## 127 128 129 130 131 132
## 253.219042 59.109894 244.035167 140.204332 142.420729 192.516124
## 133 134 135 136 137 138
## 239.566694 193.245772 278.590670 169.067271 246.006098 173.056700
## 139 140 141 142 143 144
## 179.593425 181.199237 154.455374 204.303256 206.239967 206.239967
## 145 146 147 148 149 150
## 259.511927 252.429936 200.579995 202.516706 257.612492 246.464033
## 151 152 153 154 155 156
## 207.019398 148.700934 134.464869 121.276589 107.040524 2056.488305
## 157 158 159 160 161 162
## 2052.666094 2054.602806 2027.858942 2024.778270 2026.714981 1999.971117
## 163 164 165 166 167 168
## 1755.193118 1324.001743 1320.179532 1322.116243 1295.372379 1324.165178
## 169 170 171 172 173 174
## 1320.342968 1322.279679 1295.535815 1219.390356 1136.368882 1007.594325
## 175 176 177 178 179 180
## 1003.772115 1005.708826 978.964962 1064.691896 992.999346 763.769602
## 181 182 183 184 185 186
## 759.947392 761.884103 735.140239 903.956426 673.290973 648.483820
## 187 188 189 190 191 192
## 670.590395 672.527106 645.783242 550.241462 1256.294137 1252.471926
## 193 194 195 196 197 198
## 1254.408638 1227.664774 1200.371382 1196.549171 1198.485882 1171.742019
## 199 200 201 202 203 204
## 1247.681355 1243.859145 1245.795856 1017.468134 1019.404845 758.466695
## 205 206 207 208 209 210
## 754.644484 756.581195 729.837332 624.427550 533.681496 531.795997
## 211 212 213 214 215 216
## 505.052133 1361.211296 1083.301243 659.536031 173.925568 170.103357
## 217 218 219 220 221 222
## 172.040069 145.296205 173.925568 170.103357 172.040069 145.296205
## 223 224 225 226 227 228
## 118.998628 120.935339 94.191476 87.571336 60.827472 191.932462
## 229 230 231 232 233 234
## 193.869173 167.125309 128.017331 178.306393 174.484183 179.998225
## 235 236 237 238 239 240
## 153.254361 177.284299 173.462088 179.998225 153.254361 1319.956228
## 241 242 243 244 245 246
## 1295.149076 642.280354 818.916573 820.853284 794.109420 696.729878
## 247 248 249 250 251 252
## 692.907668 694.844379 668.100515 1109.259990 1111.196701 1084.452837
## 253 254 255 256 257 258
## 749.952055 746.129845 748.066556 721.322692 663.266925 665.203636
## 259 260 261 262 263 264
## 638.459772 1245.235846 675.896590 677.833301 651.089437 588.215644
## 265 266 267 268 269 270
## 590.152355 563.408491 985.515050 321.743756 323.680467 296.936603
## 271 272 273 274 275 276
## 1355.437680 1330.630527 1203.027112 646.515250 960.707898 608.101272
## 277 278 279 280 281 282
## 604.279062 606.215773 433.043412 891.937465 139.682861 111.405856
## 283 284 285 286 287 288
## 140.009528 142.968333 116.735517 155.345058 153.459559 126.715695
## 289 290 291 292 293 294
## 120.336323 87.970939 97.169790 143.711208 105.477500 114.568873
## 295 296 297 298 299 300
## -47.129128 -18.266635 -10.235808 -22.233741 2.573412 104.773544
## 301 302 303 304 305 306
## 10.604239 -56.667853 -82.389622 -71.052416 -27.406170 -91.734403
## 307 308 309 310 311 312
## -75.041844 843.917427 446.896079 341.355344 -3.147501 -29.891365
## 313 314 315 316 317 318
## 11.381011 -36.330768 1013.555157 796.765979 770.022115 751.781645
## 319 320 321 322 323 324
## 538.504479 540.441190 513.697327 422.523023 364.019340 365.956051
## 325 326 327 328 329 330
## 286.343091 288.279802 261.535939 30.819445 32.756156 6.012293
## 331 332 333 334 335 336
## -286.733832 -290.556043 -288.619332 -315.363195 157.486503 159.423214
## 337 338 339 340 341 342
## 132.679350 161.308713 388.892014 390.828725 364.084861 102.942046
## 343 344 345 346 347 348
## 85.697391 187.640682 183.818472 185.755183 104.679400 64.199186
## 349 350 351 352 353 354
## 37.455322 194.722673 190.900463 192.837174 166.093310 105.235259
## 355 356 357 358 359 360
## 101.413048 103.349760 80.694274 186.301037 188.237748 161.493885
## 361 362 363 364 365 366
## 309.654176 305.831965 317.885071 314.062860 315.999571 289.255708
## 367 368 369 370 371 372
## 1697.048625 1698.985336 1672.241472 695.041397 696.978108 670.234244
## 373 374 375 376 377 378
## 961.291745 736.690928 709.947064 425.282273 775.433788 685.003068
## 379 380 381 382 383 384
## 916.161342 918.098054 891.354190 904.360275 719.498134 771.197884
## 385 386 387 388 389 390
## 656.640493 489.879933 389.521755 387.636255 360.892392 280.523928
## 391 392 393 394 395 396
## 278.638429 251.894565 337.735533 267.795313 296.525672 273.870186
## 397 398 399 400 401 402
## 199.062744 34.175794 26.729272 76.838186 73.015976 74.952687
## 403 404 405 406 407 408
## 48.208823 -167.719755 -423.618339 1317.378319 1290.634455 1159.208829
## 409 410 411 412 413 414
## 475.606816 892.829601 889.007391 890.944102 864.200238 526.408693
## 415 416 417 418 419 420
## 522.586482 524.523193 497.779330 561.747154 557.924944 559.861655
## 421 422 423 424 425 426
## 533.117791 246.942022 243.119812 245.056523 218.312659 1253.138045
## 427 428 429 430 431 432
## 1226.394181 126.468321 128.405032 280.147626 282.084337 255.340474
## 433 434 435 436 437 438
## 145.549279 146.326494 148.263206 121.519342 293.765754 267.021890
## 439 440 441 442 443 444
## 364.496708 896.440431 749.065902 720.436539 579.985447 576.163236
## 445 446 447 448 449 450
## 578.099947 551.356084 517.492335 268.733718 4.743808 6.680519
## 451 452 453 454 455 456
## -20.063344 -57.418405 -124.231843 -168.484484 -245.228637 -243.291926
## 457 458
## -261.847730 -499.190510
# Compare PriceDifference predicted by the model with the actual profit given in the data
predictedDifference = data.frame(fitted(model))
actualDifference = data.frame(PricePremium-PriceEconomy)
DifferenceComparison = cbind(actualDifference, predictedDifference)
View(DifferenceComparison)
*The price of Premium seats is higher than price of Economy seats in a flight
*The factors that affect the difference in price of Premium and Economy seats in a flight are FlightDuration, WidthDifference, PitchDifference, Airline, PercentPremiumSeats
*Domestic Flights are cheaper than international flights, but their number is also too low as compared to number of international flights
*AirFrance is the most expensive flight whereas Jet and Delta are the cheaper ones.
*In the month of July, the number of flights goes down and so does the price due to low demand. In the other three months, it is similar.