R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

# Analysis of Airline Ticket Pricing
# NAME: RAJ KAPOOR GUPTA
# EMAIL: mr.rajkapoor393@gmail.com
# COLLEGE : NIT ROURKELA


sixAirlines <- read.csv(paste("SixAirlinesDataV2.csv", sep=""))
View(sixAirlines)
library(psych)
summary(sixAirlines)
##       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
library(corrplot)
## corrplot 0.84 loaded
## corrplot 0.84 loaded
library(corrgram)
str(sixAirlines)
## '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 ...
boxplot(sixAirlines$SeatsEconomy, xlab= "Seats Economy", 
        ylab = "Seats Economy", main= "Seats Economy distribution", horizontal = TRUE)

boxplot(sixAirlines$SeatsPremium, xlab= "Seats Premium", ylab = "Seats Premium", 
        main= "Seats Premium distribution", horizontal = TRUE)

boxplot(sixAirlines$PitchEconomy, xlab= "Pitch Economy", ylab = "Pitch Economy",
        main= "Pitch Economy distribution", horizontal = TRUE)

boxplot(sixAirlines$PitchPremium, xlab= "PitchPremium", ylab = "PitchPremium", 
        main= "PitchPremium distribution", horizontal = TRUE)

boxplot(sixAirlines$WidthEconomy, xlab= "WidthEconomy", ylab = "WidthEconomy", 
        main= "WidthEconomy distribution", horizontal = TRUE)

boxplot(sixAirlines$WidthPremium, xlab= "WidthPremium", ylab = "WidthPremium",
        main= "WidthPremium distribution", horizontal = TRUE)
boxplot(sixAirlines$WidthPremium, xlab= "WidthPremium", ylab = "WidthPremium",
        main= "WidthPremium distribution", horizontal = TRUE)

boxplot(sixAirlines$PricePremium , xlab= "PricePremium ", ylab = "PricePremium ",
        main= "PricePremium  distribution", horizontal = TRUE)

boxplot(sixAirlines$PriceRelative, xlab= "PriceRelative", ylab = "PriceRelative", 
        main= "PriceRelative distribution", horizontal = TRUE)

boxplot(sixAirlines$SeatsTotal, xlab= "SeatsTotal", ylab = "SeatsTotal",
        main= "SeatsTotal distribution", horizontal = TRUE)

boxplot(sixAirlines$PitchDifference, xlab= "PitchDifference", ylab = "PitchDifference", 
        main= "PitchDifference distribution", horizontal = TRUE)

boxplot(sixAirlines$WidthDifference, xlab= "WidthDifference", ylab = "WidthDifference",
        main= "WidthDifference distribution", horizontal = TRUE)

boxplot(sixAirlines$PercentPremiumSeats, xlab= "PercentPremiumSeats", ylab = "PercentPremiumSeats", 
        main= "PercentPremiumSeats distribution", horizontal = TRUE)

plot(x=sixAirlines$SeatsEconomy,y=sixAirlines$PitchEconomy, xlab= "Seats Economy", 
     ylab = "Pitch Economy")

plot(x=sixAirlines$SeatsPremium,y=sixAirlines$PitchPremium, xlab= "Seats Premium",
     ylab = "Pitch Premium")

plot(x=sixAirlines$SeatsEconomy,y=sixAirlines$WidthEconomy, xlab= "Seats Economy", 
     ylab = "Width Economy")

plot(x=sixAirlines$SeatsPremium,y=sixAirlines$WidthPremium, xlab= "Seats Premium", 
     ylab = "Width Premmium")

plot(x=sixAirlines$PitchEconomy,y=sixAirlines$PriceEconomy, xlab= "Pitch Economy", 
     ylab = "Price Economy")

plot(x=sixAirlines$PitchPremium,y=sixAirlines$PricePremium, xlab= "Pitch Premium", ylab = "Price Premium")

plot(x=sixAirlines$WidthEconomy,y=sixAirlines$PriceEconomy, xlab= "Width Economy", ylab = "Price Economy")

plot(x=sixAirlines$WidthPremium,y=sixAirlines$PricePremium, xlab= "Width Premium", ylab = "Price Premium")

plot(x=sixAirlines$PitchDifference,y=sixAirlines$PriceRelative, xlab= "Pitch Difference", ylab = "Price Relative")

plot(x=sixAirlines$WidthDifference,y=sixAirlines$PriceRelative, xlab= "Width Difference", ylab = "Price Relative")

plot(x=sixAirlines$PercentPremiumSeats,y=sixAirlines$PriceRelative, xlab= "Percent premium Seats", ylab = "Price Relative")

library(corrplot)
library(corrgram)
mytable <- sixAirlines[,6:18]
cov(mytable)
##                      SeatsEconomy  SeatsPremium PitchEconomy PitchPremium
## SeatsEconomy         5832.9154300  633.07060954    7.2117665  11.96373253
## SeatsPremium          633.0706095  175.86521648   -0.2972586   0.08508595
## PitchEconomy            7.2117665   -0.29725856    0.4292471  -0.47398546
## PitchPremium           11.9637325    0.08508595   -0.4739855   1.72639580
## WidthEconomy           15.9105138    3.36977440    0.1075650  -0.01739081
## WidthPremium            8.5832800   -0.03954019   -0.3876621   1.08157435
## PriceEconomy         9673.7944684 1489.38359627  238.7031905  65.42513354
## PricePremium        17413.2541733 3717.36428960  190.8517195 149.85356368
## PriceRelative           0.1361699   -0.58078765   -0.1248808   0.24719874
## SeatsTotal           6465.9860396  808.93582602    6.9145079  12.04881848
## PitchDifference         4.7519660    0.38234451   -0.9032326   2.20038126
## WidthDifference        -7.3272338   -3.40931459   -0.4952271   1.09896515
## PercentPremiumSeats  -122.3914537   31.14753127   -0.3261739  -1.11655834
##                     WidthEconomy WidthPremium  PriceEconomy  PricePremium
## SeatsEconomy         15.91051379   8.58327998    9673.79447   17413.25417
## SeatsPremium          3.36977440  -0.03954019    1489.38360    3717.36429
## PitchEconomy          0.10756500  -0.38766208     238.70319     190.85172
## PitchPremium         -0.01739081   1.08157435      65.42513     149.85356
## WidthEconomy          0.31081765   0.05010845      37.46095     108.11612
## WidthPremium          0.05010845   1.20378776     -61.85450      90.47998
## PriceEconomy         37.46095191 -61.85450011  976684.06198 1147494.76801
## PricePremium        108.11611707  90.47997668 1147494.76801 1659293.11947
## PriceRelative        -0.01104335   0.24928593    -128.49992      18.48429
## SeatsTotal           19.28028819   8.54373979   11163.17806   21130.61846
## PitchDifference      -0.12495581   1.46923643    -173.27806     -40.99816
## WidthDifference      -0.26070920   1.15367930     -99.31545     -17.63614
## PercentPremiumSeats   0.61321816  -0.97393787     312.61077     726.01582
##                     PriceRelative    SeatsTotal PitchDifference
## SeatsEconomy           0.13616991  6465.9860396       4.7519660
## SeatsPremium          -0.58078765   808.9358260       0.3823445
## PitchEconomy          -0.12488080     6.9145079      -0.9032326
## PitchPremium           0.24719874    12.0488185       2.2003813
## WidthEconomy          -0.01104335    19.2802882      -0.1249558
## WidthPremium           0.24928593     8.5437398       1.4692364
## PriceEconomy        -128.49991725 11163.1780647    -173.2780570
## PricePremium          18.48428836 21130.6184629     -40.9981558
## PriceRelative          0.20302893    -0.4446177       0.3720795
## SeatsTotal            -0.44461774  7274.9218656       5.1343105
## PitchDifference        0.37207954     5.1343105       3.1036138
## WidthDifference        0.26032928   -10.7365484       1.5941922
## PercentPremiumSeats   -0.35252750   -91.2439224      -0.7903844
##                     WidthDifference PercentPremiumSeats
## SeatsEconomy             -7.3272338        -122.3914537
## SeatsPremium             -3.4093146          31.1475313
## PitchEconomy             -0.4952271          -0.3261739
## PitchPremium              1.0989652          -1.1165583
## WidthEconomy             -0.2607092           0.6132182
## WidthPremium              1.1536793          -0.9739379
## PriceEconomy            -99.3154520         312.6107669
## PricePremium            -17.6361404         726.0158229
## PriceRelative             0.2603293          -0.3525275
## SeatsTotal              -10.7365484         -91.2439224
## PitchDifference           1.5941922          -0.7903844
## WidthDifference           1.4143885          -1.5871560
## PercentPremiumSeats      -1.5871560          23.4493343
cor(mytable)
##                     SeatsEconomy SeatsPremium PitchEconomy PitchPremium
## SeatsEconomy         1.000000000  0.625056587   0.14412692  0.119221250
## SeatsPremium         0.625056587  1.000000000  -0.03421296  0.004883123
## PitchEconomy         0.144126924 -0.034212963   1.00000000 -0.550606241
## PitchPremium         0.119221250  0.004883123  -0.55060624  1.000000000
## WidthEconomy         0.373670252  0.455782883   0.29448586 -0.023740873
## WidthPremium         0.102431959 -0.002717527  -0.53929285  0.750259029
## PriceEconomy         0.128167220  0.113642176   0.36866123  0.050384550
## PricePremium         0.177000928  0.217612376   0.22614179  0.088539147
## PriceRelative        0.003956939 -0.097196009  -0.42302204  0.417539056
## SeatsTotal           0.992607966  0.715171053   0.12373524  0.107512784
## PitchDifference      0.035318044  0.016365566  -0.78254993  0.950591466
## WidthDifference     -0.080670148 -0.216168666  -0.63557430  0.703281797
## PercentPremiumSeats -0.330935223  0.485029771  -0.10280880 -0.175487414
##                     WidthEconomy WidthPremium PriceEconomy PricePremium
## SeatsEconomy          0.37367025  0.102431959   0.12816722   0.17700093
## SeatsPremium          0.45578288 -0.002717527   0.11364218   0.21761238
## PitchEconomy          0.29448586 -0.539292852   0.36866123   0.22614179
## PitchPremium         -0.02374087  0.750259029   0.05038455   0.08853915
## WidthEconomy          1.00000000  0.081918728   0.06799061   0.15054837
## WidthPremium          0.08191873  1.000000000  -0.05704522   0.06402004
## PriceEconomy          0.06799061 -0.057045224   1.00000000   0.90138870
## PricePremium          0.15054837  0.064020043   0.90138870   1.00000000
## PriceRelative        -0.04396116  0.504247591  -0.28856711   0.03184654
## SeatsTotal            0.40545860  0.091297500   0.13243313   0.19232533
## PitchDifference      -0.12722421  0.760121272  -0.09952511  -0.01806629
## WidthDifference      -0.39320512  0.884149655  -0.08449975  -0.01151218
## PercentPremiumSeats   0.22714172 -0.183312058   0.06532232   0.11639097
##                     PriceRelative  SeatsTotal PitchDifference
## SeatsEconomy          0.003956939  0.99260797      0.03531804
## SeatsPremium         -0.097196009  0.71517105      0.01636557
## PitchEconomy         -0.423022038  0.12373524     -0.78254993
## PitchPremium          0.417539056  0.10751278      0.95059147
## WidthEconomy         -0.043961160  0.40545860     -0.12722421
## WidthPremium          0.504247591  0.09129750      0.76012127
## PriceEconomy         -0.288567110  0.13243313     -0.09952511
## PricePremium          0.031846537  0.19232533     -0.01806629
## PriceRelative         1.000000000 -0.01156894      0.46873025
## SeatsTotal           -0.011568942  1.00000000      0.03416915
## PitchDifference       0.468730249  0.03416915      1.00000000
## WidthDifference       0.485802437 -0.10584398      0.76089108
## PercentPremiumSeats  -0.161565556 -0.22091465     -0.09264869
##                     WidthDifference PercentPremiumSeats
## 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
corr.test(mytable, use= "complete")
## Call:corr.test(x = mytable, use = "complete")
## Correlation matrix 
##                     SeatsEconomy SeatsPremium PitchEconomy PitchPremium
## SeatsEconomy                1.00         0.63         0.14         0.12
## SeatsPremium                0.63         1.00        -0.03         0.00
## PitchEconomy                0.14        -0.03         1.00        -0.55
## PitchPremium                0.12         0.00        -0.55         1.00
## WidthEconomy                0.37         0.46         0.29        -0.02
## WidthPremium                0.10         0.00        -0.54         0.75
## PriceEconomy                0.13         0.11         0.37         0.05
## PricePremium                0.18         0.22         0.23         0.09
## PriceRelative               0.00        -0.10        -0.42         0.42
## SeatsTotal                  0.99         0.72         0.12         0.11
## PitchDifference             0.04         0.02        -0.78         0.95
## WidthDifference            -0.08        -0.22        -0.64         0.70
## PercentPremiumSeats        -0.33         0.49        -0.10        -0.18
##                     WidthEconomy WidthPremium PriceEconomy PricePremium
## SeatsEconomy                0.37         0.10         0.13         0.18
## SeatsPremium                0.46         0.00         0.11         0.22
## PitchEconomy                0.29        -0.54         0.37         0.23
## PitchPremium               -0.02         0.75         0.05         0.09
## WidthEconomy                1.00         0.08         0.07         0.15
## WidthPremium                0.08         1.00        -0.06         0.06
## PriceEconomy                0.07        -0.06         1.00         0.90
## PricePremium                0.15         0.06         0.90         1.00
## PriceRelative              -0.04         0.50        -0.29         0.03
## SeatsTotal                  0.41         0.09         0.13         0.19
## PitchDifference            -0.13         0.76        -0.10        -0.02
## WidthDifference            -0.39         0.88        -0.08        -0.01
## PercentPremiumSeats         0.23        -0.18         0.07         0.12
##                     PriceRelative SeatsTotal PitchDifference
## SeatsEconomy                 0.00       0.99            0.04
## SeatsPremium                -0.10       0.72            0.02
## PitchEconomy                -0.42       0.12           -0.78
## PitchPremium                 0.42       0.11            0.95
## WidthEconomy                -0.04       0.41           -0.13
## WidthPremium                 0.50       0.09            0.76
## PriceEconomy                -0.29       0.13           -0.10
## PricePremium                 0.03       0.19           -0.02
## PriceRelative                1.00      -0.01            0.47
## SeatsTotal                  -0.01       1.00            0.03
## PitchDifference              0.47       0.03            1.00
## WidthDifference              0.49      -0.11            0.76
## PercentPremiumSeats         -0.16      -0.22           -0.09
##                     WidthDifference PercentPremiumSeats
## SeatsEconomy                  -0.08               -0.33
## SeatsPremium                  -0.22                0.49
## PitchEconomy                  -0.64               -0.10
## PitchPremium                   0.70               -0.18
## WidthEconomy                  -0.39                0.23
## WidthPremium                   0.88               -0.18
## PriceEconomy                  -0.08                0.07
## PricePremium                  -0.01                0.12
## PriceRelative                  0.49               -0.16
## SeatsTotal                    -0.11               -0.22
## PitchDifference                0.76               -0.09
## WidthDifference                1.00               -0.28
## PercentPremiumSeats           -0.28                1.00
## Sample Size 
## [1] 458
## Probability values (Entries above the diagonal are adjusted for multiple tests.) 
##                     SeatsEconomy SeatsPremium PitchEconomy PitchPremium
## SeatsEconomy                0.00         0.00         0.08         0.35
## SeatsPremium                0.00         0.00         1.00         1.00
## PitchEconomy                0.00         0.47         0.00         0.00
## PitchPremium                0.01         0.92         0.00         0.00
## WidthEconomy                0.00         0.00         0.00         0.61
## WidthPremium                0.03         0.95         0.00         0.00
## PriceEconomy                0.01         0.01         0.00         0.28
## PricePremium                0.00         0.00         0.00         0.06
## PriceRelative               0.93         0.04         0.00         0.00
## SeatsTotal                  0.00         0.00         0.01         0.02
## PitchDifference             0.45         0.73         0.00         0.00
## WidthDifference             0.08         0.00         0.00         0.00
## PercentPremiumSeats         0.00         0.00         0.03         0.00
##                     WidthEconomy WidthPremium PriceEconomy PricePremium
## SeatsEconomy                0.00         0.78         0.22         0.01
## SeatsPremium                0.00         1.00         0.46         0.00
## PitchEconomy                0.00         0.00         0.00         0.00
## PitchPremium                1.00         0.00         1.00         1.00
## WidthEconomy                0.00         1.00         1.00         0.05
## WidthPremium                0.08         0.00         1.00         1.00
## PriceEconomy                0.15         0.22         0.00         0.00
## PricePremium                0.00         0.17         0.00         0.00
## PriceRelative               0.35         0.00         0.00         0.50
## SeatsTotal                  0.00         0.05         0.00         0.00
## PitchDifference             0.01         0.00         0.03         0.70
## WidthDifference             0.00         0.00         0.07         0.81
## PercentPremiumSeats         0.00         0.00         0.16         0.01
##                     PriceRelative SeatsTotal PitchDifference
## SeatsEconomy                 1.00       0.00            1.00
## SeatsPremium                 0.94       0.00            1.00
## PitchEconomy                 0.00       0.27            0.00
## PitchPremium                 0.00       0.64            0.00
## WidthEconomy                 1.00       0.00            0.22
## WidthPremium                 0.00       1.00            0.00
## PriceEconomy                 0.00       0.17            0.86
## PricePremium                 1.00       0.00            1.00
## PriceRelative                0.00       1.00            0.00
## SeatsTotal                   0.80       0.00            1.00
## PitchDifference              0.00       0.47            0.00
## WidthDifference              0.00       0.02            0.00
## PercentPremiumSeats          0.00       0.00            0.05
##                     WidthDifference PercentPremiumSeats
## SeatsEconomy                   1.00                0.00
## SeatsPremium                   0.00                0.00
## PitchEconomy                   0.00                0.78
## PitchPremium                   0.00                0.01
## WidthEconomy                   0.00                0.00
## WidthPremium                   0.00                0.00
## PriceEconomy                   1.00                1.00
## PricePremium                   1.00                0.41
## PriceRelative                  0.00                0.02
## SeatsTotal                     0.68                0.00
## PitchDifference                0.00                1.00
## WidthDifference                0.00                0.00
## PercentPremiumSeats            0.00                0.00
## 
##  To see confidence intervals of the correlations, print with the short=FALSE option
corrgram(mytable, order= TRUE, lower.panel = panel.shade, upper.panel=panel.pie, text.panel = panel.txt,main="Corrgram of sixAirlines intercorrelation")

t.test(PriceRelative ~ IsInternational , data= sixAirlines)
## 
##  Welch Two Sample t-test
## 
## data:  PriceRelative by 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(PriceEconomy ~ Aircraft, data= sixAirlines)
## 
##  Welch Two Sample t-test
## 
## data:  PriceEconomy by Aircraft
## t = 0.64317, df = 289.45, p-value = 0.5206
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -131.7801  259.7135
## sample estimates:
## mean in group AirBus mean in group Boeing 
##             1369.954             1305.987
t.test(PricePremium ~ Aircraft, data= sixAirlines)
## 
##  Welch Two Sample t-test
## 
## data:  PricePremium by Aircraft
## t = 0.28645, df = 310.38, p-value = 0.7747
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -212.2929  284.6350
## sample estimates:
## mean in group AirBus mean in group Boeing 
##             1869.503             1833.332
t.test(PriceRelative ~ Aircraft, data= sixAirlines)
## 
##  Welch Two Sample t-test
## 
## data:  PriceRelative by Aircraft
## t = -2.6145, df = 363.72, p-value = 0.009306
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.18934647 -0.02678486
## sample estimates:
## mean in group AirBus mean in group Boeing 
##            0.4147682            0.5228339
model <- lm(PriceEconomy ~ SeatsEconomy + PitchEconomy + WidthEconomy, data = mytable)
summary(model)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy + PitchEconomy + WidthEconomy, 
##     data = mytable)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2209.23  -762.84   -39.25   727.96  1922.01 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1.414e+04  2.250e+03  -6.283 7.79e-10 ***
## SeatsEconomy  1.352e+00  6.051e-01   2.234   0.0260 *  
## PitchEconomy  5.700e+02  6.846e+01   8.325 1.00e-15 ***
## WidthEconomy -1.459e+02  8.584e+01  -1.700   0.0898 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 915.7 on 454 degrees of freedom
## Multiple R-squared:  0.1471, Adjusted R-squared:  0.1415 
## F-statistic:  26.1 on 3 and 454 DF,  p-value: 1.366e-15
model <- lm(PricePremium~ SeatsPremium + PitchPremium + WidthPremium, data = mytable)
summary(model)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium + PitchPremium + WidthPremium, 
##     data = mytable)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2219.2  -936.9  -120.4  1078.6  5762.8 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -2127.171   1736.937  -1.225    0.221    
## SeatsPremium    21.095      4.432   4.760 2.61e-06 ***
## PitchPremium    87.481     67.656   1.293    0.197    
## WidthPremium    -2.744     81.021  -0.034    0.973    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1256 on 454 degrees of freedom
## Multiple R-squared:  0.05501,    Adjusted R-squared:  0.04877 
## F-statistic: 8.809 on 3 and 454 DF,  p-value: 1.094e-05
model <- lm(PriceRelative ~ PitchDifference + WidthDifference, data= mytable)
summary(model)
## 
## Call:
## lm(formula = PriceRelative ~ PitchDifference + WidthDifference, 
##     data = mytable)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.84163 -0.28484 -0.07241  0.17698  1.18778 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -0.10514    0.08304  -1.266 0.206077    
## PitchDifference  0.06019    0.01590   3.785 0.000174 ***
## WidthDifference  0.11621    0.02356   4.933 1.14e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3886 on 455 degrees of freedom
## Multiple R-squared:  0.2593, Adjusted R-squared:  0.2561 
## F-statistic: 79.65 on 2 and 455 DF,  p-value: < 2.2e-16
model <- lm(PriceEconomy ~ . , data= mytable)
summary(model)
## 
## Call:
## lm(formula = PriceEconomy ~ ., data = mytable)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1249.84   -85.09     2.48   117.87   581.01 
## 
## Coefficients: (3 not defined because of singularities)
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         -9.816e+03  9.529e+02 -10.301  < 2e-16 ***
## SeatsEconomy         2.190e+00  5.015e-01   4.366 1.57e-05 ***
## SeatsPremium        -1.761e+01  2.966e+00  -5.939 5.77e-09 ***
## PitchEconomy         2.451e+02  2.497e+01   9.816  < 2e-16 ***
## PitchPremium         1.471e+02  1.212e+01  12.136  < 2e-16 ***
## WidthEconomy        -2.055e+02  2.458e+01  -8.360 8.01e-16 ***
## WidthPremium         1.942e+01  1.560e+01   1.246    0.214    
## PricePremium         6.730e-01  8.749e-03  76.926  < 2e-16 ***
## PriceRelative       -7.528e+02  2.642e+01 -28.492  < 2e-16 ***
## SeatsTotal                  NA         NA      NA       NA    
## PitchDifference             NA         NA      NA       NA    
## WidthDifference             NA         NA      NA       NA    
## PercentPremiumSeats  3.259e+01  7.090e+00   4.597 5.59e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 210.2 on 448 degrees of freedom
## Multiple R-squared:  0.9557, Adjusted R-squared:  0.9548 
## F-statistic:  1073 on 9 and 448 DF,  p-value: < 2.2e-16
model <- lm(PricePremium ~ . , data= mytable)
summary(model)
## 
## Call:
## lm(formula = PricePremium ~ ., data = mytable)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -884.43 -137.82   -5.22   95.60 2154.66 
## 
## Coefficients: (3 not defined because of singularities)
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1.064e+04  1.433e+03   7.424 5.76e-13 ***
## SeatsEconomy        -2.479e+00  7.242e-01  -3.422 0.000678 ***
## SeatsPremium         2.285e+01  4.279e+00   5.340 1.48e-07 ***
## PitchEconomy        -2.575e+02  3.751e+01  -6.867 2.20e-11 ***
## PitchPremium        -1.866e+02  1.797e+01 -10.384  < 2e-16 ***
## WidthEconomy         2.457e+02  3.604e+01   6.817 3.01e-11 ***
## WidthPremium        -9.399e+00  2.238e+01  -0.420 0.674650    
## PriceEconomy         1.381e+00  1.796e-02  76.926  < 2e-16 ***
## PriceRelative        1.067e+03  3.858e+01  27.660  < 2e-16 ***
## SeatsTotal                  NA         NA      NA       NA    
## PitchDifference             NA         NA      NA       NA    
## WidthDifference             NA         NA      NA       NA    
## PercentPremiumSeats -3.398e+01  1.027e+01  -3.309 0.001012 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 301.1 on 448 degrees of freedom
## Multiple R-squared:  0.9464, Adjusted R-squared:  0.9454 
## F-statistic: 879.7 on 9 and 448 DF,  p-value: < 2.2e-16
model <- lm(PriceRelative ~ . , data= mytable)
summary(model)
## 
## Call:
## lm(formula = PriceRelative ~ ., data = mytable)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.86630 -0.10024 -0.00421  0.07693  0.83219 
## 
## Coefficients: (3 not defined because of singularities)
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         -6.658e+00  1.085e+00  -6.135 1.88e-09 ***
## SeatsEconomy         1.892e-03  5.387e-04   3.513 0.000488 ***
## SeatsPremium        -1.660e-02  3.190e-03  -5.206 2.95e-07 ***
## PitchEconomy         1.232e-01  2.877e-02   4.281 2.27e-05 ***
## PitchPremium         1.223e-01  1.373e-02   8.904  < 2e-16 ***
## WidthEconomy        -1.474e-01  2.731e-02  -5.398 1.09e-07 ***
## WidthPremium         5.990e-02  1.642e-02   3.649 0.000294 ***
## PriceEconomy        -8.559e-04  3.004e-05 -28.492  < 2e-16 ***
## PricePremium         5.911e-04  2.137e-05  27.660  < 2e-16 ***
## SeatsTotal                  NA         NA      NA       NA    
## PitchDifference             NA         NA      NA       NA    
## WidthDifference             NA         NA      NA       NA    
## PercentPremiumSeats  2.389e-02  7.654e-03   3.121 0.001920 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2241 on 448 degrees of freedom
## Multiple R-squared:  0.7575, Adjusted R-squared:  0.7527 
## F-statistic: 155.5 on 9 and 448 DF,  p-value: < 2.2e-16

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.