airline <- read.csv(paste0("SixAirlinesDataV2.csv",sp=""))
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
hist(airline$PriceEconomy, main="Dependence on airlines",xlab="price of economy class",ylab="frequeny",col="blue")
hist(airline$SeatsEconomy, main="bar plot to show no of economy seats",xlab="seats of economy class",ylab="frequeny",col="lightblue")
hist(airline$SeatsPremium, main="no of premium seats",xlab="seats of premium class",ylab="frequeny",col="blue")
hist(airline$SeatsTotal, main="total no seats",xlab="total seats",ylab="count",col="lightblue")
boxplot(airline$PriceEconomy,xlab="price of economy class", ylab="economy class", main="economy class prices", horizontal = TRUE)
boxplot(airline$PriceEconomy~ airline$Airline,ylab="price of economy class", xlab="airline", main="economy class prices, all airlines", vertical = TRUE)
boxplot(airline$PriceEconomy~airline$IsInternational, xlab="Type of flight", ylab="Price of economy seats", main="economy class prices, all types", vertical= TRUE)
boxplot(airline$PricePremium~airline$IsInternational, xlab="Type of flight", ylab="Price of premium seats", main="premium class prices, all types", vertical= TRUE)
boxplot(airline$PriceEconomy~airline$TravelMonth, xlab="Month of the year", ylab="Price of economy seats", main="economy class prices, month wise", vertical= TRUE)
boxplot(airline$PricePremium~airline$TravelMonth, xlab="Month of the year", ylab="Price of premium seats", main="premium class prices, month wise", vertical= TRUE)
plot(airline$Airline, airline$PitchEconomy,col="blue",main="Pitch of economy class, as per airline", ylab="Pitch of economy class ", xlab="airline")
plot(airline$PitchEconomy, airline$PriceEconomy,col="blue",main="Relation ebtween pitch and price of economy class", ylab="Price of economy class ", xlab="pitch of economy class")
plot(airline$PitchPremium, airline$PricePremium,col="blue",main="Relation between pitch and price of premium", ylab="Price of premium class ", xlab="pitch of premium class")
library(car)
scatterplotMatrix(formula = ~ airline$PriceRelative + airline$FlightDuration +airline$SeatsPremium , cex=0.6,diagonal="histogram")
library(corrgram)
corrgram(airline, order=TRUE, lower.panel=panel.shade,
upper.panel=panel.pie, text.panel=panel.txt,
main="Correlation of relative price!!")
t.test(airline$PriceEconomy,airline$PriceRelative)
##
## Welch Two Sample t-test
##
## data: airline$PriceEconomy and airline$PriceRelative
## t = 28.727, df = 457, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1235.840 1417.339
## sample estimates:
## mean of x mean of y
## 1327.0764192 0.4872052
t.test(airline$PricePremium,airline$PriceRelative)
##
## Welch Two Sample t-test
##
## data: airline$PricePremium and airline$PriceRelative
## t = 30.649, df = 457, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1726.486 1963.055
## sample estimates:
## mean of x mean of y
## 1845.2576419 0.4872052
t.test(airline$PriceRelative~ airline$IsInternational)
##
## Welch Two Sample t-test
##
## data: airline$PriceRelative by airline$IsInternational
## t = -19.451, df = 446.12, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.4855215 -0.3964139
## sample estimates:
## mean in group Domestic mean in group International
## 0.0847500 0.5257177
t.test(airline$FlightDuration, airline$PriceRelative)
##
## Welch Two Sample t-test
##
## data: airline$FlightDuration and airline$PriceRelative
## t = 42.499, df = 471.79, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 6.762785 7.418482
## sample estimates:
## mean of x mean of y
## 7.5778384 0.4872052
model <-lm(airline$PriceEconomy~ airline$Airline+airline$Aircraft+airline$IsInternational+airline$TravelMonth+airline$FlightDuration)
summary(model)
##
## Call:
## lm(formula = airline$PriceEconomy ~ airline$Airline + airline$Aircraft +
## airline$IsInternational + airline$TravelMonth + airline$FlightDuration)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2030.72 -240.11 81.98 328.30 1189.83
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 508.4191 254.9164 1.994
## airline$AirlineBritish -1408.2061 75.2220 -18.721
## airline$AirlineDelta -696.8587 225.1777 -3.095
## airline$AirlineJet -2110.6421 105.5350 -19.999
## airline$AirlineSingapore -2083.4785 103.9639 -20.040
## airline$AirlineVirgin -1187.7312 90.6334 -13.105
## airline$AircraftBoeing 242.4410 57.5816 4.210
## airline$IsInternationalInternational 1239.4329 243.7106 5.086
## airline$TravelMonthJul 93.9861 77.4558 1.213
## airline$TravelMonthOct -46.0443 65.9322 -0.698
## airline$TravelMonthSep 0.8635 65.7224 0.013
## airline$FlightDuration 99.5027 9.0612 10.981
## Pr(>|t|)
## (Intercept) 0.04671 *
## airline$AirlineBritish < 2e-16 ***
## airline$AirlineDelta 0.00209 **
## airline$AirlineJet < 2e-16 ***
## airline$AirlineSingapore < 2e-16 ***
## airline$AirlineVirgin < 2e-16 ***
## airline$AircraftBoeing 3.08e-05 ***
## airline$IsInternationalInternational 5.40e-07 ***
## airline$TravelMonthJul 0.22561
## airline$TravelMonthOct 0.48532
## airline$TravelMonthSep 0.98952
## airline$FlightDuration < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 525.3 on 446 degrees of freedom
## Multiple R-squared: 0.7243, Adjusted R-squared: 0.7175
## F-statistic: 106.5 on 11 and 446 DF, p-value: < 2.2e-16
p-value of airlines are less than 0.05. So, price of economy class depends on airlines. p-value of aircrafts < 0.05. So, price of economy class depends on aircrafts. p-value of travel month > 0.05. So, economy price does not depend on travelling month. p-value of duration of flight <0.05. So, economy price depends on duration of flight. p-value of isInternational <0.05. So, price of economy class depends on whether the flight is international or not.