SUMMARY

air.df <- read.csv(paste("SixAirlinesDataV2.csv"))
summary(air.df)
##       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

CORRELATION TEST

cor.test(air.df$PriceRelative,air.df$WidthDifference)
## 
##  Pearson's product-moment correlation
## 
## data:  air.df$PriceRelative and air.df$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

PLOT

attach(air.df)
plot(Airline,SeatsPremium, ylab="Number of economy Class seats",col="yellow")

GRAPH PLOT

plot(WidthDifference,PriceRelative,main = "Analysis of width of Seats in Difference in price of class")
abline(lm(PriceRelative~WidthDifference),col="red",data=air.df)
## Warning in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): "data"
## is not a graphical parameter

BOX PLOT

boxplot(air.df$PriceEconomy~air.df$Airline,col=c("pink","pink","pink","pink","pink"),main="Airlines Vs Price Economy")

DIFFERENCE

par(mfrow=c(1,2))
with(air.df,plot(Aircraft,PriceEconomy,col=c("pink","khaki"),main="Aircraft vs Economy Pricing"))
with(air.df,plot(Aircraft,PricePremium,col=c("pink","khaki"), main="Aircraft vs Premium Pricing"))

SCATTER PLOT

library(car)
scatterplot(air.df$PriceEconomy,air.df$SeatsEconomy,smoother.args = list(lty=2))

CORRGRAM

library(corrgram)
corrgram(air.df,main="Analysis for different airlines",lower.panel=panel.shade, upper.panel=panel.pie,text.panel=panel.txt)

T TEST

t.test(air.df$PriceEconomy,air.df$PriceRelative,var.equal = T)
## 
##  Two Sample t-test
## 
## data:  air.df$PriceEconomy and air.df$PriceRelative
## t = 28.727, df = 914, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  1235.960 1417.218
## sample estimates:
##    mean of x    mean of y 
## 1327.0764192    0.4872052

FINAL

air1.df <- lm(formula = PriceRelative~Airline+Aircraft+FlightDuration+PriceEconomy+PricePremium+WidthEconomy + WidthPremium, data = air.df)
summary(air1.df)
## 
## Call:
## lm(formula = PriceRelative ~ Airline + Aircraft + FlightDuration + 
##     PriceEconomy + PricePremium + WidthEconomy + WidthPremium, 
##     data = air.df)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.71554 -0.10150 -0.00295  0.08886  0.83422 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       1.564e-01  7.663e-01   0.204   0.8384    
## AirlineBritish   -4.379e-01  4.777e-02  -9.165  < 2e-16 ***
## AirlineDelta     -5.205e-01  5.861e-02  -8.882  < 2e-16 ***
## AirlineJet       -2.234e-01  7.539e-02  -2.964   0.0032 ** 
## AirlineSingapore -4.365e-01  8.443e-02  -5.170 3.54e-07 ***
## AirlineVirgin    -5.253e-01  6.727e-02  -7.808 4.19e-14 ***
## AircraftBoeing    5.967e-02  2.536e-02   2.353   0.0190 *  
## FlightDuration    2.805e-02  4.409e-03   6.361 4.97e-10 ***
## PriceEconomy     -9.358e-04  3.240e-05 -28.883  < 2e-16 ***
## PricePremium      5.800e-04  2.272e-05  25.530  < 2e-16 ***
## WidthEconomy     -8.712e-02  4.089e-02  -2.130   0.0337 *  
## WidthPremium      1.111e-01  2.149e-02   5.167 3.59e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.212 on 446 degrees of freedom
## Multiple R-squared:  0.784,  Adjusted R-squared:  0.7786 
## F-statistic: 147.1 on 11 and 446 DF,  p-value: < 2.2e-16

Thus the aitline prices are compared and analysed.