Airline Data Analysis

Airline_Group5

First Slide

For more details on authoring R presentations please visit https://support.rstudio.com/hc/en-us/articles/200486468.

  • Removing all the Columns that doesnt make sense rationally – Feature Selection
  • We run linear regression to tell the values that significantly affect the predicition
  • Our Top 3 terms are Departure Time

Slide with Trial 1

setwd("~/Desktop/Dropbox/Study Material/DAM/R_Workspace/Class 8 - Class Exercise/")
airline = read.csv("Mod_AirlinePricingData.csv")
colnames(airline)
 [1] "DepartureCityCode"   "ArrivalCityCode"     "DepartureTime"      
 [4] "Capacity"            "SeatPitch"           "SeatWidth"          
 [7] "DateDeparture"       "IsWeekend"           "Price"              
[10] "AdvancedBookingDays" "IsDiwali"            "DayBeforeDiwali"    
[13] "DayAfterDiwali"      "MarketShare"         "LoadFactor"         
m = lm(Price~DepartureTime + Capacity + SeatPitch + SeatWidth+ IsWeekend + AdvancedBookingDays + IsDiwali + DayBeforeDiwali + DayAfterDiwali + MarketShare + LoadFactor,data = airline)
summary(m)

Call:
lm(formula = Price ~ DepartureTime + Capacity + SeatPitch + SeatWidth + 
    IsWeekend + AdvancedBookingDays + IsDiwali + DayBeforeDiwali + 
    DayAfterDiwali + MarketShare + LoadFactor, data = airline)

Residuals:
    Min      1Q  Median      3Q     Max 
-3668.8 -1179.6  -408.9   819.7 11568.9 

Coefficients: (1 not defined because of singularities)
                     Estimate Std. Error t value Pr(>|t|)    
(Intercept)         10002.490  11187.532   0.894  0.37201    
DepartureTime         -77.806     22.917  -3.395  0.00078 ***
Capacity               -5.526      5.638  -0.980  0.32784    
SeatPitch            -246.723    259.773  -0.950  0.34301    
SeatWidth            1001.036    524.814   1.907  0.05744 .  
IsWeekendYes         -967.186    385.022  -2.512  0.01254 *  
AdvancedBookingDays   -90.621     12.593  -7.196 5.17e-12 ***
IsDiwali             3930.349    615.240   6.388 6.55e-10 ***
DayBeforeDiwali       788.764    383.534   2.057  0.04061 *  
DayAfterDiwali             NA         NA      NA       NA    
MarketShare           -33.059     20.804  -1.589  0.11311    
LoadFactor           -127.794     47.165  -2.710  0.00713 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2103 on 294 degrees of freedom
Multiple R-squared:  0.2498,    Adjusted R-squared:  0.2243 
F-statistic:  9.79 on 10 and 294 DF,  p-value: 3.93e-14

Slide With Trial 2


Call:
lm(formula = Price ~ DepartureTime + IsWeekend + AdvancedBookingDays + 
    IsDiwali + DayBeforeDiwali + LoadFactor, data = airline)

Residuals:
    Min      1Q  Median      3Q     Max 
-3566.1 -1219.2  -466.5   766.8 11609.9 

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)    
(Intercept)         16597.49    2585.39   6.420 5.37e-10 ***
DepartureTime         -73.61      21.84  -3.370 0.000851 ***
IsWeekendYes         -883.20     376.52  -2.346 0.019646 *  
AdvancedBookingDays   -89.89      12.44  -7.228 4.14e-12 ***
IsDiwali             3924.94     610.01   6.434 4.94e-10 ***
DayBeforeDiwali       789.02     383.50   2.057 0.040515 *  
LoadFactor           -108.91      29.13  -3.738 0.000222 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2104 on 298 degrees of freedom
Multiple R-squared:  0.2391,    Adjusted R-squared:  0.2238 
F-statistic: 15.61 on 6 and 298 DF,  p-value: 1.397e-15

Slide With Trial 3

Error in parse(text = x, srcfile = src) : <text>:2:1: unexpected ','
1: m2 = lm(Price~DepartureTime +IsWeekend + AdvancedBookingDays + IsDiwali + LoadFactor,data = airline)
2: ,
   ^