this is the Premium Economy Vs Economy Ticket Pricing by Airlines Project A short Description:-

DATA FIELD DESCRIPTION – PREMIUM ECONOMY VS ECONOMY

This dataset describes information about Premium Economy and Regular Economy Air Tickets.

-We collected data in May for hypothetical future travel in July, August, September and October. -We visited the websites of the following six airlines British Airways, Delta Airlines, Air France, Singapore Airlines, Virgin Airlines, Jet Airways. -We selected a variety of routes on which each airline flies (e.g. British Airways flying from London to Frankfurt). -We recorded the price of purchasing a Economy Ticket and a Premium Economy Ticket from the airline website. -We used the website Seat Guru to get additional information about the Aircraft being used by each airline on each route. -This generated a dataset having the following data fields:

DATA FIELD UNITS MEANING

Airline Factor Factor variable denoting the name of the There are 6 airlines in the data: British Airways Delta Airlines Air France Singapore Airlines Virgin Airlines Jet Airways

Aircraft Factor Manufacturer of the Airplane / Aircraft e.g.

                                                                    Boeing 
                                                                    Airbus 

TravelMonth Factor Factor variable denoting the month Travel

                                                                     Jul
                                                                     Aug    
                                                                     Sep 
                                                                     Oct

FlightDuration Hours Flight Duration

IsInternational Factor International or Domestic Flight w.r.t. Airlines’ Home Country

SeatsEconomy Number Number of Economy Seats in the Aircraft

SeatsPremium Number Number of Premium Economy Seats in the Aircraft

PitchEconomy Number (Inches) Distance between two consecutive Economy Seats

PitchPremium Number (Inches) Distance between two consecutive Premium Seats

WidthEconomy Number (Inches) Width between armrests of an Economy Seat

WidthPremium Number (Inches) Width between armrests of a Premium Economy Seat

PriceEconomy Number (USD) Price of Economy Seat

PricePremium Number (USD) Price of Premium Economy Seat

PriceRelative (PricePremium - PriceEconomy) / PriceEconomy

SeatsTotal SeatsEconomy + SeatsPremium

PercentPremiumSeats (SeatsPremium / SeatsTotal) * 100

PitchDifference PitchPremium - PitchEconomy

WidthDifference WidthPremium - WidthEconomy

setwd("G:/IIEST 2K15-2K20/Intern/Winter Internship/Resources/Week 3/week 3 day 3")
airline <- read.csv(paste("SixAirlinesDataV2.csv", sep=""))
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
library(psych)
describe(airline)
##                     vars   n    mean      sd  median trimmed     mad   min
## Airline*               1 458    3.01    1.65    2.00    2.89    1.48  1.00
## Aircraft*              2 458    1.67    0.47    2.00    1.71    0.00  1.00
## FlightDuration         3 458    7.58    3.54    7.79    7.57    4.81  1.25
## TravelMonth*           4 458    2.56    1.17    3.00    2.58    1.48  1.00
## IsInternational*       5 458    1.91    0.28    2.00    2.00    0.00  1.00
## SeatsEconomy           6 458  202.31   76.37  185.00  194.64   85.99 78.00
## SeatsPremium           7 458   33.65   13.26   36.00   33.35   11.86  8.00
## PitchEconomy           8 458   31.22    0.66   31.00   31.26    0.00 30.00
## PitchPremium           9 458   37.91    1.31   38.00   38.05    0.00 34.00
## WidthEconomy          10 458   17.84    0.56   18.00   17.81    0.00 17.00
## WidthPremium          11 458   19.47    1.10   19.00   19.53    0.00 17.00
## PriceEconomy          12 458 1327.08  988.27 1242.00 1244.40 1159.39 65.00
## PricePremium          13 458 1845.26 1288.14 1737.00 1799.05 1845.84 86.00
## PriceRelative         14 458    0.49    0.45    0.36    0.42    0.41  0.02
## SeatsTotal            15 458  235.96   85.29  227.00  228.73   90.44 98.00
## PitchDifference       16 458    6.69    1.76    7.00    6.76    0.00  2.00
## WidthDifference       17 458    1.63    1.19    1.00    1.53    0.00  0.00
## PercentPremiumSeats   18 458   14.65    4.84   13.21   14.31    2.68  4.71
##                         max   range  skew kurtosis    se
## Airline*               6.00    5.00  0.61    -0.95  0.08
## Aircraft*              2.00    1.00 -0.72    -1.48  0.02
## FlightDuration        14.66   13.41 -0.07    -1.12  0.17
## TravelMonth*           4.00    3.00 -0.14    -1.46  0.05
## IsInternational*       2.00    1.00 -2.91     6.50  0.01
## 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
## SeatsTotal           441.00  343.00  0.70    -0.53  3.99
## PitchDifference       10.00    8.00 -0.54     1.78  0.08
## WidthDifference        4.00    4.00  0.84    -0.53  0.06
## PercentPremiumSeats   24.69   19.98  0.71     0.28  0.23

Here we have six different airlines.First of all we divide all the airlines into 6 groups for better understanding.

British Airlines

Analyse all about British Airlines:-

British <- airline[ which(airline$Airline=='British'),]
View(British)
summary(British)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance:  0   AirBus: 47   Min.   : 1.250   Aug:52     
##  British  :175   Boeing:128   1st Qu.: 4.290   Jul:16     
##  Delta    :  0                Median : 8.580   Oct:53     
##  Jet      :  0                Mean   : 7.855   Sep:54     
##  Singapore:  0                3rd Qu.:11.120              
##  Virgin   :  0                Max.   :13.830              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     :  0    Min.   :122.0   Min.   :24.00   Min.   :31   
##  International:175    1st Qu.:122.0   1st Qu.:36.00   1st Qu.:31   
##                       Median :243.0   Median :40.00   Median :31   
##                       Mean   :216.6   Mean   :43.18   Mean   :31   
##                       3rd Qu.:303.0   3rd Qu.:55.00   3rd Qu.:31   
##                       Max.   :312.0   Max.   :56.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   
##  Min.   :38    Min.   :18    Min.   :19    Min.   :  65.0  
##  1st Qu.:38    1st Qu.:18    1st Qu.:19    1st Qu.: 528.5  
##  Median :38    Median :18    Median :19    Median :1444.0  
##  Mean   :38    Mean   :18    Mean   :19    Mean   :1293.5  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:19    3rd Qu.:1813.0  
##  Max.   :38    Max.   :18    Max.   :19    Max.   :3102.0  
##   PricePremium    PriceRelative      SeatsTotal    PitchDifference
##  Min.   :  86.0   Min.   :0.0400   Min.   :162.0   Min.   :7      
##  1st Qu.: 807.5   1st Qu.:0.2100   1st Qu.:162.0   1st Qu.:7      
##  Median :2049.0   Median :0.3600   Median :279.0   Median :7      
##  Mean   :1937.0   Mean   :0.4375   Mean   :259.8   Mean   :7      
##  3rd Qu.:2982.0   3rd Qu.:0.5200   3rd Qu.:358.0   3rd Qu.:7      
##  Max.   :7414.0   Max.   :1.3900   Max.   :367.0   Max.   :7      
##  WidthDifference PercentPremiumSeats
##  Min.   :1       Min.   :10.57      
##  1st Qu.:1       1st Qu.:12.90      
##  Median :1       Median :15.36      
##  Mean   :1       Mean   :17.79      
##  3rd Qu.:1       3rd Qu.:24.69      
##  Max.   :1       Max.   :24.69

Check the all the means now all british aircrafts

mean(British$PriceEconomy)
## [1] 1293.48
mean(British$PricePremium)
## [1] 1937.029
mean(British$FlightDuration)
## [1] 7.854971
mean(British$PitchEconomy)
## [1] 31
mean(British$PitchPremium)
## [1] 38
mean(British$WidthEconomy)
## [1] 18
mean(British$WidthPremium)
## [1] 19
mean(British$PriceRelative)
## [1] 0.4375429
mean(British$PitchDifference)
## [1] 7
mean(British$WidthDifference)
## [1] 1

Now Analyse separately for Each Aircrafts in British Airlines i.e-Boeing and AirBus

Brboeing <- British[ which(British$Aircraft=='Boeing'),]
View(Brboeing)
summary(Brboeing)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance:  0   AirBus:  0   Min.   : 1.250   Aug:39     
##  British  :128   Boeing:128   1st Qu.: 6.810   Jul:10     
##  Delta    :  0                Median : 8.910   Oct:39     
##  Jet      :  0                Mean   : 8.747   Sep:40     
##  Singapore:  0                3rd Qu.:11.410              
##  Virgin   :  0                Max.   :13.830              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     :  0    Min.   :122.0   Min.   :24.00   Min.   :31   
##  International:128    1st Qu.:122.0   1st Qu.:36.00   1st Qu.:31   
##                       Median :203.0   Median :40.00   Median :31   
##                       Mean   :184.8   Mean   :38.84   Mean   :31   
##                       3rd Qu.:243.0   3rd Qu.:40.00   3rd Qu.:31   
##                       Max.   :303.0   Max.   :56.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :19    Min.   :  65   Min.   :  86  
##  1st Qu.:38    1st Qu.:18    1st Qu.:19    1st Qu.:1126   1st Qu.:1539  
##  Median :38    Median :18    Median :19    Median :1609   Median :2236  
##  Mean   :38    Mean   :18    Mean   :19    Mean   :1515   Mean   :2261  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:19    3rd Qu.:1813   3rd Qu.:2989  
##  Max.   :38    Max.   :18    Max.   :19    Max.   :3102   Max.   :7414  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0400   Min.   :162.0   Min.   :7       Min.   :1      
##  1st Qu.:0.3300   1st Qu.:162.0   1st Qu.:7       1st Qu.:1      
##  Median :0.3800   Median :227.0   Median :7       Median :1      
##  Mean   :0.4795   Mean   :223.6   Mean   :7       Mean   :1      
##  3rd Qu.:0.5625   3rd Qu.:279.0   3rd Qu.:7       3rd Qu.:1      
##  Max.   :1.3900   Max.   :358.0   Max.   :7       Max.   :1      
##  PercentPremiumSeats
##  Min.   :10.57      
##  1st Qu.:12.90      
##  Median :18.73      
##  Mean   :18.69      
##  3rd Qu.:24.69      
##  Max.   :24.69
mean(Brboeing$PriceEconomy)
## [1] 1515.328
mean(Brboeing$PricePremium)
## [1] 2260.586
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Brboeing$PriceEconomy,Brboeing$TravelMonth,mean))
y2<-c(by(Brboeing$PricePremium,Brboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Brboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1389.0  -356.3   178.7   373.6  1100.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      679.18     155.63   4.364 2.63e-05 ***
## FlightDuration    95.59      16.77   5.701 8.02e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 588.7 on 126 degrees of freedom
## Multiple R-squared:  0.205,  Adjusted R-squared:  0.1987 
## F-statistic:  32.5 on 1 and 126 DF,  p-value: 8.021e-08
Brboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  137
##  [71]  109   77   77   69   65 1651 1651 2775 2230 2230 2230 2356 2356 2356
##  [85] 2356 1562 1562 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609
##  [99] 1609 1632 1632 1632 1140 1736 1736 1736  846  846  937 1485  891 1323
## [113] 1023 1023  757  533 3102 3102 3102 2166 2166 2166  649  575  575  797
## [127]  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1850.1845 1850.1845 1850.1845 1850.1845 1459.2125 1459.2125 1459.2125 
##         8         9        10        11        12        13        14 
## 1300.5295 1300.5295 1778.4904 1778.4904 1778.4904 1778.4904 1786.1378 
##        15        16        17        18        19        20        21 
## 1786.1378 1786.1378 1554.8047 1554.8047 1554.8047 1324.4276 1324.4276 
##        22        23        24        25        26        27        28 
## 1324.4276 1315.8243 1315.8243 1315.8243 1515.6119 1515.6119 1515.6119 
##        29        30        31        32        33        34        35 
## 1148.5380 1148.5380 1148.5380 1045.2984 1045.2984 1045.2984 1045.2984 
##        36        37        38        39        40        41        42 
## 1969.6748 1969.6748 1969.6748 1045.2984 1045.2984 1045.2984 1045.2984 
##        43        44        45        46        47        48        49 
## 1196.3340 1196.3340 1196.3340 1467.8158 1467.8158 1467.8158 1897.9806 
##        50        51        52        53        54        55        56 
## 1897.9806 1897.9806 1300.5295 1738.3417 1738.3417 1738.3417 1260.3808 
##        57        58        59        60        61        82        83 
## 1260.3808 1260.3808 1874.0826 1831.0661 1874.0826 1332.0749 1332.0749 
##        84        85        86        87        88        89       138 
## 1332.0749 1332.0749 1403.7691 1403.7691 1403.7691 1403.7691  798.6706 
##       144       147       148       149       151       240       241 
##  798.6706  806.3180  806.3180  798.6706  806.3180 1674.2949 1674.2949 
##       242       243       244       245       246       247       248 
## 1674.2949 1730.6943 1730.6943 1730.6943 1626.4988 1626.4988 1626.4988 
##       249       250       251       252       253       254       255 
## 1626.4988 1499.3612 1499.3612 1499.3612 1769.8871 1769.8871 1769.8871 
##       256       257       258       259       260       261       262 
## 1769.8871 1571.0554 1571.0554 1571.0554 1530.9067 1507.0086 1507.0086 
##       263       264       265       266       267       268       269 
## 1507.0086 1372.2236 1372.2236 1372.2236 1530.9067 1355.9730 1355.9730 
##       270       271       272       273       274       275       276 
## 1355.9730 1769.8871 1769.8871 1769.8871 1769.8871 1530.9067 1738.3417 
##       277       278       279       280       367       368       369 
## 1738.3417 1738.3417 1355.9730 1738.3417 2001.2202 2001.2202 2001.2202 
##       370       371       372       373       374       375       376 
## 1953.4241 1953.4241 1953.4241 1530.9067 1530.9067 1530.9067 1594.9534 
##       377       378 
## 1594.9534 1594.9534
cor(Brboeing$PriceEconomy,Brboeing$FlightDuration)
## [1] 0.4528194
fit<-lm(PriceEconomy~SeatsEconomy,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1310.60  -462.54    50.37   366.48  1608.20 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1733.7470   182.9411   9.477   <2e-16 ***
## SeatsEconomy   -1.1820     0.9389  -1.259     0.21    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 656.1 on 126 degrees of freedom
## Multiple R-squared:  0.01242,    Adjusted R-squared:  0.004583 
## F-statistic: 1.585 on 1 and 126 DF,  p-value: 0.2104
Brboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  137
##  [71]  109   77   77   69   65 1651 1651 2775 2230 2230 2230 2356 2356 2356
##  [85] 2356 1562 1562 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609
##  [99] 1609 1632 1632 1632 1140 1736 1736 1736  846  846  937 1485  891 1323
## [113] 1023 1023  757  533 3102 3102 3102 2166 2166 2166  649  575  575  797
## [127]  524  582
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##        9       10       11       12       13       14       15       16 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       17       18       19       20       21       22       23       24 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       25       26       27       28       29       30       31       32 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       33       34       35       36       37       38       39       40 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       41       42       43       44       45       46       47       48 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       49       50       51       52       53       54       55       56 
## 1589.544 1589.544 1589.544 1583.634 1583.634 1583.634 1583.634 1583.634 
##       57       58       59       60       61       82       83       84 
## 1583.634 1583.634 1583.634 1583.634 1583.634 1446.523 1446.523 1446.523 
##       85       86       87       88       89      138      144      147 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1375.604 1375.604 1375.604 
##      148      149      151      240      241      242      243      244 
## 1375.604 1375.604 1375.604 1446.523 1446.523 1446.523 1446.523 1446.523 
##      245      246      247      248      249      250      251      252 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      253      254      255      256      257      258      259      260 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      261      262      263      264      265      266      267      268 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      269      270      271      272      273      274      275      276 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      277      278      279      280      367      368      369      370 
## 1446.523 1446.523 1446.523 1446.523 1493.803 1493.803 1493.803 1493.803 
##      371      372      373      374      375      376      377      378 
## 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803
cor(Brboeing$PriceEconomy,Brboeing$SeatsEconomy)
## [1] -0.1114495
fit<-lm(PriceEconomy~PriceRelative,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1430.07  -325.06    81.24   322.10  1400.57 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1417.3      107.8   13.15   <2e-16 ***
## PriceRelative    204.4      189.3    1.08    0.282    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 657.2 on 126 degrees of freedom
## Multiple R-squared:  0.009169,   Adjusted R-squared:  0.001306 
## F-statistic: 1.166 on 1 and 126 DF,  p-value: 0.2823
Brboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  137
##  [71]  109   77   77   69   65 1651 1651 2775 2230 2230 2230 2356 2356 2356
##  [85] 2356 1562 1562 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609
##  [99] 1609 1632 1632 1632 1140 1736 1736 1736  846  846  937 1485  891 1323
## [113] 1023 1023  757  533 3102 3102 3102 2166 2166 2166  649  575  575  797
## [127]  524  582
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1494.984 1494.984 1494.984 1494.984 1554.260 1554.260 1554.260 1627.844 
##        9       10       11       12       13       14       15       16 
## 1627.844 1570.612 1570.612 1531.776 1470.456 1523.600 1523.600 1523.600 
##       17       18       19       20       21       22       23       24 
## 1494.984 1494.984 1494.984 1486.808 1486.808 1486.808 1484.764 1484.764 
##       25       26       27       28       29       30       31       32 
## 1484.764 1488.852 1484.764 1484.764 1486.808 1486.808 1486.808 1503.160 
##       33       34       35       36       37       38       39       40 
## 1503.160 1503.160 1503.160 1550.172 1550.172 1550.172 1466.368 1466.368 
##       41       42       43       44       45       46       47       48 
## 1466.368 1466.368 1452.060 1452.060 1452.060 1433.664 1433.664 1433.664 
##       49       50       51       52       53       54       55       56 
## 1523.600 1523.600 1523.600 1627.844 1490.896 1490.896 1490.896 1486.808 
##       57       58       59       60       61       82       83       84 
## 1486.808 1486.808 1460.236 1460.236 1541.996 1636.020 1636.020 1636.020 
##       85       86       87       88       89      138      144      147 
## 1636.020 1499.072 1499.072 1499.072 1499.072 1470.456 1478.632 1476.588 
##      148      149      151      240      241      242      243      244 
## 1476.588 1499.072 1484.764 1648.284 1648.284 1470.456 1509.292 1509.292 
##      245      246      247      248      249      250      251      252 
## 1509.292 1490.896 1490.896 1490.896 1490.896 1617.624 1617.624 1617.624 
##      253      254      255      256      257      258      259      260 
## 1484.764 1484.764 1484.764 1484.764 1490.896 1490.896 1490.896 1648.284 
##      261      262      263      264      265      266      267      268 
## 1503.160 1503.160 1503.160 1499.072 1499.072 1499.072 1580.832 1431.620 
##      269      270      271      272      273      274      275      276 
## 1431.620 1431.620 1644.196 1644.196 1603.316 1458.192 1580.832 1452.060 
##      277      278      279      280      367      368      369      370 
## 1452.060 1452.060 1460.236 1533.820 1701.428 1701.428 1701.428 1445.928 
##      371      372      373      374      375      376      377      378 
## 1445.928 1445.928 1574.700 1515.424 1515.424 1425.488 1523.600 1492.940
cor(Brboeing$PriceEconomy,Brboeing$PriceRelative)
## [1] 0.09575739
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1464.06  -367.54    72.62   308.85  1553.16 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         1592.473    196.883   8.088 4.32e-13 ***
## PercentPremiumSeats   -4.128     10.063  -0.410    0.682    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 659.8 on 126 degrees of freedom
## Multiple R-squared:  0.001334,   Adjusted R-squared:  -0.006592 
## F-statistic: 0.1683 on 1 and 126 DF,  p-value: 0.6823
Brboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  137
##  [71]  109   77   77   69   65 1651 1651 2775 2230 2230 2230 2356 2356 2356
##  [85] 2356 1562 1562 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609
##  [99] 1609 1632 1632 1632 1140 1736 1736 1736  846  846  937 1485  891 1323
## [113] 1023 1023  757  533 3102 3102 3102 2166 2166 2166  649  575  575  797
## [127]  524  582
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##        9       10       11       12       13       14       15       16 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       17       18       19       20       21       22       23       24 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       25       26       27       28       29       30       31       32 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       33       34       35       36       37       38       39       40 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       41       42       43       44       45       46       47       48 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       49       50       51       52       53       54       55       56 
## 1490.542 1490.542 1490.542 1495.496 1495.496 1495.496 1495.496 1495.496 
##       57       58       59       60       61       82       83       84 
## 1495.496 1495.496 1495.496 1495.496 1495.496 1515.147 1515.147 1515.147 
##       85       86       87       88       89      138      144      147 
## 1515.147 1515.147 1515.147 1515.147 1515.147 1529.060 1529.060 1529.060 
##      148      149      151      240      241      242      243      244 
## 1529.060 1529.060 1529.060 1539.216 1539.216 1539.216 1539.216 1539.216 
##      245      246      247      248      249      250      251      252 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      253      254      255      256      257      258      259      260 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      261      262      263      264      265      266      267      268 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      269      270      271      272      273      274      275      276 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      277      278      279      280      367      368      369      370 
## 1539.216 1539.216 1539.216 1539.216 1548.835 1548.835 1548.835 1548.835 
##      371      372      373      374      375      376      377      378 
## 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835
cor(Brboeing$PriceEconomy,Brboeing$PercentPremiumSeats)
## [1] -0.03652258
fit<-lm(PricePremium~FlightDuration,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Brboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2178.0  -803.3   196.7   489.7  4276.7 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      751.97     285.45   2.634  0.00949 ** 
## FlightDuration   172.47      30.76   5.608 1.24e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1080 on 126 degrees of freedom
## Multiple R-squared:  0.1997, Adjusted R-squared:  0.1934 
## F-statistic: 31.45 on 1 and 126 DF,  p-value: 1.236e-07
Brboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  172
##  [71]  141   99   99   97   86 3509 3509 3509 3227 3227 3227 3200 3200 3200
##  [85] 3200 3099 3099 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292
##  [99] 2292 2278 2278 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550
## [113] 1199 1199  912  837 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [127]  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 2864.7507 2864.7507 2864.7507 2864.7507 2159.3394 2159.3394 2159.3394 
##         8         9        10        11        12        13        14 
## 1873.0355 1873.0355 2735.3966 2735.3966 2735.3966 2735.3966 2749.1944 
##        15        16        17        18        19        20        21 
## 2749.1944 2749.1944 2331.8116 2331.8116 2331.8116 1916.1535 1916.1535 
##        22        23        24        25        26        27        28 
## 1916.1535 1900.6310 1900.6310 1900.6310 2261.0980 2261.0980 2261.0980 
##        29        30        31        32        33        34        35 
## 1598.8046 1598.8046 1598.8046 1412.5346 1412.5346 1412.5346 1412.5346 
##        36        37        38        39        40        41        42 
## 3080.3410 3080.3410 3080.3410 1412.5346 1412.5346 1412.5346 1412.5346 
##        43        44        45        46        47        48        49 
## 1685.0407 1685.0407 1685.0407 2174.8619 2174.8619 2174.8619 2950.9869 
##        50        51        52        53        54        55        56 
## 2950.9869 2950.9869 1873.0355 2662.9582 2662.9582 2662.9582 1800.5971 
##        57        58        59        60        61        82        83 
## 1800.5971 1800.5971 2907.8688 2830.2563 2907.8688 1929.9513 1929.9513 
##        84        85        86        87        88        89       138 
## 1929.9513 1929.9513 2059.3055 2059.3055 2059.3055 2059.3055  967.5563 
##       144       147       148       149       151       240       241 
##  967.5563  981.3541  981.3541  967.5563  981.3541 2547.4019 2547.4019 
##       242       243       244       245       246       247       248 
## 2547.4019 2649.1605 2649.1605 2649.1605 2461.1657 2461.1657 2461.1657 
##       249       250       251       252       253       254       255 
## 2461.1657 2231.7777 2231.7777 2231.7777 2719.8741 2719.8741 2719.8741 
##       256       257       258       259       260       261       262 
## 2719.8741 2361.1319 2361.1319 2361.1319 2288.6935 2245.5755 2245.5755 
##       263       264       265       266       267       268       269 
## 2245.5755 2002.3896 2002.3896 2002.3896 2288.6935 1973.0693 1973.0693 
##       270       271       272       273       274       275       276 
## 1973.0693 2719.8741 2719.8741 2719.8741 2719.8741 2288.6935 2662.9582 
##       277       278       279       280       367       368       369 
## 2662.9582 2662.9582 1973.0693 2662.9582 3137.2569 3137.2569 3137.2569 
##       370       371       372       373       374       375       376 
## 3051.0208 3051.0208 3051.0208 2288.6935 2288.6935 2288.6935 2404.2499 
##       377       378 
## 2404.2499 2404.2499
cor(Brboeing$PricePremium,Brboeing$FlightDuration)
## [1] 0.4469114
fit<-lm(PriceEconomy~SeatsEconomy,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1310.60  -462.54    50.37   366.48  1608.20 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1733.7470   182.9411   9.477   <2e-16 ***
## SeatsEconomy   -1.1820     0.9389  -1.259     0.21    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 656.1 on 126 degrees of freedom
## Multiple R-squared:  0.01242,    Adjusted R-squared:  0.004583 
## F-statistic: 1.585 on 1 and 126 DF,  p-value: 0.2104
Brboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  172
##  [71]  141   99   99   97   86 3509 3509 3509 3227 3227 3227 3200 3200 3200
##  [85] 3200 3099 3099 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292
##  [99] 2292 2278 2278 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550
## [113] 1199 1199  912  837 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [127]  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##        9       10       11       12       13       14       15       16 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       17       18       19       20       21       22       23       24 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       25       26       27       28       29       30       31       32 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       33       34       35       36       37       38       39       40 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       41       42       43       44       45       46       47       48 
## 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 1589.544 
##       49       50       51       52       53       54       55       56 
## 1589.544 1589.544 1589.544 1583.634 1583.634 1583.634 1583.634 1583.634 
##       57       58       59       60       61       82       83       84 
## 1583.634 1583.634 1583.634 1583.634 1583.634 1446.523 1446.523 1446.523 
##       85       86       87       88       89      138      144      147 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1375.604 1375.604 1375.604 
##      148      149      151      240      241      242      243      244 
## 1375.604 1375.604 1375.604 1446.523 1446.523 1446.523 1446.523 1446.523 
##      245      246      247      248      249      250      251      252 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      253      254      255      256      257      258      259      260 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      261      262      263      264      265      266      267      268 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      269      270      271      272      273      274      275      276 
## 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 1446.523 
##      277      278      279      280      367      368      369      370 
## 1446.523 1446.523 1446.523 1446.523 1493.803 1493.803 1493.803 1493.803 
##      371      372      373      374      375      376      377      378 
## 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803 1493.803
cor(Brboeing$PricePremium,Brboeing$SeatsEconomy)
## [1] -0.03416268
fit<-lm(PriceEconomy~SeatsPremium,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Brboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1331.0  -365.9    70.6   321.2  1247.0 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2404.163    302.234   7.955 8.88e-13 ***
## SeatsPremium  -22.882      7.644  -2.993  0.00332 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 637.9 on 126 degrees of freedom
## Multiple R-squared:  0.0664, Adjusted R-squared:  0.05899 
## F-statistic: 8.961 on 1 and 126 DF,  p-value: 0.003321
Brboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  172
##  [71]  141   99   99   97   86 3509 3509 3509 3227 3227 3227 3200 3200 3200
##  [85] 3200 3099 3099 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292
##  [99] 2292 2278 2278 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550
## [113] 1199 1199  912  837 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [127]  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##        9       10       11       12       13       14       15       16 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##       17       18       19       20       21       22       23       24 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##       25       26       27       28       29       30       31       32 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##       33       34       35       36       37       38       39       40 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##       41       42       43       44       45       46       47       48 
## 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 1488.870 
##       49       50       51       52       53       54       55       56 
## 1488.870 1488.870 1488.870 1511.753 1511.753 1511.753 1511.753 1511.753 
##       57       58       59       60       61       82       83       84 
## 1511.753 1511.753 1511.753 1511.753 1511.753 1122.753 1122.753 1122.753 
##       85       86       87       88       89      138      144      147 
## 1122.753 1122.753 1122.753 1122.753 1122.753 1145.636 1145.636 1145.636 
##      148      149      151      240      241      242      243      244 
## 1145.636 1145.636 1145.636 1580.400 1580.400 1580.400 1580.400 1580.400 
##      245      246      247      248      249      250      251      252 
## 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 
##      253      254      255      256      257      258      259      260 
## 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 
##      261      262      263      264      265      266      267      268 
## 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 
##      269      270      271      272      273      274      275      276 
## 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 1580.400 
##      277      278      279      280      367      368      369      370 
## 1580.400 1580.400 1580.400 1580.400 1854.987 1854.987 1854.987 1854.987 
##      371      372      373      374      375      376      377      378 
## 1854.987 1854.987 1854.987 1854.987 1854.987 1854.987 1854.987 1854.987
cor(Brboeing$PricePremium,Brboeing$SeatsPremium)
## [1] -0.2492273
fit<-lm(PriceEconomy~PriceRelative,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1430.07  -325.06    81.24   322.10  1400.57 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1417.3      107.8   13.15   <2e-16 ***
## PriceRelative    204.4      189.3    1.08    0.282    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 657.2 on 126 degrees of freedom
## Multiple R-squared:  0.009169,   Adjusted R-squared:  0.001306 
## F-statistic: 1.166 on 1 and 126 DF,  p-value: 0.2823
Brboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  172
##  [71]  141   99   99   97   86 3509 3509 3509 3227 3227 3227 3200 3200 3200
##  [85] 3200 3099 3099 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292
##  [99] 2292 2278 2278 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550
## [113] 1199 1199  912  837 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [127]  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1494.984 1494.984 1494.984 1494.984 1554.260 1554.260 1554.260 1627.844 
##        9       10       11       12       13       14       15       16 
## 1627.844 1570.612 1570.612 1531.776 1470.456 1523.600 1523.600 1523.600 
##       17       18       19       20       21       22       23       24 
## 1494.984 1494.984 1494.984 1486.808 1486.808 1486.808 1484.764 1484.764 
##       25       26       27       28       29       30       31       32 
## 1484.764 1488.852 1484.764 1484.764 1486.808 1486.808 1486.808 1503.160 
##       33       34       35       36       37       38       39       40 
## 1503.160 1503.160 1503.160 1550.172 1550.172 1550.172 1466.368 1466.368 
##       41       42       43       44       45       46       47       48 
## 1466.368 1466.368 1452.060 1452.060 1452.060 1433.664 1433.664 1433.664 
##       49       50       51       52       53       54       55       56 
## 1523.600 1523.600 1523.600 1627.844 1490.896 1490.896 1490.896 1486.808 
##       57       58       59       60       61       82       83       84 
## 1486.808 1486.808 1460.236 1460.236 1541.996 1636.020 1636.020 1636.020 
##       85       86       87       88       89      138      144      147 
## 1636.020 1499.072 1499.072 1499.072 1499.072 1470.456 1478.632 1476.588 
##      148      149      151      240      241      242      243      244 
## 1476.588 1499.072 1484.764 1648.284 1648.284 1470.456 1509.292 1509.292 
##      245      246      247      248      249      250      251      252 
## 1509.292 1490.896 1490.896 1490.896 1490.896 1617.624 1617.624 1617.624 
##      253      254      255      256      257      258      259      260 
## 1484.764 1484.764 1484.764 1484.764 1490.896 1490.896 1490.896 1648.284 
##      261      262      263      264      265      266      267      268 
## 1503.160 1503.160 1503.160 1499.072 1499.072 1499.072 1580.832 1431.620 
##      269      270      271      272      273      274      275      276 
## 1431.620 1431.620 1644.196 1644.196 1603.316 1458.192 1580.832 1452.060 
##      277      278      279      280      367      368      369      370 
## 1452.060 1452.060 1460.236 1533.820 1701.428 1701.428 1701.428 1445.928 
##      371      372      373      374      375      376      377      378 
## 1445.928 1445.928 1574.700 1515.424 1515.424 1425.488 1523.600 1492.940
cor(Brboeing$PricePremium,Brboeing$PriceRelative)
## [1] 0.5213261
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Brboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Brboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1464.06  -367.54    72.62   308.85  1553.16 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         1592.473    196.883   8.088 4.32e-13 ***
## PercentPremiumSeats   -4.128     10.063  -0.410    0.682    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 659.8 on 126 degrees of freedom
## Multiple R-squared:  0.001334,   Adjusted R-squared:  -0.006592 
## F-statistic: 0.1683 on 1 and 126 DF,  p-value: 0.6823
Brboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  172
##  [71]  141   99   99   97   86 3509 3509 3509 3227 3227 3227 3200 3200 3200
##  [85] 3200 3099 3099 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292
##  [99] 2292 2278 2278 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550
## [113] 1199 1199  912  837 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [127]  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##        9       10       11       12       13       14       15       16 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       17       18       19       20       21       22       23       24 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       25       26       27       28       29       30       31       32 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       33       34       35       36       37       38       39       40 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       41       42       43       44       45       46       47       48 
## 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 1490.542 
##       49       50       51       52       53       54       55       56 
## 1490.542 1490.542 1490.542 1495.496 1495.496 1495.496 1495.496 1495.496 
##       57       58       59       60       61       82       83       84 
## 1495.496 1495.496 1495.496 1495.496 1495.496 1515.147 1515.147 1515.147 
##       85       86       87       88       89      138      144      147 
## 1515.147 1515.147 1515.147 1515.147 1515.147 1529.060 1529.060 1529.060 
##      148      149      151      240      241      242      243      244 
## 1529.060 1529.060 1529.060 1539.216 1539.216 1539.216 1539.216 1539.216 
##      245      246      247      248      249      250      251      252 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      253      254      255      256      257      258      259      260 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      261      262      263      264      265      266      267      268 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      269      270      271      272      273      274      275      276 
## 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 1539.216 
##      277      278      279      280      367      368      369      370 
## 1539.216 1539.216 1539.216 1539.216 1548.835 1548.835 1548.835 1548.835 
##      371      372      373      374      375      376      377      378 
## 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835 1548.835
cor(Brboeing$PricePremium,Brboeing$PercentPremiumSeats)
## [1] -0.1123491
Brairbus <-British[ which(British$Aircraft=='AirBus'),]
View(Brairbus)
summary(Brairbus)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance: 0   AirBus:47   Min.   : 1.250   Aug:13     
##  British  :47   Boeing: 0   1st Qu.: 2.410   Jul: 6     
##  Delta    : 0               Median : 3.580   Oct:14     
##  Jet      : 0               Mean   : 5.426   Sep:14     
##  Singapore: 0               3rd Qu.:10.500              
##  Virgin   : 0               Max.   :13.080              
##       IsInternational  SeatsEconomy    SeatsPremium  PitchEconomy
##  Domestic     : 0     Min.   :303.0   Min.   :55    Min.   :31   
##  International:47     1st Qu.:303.0   1st Qu.:55    1st Qu.:31   
##                       Median :303.0   Median :55    Median :31   
##                       Mean   :303.2   Mean   :55    Mean   :31   
##                       3rd Qu.:303.0   3rd Qu.:55    3rd Qu.:31   
##                       Max.   :312.0   Max.   :55    Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy     PricePremium 
##  Min.   :38    Min.   :18    Min.   :19    Min.   :  74.0   Min.   :  97  
##  1st Qu.:38    1st Qu.:18    1st Qu.:19    1st Qu.: 176.5   1st Qu.: 206  
##  Median :38    Median :18    Median :19    Median : 297.0   Median : 319  
##  Mean   :38    Mean   :18    Mean   :19    Mean   : 689.3   Mean   :1056  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:19    3rd Qu.: 958.5   3rd Qu.:1634  
##  Max.   :38    Max.   :18    Max.   :19    Max.   :2384.0   Max.   :3563  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0400   Min.   :358.0   Min.   :7       Min.   :1      
##  1st Qu.:0.1200   1st Qu.:358.0   1st Qu.:7       1st Qu.:1      
##  Median :0.1900   Median :358.0   Median :7       Median :1      
##  Mean   :0.3232   Mean   :358.2   Mean   :7       Mean   :1      
##  3rd Qu.:0.4700   3rd Qu.:358.0   3rd Qu.:7       3rd Qu.:1      
##  Max.   :1.2700   Max.   :367.0   Max.   :7       Max.   :1      
##  PercentPremiumSeats
##  Min.   :14.99      
##  1st Qu.:15.36      
##  Median :15.36      
##  Mean   :15.35      
##  3rd Qu.:15.36      
##  Max.   :15.36
mean(Brairbus$PriceEconomy)
## [1] 689.2979
mean(Brairbus$PricePremium)
## [1] 1055.851
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Brairbus$PriceEconomy,Brairbus$TravelMonth,mean))
y4<-c(by(Brairbus$PricePremium,Brairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -961.8 -209.0   39.1  141.7  703.2 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -248.79      85.78   -2.90  0.00575 ** 
## FlightDuration   172.90      12.73   13.58  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 348.6 on 45 degrees of freedom
## Multiple R-squared:  0.8038, Adjusted R-squared:  0.7995 
## F-statistic: 184.4 on 1 and 45 DF,  p-value: < 2.2e-16
Brairbus$PriceEconomy
##  [1] 2384 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198
## [15]  457  402  402  392  356  356  322  297  303  303  276  249  238  238
## [29]  228  231  203  201  207  207  182  171  168  140  147  138  126  126
## [43]  109  109  104   97   74
fitted(fit)
##         99        100        101        102        103        104 
## 1680.80371 1680.80371 1680.80371 1680.80371 1566.68783 1566.68783 
##        105        106        107        108        109        110 
## 1566.68783 1566.68783 2012.77717 2012.77717 2012.77717 1680.80371 
##        111        112        113        114        115        116 
## 1680.80371 1680.80371  456.65158  370.20016  370.20016  167.90383 
##        117        118        119        120        121        122 
##  313.14222  313.14222  370.20016  211.12954  167.90383  167.90383 
##        123        124        125        126        127        128 
##  167.90383  313.14222   67.62018  370.20016  529.27077  167.90383 
##        129        130        131        132        133        134 
##  529.27077   67.62018  167.90383  370.20016  456.65158  240.52302 
##        135        136        137        139        140        141 
##  529.27077  -32.66347  456.65158  167.90383   67.62018   67.62018 
##        142        143        145        146        150 
##  -32.66347  -32.66347  370.20016  240.52302  167.90383
cor(Brairbus$PriceEconomy,Brairbus$FlightDuration)
## [1] 0.8965569
fit<-lm(PriceEconomy~SeatsEconomy,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -605.7 -511.2 -399.7  255.8 1681.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)  21868.03   26614.19   0.822    0.416
## SeatsEconomy   -69.85      87.78  -0.796    0.430
## 
## Residual standard error: 781.6 on 45 degrees of freedom
## Multiple R-squared:  0.01388,    Adjusted R-squared:  -0.008037 
## F-statistic: 0.6333 on 1 and 45 DF,  p-value: 0.4303
Brairbus$PriceEconomy
##  [1] 2384 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198
## [15]  457  402  402  392  356  356  322  297  303  303  276  249  238  238
## [29]  228  231  203  201  207  207  182  171  168  140  147  138  126  126
## [43]  109  109  104   97   74
fitted(fit)
##       99      100      101      102      103      104      105      106 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      107      108      109      110      111      112      113      114 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      115      116      117      118      119      120      121      122 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      123      124      125      126      127      128      129      130 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      131      132      133      134      135      136      137      139 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      140      141      142      143      145      146      150 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739  74.0000
cor(Brairbus$PriceEconomy,Brairbus$SeatsEconomy)
## [1] -0.1178013
fit<-lm(PriceEconomy~PriceRelative,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Brairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1395.36  -328.30   -92.42   219.66  1443.64 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      202.9      133.5   1.519    0.136    
## PriceRelative   1505.1      299.7   5.022 8.55e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 630 on 45 degrees of freedom
## Multiple R-squared:  0.3592, Adjusted R-squared:  0.3449 
## F-statistic: 25.22 on 1 and 45 DF,  p-value: 8.547e-06
Brairbus$PriceEconomy
##  [1] 2384 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198
## [15]  457  402  402  392  356  356  322  297  303  303  276  249  238  238
## [29]  228  231  203  201  207  207  182  171  168  140  147  138  126  126
## [43]  109  109  104   97   74
fitted(fit)
##        99       100       101       102       103       104       105 
##  940.3645  940.3645  940.3645  940.3645 1572.5146 1572.5146 1572.5146 
##       106       107       108       109       110       111       112 
## 1572.5146  910.2622  910.2622  910.2622 2114.3574 2114.3574  744.6991 
##       113       114       115       116       117       118       119 
##  293.1633  353.3681  353.3681  263.0610  368.4193  368.4193  323.2657 
##       120       121       122       123       124       125       126 
##  338.3169  278.1121  278.1121  368.4193  413.5729  458.7264  443.6752 
##       127       128       129       130       131       132       133 
##  428.6241  308.2145  458.7264  473.7776  413.5729  398.5217  443.6752 
##       134       135       136       137       139       140       141 
##  473.7776  473.7776  579.1360  503.8800  488.8288  549.0336  549.0336 
##       142       143       145       146       150 
##  654.3919  654.3919  579.1360  639.3407  669.4431
cor(Brairbus$PriceEconomy,Brairbus$PriceRelative)
## [1] 0.5993052
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -605.7 -511.2 -399.7  255.8 1681.3 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)
## (Intercept)           -25396      32780  -0.775    0.443
## PercentPremiumSeats     1699       2135   0.796    0.430
## 
## Residual standard error: 781.6 on 45 degrees of freedom
## Multiple R-squared:  0.01388,    Adjusted R-squared:  -0.008037 
## F-statistic: 0.6333 on 1 and 45 DF,  p-value: 0.4303
Brairbus$PriceEconomy
##  [1] 2384 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198
## [15]  457  402  402  392  356  356  322  297  303  303  276  249  238  238
## [29]  228  231  203  201  207  207  182  171  168  140  147  138  126  126
## [43]  109  109  104   97   74
fitted(fit)
##       99      100      101      102      103      104      105      106 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      107      108      109      110      111      112      113      114 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      115      116      117      118      119      120      121      122 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      123      124      125      126      127      128      129      130 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      131      132      133      134      135      136      137      139 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739 
##      140      141      142      143      145      146      150 
## 702.6739 702.6739 702.6739 702.6739 702.6739 702.6739  74.0000
fit<-lm(PricePremium~FlightDuration,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Brairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1109.46  -330.22   -19.61   259.79   986.77 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -540.84     138.28  -3.911 0.000307 ***
## FlightDuration   294.29      20.53  14.337  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 562 on 45 degrees of freedom
## Multiple R-squared:  0.8204, Adjusted R-squared:  0.8164 
## F-statistic: 205.5 on 1 and 45 DF,  p-value: < 2.2e-16
Brairbus$PricePremium
##  [1] 3563 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634
## [15]  486  442  442  407  396  396  348  323  319  319  306  285  278  276
## [29]  263  247  238  237  237  234  211  201  198  175  175  165  156  156
## [43]  141  141  131  125   97
fitted(fit)
##          99         100         101         102         103         104 
## 2743.463322 2743.463322 2743.463322 2743.463322 2549.230121 2549.230121 
##         105         106         107         108         109         110 
## 2549.230121 2549.230121 3308.505360 3308.505360 3308.505360 2743.463322 
##         111         112         113         114         115         116 
## 2743.463322 2743.463322  659.870806  512.724442  512.724442  168.401949 
##         117         118         119         120         121         122 
##  415.607841  415.607841  512.724442  241.975132  168.401949  168.401949 
##         123         124         125         126         127         128 
##  168.401949  415.607841   -2.287833  512.724442  783.473752  168.401949 
##         129         130         131         132         133         134 
##  783.473752   -2.287833  168.401949  512.724442  659.870806  292.004895 
##         135         136         137         139         140         141 
##  783.473752 -172.977615  659.870806  168.401949   -2.287833   -2.287833 
##         142         143         145         146         150 
## -172.977615 -172.977615  512.724442  292.004895  168.401949
cor(Brairbus$PricePremium,Brairbus$FlightDuration)
## [1] 0.905756
fit<-lm(PricePremium~SeatsEconomy,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -951.7 -854.2 -757.7  557.3 2486.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   34059.8    44884.7   0.759    0.452
## SeatsEconomy   -108.9      148.0  -0.735    0.466
## 
## Residual standard error: 1318 on 45 degrees of freedom
## Multiple R-squared:  0.01187,    Adjusted R-squared:  -0.01009 
## F-statistic: 0.5407 on 1 and 45 DF,  p-value: 0.466
Brairbus$PricePremium
##  [1] 3563 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634
## [15]  486  442  442  407  396  396  348  323  319  319  306  285  278  276
## [29]  263  247  238  237  237  234  211  201  198  175  175  165  156  156
## [43]  141  141  131  125   97
fitted(fit)
##       99      100      101      102      103      104      105      106 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      107      108      109      110      111      112      113      114 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      115      116      117      118      119      120      121      122 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      123      124      125      126      127      128      129      130 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      131      132      133      134      135      136      137      139 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      140      141      142      143      145      146      150 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696   97.000
cor(Brairbus$PricePremium,Brairbus$SeatsEconomy)
## [1] -0.1089611
fit<-lm(PricePremium~SeatsPremium,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -958.9 -849.9 -736.9  578.1 2507.2 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1055.9      191.3   5.519 1.51e-06 ***
## SeatsPremium       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1312 on 46 degrees of freedom
Brairbus$PricePremium
##  [1] 3563 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634
## [15]  486  442  442  407  396  396  348  323  319  319  306  285  278  276
## [29]  263  247  238  237  237  234  211  201  198  175  175  165  156  156
## [43]  141  141  131  125   97
fitted(fit)
##       99      100      101      102      103      104      105      106 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 
##      107      108      109      110      111      112      113      114 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 
##      115      116      117      118      119      120      121      122 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 
##      123      124      125      126      127      128      129      130 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 
##      131      132      133      134      135      136      137      139 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 
##      140      141      142      143      145      146      150 
## 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851 1055.851
cor(Brairbus$PricePremium,Brairbus$SeatsPremium)
## Warning in cor(Brairbus$PricePremium, Brairbus$SeatsPremium): the standard
## deviation is zero
## [1] NA
fit<-lm(PricePremium~PriceRelative,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = Brairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2283.8  -456.6  -105.4   346.3  2002.9 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      78.93     196.64   0.401     0.69    
## PriceRelative  3022.74     441.37   6.849 1.71e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 927.9 on 45 degrees of freedom
## Multiple R-squared:  0.5104, Adjusted R-squared:  0.4995 
## F-statistic:  46.9 on 1 and 45 DF,  p-value: 1.71e-08
Brairbus$PricePremium
##  [1] 3563 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634
## [15]  486  442  442  407  396  396  348  323  319  319  306  285  278  276
## [29]  263  247  238  237  237  234  211  201  198  175  175  165  156  156
## [43]  141  141  131  125   97
fitted(fit)
##        99       100       101       102       103       104       105 
## 1560.0706 1560.0706 1560.0706 1560.0706 2829.6234 2829.6234 2829.6234 
##       106       107       108       109       110       111       112 
## 2829.6234 1499.6157 1499.6157 1499.6157 3917.8115 3917.8115 1167.1138 
##       113       114       115       116       117       118       119 
##  260.2904  381.2002  381.2002  199.8355  411.4276  411.4276  320.7453 
##       120       121       122       123       124       125       126 
##  350.9727  230.0629  230.0629  411.4276  502.1100  592.7923  562.5649 
##       127       128       129       130       131       132       133 
##  532.3374  290.5178  592.7923  623.0197  502.1100  471.8825  562.5649 
##       134       135       136       137       139       140       141 
##  623.0197  623.0197  834.6119  683.4746  653.2472  774.1570  774.1570 
##       142       143       145       146       150 
##  985.7491  985.7491  834.6119  955.5217 1015.9766
cor(Brairbus$PricePremium,Brairbus$PriceRelative)
## [1] 0.7143888
fit<-lm(PricePremium~PercentPremiumSeats,data = Brairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = Brairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -951.7 -854.2 -757.7  557.3 2486.3 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)
## (Intercept)           -39594      55283  -0.716    0.478
## PercentPremiumSeats     2648       3601   0.735    0.466
## 
## Residual standard error: 1318 on 45 degrees of freedom
## Multiple R-squared:  0.01187,    Adjusted R-squared:  -0.01009 
## F-statistic: 0.5407 on 1 and 45 DF,  p-value: 0.466
Brairbus$PricePremium
##  [1] 3563 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634
## [15]  486  442  442  407  396  396  348  323  319  319  306  285  278  276
## [29]  263  247  238  237  237  234  211  201  198  175  175  165  156  156
## [43]  141  141  131  125   97
fitted(fit)
##       99      100      101      102      103      104      105      106 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      107      108      109      110      111      112      113      114 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      115      116      117      118      119      120      121      122 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      123      124      125      126      127      128      129      130 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      131      132      133      134      135      136      137      139 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696 
##      140      141      142      143      145      146      150 
## 1076.696 1076.696 1076.696 1076.696 1076.696 1076.696   97.000
cor(Brairbus$PricePremium,Brairbus$PercentPremiumSeats)
## [1] 0.1089611

Now We Should Analyse the international aircrafts of British Airlines

Brint <- British[ which(British$IsInternational=='International'),]
View(Brint)
summary(Brint)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance:  0   AirBus: 47   Min.   : 1.250   Aug:52     
##  British  :175   Boeing:128   1st Qu.: 4.290   Jul:16     
##  Delta    :  0                Median : 8.580   Oct:53     
##  Jet      :  0                Mean   : 7.855   Sep:54     
##  Singapore:  0                3rd Qu.:11.120              
##  Virgin   :  0                Max.   :13.830              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     :  0    Min.   :122.0   Min.   :24.00   Min.   :31   
##  International:175    1st Qu.:122.0   1st Qu.:36.00   1st Qu.:31   
##                       Median :243.0   Median :40.00   Median :31   
##                       Mean   :216.6   Mean   :43.18   Mean   :31   
##                       3rd Qu.:303.0   3rd Qu.:55.00   3rd Qu.:31   
##                       Max.   :312.0   Max.   :56.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   
##  Min.   :38    Min.   :18    Min.   :19    Min.   :  65.0  
##  1st Qu.:38    1st Qu.:18    1st Qu.:19    1st Qu.: 528.5  
##  Median :38    Median :18    Median :19    Median :1444.0  
##  Mean   :38    Mean   :18    Mean   :19    Mean   :1293.5  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:19    3rd Qu.:1813.0  
##  Max.   :38    Max.   :18    Max.   :19    Max.   :3102.0  
##   PricePremium    PriceRelative      SeatsTotal    PitchDifference
##  Min.   :  86.0   Min.   :0.0400   Min.   :162.0   Min.   :7      
##  1st Qu.: 807.5   1st Qu.:0.2100   1st Qu.:162.0   1st Qu.:7      
##  Median :2049.0   Median :0.3600   Median :279.0   Median :7      
##  Mean   :1937.0   Mean   :0.4375   Mean   :259.8   Mean   :7      
##  3rd Qu.:2982.0   3rd Qu.:0.5200   3rd Qu.:358.0   3rd Qu.:7      
##  Max.   :7414.0   Max.   :1.3900   Max.   :367.0   Max.   :7      
##  WidthDifference PercentPremiumSeats
##  Min.   :1       Min.   :10.57      
##  1st Qu.:1       1st Qu.:12.90      
##  Median :1       Median :15.36      
##  Mean   :1       Mean   :17.79      
##  3rd Qu.:1       3rd Qu.:24.69      
##  Max.   :1       Max.   :24.69
mean(Brint$PriceEconomy)
## [1] 1293.48
mean(Brint$PricePremium)
## [1] 1937.029
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Brint$PriceEconomy,Brint$TravelMonth,mean))
y2<-c(by(Brint$PricePremium,Brint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1492.9  -302.3   143.0   485.0  1111.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      156.69     102.25   1.532    0.127    
## FlightDuration   144.72      11.79  12.273   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 573 on 173 degrees of freedom
## Multiple R-squared:  0.4654, Adjusted R-squared:  0.4623 
## F-statistic: 150.6 on 1 and 173 DF,  p-value: < 2.2e-16
Brint$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1929.5390 1929.5390 1929.5390 1929.5390 1337.6245 1337.6245 1337.6245 
##         8         9        10        11        12        13        14 
## 1097.3853 1097.3853 1820.9972 1820.9972 1820.9972 1820.9972 1832.5750 
##        15        16        17        18        19        20        21 
## 1832.5750 1832.5750 1482.3468 1482.3468 1482.3468 1133.5659 1133.5659 
##        22        23        24        25        26        27        28 
## 1133.5659 1120.5409 1120.5409 1120.5409 1423.0107 1423.0107 1423.0107 
##        29        30        31        32        33        34        35 
##  867.2767  867.2767  867.2767  710.9766  710.9766  710.9766  710.9766 
##        36        37        38        39        40        41        42 
## 2110.4420 2110.4420 2110.4420  710.9766  710.9766  710.9766  710.9766 
##        43        44        45        46        47        48        49 
##  939.6379  939.6379  939.6379 1350.6495 1350.6495 1350.6495 2001.9002 
##        50        51        52        53        54        55        56 
## 2001.9002 2001.9002 1097.3853 1760.2138 1760.2138 1760.2138 1036.6019 
##        57        58        59        60        61        82        83 
## 1036.6019 1036.6019 1965.7196 1900.5945 1965.7196 1145.1437 1145.1437 
##        84        85        86        87        88        89        99 
## 1145.1437 1145.1437 1253.6855 1253.6855 1253.6855 1253.6855 1771.7916 
##       100       101       102       103       104       105       106 
## 1771.7916 1771.7916 1771.7916 1676.2748 1676.2748 1676.2748 1676.2748 
##       107       108       109       110       111       112       113 
## 2049.6586 2049.6586 2049.6586 1771.7916 1771.7916 1771.7916  747.1571 
##       114       115       116       117       118       119       120 
##  674.7960  674.7960  505.4708  627.0376  627.0376  674.7960  541.6514 
##       121       122       123       124       125       126       127 
##  505.4708  505.4708  505.4708  627.0376  421.5318  674.7960  807.9405 
##       128       129       130       131       132       133       134 
##  505.4708  807.9405  421.5318  505.4708  674.7960  747.1571  566.2542 
##       135       136       137       138       139       140       141 
##  807.9405  337.5928  747.1571  337.5928  505.4708  421.5318  421.5318 
##       142       143       144       145       146       147       148 
##  337.5928  337.5928  337.5928  674.7960  566.2542  349.1706  349.1706 
##       149       150       151       240       241       242       243 
##  337.5928  505.4708  349.1706 1663.2498 1663.2498 1663.2498 1748.6360 
##       244       245       246       247       248       249       250 
## 1748.6360 1748.6360 1590.8886 1590.8886 1590.8886 1590.8886 1398.4079 
##       251       252       253       254       255       256       257 
## 1398.4079 1398.4079 1807.9722 1807.9722 1807.9722 1807.9722 1506.9496 
##       258       259       260       261       262       263       264 
## 1506.9496 1506.9496 1446.1662 1409.9857 1409.9857 1409.9857 1205.9271 
##       265       266       267       268       269       270       271 
## 1205.9271 1205.9271 1446.1662 1181.3243 1181.3243 1181.3243 1807.9722 
##       272       273       274       275       276       277       278 
## 1807.9722 1807.9722 1807.9722 1446.1662 1760.2138 1760.2138 1760.2138 
##       279       280       367       368       369       370       371 
## 1181.3243 1760.2138 2158.2004 2158.2004 2158.2004 2085.8392 2085.8392 
##       372       373       374       375       376       377       378 
## 2085.8392 1446.1662 1446.1662 1446.1662 1543.1302 1543.1302 1543.1302
cor(Brint$PriceEconomy,Brint$FlightDuration)
## [1] 0.6822227
fit<-lm(PriceEconomy~SeatsEconomy,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1169.0  -639.2   -46.1   524.1  1753.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2174.0297   167.9032  12.948  < 2e-16 ***
## SeatsEconomy   -4.0655     0.7331  -5.546 1.08e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 722.1 on 173 degrees of freedom
## Multiple R-squared:  0.1509, Adjusted R-squared:  0.146 
## F-statistic: 30.75 on 1 and 173 DF,  p-value: 1.079e-07
Brint$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##         8         9        10        11        12        13        14 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        15        16        17        18        19        20        21 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        22        23        24        25        26        27        28 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        29        30        31        32        33        34        35 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        36        37        38        39        40        41        42 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        43        44        45        46        47        48        49 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        50        51        52        53        54        55        56 
## 1678.0337 1678.0337 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 
##        57        58        59        60        61        82        83 
## 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 1186.1033 1186.1033 
##        84        85        86        87        88        89        99 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033  942.1708 
##       100       101       102       103       104       105       106 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       107       108       109       110       111       112       113 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       114       115       116       117       118       119       120 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       121       122       123       124       125       126       127 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       128       129       130       131       132       133       134 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       135       136       137       138       139       140       141 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       142       143       144       145       146       147       148 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       149       150       151       240       241       242       243 
##  942.1708  905.5809  942.1708 1186.1033 1186.1033 1186.1033 1186.1033 
##       244       245       246       247       248       249       250 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       251       252       253       254       255       256       257 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       258       259       260       261       262       263       264 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       265       266       267       268       269       270       271 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       272       273       274       275       276       277       278 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       279       280       367       368       369       370       371 
## 1186.1033 1186.1033 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 
##       372       373       374       375       376       377       378 
## 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249
cor(Brint$PriceEconomy,Brint$SeatsEconomy)
## [1] -0.3885088
fit<-lm(PriceEconomy~PriceRelative,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Brint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1226.20  -709.99    85.17   481.68  1620.52 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     950.93      96.29   9.876  < 2e-16 ***
## PriceRelative   782.89     178.69   4.381 2.04e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 743.5 on 173 degrees of freedom
## Multiple R-squared:  0.09987,    Adjusted R-squared:  0.09467 
## F-statistic:  19.2 on 1 and 173 DF,  p-value: 2.041e-05
Brint$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1248.4304 1248.4304 1248.4304 1248.4304 1475.4679 1475.4679 1475.4679 
##         8         9        10        11        12        13        14 
## 1757.3075 1757.3075 1538.0989 1538.0989 1389.3502 1154.4839 1358.0347 
##        15        16        17        18        19        20        21 
## 1358.0347 1358.0347 1248.4304 1248.4304 1248.4304 1217.1149 1217.1149 
##        22        23        24        25        26        27        28 
## 1217.1149 1209.2860 1209.2860 1209.2860 1224.9438 1209.2860 1209.2860 
##        29        30        31        32        33        34        35 
## 1217.1149 1217.1149 1217.1149 1279.7459 1279.7459 1279.7459 1279.7459 
##        36        37        38        39        40        41        42 
## 1459.8101 1459.8101 1459.8101 1138.8261 1138.8261 1138.8261 1138.8261 
##        43        44        45        46        47        48        49 
## 1084.0240 1084.0240 1084.0240 1013.5641 1013.5641 1013.5641 1358.0347 
##        50        51        52        53        54        55        56 
## 1358.0347 1358.0347 1757.3075 1232.7726 1232.7726 1232.7726 1217.1149 
##        57        58        59        60        61        82        83 
## 1217.1149 1217.1149 1115.3395 1115.3395 1428.4946 1788.6230 1788.6230 
##        84        85        86        87        88        89        99 
## 1788.6230 1788.6230 1264.0882 1264.0882 1264.0882 1264.0882 1334.5481 
##       100       101       102       103       104       105       106 
## 1334.5481 1334.5481 1334.5481 1663.3609 1663.3609 1663.3609 1663.3609 
##       107       108       109       110       111       112       113 
## 1318.8903 1318.8903 1318.8903 1945.2005 1945.2005 1232.7726  997.9063 
##       114       115       116       117       118       119       120 
## 1029.2218 1029.2218  982.2486 1037.0507 1037.0507 1013.5641 1021.3929 
##       121       122       123       124       125       126       127 
##  990.0774  990.0774 1037.0507 1060.5373 1084.0240 1076.1951 1068.3662 
##       128       129       130       131       132       133       134 
## 1005.7352 1084.0240 1091.8528 1060.5373 1052.7085 1076.1951 1091.8528 
##       135       136       137       138       139       140       141 
## 1091.8528 1146.6550 1107.5106 1154.4839 1099.6817 1130.9972 1130.9972 
##       142       143       144       145       146       147       148 
## 1185.7994 1185.7994 1185.7994 1146.6550 1177.9705 1177.9705 1177.9705 
##       149       150       151       240       241       242       243 
## 1264.0882 1193.6283 1209.2860 1835.5962 1835.5962 1154.4839 1303.2325 
##       244       245       246       247       248       249       250 
## 1303.2325 1303.2325 1232.7726 1232.7726 1232.7726 1232.7726 1718.1631 
##       251       252       253       254       255       256       257 
## 1718.1631 1718.1631 1209.2860 1209.2860 1209.2860 1209.2860 1232.7726 
##       258       259       260       261       262       263       264 
## 1232.7726 1232.7726 1835.5962 1279.7459 1279.7459 1279.7459 1264.0882 
##       265       266       267       268       269       270       271 
## 1264.0882 1264.0882 1577.2433 1005.7352 1005.7352 1005.7352 1819.9385 
##       272       273       274       275       276       277       278 
## 1819.9385 1663.3609 1107.5106 1577.2433 1084.0240 1084.0240 1084.0240 
##       279       280       367       368       369       370       371 
## 1115.3395 1397.1791 2039.1471 2039.1471 2039.1471 1060.5373 1060.5373 
##       372       373       374       375       376       377       378 
## 1060.5373 1553.7566 1326.7192 1326.7192  982.2486 1358.0347 1240.6015
cor(Brint$PriceEconomy,Brint$PriceRelative)
## [1] 0.3160274
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1188.4  -665.2   110.1   509.3  1927.5 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.23     210.95   4.741 4.41e-06 ***
## PercentPremiumSeats    16.48      11.39   1.448     0.15    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 779 on 173 degrees of freedom
## Multiple R-squared:  0.01197,    Adjusted R-squared:  0.006258 
## F-statistic: 2.096 on 1 and 173 DF,  p-value: 0.1495
Brint$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##        9       10       11       12       13       14       15       16 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       17       18       19       20       21       22       23       24 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       25       26       27       28       29       30       31       32 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       33       34       35       36       37       38       39       40 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       41       42       43       44       45       46       47       48 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       49       50       51       52       53       54       55       56 
## 1407.202 1407.202 1407.202 1387.422 1387.422 1387.422 1387.422 1387.422 
##       57       58       59       60       61       82       83       84 
## 1387.422 1387.422 1387.422 1387.422 1387.422 1308.962 1308.962 1308.962 
##       85       86       87       88       89       99      100      101 
## 1308.962 1308.962 1308.962 1308.962 1308.962 1253.414 1253.414 1253.414 
##      102      103      104      105      106      107      108      109 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      110      111      112      113      114      115      116      117 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      118      119      120      121      122      123      124      125 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      126      127      128      129      130      131      132      133 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      134      135      136      137      138      139      140      141 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      142      143      144      145      146      147      148      149 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      150      151      240      241      242      243      244      245 
## 1247.315 1253.414 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      246      247      248      249      250      251      252      253 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      254      255      256      257      258      259      260      261 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      262      263      264      265      266      267      268      269 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      270      271      272      273      274      275      276      277 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      278      279      280      367      368      369      370      371 
## 1212.865 1212.865 1212.865 1174.459 1174.459 1174.459 1174.459 1174.459 
##      372      373      374      375      376      377      378 
## 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459
cor(Brint$PriceEconomy,Brint$PercentPremiumSeats)
## [1] 0.1094026
fit<-lm(PricePremium~FlightDuration,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2347.1  -602.7   116.3   678.4  4032.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       38.52     179.30   0.215     0.83    
## FlightDuration   241.70      20.68  11.689   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1005 on 173 degrees of freedom
## Multiple R-squared:  0.4413, Adjusted R-squared:  0.4381 
## F-statistic: 136.6 on 1 and 173 DF,  p-value: < 2.2e-16
Brint$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 2999.2858 2999.2858 2999.2858 2999.2858 2010.7525 2010.7525 2010.7525 
##         8         9        10        11        12        13        14 
## 1609.5385 1609.5385 2818.0144 2818.0144 2818.0144 2818.0144 2837.3500 
##        15        16        17        18        19        20        21 
## 2837.3500 2837.3500 2252.4477 2252.4477 2252.4477 1669.9623 1669.9623 
##        22        23        24        25        26        27        28 
## 1669.9623 1648.2097 1648.2097 1648.2097 2153.3527 2153.3527 2153.3527 
##        29        30        31        32        33        34        35 
## 1225.2432 1225.2432 1225.2432  964.2124  964.2124  964.2124  964.2124 
##        36        37        38        39        40        41        42 
## 3301.4048 3301.4048 3301.4048  964.2124  964.2124  964.2124  964.2124 
##        43        44        45        46        47        48        49 
## 1346.0907 1346.0907 1346.0907 2032.5051 2032.5051 2032.5051 3120.1334 
##        50        51        52        53        54        55        56 
## 3120.1334 3120.1334 1609.5385 2716.5025 2716.5025 2716.5025 1508.0265 
##        57        58        59        60        61        82        83 
## 1508.0265 1508.0265 3059.7096 2950.9468 3059.7096 1689.2979 1689.2979 
##        84        85        86        87        88        89        99 
## 1689.2979 1689.2979 1870.5693 1870.5693 1870.5693 1870.5693 2735.8381 
##       100       101       102       103       104       105       106 
## 2735.8381 2735.8381 2735.8381 2576.3192 2576.3192 2576.3192 2576.3192 
##       107       108       109       110       111       112       113 
## 3199.8928 3199.8928 3199.8928 2735.8381 2735.8381 2735.8381 1024.6362 
##       114       115       116       117       118       119       120 
##  903.7886  903.7886  621.0052  824.0291  824.0291  903.7886  681.4290 
##       121       122       123       124       125       126       127 
##  621.0052  621.0052  621.0052  824.0291  480.8220  903.7886 1126.1481 
##       128       129       130       131       132       133       134 
##  621.0052 1126.1481  480.8220  621.0052  903.7886 1024.6362  722.5172 
##       135       136       137       138       139       140       141 
## 1126.1481  340.6388 1024.6362  340.6388  621.0052  480.8220  480.8220 
##       142       143       144       145       146       147       148 
##  340.6388  340.6388  340.6388  903.7886  722.5172  359.9744  359.9744 
##       149       150       151       240       241       242       243 
##  340.6388  621.0052  359.9744 2554.5667 2554.5667 2554.5667 2697.1668 
##       244       245       246       247       248       249       250 
## 2697.1668 2697.1668 2433.7191 2433.7191 2433.7191 2433.7191 2112.2645 
##       251       252       253       254       255       256       257 
## 2112.2645 2112.2645 2796.2619 2796.2619 2796.2619 2796.2619 2293.5359 
##       258       259       260       261       262       263       264 
## 2293.5359 2293.5359 2192.0239 2131.6001 2131.6001 2131.6001 1790.8099 
##       265       266       267       268       269       270       271 
## 1790.8099 1790.8099 2192.0239 1749.7217 1749.7217 1749.7217 2796.2619 
##       272       273       274       275       276       277       278 
## 2796.2619 2796.2619 2796.2619 2192.0239 2716.5025 2716.5025 2716.5025 
##       279       280       367       368       369       370       371 
## 1749.7217 2716.5025 3381.1642 3381.1642 3381.1642 3260.3166 3260.3166 
##       372       373       374       375       376       377       378 
## 3260.3166 2192.0239 2192.0239 2192.0239 2353.9597 2353.9597 2353.9597
cor(Brint$PricePremium,Brint$FlightDuration)
## [1] 0.664292
fit<-lm(PriceEconomy~SeatsEconomy,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1169.0  -639.2   -46.1   524.1  1753.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2174.0297   167.9032  12.948  < 2e-16 ***
## SeatsEconomy   -4.0655     0.7331  -5.546 1.08e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 722.1 on 173 degrees of freedom
## Multiple R-squared:  0.1509, Adjusted R-squared:  0.146 
## F-statistic: 30.75 on 1 and 173 DF,  p-value: 1.079e-07
Brint$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##         8         9        10        11        12        13        14 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        15        16        17        18        19        20        21 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        22        23        24        25        26        27        28 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        29        30        31        32        33        34        35 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        36        37        38        39        40        41        42 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        43        44        45        46        47        48        49 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        50        51        52        53        54        55        56 
## 1678.0337 1678.0337 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 
##        57        58        59        60        61        82        83 
## 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 1186.1033 1186.1033 
##        84        85        86        87        88        89        99 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033  942.1708 
##       100       101       102       103       104       105       106 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       107       108       109       110       111       112       113 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       114       115       116       117       118       119       120 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       121       122       123       124       125       126       127 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       128       129       130       131       132       133       134 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       135       136       137       138       139       140       141 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       142       143       144       145       146       147       148 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       149       150       151       240       241       242       243 
##  942.1708  905.5809  942.1708 1186.1033 1186.1033 1186.1033 1186.1033 
##       244       245       246       247       248       249       250 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       251       252       253       254       255       256       257 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       258       259       260       261       262       263       264 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       265       266       267       268       269       270       271 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       272       273       274       275       276       277       278 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       279       280       367       368       369       370       371 
## 1186.1033 1186.1033 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 
##       372       373       374       375       376       377       378 
## 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249
cor(Brint$PricePremium,Brint$SeatsEconomy)
## [1] -0.3006343
fit<-lm(PriceEconomy~SeatsPremium,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Brint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1513.48  -572.66   -10.06   396.07  1548.84 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2968.309    241.589   12.29  < 2e-16 ***
## SeatsPremium  -38.785      5.463   -7.10  3.1e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 689.7 on 173 degrees of freedom
## Multiple R-squared:  0.2256, Adjusted R-squared:  0.2212 
## F-statistic: 50.41 on 1 and 173 DF,  p-value: 3.101e-11
Brint$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##         8         9        10        11        12        13        14 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        15        16        17        18        19        20        21 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        22        23        24        25        26        27        28 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        29        30        31        32        33        34        35 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        36        37        38        39        40        41        42 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        43        44        45        46        47        48        49 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        50        51        52        53        54        55        56 
## 1416.9258 1416.9258 1455.7103 1455.7103 1455.7103 1455.7103 1455.7103 
##        57        58        59        60        61        82        83 
## 1455.7103 1455.7103 1455.7103 1455.7103 1455.7103  796.3725  796.3725 
##        84        85        86        87        88        89        99 
##  796.3725  796.3725  796.3725  796.3725  796.3725  796.3725  835.1571 
##       100       101       102       103       104       105       106 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       107       108       109       110       111       112       113 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       114       115       116       117       118       119       120 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       121       122       123       124       125       126       127 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       128       129       130       131       132       133       134 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       135       136       137       138       139       140       141 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       142       143       144       145       146       147       148 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       149       150       151       240       241       242       243 
##  835.1571  835.1571  835.1571 1572.0641 1572.0641 1572.0641 1572.0641 
##       244       245       246       247       248       249       250 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       251       252       253       254       255       256       257 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       258       259       260       261       262       263       264 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       265       266       267       268       269       270       271 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       272       273       274       275       276       277       278 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       279       280       367       368       369       370       371 
## 1572.0641 1572.0641 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 
##       372       373       374       375       376       377       378 
## 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790
cor(Brint$PricePremium,Brint$SeatsPremium)
## [1] -0.4260349
fit<-lm(PriceEconomy~PriceRelative,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Brint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1226.20  -709.99    85.17   481.68  1620.52 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     950.93      96.29   9.876  < 2e-16 ***
## PriceRelative   782.89     178.69   4.381 2.04e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 743.5 on 173 degrees of freedom
## Multiple R-squared:  0.09987,    Adjusted R-squared:  0.09467 
## F-statistic:  19.2 on 1 and 173 DF,  p-value: 2.041e-05
Brint$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1248.4304 1248.4304 1248.4304 1248.4304 1475.4679 1475.4679 1475.4679 
##         8         9        10        11        12        13        14 
## 1757.3075 1757.3075 1538.0989 1538.0989 1389.3502 1154.4839 1358.0347 
##        15        16        17        18        19        20        21 
## 1358.0347 1358.0347 1248.4304 1248.4304 1248.4304 1217.1149 1217.1149 
##        22        23        24        25        26        27        28 
## 1217.1149 1209.2860 1209.2860 1209.2860 1224.9438 1209.2860 1209.2860 
##        29        30        31        32        33        34        35 
## 1217.1149 1217.1149 1217.1149 1279.7459 1279.7459 1279.7459 1279.7459 
##        36        37        38        39        40        41        42 
## 1459.8101 1459.8101 1459.8101 1138.8261 1138.8261 1138.8261 1138.8261 
##        43        44        45        46        47        48        49 
## 1084.0240 1084.0240 1084.0240 1013.5641 1013.5641 1013.5641 1358.0347 
##        50        51        52        53        54        55        56 
## 1358.0347 1358.0347 1757.3075 1232.7726 1232.7726 1232.7726 1217.1149 
##        57        58        59        60        61        82        83 
## 1217.1149 1217.1149 1115.3395 1115.3395 1428.4946 1788.6230 1788.6230 
##        84        85        86        87        88        89        99 
## 1788.6230 1788.6230 1264.0882 1264.0882 1264.0882 1264.0882 1334.5481 
##       100       101       102       103       104       105       106 
## 1334.5481 1334.5481 1334.5481 1663.3609 1663.3609 1663.3609 1663.3609 
##       107       108       109       110       111       112       113 
## 1318.8903 1318.8903 1318.8903 1945.2005 1945.2005 1232.7726  997.9063 
##       114       115       116       117       118       119       120 
## 1029.2218 1029.2218  982.2486 1037.0507 1037.0507 1013.5641 1021.3929 
##       121       122       123       124       125       126       127 
##  990.0774  990.0774 1037.0507 1060.5373 1084.0240 1076.1951 1068.3662 
##       128       129       130       131       132       133       134 
## 1005.7352 1084.0240 1091.8528 1060.5373 1052.7085 1076.1951 1091.8528 
##       135       136       137       138       139       140       141 
## 1091.8528 1146.6550 1107.5106 1154.4839 1099.6817 1130.9972 1130.9972 
##       142       143       144       145       146       147       148 
## 1185.7994 1185.7994 1185.7994 1146.6550 1177.9705 1177.9705 1177.9705 
##       149       150       151       240       241       242       243 
## 1264.0882 1193.6283 1209.2860 1835.5962 1835.5962 1154.4839 1303.2325 
##       244       245       246       247       248       249       250 
## 1303.2325 1303.2325 1232.7726 1232.7726 1232.7726 1232.7726 1718.1631 
##       251       252       253       254       255       256       257 
## 1718.1631 1718.1631 1209.2860 1209.2860 1209.2860 1209.2860 1232.7726 
##       258       259       260       261       262       263       264 
## 1232.7726 1232.7726 1835.5962 1279.7459 1279.7459 1279.7459 1264.0882 
##       265       266       267       268       269       270       271 
## 1264.0882 1264.0882 1577.2433 1005.7352 1005.7352 1005.7352 1819.9385 
##       272       273       274       275       276       277       278 
## 1819.9385 1663.3609 1107.5106 1577.2433 1084.0240 1084.0240 1084.0240 
##       279       280       367       368       369       370       371 
## 1115.3395 1397.1791 2039.1471 2039.1471 2039.1471 1060.5373 1060.5373 
##       372       373       374       375       376       377       378 
## 1060.5373 1553.7566 1326.7192 1326.7192  982.2486 1358.0347 1240.6015
cor(Brint$PricePremium,Brint$PriceRelative)
## [1] 0.602946
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Brint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Brint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1188.4  -665.2   110.1   509.3  1927.5 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.23     210.95   4.741 4.41e-06 ***
## PercentPremiumSeats    16.48      11.39   1.448     0.15    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 779 on 173 degrees of freedom
## Multiple R-squared:  0.01197,    Adjusted R-squared:  0.006258 
## F-statistic: 2.096 on 1 and 173 DF,  p-value: 0.1495
Brint$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##        9       10       11       12       13       14       15       16 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       17       18       19       20       21       22       23       24 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       25       26       27       28       29       30       31       32 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       33       34       35       36       37       38       39       40 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       41       42       43       44       45       46       47       48 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       49       50       51       52       53       54       55       56 
## 1407.202 1407.202 1407.202 1387.422 1387.422 1387.422 1387.422 1387.422 
##       57       58       59       60       61       82       83       84 
## 1387.422 1387.422 1387.422 1387.422 1387.422 1308.962 1308.962 1308.962 
##       85       86       87       88       89       99      100      101 
## 1308.962 1308.962 1308.962 1308.962 1308.962 1253.414 1253.414 1253.414 
##      102      103      104      105      106      107      108      109 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      110      111      112      113      114      115      116      117 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      118      119      120      121      122      123      124      125 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      126      127      128      129      130      131      132      133 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      134      135      136      137      138      139      140      141 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      142      143      144      145      146      147      148      149 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      150      151      240      241      242      243      244      245 
## 1247.315 1253.414 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      246      247      248      249      250      251      252      253 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      254      255      256      257      258      259      260      261 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      262      263      264      265      266      267      268      269 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      270      271      272      273      274      275      276      277 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      278      279      280      367      368      369      370      371 
## 1212.865 1212.865 1212.865 1174.459 1174.459 1174.459 1174.459 1174.459 
##      372      373      374      375      376      377      378 
## 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459
cor(Brint$PricePremium,Brint$PercentPremiumSeats)
## [1] 0.03194159

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Brboeing$PriceEconomy,Brboeing$TravelMonth,mean))
y2<-c(by(Brboeing$PricePremium,Brboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Brairbus$PriceEconomy,Brairbus$TravelMonth,mean))
y4<-c(by(Brairbus$PricePremium,Brairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of British Airlines

mean(British$PriceEconomy)
## [1] 1293.48
mean(British$PricePremium)
## [1] 1937.029
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(British$PriceEconomy,British$TravelMonth,mean))
y2<-c(by(British$PricePremium,British$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1492.9  -302.3   143.0   485.0  1111.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      156.69     102.25   1.532    0.127    
## FlightDuration   144.72      11.79  12.273   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 573 on 173 degrees of freedom
## Multiple R-squared:  0.4654, Adjusted R-squared:  0.4623 
## F-statistic: 150.6 on 1 and 173 DF,  p-value: < 2.2e-16
British$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1929.5390 1929.5390 1929.5390 1929.5390 1337.6245 1337.6245 1337.6245 
##         8         9        10        11        12        13        14 
## 1097.3853 1097.3853 1820.9972 1820.9972 1820.9972 1820.9972 1832.5750 
##        15        16        17        18        19        20        21 
## 1832.5750 1832.5750 1482.3468 1482.3468 1482.3468 1133.5659 1133.5659 
##        22        23        24        25        26        27        28 
## 1133.5659 1120.5409 1120.5409 1120.5409 1423.0107 1423.0107 1423.0107 
##        29        30        31        32        33        34        35 
##  867.2767  867.2767  867.2767  710.9766  710.9766  710.9766  710.9766 
##        36        37        38        39        40        41        42 
## 2110.4420 2110.4420 2110.4420  710.9766  710.9766  710.9766  710.9766 
##        43        44        45        46        47        48        49 
##  939.6379  939.6379  939.6379 1350.6495 1350.6495 1350.6495 2001.9002 
##        50        51        52        53        54        55        56 
## 2001.9002 2001.9002 1097.3853 1760.2138 1760.2138 1760.2138 1036.6019 
##        57        58        59        60        61        82        83 
## 1036.6019 1036.6019 1965.7196 1900.5945 1965.7196 1145.1437 1145.1437 
##        84        85        86        87        88        89        99 
## 1145.1437 1145.1437 1253.6855 1253.6855 1253.6855 1253.6855 1771.7916 
##       100       101       102       103       104       105       106 
## 1771.7916 1771.7916 1771.7916 1676.2748 1676.2748 1676.2748 1676.2748 
##       107       108       109       110       111       112       113 
## 2049.6586 2049.6586 2049.6586 1771.7916 1771.7916 1771.7916  747.1571 
##       114       115       116       117       118       119       120 
##  674.7960  674.7960  505.4708  627.0376  627.0376  674.7960  541.6514 
##       121       122       123       124       125       126       127 
##  505.4708  505.4708  505.4708  627.0376  421.5318  674.7960  807.9405 
##       128       129       130       131       132       133       134 
##  505.4708  807.9405  421.5318  505.4708  674.7960  747.1571  566.2542 
##       135       136       137       138       139       140       141 
##  807.9405  337.5928  747.1571  337.5928  505.4708  421.5318  421.5318 
##       142       143       144       145       146       147       148 
##  337.5928  337.5928  337.5928  674.7960  566.2542  349.1706  349.1706 
##       149       150       151       240       241       242       243 
##  337.5928  505.4708  349.1706 1663.2498 1663.2498 1663.2498 1748.6360 
##       244       245       246       247       248       249       250 
## 1748.6360 1748.6360 1590.8886 1590.8886 1590.8886 1590.8886 1398.4079 
##       251       252       253       254       255       256       257 
## 1398.4079 1398.4079 1807.9722 1807.9722 1807.9722 1807.9722 1506.9496 
##       258       259       260       261       262       263       264 
## 1506.9496 1506.9496 1446.1662 1409.9857 1409.9857 1409.9857 1205.9271 
##       265       266       267       268       269       270       271 
## 1205.9271 1205.9271 1446.1662 1181.3243 1181.3243 1181.3243 1807.9722 
##       272       273       274       275       276       277       278 
## 1807.9722 1807.9722 1807.9722 1446.1662 1760.2138 1760.2138 1760.2138 
##       279       280       367       368       369       370       371 
## 1181.3243 1760.2138 2158.2004 2158.2004 2158.2004 2085.8392 2085.8392 
##       372       373       374       375       376       377       378 
## 2085.8392 1446.1662 1446.1662 1446.1662 1543.1302 1543.1302 1543.1302
cor(British$PriceEconomy,British$FlightDuration)
## [1] 0.6822227
fit<-lm(PriceEconomy~SeatsEconomy,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1169.0  -639.2   -46.1   524.1  1753.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2174.0297   167.9032  12.948  < 2e-16 ***
## SeatsEconomy   -4.0655     0.7331  -5.546 1.08e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 722.1 on 173 degrees of freedom
## Multiple R-squared:  0.1509, Adjusted R-squared:  0.146 
## F-statistic: 30.75 on 1 and 173 DF,  p-value: 1.079e-07
British$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##         8         9        10        11        12        13        14 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        15        16        17        18        19        20        21 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        22        23        24        25        26        27        28 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        29        30        31        32        33        34        35 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        36        37        38        39        40        41        42 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        43        44        45        46        47        48        49 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        50        51        52        53        54        55        56 
## 1678.0337 1678.0337 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 
##        57        58        59        60        61        82        83 
## 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 1186.1033 1186.1033 
##        84        85        86        87        88        89        99 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033  942.1708 
##       100       101       102       103       104       105       106 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       107       108       109       110       111       112       113 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       114       115       116       117       118       119       120 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       121       122       123       124       125       126       127 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       128       129       130       131       132       133       134 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       135       136       137       138       139       140       141 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       142       143       144       145       146       147       148 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       149       150       151       240       241       242       243 
##  942.1708  905.5809  942.1708 1186.1033 1186.1033 1186.1033 1186.1033 
##       244       245       246       247       248       249       250 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       251       252       253       254       255       256       257 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       258       259       260       261       262       263       264 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       265       266       267       268       269       270       271 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       272       273       274       275       276       277       278 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       279       280       367       368       369       370       371 
## 1186.1033 1186.1033 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 
##       372       373       374       375       376       377       378 
## 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249
cor(British$PriceEconomy,British$SeatsEconomy)
## [1] -0.3885088
fit<-lm(PriceEconomy~PriceRelative,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = British)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1226.20  -709.99    85.17   481.68  1620.52 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     950.93      96.29   9.876  < 2e-16 ***
## PriceRelative   782.89     178.69   4.381 2.04e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 743.5 on 173 degrees of freedom
## Multiple R-squared:  0.09987,    Adjusted R-squared:  0.09467 
## F-statistic:  19.2 on 1 and 173 DF,  p-value: 2.041e-05
British$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##         1         2         3         4         5         6         7 
## 1248.4304 1248.4304 1248.4304 1248.4304 1475.4679 1475.4679 1475.4679 
##         8         9        10        11        12        13        14 
## 1757.3075 1757.3075 1538.0989 1538.0989 1389.3502 1154.4839 1358.0347 
##        15        16        17        18        19        20        21 
## 1358.0347 1358.0347 1248.4304 1248.4304 1248.4304 1217.1149 1217.1149 
##        22        23        24        25        26        27        28 
## 1217.1149 1209.2860 1209.2860 1209.2860 1224.9438 1209.2860 1209.2860 
##        29        30        31        32        33        34        35 
## 1217.1149 1217.1149 1217.1149 1279.7459 1279.7459 1279.7459 1279.7459 
##        36        37        38        39        40        41        42 
## 1459.8101 1459.8101 1459.8101 1138.8261 1138.8261 1138.8261 1138.8261 
##        43        44        45        46        47        48        49 
## 1084.0240 1084.0240 1084.0240 1013.5641 1013.5641 1013.5641 1358.0347 
##        50        51        52        53        54        55        56 
## 1358.0347 1358.0347 1757.3075 1232.7726 1232.7726 1232.7726 1217.1149 
##        57        58        59        60        61        82        83 
## 1217.1149 1217.1149 1115.3395 1115.3395 1428.4946 1788.6230 1788.6230 
##        84        85        86        87        88        89        99 
## 1788.6230 1788.6230 1264.0882 1264.0882 1264.0882 1264.0882 1334.5481 
##       100       101       102       103       104       105       106 
## 1334.5481 1334.5481 1334.5481 1663.3609 1663.3609 1663.3609 1663.3609 
##       107       108       109       110       111       112       113 
## 1318.8903 1318.8903 1318.8903 1945.2005 1945.2005 1232.7726  997.9063 
##       114       115       116       117       118       119       120 
## 1029.2218 1029.2218  982.2486 1037.0507 1037.0507 1013.5641 1021.3929 
##       121       122       123       124       125       126       127 
##  990.0774  990.0774 1037.0507 1060.5373 1084.0240 1076.1951 1068.3662 
##       128       129       130       131       132       133       134 
## 1005.7352 1084.0240 1091.8528 1060.5373 1052.7085 1076.1951 1091.8528 
##       135       136       137       138       139       140       141 
## 1091.8528 1146.6550 1107.5106 1154.4839 1099.6817 1130.9972 1130.9972 
##       142       143       144       145       146       147       148 
## 1185.7994 1185.7994 1185.7994 1146.6550 1177.9705 1177.9705 1177.9705 
##       149       150       151       240       241       242       243 
## 1264.0882 1193.6283 1209.2860 1835.5962 1835.5962 1154.4839 1303.2325 
##       244       245       246       247       248       249       250 
## 1303.2325 1303.2325 1232.7726 1232.7726 1232.7726 1232.7726 1718.1631 
##       251       252       253       254       255       256       257 
## 1718.1631 1718.1631 1209.2860 1209.2860 1209.2860 1209.2860 1232.7726 
##       258       259       260       261       262       263       264 
## 1232.7726 1232.7726 1835.5962 1279.7459 1279.7459 1279.7459 1264.0882 
##       265       266       267       268       269       270       271 
## 1264.0882 1264.0882 1577.2433 1005.7352 1005.7352 1005.7352 1819.9385 
##       272       273       274       275       276       277       278 
## 1819.9385 1663.3609 1107.5106 1577.2433 1084.0240 1084.0240 1084.0240 
##       279       280       367       368       369       370       371 
## 1115.3395 1397.1791 2039.1471 2039.1471 2039.1471 1060.5373 1060.5373 
##       372       373       374       375       376       377       378 
## 1060.5373 1553.7566 1326.7192 1326.7192  982.2486 1358.0347 1240.6015
cor(British$PriceEconomy,British$PriceRelative)
## [1] 0.3160274
fit<-lm(PriceEconomy~PercentPremiumSeats,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1188.4  -665.2   110.1   509.3  1927.5 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.23     210.95   4.741 4.41e-06 ***
## PercentPremiumSeats    16.48      11.39   1.448     0.15    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 779 on 173 degrees of freedom
## Multiple R-squared:  0.01197,    Adjusted R-squared:  0.006258 
## F-statistic: 2.096 on 1 and 173 DF,  p-value: 0.1495
British$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823 2384
##  [71] 2384 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457
##  [85]  402  402  392  356  356  322  297  303  303  276  249  238  238  228
##  [99]  231  203  201  207  207  182  171  168  140  147  137  138  126  126
## [113]  109  109  109  104   97   77   77   69   74   65 1651 1651 2775 2230
## [127] 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281 2281 2281 1813
## [141] 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736 1736 1736  846
## [155]  846  937 1485  891 1323 1023 1023  757  533 3102 3102 3102 2166 2166
## [169] 2166  649  575  575  797  524  582
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##        9       10       11       12       13       14       15       16 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       17       18       19       20       21       22       23       24 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       25       26       27       28       29       30       31       32 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       33       34       35       36       37       38       39       40 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       41       42       43       44       45       46       47       48 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       49       50       51       52       53       54       55       56 
## 1407.202 1407.202 1407.202 1387.422 1387.422 1387.422 1387.422 1387.422 
##       57       58       59       60       61       82       83       84 
## 1387.422 1387.422 1387.422 1387.422 1387.422 1308.962 1308.962 1308.962 
##       85       86       87       88       89       99      100      101 
## 1308.962 1308.962 1308.962 1308.962 1308.962 1253.414 1253.414 1253.414 
##      102      103      104      105      106      107      108      109 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      110      111      112      113      114      115      116      117 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      118      119      120      121      122      123      124      125 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      126      127      128      129      130      131      132      133 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      134      135      136      137      138      139      140      141 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      142      143      144      145      146      147      148      149 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      150      151      240      241      242      243      244      245 
## 1247.315 1253.414 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      246      247      248      249      250      251      252      253 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      254      255      256      257      258      259      260      261 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      262      263      264      265      266      267      268      269 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      270      271      272      273      274      275      276      277 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      278      279      280      367      368      369      370      371 
## 1212.865 1212.865 1212.865 1174.459 1174.459 1174.459 1174.459 1174.459 
##      372      373      374      375      376      377      378 
## 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459
cor(British$PriceEconomy,British$PercentPremiumSeats)
## [1] 0.1094026
fit<-lm(PricePremium~FlightDuration,data = British)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2347.1  -602.7   116.3   678.4  4032.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       38.52     179.30   0.215     0.83    
## FlightDuration   241.70      20.68  11.689   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1005 on 173 degrees of freedom
## Multiple R-squared:  0.4413, Adjusted R-squared:  0.4381 
## F-statistic: 136.6 on 1 and 173 DF,  p-value: < 2.2e-16
British$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 2999.2858 2999.2858 2999.2858 2999.2858 2010.7525 2010.7525 2010.7525 
##         8         9        10        11        12        13        14 
## 1609.5385 1609.5385 2818.0144 2818.0144 2818.0144 2818.0144 2837.3500 
##        15        16        17        18        19        20        21 
## 2837.3500 2837.3500 2252.4477 2252.4477 2252.4477 1669.9623 1669.9623 
##        22        23        24        25        26        27        28 
## 1669.9623 1648.2097 1648.2097 1648.2097 2153.3527 2153.3527 2153.3527 
##        29        30        31        32        33        34        35 
## 1225.2432 1225.2432 1225.2432  964.2124  964.2124  964.2124  964.2124 
##        36        37        38        39        40        41        42 
## 3301.4048 3301.4048 3301.4048  964.2124  964.2124  964.2124  964.2124 
##        43        44        45        46        47        48        49 
## 1346.0907 1346.0907 1346.0907 2032.5051 2032.5051 2032.5051 3120.1334 
##        50        51        52        53        54        55        56 
## 3120.1334 3120.1334 1609.5385 2716.5025 2716.5025 2716.5025 1508.0265 
##        57        58        59        60        61        82        83 
## 1508.0265 1508.0265 3059.7096 2950.9468 3059.7096 1689.2979 1689.2979 
##        84        85        86        87        88        89        99 
## 1689.2979 1689.2979 1870.5693 1870.5693 1870.5693 1870.5693 2735.8381 
##       100       101       102       103       104       105       106 
## 2735.8381 2735.8381 2735.8381 2576.3192 2576.3192 2576.3192 2576.3192 
##       107       108       109       110       111       112       113 
## 3199.8928 3199.8928 3199.8928 2735.8381 2735.8381 2735.8381 1024.6362 
##       114       115       116       117       118       119       120 
##  903.7886  903.7886  621.0052  824.0291  824.0291  903.7886  681.4290 
##       121       122       123       124       125       126       127 
##  621.0052  621.0052  621.0052  824.0291  480.8220  903.7886 1126.1481 
##       128       129       130       131       132       133       134 
##  621.0052 1126.1481  480.8220  621.0052  903.7886 1024.6362  722.5172 
##       135       136       137       138       139       140       141 
## 1126.1481  340.6388 1024.6362  340.6388  621.0052  480.8220  480.8220 
##       142       143       144       145       146       147       148 
##  340.6388  340.6388  340.6388  903.7886  722.5172  359.9744  359.9744 
##       149       150       151       240       241       242       243 
##  340.6388  621.0052  359.9744 2554.5667 2554.5667 2554.5667 2697.1668 
##       244       245       246       247       248       249       250 
## 2697.1668 2697.1668 2433.7191 2433.7191 2433.7191 2433.7191 2112.2645 
##       251       252       253       254       255       256       257 
## 2112.2645 2112.2645 2796.2619 2796.2619 2796.2619 2796.2619 2293.5359 
##       258       259       260       261       262       263       264 
## 2293.5359 2293.5359 2192.0239 2131.6001 2131.6001 2131.6001 1790.8099 
##       265       266       267       268       269       270       271 
## 1790.8099 1790.8099 2192.0239 1749.7217 1749.7217 1749.7217 2796.2619 
##       272       273       274       275       276       277       278 
## 2796.2619 2796.2619 2796.2619 2192.0239 2716.5025 2716.5025 2716.5025 
##       279       280       367       368       369       370       371 
## 1749.7217 2716.5025 3381.1642 3381.1642 3381.1642 3260.3166 3260.3166 
##       372       373       374       375       376       377       378 
## 3260.3166 2192.0239 2192.0239 2192.0239 2353.9597 2353.9597 2353.9597
cor(British$PricePremium,British$FlightDuration)
## [1] 0.664292
fit<-lm(PriceEconomy~SeatsEconomy,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1169.0  -639.2   -46.1   524.1  1753.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2174.0297   167.9032  12.948  < 2e-16 ***
## SeatsEconomy   -4.0655     0.7331  -5.546 1.08e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 722.1 on 173 degrees of freedom
## Multiple R-squared:  0.1509, Adjusted R-squared:  0.146 
## F-statistic: 30.75 on 1 and 173 DF,  p-value: 1.079e-07
British$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##         8         9        10        11        12        13        14 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        15        16        17        18        19        20        21 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        22        23        24        25        26        27        28 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        29        30        31        32        33        34        35 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        36        37        38        39        40        41        42 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        43        44        45        46        47        48        49 
## 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 1678.0337 
##        50        51        52        53        54        55        56 
## 1678.0337 1678.0337 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 
##        57        58        59        60        61        82        83 
## 1657.7060 1657.7060 1657.7060 1657.7060 1657.7060 1186.1033 1186.1033 
##        84        85        86        87        88        89        99 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033  942.1708 
##       100       101       102       103       104       105       106 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       107       108       109       110       111       112       113 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       114       115       116       117       118       119       120 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       121       122       123       124       125       126       127 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       128       129       130       131       132       133       134 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       135       136       137       138       139       140       141 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       142       143       144       145       146       147       148 
##  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708  942.1708 
##       149       150       151       240       241       242       243 
##  942.1708  905.5809  942.1708 1186.1033 1186.1033 1186.1033 1186.1033 
##       244       245       246       247       248       249       250 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       251       252       253       254       255       256       257 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       258       259       260       261       262       263       264 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       265       266       267       268       269       270       271 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       272       273       274       275       276       277       278 
## 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 1186.1033 
##       279       280       367       368       369       370       371 
## 1186.1033 1186.1033 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 
##       372       373       374       375       376       377       378 
## 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249 1348.7249
cor(British$PricePremium,British$SeatsEconomy)
## [1] -0.3006343
fit<-lm(PriceEconomy~SeatsPremium,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = British)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1513.48  -572.66   -10.06   396.07  1548.84 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2968.309    241.589   12.29  < 2e-16 ***
## SeatsPremium  -38.785      5.463   -7.10  3.1e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 689.7 on 173 degrees of freedom
## Multiple R-squared:  0.2256, Adjusted R-squared:  0.2212 
## F-statistic: 50.41 on 1 and 173 DF,  p-value: 3.101e-11
British$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##         8         9        10        11        12        13        14 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        15        16        17        18        19        20        21 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        22        23        24        25        26        27        28 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        29        30        31        32        33        34        35 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        36        37        38        39        40        41        42 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        43        44        45        46        47        48        49 
## 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 1416.9258 
##        50        51        52        53        54        55        56 
## 1416.9258 1416.9258 1455.7103 1455.7103 1455.7103 1455.7103 1455.7103 
##        57        58        59        60        61        82        83 
## 1455.7103 1455.7103 1455.7103 1455.7103 1455.7103  796.3725  796.3725 
##        84        85        86        87        88        89        99 
##  796.3725  796.3725  796.3725  796.3725  796.3725  796.3725  835.1571 
##       100       101       102       103       104       105       106 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       107       108       109       110       111       112       113 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       114       115       116       117       118       119       120 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       121       122       123       124       125       126       127 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       128       129       130       131       132       133       134 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       135       136       137       138       139       140       141 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       142       143       144       145       146       147       148 
##  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571  835.1571 
##       149       150       151       240       241       242       243 
##  835.1571  835.1571  835.1571 1572.0641 1572.0641 1572.0641 1572.0641 
##       244       245       246       247       248       249       250 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       251       252       253       254       255       256       257 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       258       259       260       261       262       263       264 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       265       266       267       268       269       270       271 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       272       273       274       275       276       277       278 
## 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 1572.0641 
##       279       280       367       368       369       370       371 
## 1572.0641 1572.0641 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 
##       372       373       374       375       376       377       378 
## 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790 2037.4790
cor(British$PricePremium,British$SeatsPremium)
## [1] -0.4260349
fit<-lm(PriceEconomy~PriceRelative,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = British)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1226.20  -709.99    85.17   481.68  1620.52 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     950.93      96.29   9.876  < 2e-16 ***
## PriceRelative   782.89     178.69   4.381 2.04e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 743.5 on 173 degrees of freedom
## Multiple R-squared:  0.09987,    Adjusted R-squared:  0.09467 
## F-statistic:  19.2 on 1 and 173 DF,  p-value: 2.041e-05
British$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##         1         2         3         4         5         6         7 
## 1248.4304 1248.4304 1248.4304 1248.4304 1475.4679 1475.4679 1475.4679 
##         8         9        10        11        12        13        14 
## 1757.3075 1757.3075 1538.0989 1538.0989 1389.3502 1154.4839 1358.0347 
##        15        16        17        18        19        20        21 
## 1358.0347 1358.0347 1248.4304 1248.4304 1248.4304 1217.1149 1217.1149 
##        22        23        24        25        26        27        28 
## 1217.1149 1209.2860 1209.2860 1209.2860 1224.9438 1209.2860 1209.2860 
##        29        30        31        32        33        34        35 
## 1217.1149 1217.1149 1217.1149 1279.7459 1279.7459 1279.7459 1279.7459 
##        36        37        38        39        40        41        42 
## 1459.8101 1459.8101 1459.8101 1138.8261 1138.8261 1138.8261 1138.8261 
##        43        44        45        46        47        48        49 
## 1084.0240 1084.0240 1084.0240 1013.5641 1013.5641 1013.5641 1358.0347 
##        50        51        52        53        54        55        56 
## 1358.0347 1358.0347 1757.3075 1232.7726 1232.7726 1232.7726 1217.1149 
##        57        58        59        60        61        82        83 
## 1217.1149 1217.1149 1115.3395 1115.3395 1428.4946 1788.6230 1788.6230 
##        84        85        86        87        88        89        99 
## 1788.6230 1788.6230 1264.0882 1264.0882 1264.0882 1264.0882 1334.5481 
##       100       101       102       103       104       105       106 
## 1334.5481 1334.5481 1334.5481 1663.3609 1663.3609 1663.3609 1663.3609 
##       107       108       109       110       111       112       113 
## 1318.8903 1318.8903 1318.8903 1945.2005 1945.2005 1232.7726  997.9063 
##       114       115       116       117       118       119       120 
## 1029.2218 1029.2218  982.2486 1037.0507 1037.0507 1013.5641 1021.3929 
##       121       122       123       124       125       126       127 
##  990.0774  990.0774 1037.0507 1060.5373 1084.0240 1076.1951 1068.3662 
##       128       129       130       131       132       133       134 
## 1005.7352 1084.0240 1091.8528 1060.5373 1052.7085 1076.1951 1091.8528 
##       135       136       137       138       139       140       141 
## 1091.8528 1146.6550 1107.5106 1154.4839 1099.6817 1130.9972 1130.9972 
##       142       143       144       145       146       147       148 
## 1185.7994 1185.7994 1185.7994 1146.6550 1177.9705 1177.9705 1177.9705 
##       149       150       151       240       241       242       243 
## 1264.0882 1193.6283 1209.2860 1835.5962 1835.5962 1154.4839 1303.2325 
##       244       245       246       247       248       249       250 
## 1303.2325 1303.2325 1232.7726 1232.7726 1232.7726 1232.7726 1718.1631 
##       251       252       253       254       255       256       257 
## 1718.1631 1718.1631 1209.2860 1209.2860 1209.2860 1209.2860 1232.7726 
##       258       259       260       261       262       263       264 
## 1232.7726 1232.7726 1835.5962 1279.7459 1279.7459 1279.7459 1264.0882 
##       265       266       267       268       269       270       271 
## 1264.0882 1264.0882 1577.2433 1005.7352 1005.7352 1005.7352 1819.9385 
##       272       273       274       275       276       277       278 
## 1819.9385 1663.3609 1107.5106 1577.2433 1084.0240 1084.0240 1084.0240 
##       279       280       367       368       369       370       371 
## 1115.3395 1397.1791 2039.1471 2039.1471 2039.1471 1060.5373 1060.5373 
##       372       373       374       375       376       377       378 
## 1060.5373 1553.7566 1326.7192 1326.7192  982.2486 1358.0347 1240.6015
cor(British$PricePremium,British$PriceRelative)
## [1] 0.602946
fit<-lm(PriceEconomy~PercentPremiumSeats,data = British)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = British)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1188.4  -665.2   110.1   509.3  1927.5 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.23     210.95   4.741 4.41e-06 ***
## PercentPremiumSeats    16.48      11.39   1.448     0.15    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 779 on 173 degrees of freedom
## Multiple R-squared:  0.01197,    Adjusted R-squared:  0.006258 
## F-statistic: 2.096 on 1 and 173 DF,  p-value: 0.1495
British$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548 3563
##  [71] 3563 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486
##  [85]  442  442  407  396  396  348  323  319  319  306  285  278  276  263
##  [99]  247  238  237  237  234  211  201  198  175  175  172  165  156  156
## [113]  141  141  141  131  125   99   99   97   97   86 3509 3509 3509 3227
## [127] 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025 3025 3025 2472
## [141] 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866 1866 1866 1784
## [155] 1784 1784 1784 1603 1550 1199 1199  912  837 7414 7414 7414 2470 2470
## [169] 2470 1152  853  853  826  797  797
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##        9       10       11       12       13       14       15       16 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       17       18       19       20       21       22       23       24 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       25       26       27       28       29       30       31       32 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       33       34       35       36       37       38       39       40 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       41       42       43       44       45       46       47       48 
## 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 1407.202 
##       49       50       51       52       53       54       55       56 
## 1407.202 1407.202 1407.202 1387.422 1387.422 1387.422 1387.422 1387.422 
##       57       58       59       60       61       82       83       84 
## 1387.422 1387.422 1387.422 1387.422 1387.422 1308.962 1308.962 1308.962 
##       85       86       87       88       89       99      100      101 
## 1308.962 1308.962 1308.962 1308.962 1308.962 1253.414 1253.414 1253.414 
##      102      103      104      105      106      107      108      109 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      110      111      112      113      114      115      116      117 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      118      119      120      121      122      123      124      125 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      126      127      128      129      130      131      132      133 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      134      135      136      137      138      139      140      141 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      142      143      144      145      146      147      148      149 
## 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 1253.414 
##      150      151      240      241      242      243      244      245 
## 1247.315 1253.414 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      246      247      248      249      250      251      252      253 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      254      255      256      257      258      259      260      261 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      262      263      264      265      266      267      268      269 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      270      271      272      273      274      275      276      277 
## 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 1212.865 
##      278      279      280      367      368      369      370      371 
## 1212.865 1212.865 1212.865 1174.459 1174.459 1174.459 1174.459 1174.459 
##      372      373      374      375      376      377      378 
## 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459 1174.459
cor(British$PricePremium,British$PercentPremiumSeats)
## [1] 0.03194159

Virgin Airlines

Analyse all about Virgin Airlines:-

Virgin <- airline[ which(airline$Airline=='Virgin'),]
View(Virgin)
summary(Virgin)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance: 0   AirBus:33   Min.   : 6.580   Aug:16     
##  British  : 0   Boeing:29   1st Qu.: 7.473   Jul:14     
##  Delta    : 0               Median : 8.830   Oct:16     
##  Jet      : 0               Mean   : 9.250   Sep:16     
##  Singapore: 0               3rd Qu.:10.830              
##  Virgin   :62               Max.   :12.580              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :185.0   Min.   :35.00   Min.   :31   
##  International:62     1st Qu.:198.0   1st Qu.:35.00   1st Qu.:31   
##                       Median :198.0   Median :38.00   Median :31   
##                       Mean   :230.2   Mean   :42.53   Mean   :31   
##                       3rd Qu.:233.0   3rd Qu.:48.00   3rd Qu.:31   
##                       Max.   :375.0   Max.   :66.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :21    Min.   : 540   Min.   : 594  
##  1st Qu.:38    1st Qu.:18    1st Qu.:21    1st Qu.:1434   1st Qu.:2499  
##  Median :38    Median :18    Median :21    Median :1774   Median :2973  
##  Mean   :38    Mean   :18    Mean   :21    Mean   :1604   Mean   :2722  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:21    3rd Qu.:1903   3rd Qu.:3128  
##  Max.   :38    Max.   :18    Max.   :21    Max.   :2445   Max.   :3694  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.1000   Min.   :233.0   Min.   :7       Min.   :3      
##  1st Qu.:0.4000   1st Qu.:233.0   1st Qu.:7       1st Qu.:3      
##  Median :0.7300   Median :233.0   Median :7       Median :3      
##  Mean   :0.7606   Mean   :272.7   Mean   :7       Mean   :3      
##  3rd Qu.:1.0150   3rd Qu.:271.0   3rd Qu.:7       3rd Qu.:3      
##  Max.   :1.8200   Max.   :441.0   Max.   :7       Max.   :3      
##  PercentPremiumSeats
##  Min.   :14.02      
##  1st Qu.:14.02      
##  Median :15.02      
##  Mean   :15.75      
##  3rd Qu.:15.02      
##  Max.   :20.60

Check the all the means now all Virgin aircrafts

mean(Virgin$PriceEconomy)
## [1] 1603.532
mean(Virgin$PricePremium)
## [1] 2721.694
mean(Virgin$FlightDuration)
## [1] 9.250484
mean(Virgin$PitchEconomy)
## [1] 31
mean(Virgin$PitchPremium)
## [1] 38
mean(Virgin$WidthEconomy)
## [1] 18
mean(Virgin$WidthPremium)
## [1] 21
mean(Virgin$PriceRelative)
## [1] 0.7606452
mean(Virgin$PitchDifference)
## [1] 7
mean(Virgin$WidthDifference)
## [1] 3

Now Analyse separately for Each Aircrafts in Virgin Airlines

Vrboeing <- Virgin[ which(Virgin$Aircraft=='Boeing'),]
View(Vrboeing)
summary(Vrboeing)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 0   Min.   : 7.66   Aug:7      
##  British  : 0   Boeing:29   1st Qu.: 9.91   Jul:6      
##  Delta    : 0               Median :10.83   Oct:9      
##  Jet      : 0               Mean   :10.67   Sep:7      
##  Singapore: 0               3rd Qu.:11.33              
##  Virgin   :29               Max.   :12.58              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :198.0   Min.   :35.00   Min.   :31   
##  International:29     1st Qu.:198.0   1st Qu.:35.00   1st Qu.:31   
##                       Median :198.0   Median :35.00   Median :31   
##                       Mean   :246.8   Mean   :43.55   Mean   :31   
##                       3rd Qu.:375.0   3rd Qu.:66.00   3rd Qu.:31   
##                       Max.   :375.0   Max.   :66.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :21    Min.   : 574   Min.   :1465  
##  1st Qu.:38    1st Qu.:18    1st Qu.:21    1st Qu.:1086   1st Qu.:2531  
##  Median :38    Median :18    Median :21    Median :1580   Median :2964  
##  Mean   :38    Mean   :18    Mean   :21    Mean   :1551   Mean   :2803  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:21    3rd Qu.:1811   3rd Qu.:3509  
##  Max.   :38    Max.   :18    Max.   :21    Max.   :2445   Max.   :3694  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.2600   Min.   :233.0   Min.   :7       Min.   :3      
##  1st Qu.:0.5100   1st Qu.:233.0   1st Qu.:7       1st Qu.:3      
##  Median :0.9100   Median :233.0   Median :7       Median :3      
##  Mean   :0.9538   Mean   :290.4   Mean   :7       Mean   :3      
##  3rd Qu.:1.3800   3rd Qu.:441.0   3rd Qu.:7       3rd Qu.:3      
##  Max.   :1.8200   Max.   :441.0   Max.   :7       Max.   :3      
##  PercentPremiumSeats
##  Min.   :14.97      
##  1st Qu.:14.97      
##  Median :15.02      
##  Mean   :15.01      
##  3rd Qu.:15.02      
##  Max.   :15.02
mean(Vrboeing$PriceEconomy)
## [1] 1550.621
mean(Vrboeing$PricePremium)
## [1] 2802.69
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Vrboeing$PriceEconomy,Vrboeing$TravelMonth,mean))
y2<-c(by(Vrboeing$PricePremium,Vrboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Vrboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -878.1 -250.1   56.7  101.6  930.5 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     3360.46     755.41   4.449 0.000134 ***
## FlightDuration  -169.64      70.18  -2.417 0.022662 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 541 on 27 degrees of freedom
## Multiple R-squared:  0.1779, Adjusted R-squared:  0.1475 
## F-statistic: 5.843 on 1 and 27 DF,  p-value: 0.02266
Vrboeing$PriceEconomy
##  [1]  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580
## [15] 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811
## [29] 1356
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1452.056 1452.056 1452.056 1452.056 1311.258 1311.258 1311.258 1311.258 
##      164      165      166      167      168      169      170      171 
## 1679.369 1679.369 1679.369 1679.369 1523.303 1523.303 1523.303 1523.303 
##      172      173      174      175      176      177      178      179 
## 1594.551 1226.440 1536.874 1536.874 1536.874 1536.874 1226.440 1438.485 
##      180      181      182      183      184 
## 2061.050 2061.050 2061.050 2061.050 1226.440
cor(Vrboeing$PriceEconomy,Vrboeing$FlightDuration)
## [1] -0.4218011
fit<-lm(PriceEconomy~SeatsEconomy,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.38 -332.00   19.62  332.00 1032.62 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   467.621    289.599   1.615 0.117999    
## SeatsEconomy    4.388      1.117   3.927 0.000537 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 476 on 27 degrees of freedom
## Multiple R-squared:  0.3635, Adjusted R-squared:   0.34 
## F-statistic: 15.42 on 1 and 27 DF,  p-value: 0.0005366
Vrboeing$PriceEconomy
##  [1]  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580
## [15] 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811
## [29] 1356
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 
##      164      165      166      167      168      169      170      171 
## 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 1336.381 1336.381 
##      172      173      174      175      176      177      178      179 
## 1336.381 1336.381 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 
##      180      181      182      183      184 
## 1336.381 1336.381 1336.381 1336.381 1336.381
cor(Vrboeing$PriceEconomy,Vrboeing$SeatsEconomy)
## [1] 0.6029359
fit<-lm(PriceEconomy~PriceRelative,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -945.78 -191.35   -6.34  243.60  532.38 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2328.6      151.8  15.339 7.48e-15 ***
## PriceRelative   -815.7      139.3  -5.858 3.08e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 395.9 on 27 degrees of freedom
## Multiple R-squared:  0.5596, Adjusted R-squared:  0.5433 
## F-statistic: 34.31 on 1 and 27 DF,  p-value: 3.08e-06
Vrboeing$PriceEconomy
##  [1]  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580
## [15] 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811
## [29] 1356
fitted(fit)
##       156       157       158       159       160       161       162 
##  844.0523  844.0523  844.0523  844.0523  917.4657  917.4657  917.4657 
##       163       164       165       166       167       168       169 
## 1202.9620 1537.4007 1537.4007 1537.4007 1537.4007 1586.3429 1586.3429 
##       170       171       172       173       174       175       176 
## 1586.3429 1586.3429 1643.4422 1871.8393 1912.6245 1912.6245 1912.6245 
##       177       178       179       180       181       182       183 
## 1912.6245 1920.7815 1928.9386 2002.3519 2002.3519 2002.3519 2002.3519 
##       184 
## 2116.5505
cor(Vrboeing$PriceEconomy,Vrboeing$PriceRelative)
## [1] -0.7480927
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.38 -332.00   19.62  332.00 1032.62 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           234633      59353   3.953 0.000501 ***
## PercentPremiumSeats   -15532       3955  -3.927 0.000537 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 476 on 27 degrees of freedom
## Multiple R-squared:  0.3635, Adjusted R-squared:   0.34 
## F-statistic: 15.42 on 1 and 27 DF,  p-value: 0.0005366
Vrboeing$PriceEconomy
##  [1]  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580
## [15] 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811
## [29] 1356
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 
##      164      165      166      167      168      169      170      171 
## 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 1336.381 1336.381 
##      172      173      174      175      176      177      178      179 
## 1336.381 1336.381 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 
##      180      181      182      183      184 
## 1336.381 1336.381 1336.381 1336.381 1336.381
cor(Vrboeing$PriceEconomy,Vrboeing$PercentPremiumSeats)
## [1] -0.6029359
fit<-lm(PricePremium~FlightDuration,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1121.8  -611.7   234.5   620.5   900.5 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     4008.26    1069.08   3.749 0.000856 ***
## FlightDuration  -113.00      99.31  -1.138 0.265208    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 765.6 on 27 degrees of freedom
## Multiple R-squared:  0.04575,    Adjusted R-squared:  0.01041 
## F-statistic: 1.295 on 1 and 27 DF,  p-value: 0.2652
Vrboeing$PricePremium
##  [1] 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019
## [15] 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531
## [29] 1710
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 2737.034 2737.034 2737.034 2737.034 2643.245 2643.245 2643.245 2643.245 
##      164      165      166      167      168      169      170      171 
## 2888.451 2888.451 2888.451 2888.451 2784.493 2784.493 2784.493 2784.493 
##      172      173      174      175      176      177      178      179 
## 2831.952 2586.746 2793.533 2793.533 2793.533 2793.533 2586.746 2727.994 
##      180      181      182      183      184 
## 3142.697 3142.697 3142.697 3142.697 2586.746
cor(Vrboeing$PricePremium,Vrboeing$FlightDuration)
## [1] -0.2138983
fit<-lm(PriceEconomy~SeatsEconomy,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.38 -332.00   19.62  332.00 1032.62 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   467.621    289.599   1.615 0.117999    
## SeatsEconomy    4.388      1.117   3.927 0.000537 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 476 on 27 degrees of freedom
## Multiple R-squared:  0.3635, Adjusted R-squared:   0.34 
## F-statistic: 15.42 on 1 and 27 DF,  p-value: 0.0005366
Vrboeing$PricePremium
##  [1] 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019
## [15] 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531
## [29] 1710
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 
##      164      165      166      167      168      169      170      171 
## 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 1336.381 1336.381 
##      172      173      174      175      176      177      178      179 
## 1336.381 1336.381 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 
##      180      181      182      183      184 
## 1336.381 1336.381 1336.381 1336.381 1336.381
cor(Vrboeing$PricePremium,Vrboeing$SeatsEconomy)
## [1] 0.6519771
fit<-lm(PriceEconomy~SeatsPremium,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.38 -332.00   19.62  332.00 1032.62 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   459.553    291.556   1.576 0.126624    
## SeatsPremium   25.052      6.379   3.927 0.000537 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 476 on 27 degrees of freedom
## Multiple R-squared:  0.3635, Adjusted R-squared:   0.34 
## F-statistic: 15.42 on 1 and 27 DF,  p-value: 0.0005366
Vrboeing$PricePremium
##  [1] 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019
## [15] 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531
## [29] 1710
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 
##      164      165      166      167      168      169      170      171 
## 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 1336.381 1336.381 
##      172      173      174      175      176      177      178      179 
## 1336.381 1336.381 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 
##      180      181      182      183      184 
## 1336.381 1336.381 1336.381 1336.381 1336.381
cor(Vrboeing$PricePremium,Vrboeing$SeatsPremium)
## [1] 0.6519771
fit<-lm(PriceEconomy~PriceRelative,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -945.78 -191.35   -6.34  243.60  532.38 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2328.6      151.8  15.339 7.48e-15 ***
## PriceRelative   -815.7      139.3  -5.858 3.08e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 395.9 on 27 degrees of freedom
## Multiple R-squared:  0.5596, Adjusted R-squared:  0.5433 
## F-statistic: 34.31 on 1 and 27 DF,  p-value: 3.08e-06
Vrboeing$PricePremium
##  [1] 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019
## [15] 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531
## [29] 1710
fitted(fit)
##       156       157       158       159       160       161       162 
##  844.0523  844.0523  844.0523  844.0523  917.4657  917.4657  917.4657 
##       163       164       165       166       167       168       169 
## 1202.9620 1537.4007 1537.4007 1537.4007 1537.4007 1586.3429 1586.3429 
##       170       171       172       173       174       175       176 
## 1586.3429 1586.3429 1643.4422 1871.8393 1912.6245 1912.6245 1912.6245 
##       177       178       179       180       181       182       183 
## 1912.6245 1920.7815 1928.9386 2002.3519 2002.3519 2002.3519 2002.3519 
##       184 
## 2116.5505
cor(Vrboeing$PricePremium,Vrboeing$PriceRelative)
## [1] -0.2812307
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Vrboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Vrboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.38 -332.00   19.62  332.00 1032.62 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           234633      59353   3.953 0.000501 ***
## PercentPremiumSeats   -15532       3955  -3.927 0.000537 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 476 on 27 degrees of freedom
## Multiple R-squared:  0.3635, Adjusted R-squared:   0.34 
## F-statistic: 15.42 on 1 and 27 DF,  p-value: 0.0005366
Vrboeing$PricePremium
##  [1] 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019
## [15] 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531
## [29] 1710
fitted(fit)
##      156      157      158      159      160      161      162      163 
## 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 1336.381 
##      164      165      166      167      168      169      170      171 
## 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 1336.381 1336.381 
##      172      173      174      175      176      177      178      179 
## 1336.381 1336.381 2113.000 2113.000 2113.000 2113.000 1336.381 1336.381 
##      180      181      182      183      184 
## 1336.381 1336.381 1336.381 1336.381 1336.381
cor(Vrboeing$PricePremium,Vrboeing$PercentPremiumSeats)
## [1] -0.6519771
Vrairbus <-Virgin[ which(Virgin$Aircraft=='AirBus'),]
View(Vrairbus)
summary(Vrairbus)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance: 0   AirBus:33   Min.   : 6.580   Aug:9      
##  British  : 0   Boeing: 0   1st Qu.: 7.080   Jul:8      
##  Delta    : 0               Median : 7.750   Oct:7      
##  Jet      : 0               Mean   : 8.004   Sep:9      
##  Singapore: 0               3rd Qu.: 8.830              
##  Virgin   :33               Max.   :11.330              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :185.0   Min.   :38.00   Min.   :31   
##  International:33     1st Qu.:185.0   1st Qu.:38.00   1st Qu.:31   
##                       Median :233.0   Median :38.00   Median :31   
##                       Mean   :215.5   Mean   :41.64   Mean   :31   
##                       3rd Qu.:233.0   3rd Qu.:48.00   3rd Qu.:31   
##                       Max.   :233.0   Max.   :48.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :21    Min.   : 540   Min.   : 594  
##  1st Qu.:38    1st Qu.:18    1st Qu.:21    1st Qu.:1476   1st Qu.:2499  
##  Median :38    Median :18    Median :21    Median :1813   Median :2982  
##  Mean   :38    Mean   :18    Mean   :21    Mean   :1650   Mean   :2651  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:21    3rd Qu.:1919   3rd Qu.:3128  
##  Max.   :38    Max.   :18    Max.   :21    Max.   :2369   Max.   :3540  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.1000   Min.   :233.0   Min.   :7       Min.   :3      
##  1st Qu.:0.3900   1st Qu.:233.0   1st Qu.:7       1st Qu.:3      
##  Median :0.4900   Median :271.0   Median :7       Median :3      
##  Mean   :0.5909   Mean   :257.2   Mean   :7       Mean   :3      
##  3rd Qu.:0.8400   3rd Qu.:271.0   3rd Qu.:7       3rd Qu.:3      
##  Max.   :1.0800   Max.   :271.0   Max.   :7       Max.   :3      
##  PercentPremiumSeats
##  Min.   :14.02      
##  1st Qu.:14.02      
##  Median :14.02      
##  Mean   :16.41      
##  3rd Qu.:20.60      
##  Max.   :20.60
mean(Vrairbus$PriceEconomy)
## [1] 1650.03
mean(Vrairbus$PricePremium)
## [1] 2650.515
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Vrairbus$PriceEconomy,Vrairbus$TravelMonth,mean))
y4<-c(by(Vrairbus$PricePremium,Vrairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Vrairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1069.00   -39.29   163.61   212.93   418.24 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      356.92     459.77   0.776  0.44345   
## FlightDuration   161.56      56.64   2.852  0.00766 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 439.5 on 31 degrees of freedom
## Multiple R-squared:  0.2079, Adjusted R-squared:  0.1823 
## F-statistic: 8.136 on 1 and 31 DF,  p-value: 0.00766
Vrairbus$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 1434 1434
## [15] 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767
## [29] 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1649.394 1649.394 1649.394 1649.394 1783.488 1783.488 1783.488 1783.488 
##       70       71       72       73      191      192      193      194 
## 1500.759 1500.759 1500.759 1609.004 1473.294 1473.294 1473.294 1473.294 
##      195      196      197      198      199      200      201      202 
## 1419.979 1419.979 1419.979 1419.979 2038.753 2038.753 2038.753 2187.387 
##      203      204      205      206      207      208      209      210 
## 2187.387 1554.074 1554.074 1554.074 1554.074 1500.759 1609.004 1609.004 
##      211 
## 1609.004
cor(Vrairbus$PriceEconomy,Vrairbus$FlightDuration)
## [1] 0.4559439
fit<-lm(PriceEconomy~SeatsEconomy,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Vrairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1273.08   -80.86   105.92   238.92   812.14 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  2800.622    779.795   3.591  0.00112 **
## SeatsEconomy   -5.338      3.597  -1.484  0.14792   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 477.1 on 31 degrees of freedom
## Multiple R-squared:  0.06632,    Adjusted R-squared:  0.03621 
## F-statistic: 2.202 on 1 and 31 DF,  p-value: 0.1479
Vrairbus$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 1434 1434
## [15] 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767
## [29] 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 
##       70       71       72       73      191      192      193      194 
## 1813.083 1813.083 1813.083 1813.083 1556.857 1556.857 1556.857 1556.857 
##      195      196      197      198      199      200      201      202 
## 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 
##      203      204      205      206      207      208      209      210 
## 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 
##      211 
## 1556.857
cor(Vrairbus$PriceEconomy,Vrairbus$SeatsEconomy)
## [1] -0.2575346
fit<-lm(PriceEconomy~PriceRelative,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1001.1  -271.4   157.1   342.4   741.4 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1518.9      172.1   8.824 5.81e-10 ***
## PriceRelative    221.9      253.4   0.876    0.388    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 487.8 on 31 degrees of freedom
## Multiple R-squared:  0.02414,    Adjusted R-squared:  -0.007343 
## F-statistic: 0.7667 on 1 and 31 DF,  p-value: 0.388
Vrairbus$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 1434 1434
## [15] 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767
## [29] 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1680.890 1680.890 1680.890 1680.890 1605.455 1605.455 1605.455 1605.455 
##       70       71       72       73      191      192      193      194 
## 1576.612 1576.612 1576.612 1541.113 1758.545 1758.545 1758.545 1758.545 
##      195      196      197      198      199      200      201      202 
## 1747.451 1747.451 1747.451 1747.451 1705.296 1705.296 1705.296 1627.642 
##      203      204      205      206      207      208      209      210 
## 1627.642 1609.892 1609.892 1609.892 1609.892 1576.612 1541.113 1541.113 
##      211 
## 1541.113
cor(Vrairbus$PriceEconomy,Vrairbus$PriceRelative)
## [1] 0.1553585
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Vrairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1273.08   -80.86   105.92   238.92   812.14 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          1010.92     438.62   2.305    0.028 *
## PercentPremiumSeats    38.94      26.24   1.484    0.148  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 477.1 on 31 degrees of freedom
## Multiple R-squared:  0.06632,    Adjusted R-squared:  0.03621 
## F-statistic: 2.202 on 1 and 31 DF,  p-value: 0.1479
Vrairbus$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 1434 1434
## [15] 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767
## [29] 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 1813.083 
##       70       71       72       73      191      192      193      194 
## 1813.083 1813.083 1813.083 1813.083 1556.857 1556.857 1556.857 1556.857 
##      195      196      197      198      199      200      201      202 
## 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 
##      203      204      205      206      207      208      209      210 
## 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 1556.857 
##      211 
## 1556.857
fit<-lm(PricePremium~FlightDuration,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2002.9   -26.2   187.7   478.3   646.9 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)       961.7      847.7   1.134   0.2653  
## FlightDuration    211.0      104.4   2.020   0.0521 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 810.3 on 31 degrees of freedom
## Multiple R-squared:  0.1163, Adjusted R-squared:  0.08784 
## F-statistic: 4.082 on 1 and 31 DF,  p-value: 0.05206
Vrairbus$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 2982 2982
## [15] 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499
## [29] 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2649.684 2649.684 2649.684 2649.684 2824.810 2824.810 2824.810 2824.810 
##       70       71       72       73      191      192      193      194 
## 2455.568 2455.568 2455.568 2596.935 2419.699 2419.699 2419.699 2419.699 
##      195      196      197      198      199      200      201      202 
## 2350.071 2350.071 2350.071 2350.071 3158.182 3158.182 3158.182 3352.298 
##      203      204      205      206      207      208      209      210 
## 3352.298 2525.197 2525.197 2525.197 2525.197 2455.568 2596.935 2596.935 
##      211 
## 2596.935
cor(Vrairbus$PricePremium,Vrairbus$FlightDuration)
## [1] 0.3410968
fit<-lm(PricePremium~SeatsEconomy,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2058.9  -153.9   329.1   481.6   887.1 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  2621.5940  1408.8114   1.861   0.0723 .
## SeatsEconomy    0.1342     6.4988   0.021   0.9837  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 862 on 31 degrees of freedom
## Multiple R-squared:  1.375e-05,  Adjusted R-squared:  -0.03224 
## F-statistic: 0.0004263 on 1 and 31 DF,  p-value: 0.9837
Vrairbus$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 2982 2982
## [15] 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499
## [29] 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 
##       70       71       72       73      191      192      193      194 
## 2646.417 2646.417 2646.417 2646.417 2652.857 2652.857 2652.857 2652.857 
##      195      196      197      198      199      200      201      202 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      203      204      205      206      207      208      209      210 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      211 
## 2652.857
cor(Vrairbus$PricePremium,Vrairbus$SeatsEconomy)
## [1] 0.003708144
fit<-lm(PricePremium~SeatsPremium,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2058.9  -153.9   329.1   481.6   887.1 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  2677.331   1307.464   2.048   0.0491 *
## SeatsPremium   -0.644     31.195  -0.021   0.9837  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 862 on 31 degrees of freedom
## Multiple R-squared:  1.375e-05,  Adjusted R-squared:  -0.03224 
## F-statistic: 0.0004263 on 1 and 31 DF,  p-value: 0.9837
Vrairbus$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 2982 2982
## [15] 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499
## [29] 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 
##       70       71       72       73      191      192      193      194 
## 2646.417 2646.417 2646.417 2646.417 2652.857 2652.857 2652.857 2652.857 
##      195      196      197      198      199      200      201      202 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      203      204      205      206      207      208      209      210 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      211 
## 2652.857
cor(Vrairbus$PricePremium,Vrairbus$SeatsPremium)
## [1] -0.003708144
fit<-lm(PricePremium~PriceRelative,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1223.8  -398.4   241.5   435.9  1060.7 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1648.1      222.9   7.394 2.52e-08 ***
## PriceRelative   1696.4      328.1   5.170 1.32e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 631.7 on 31 degrees of freedom
## Multiple R-squared:  0.463,  Adjusted R-squared:  0.4457 
## F-statistic: 26.73 on 1 and 31 DF,  p-value: 1.32e-05
Vrairbus$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 2982 2982
## [15] 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499
## [29] 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2886.463 2886.463 2886.463 2886.463 2309.702 2309.702 2309.702 2309.702 
##       70       71       72       73      191      192      193      194 
## 2089.176 2089.176 2089.176 1817.759 3480.187 3480.187 3480.187 3480.187 
##      195      196      197      198      199      200      201      202 
## 3395.369 3395.369 3395.369 3395.369 3073.062 3073.062 3073.062 2479.338 
##      203      204      205      206      207      208      209      210 
## 2479.338 2343.629 2343.629 2343.629 2343.629 2089.176 1817.759 1817.759 
##      211 
## 1817.759
cor(Vrairbus$PricePremium,Vrairbus$PriceRelative)
## [1] 0.6804258
fit<-lm(PricePremium~PercentPremiumSeats,data = Vrairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = Vrairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2058.9  -153.9   329.1   481.6   887.1 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)   
## (Intercept)         2666.5799   792.4323   3.365  0.00205 **
## PercentPremiumSeats   -0.9788    47.4080  -0.021  0.98366   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 862 on 31 degrees of freedom
## Multiple R-squared:  1.375e-05,  Adjusted R-squared:  -0.03224 
## F-statistic: 0.0004263 on 1 and 31 DF,  p-value: 0.9837
Vrairbus$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 2982 2982
## [15] 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499
## [29] 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 2646.417 
##       70       71       72       73      191      192      193      194 
## 2646.417 2646.417 2646.417 2646.417 2652.857 2652.857 2652.857 2652.857 
##      195      196      197      198      199      200      201      202 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      203      204      205      206      207      208      209      210 
## 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 2652.857 
##      211 
## 2652.857
cor(Vrairbus$PricePremium,Vrairbus$PercentPremiumSeats)
## [1] -0.003708144

Now We Should Analyse the international aircrafts of Virgin Airlines

Vrint <- Virgin[ which(Virgin$IsInternational=='International'),]
View(Vrint)
summary(Vrint)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance: 0   AirBus:33   Min.   : 6.580   Aug:16     
##  British  : 0   Boeing:29   1st Qu.: 7.473   Jul:14     
##  Delta    : 0               Median : 8.830   Oct:16     
##  Jet      : 0               Mean   : 9.250   Sep:16     
##  Singapore: 0               3rd Qu.:10.830              
##  Virgin   :62               Max.   :12.580              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :185.0   Min.   :35.00   Min.   :31   
##  International:62     1st Qu.:198.0   1st Qu.:35.00   1st Qu.:31   
##                       Median :198.0   Median :38.00   Median :31   
##                       Mean   :230.2   Mean   :42.53   Mean   :31   
##                       3rd Qu.:233.0   3rd Qu.:48.00   3rd Qu.:31   
##                       Max.   :375.0   Max.   :66.00   Max.   :31   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :21    Min.   : 540   Min.   : 594  
##  1st Qu.:38    1st Qu.:18    1st Qu.:21    1st Qu.:1434   1st Qu.:2499  
##  Median :38    Median :18    Median :21    Median :1774   Median :2973  
##  Mean   :38    Mean   :18    Mean   :21    Mean   :1604   Mean   :2722  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:21    3rd Qu.:1903   3rd Qu.:3128  
##  Max.   :38    Max.   :18    Max.   :21    Max.   :2445   Max.   :3694  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.1000   Min.   :233.0   Min.   :7       Min.   :3      
##  1st Qu.:0.4000   1st Qu.:233.0   1st Qu.:7       1st Qu.:3      
##  Median :0.7300   Median :233.0   Median :7       Median :3      
##  Mean   :0.7606   Mean   :272.7   Mean   :7       Mean   :3      
##  3rd Qu.:1.0150   3rd Qu.:271.0   3rd Qu.:7       3rd Qu.:3      
##  Max.   :1.8200   Max.   :441.0   Max.   :7       Max.   :3      
##  PercentPremiumSeats
##  Min.   :14.02      
##  1st Qu.:14.02      
##  Median :15.02      
##  Mean   :15.75      
##  3rd Qu.:15.02      
##  Max.   :20.60
mean(Vrint$PriceEconomy)
## [1] 1603.532
mean(Vrint$PricePremium)
## [1] 2721.694
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Vrint$PriceEconomy,Vrint$TravelMonth,mean))
y2<-c(by(Vrint$PricePremium,Vrint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Vrint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1092.6  -214.9   152.2   273.4   870.5 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1782.82     334.46   5.330 1.56e-06 ***
## FlightDuration   -19.38      35.40  -0.548    0.586    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 536 on 60 degrees of freedom
## Multiple R-squared:  0.004972,   Adjusted R-squared:  -0.01161 
## F-statistic: 0.2998 on 1 and 60 DF,  p-value: 0.586
Vrint$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1627.769 1627.769 1627.769 1627.769 1611.682 1611.682 1611.682 1611.682 
##       70       71       72       73      156      157      158      159 
## 1645.600 1645.600 1645.600 1632.614 1564.778 1564.778 1564.778 1564.778 
##      160      161      162      163      164      165      166      167 
## 1548.691 1548.691 1548.691 1548.691 1590.750 1590.750 1590.750 1590.750 
##      168      169      170      171      172      173      174      175 
## 1572.918 1572.918 1572.918 1572.918 1581.059 1539.000 1574.469 1574.469 
##      176      177      178      179      180      181      182      183 
## 1574.469 1574.469 1539.000 1563.227 1634.359 1634.359 1634.359 1634.359 
##      184      191      192      193      194      195      196      197 
## 1539.000 1648.895 1648.895 1648.895 1648.895 1655.291 1655.291 1655.291 
##      198      199      200      201      202      203      204      205 
## 1655.291 1581.059 1581.059 1581.059 1563.227 1563.227 1639.204 1639.204 
##      206      207      208      209      210      211 
## 1639.204 1639.204 1645.600 1632.614 1632.614 1632.614
cor(Vrint$PriceEconomy,Vrint$FlightDuration)
## [1] -0.0705092
fit<-lm(PriceEconomy~SeatsEconomy,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Vrint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1072.2  -265.0   114.8   347.5   863.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   900.280    259.407   3.471 0.000969 ***
## SeatsEconomy    3.055      1.092   2.798 0.006903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 505.4 on 60 degrees of freedom
## Multiple R-squared:  0.1154, Adjusted R-squared:  0.1007 
## F-statistic: 7.829 on 1 and 60 DF,  p-value: 0.006903
Vrint$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 
##       70       71       72       73      156      157      158      159 
## 1465.503 1465.503 1465.503 1465.503 1505.222 1505.222 1505.222 1505.222 
##      160      161      162      163      164      165      166      167 
## 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 2046.003 2046.003 
##      168      169      170      171      172      173      174      175 
## 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 
##      176      177      178      179      180      181      182      183 
## 2046.003 2046.003 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 
##      184      191      192      193      194      195      196      197 
## 1505.222 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      198      199      200      201      202      203      204      205 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      206      207      208      209      210      211 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156
cor(Vrint$PriceEconomy,Vrint$SeatsEconomy)
## [1] 0.3397343
fit<-lm(PriceEconomy~PriceRelative,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Vrint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1366.00   -23.32    43.60   273.32   726.71 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1951.8      118.1  16.530  < 2e-16 ***
## PriceRelative   -457.8      131.9  -3.472 0.000965 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 490.3 on 60 degrees of freedom
## Multiple R-squared:  0.1673, Adjusted R-squared:  0.1534 
## F-statistic: 12.05 on 1 and 60 DF,  p-value: 0.0009654
Vrint$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1617.563 1617.563 1617.563 1617.563 1773.229 1773.229 1773.229 1773.229 
##       70       71       72       73      156      157      158      159 
## 1832.748 1832.748 1832.748 1906.003 1118.516 1118.516 1118.516 1118.516 
##      160      161      162      163      164      165      166      167 
## 1159.721 1159.721 1159.721 1319.966 1507.681 1507.681 1507.681 1507.681 
##      168      169      170      171      172      173      174      175 
## 1535.151 1535.151 1535.151 1535.151 1567.200 1695.396 1718.288 1718.288 
##      176      177      178      179      180      181      182      183 
## 1718.288 1718.288 1722.866 1727.445 1768.651 1768.651 1768.651 1768.651 
##      184      191      192      193      194      195      196      197 
## 1832.748 1457.318 1457.318 1457.318 1457.318 1480.210 1480.210 1480.210 
##      198      199      200      201      202      203      204      205 
## 1480.210 1567.200 1567.200 1567.200 1727.445 1727.445 1764.072 1764.072 
##      206      207      208      209      210      211 
## 1764.072 1764.072 1832.748 1906.003 1906.003 1906.003
cor(Vrint$PriceEconomy,Vrint$PriceRelative)
## [1] -0.4089837
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Vrint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1262.18   -98.41    63.82   246.76   873.65 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           957.60     442.67   2.163   0.0345 *
## PercentPremiumSeats    41.00      27.77   1.476   0.1451  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 527.8 on 60 degrees of freedom
## Multiple R-squared:  0.03505,    Adjusted R-squared:  0.01896 
## F-statistic: 2.179 on 1 and 60 DF,  p-value: 0.1451
Vrint$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 
##       70       71       72       73      156      157      158      159 
## 1802.179 1802.179 1802.179 1802.179 1573.405 1573.405 1573.405 1573.405 
##      160      161      162      163      164      165      166      167 
## 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 1571.355 1571.355 
##      168      169      170      171      172      173      174      175 
## 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 
##      176      177      178      179      180      181      182      183 
## 1571.355 1571.355 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 
##      184      191      192      193      194      195      196      197 
## 1573.405 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      198      199      200      201      202      203      204      205 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      206      207      208      209      210      211 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406
cor(Vrint$PriceEconomy,Vrint$PercentPremiumSeats)
## [1] 0.1872078
fit<-lm(PricePremium~FlightDuration,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Vrint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2047.5  -124.4   184.8   473.1   892.2 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2227.50     505.17   4.409 4.37e-05 ***
## FlightDuration    53.42      53.47   0.999    0.322    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 809.6 on 60 degrees of freedom
## Multiple R-squared:  0.01637,    Adjusted R-squared:  -2.707e-05 
## F-statistic: 0.9983 on 1 and 60 DF,  p-value: 0.3217
Vrint$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2654.889 2654.889 2654.889 2654.889 2699.230 2699.230 2699.230 2699.230 
##       70       71       72       73      156      157      158      159 
## 2605.739 2605.739 2605.739 2641.533 2828.514 2828.514 2828.514 2828.514 
##      160      161      162      163      164      165      166      167 
## 2872.856 2872.856 2872.856 2872.856 2756.927 2756.927 2756.927 2756.927 
##      168      169      170      171      172      173      174      175 
## 2806.076 2806.076 2806.076 2806.076 2783.639 2899.567 2801.803 2801.803 
##      176      177      178      179      180      181      182      183 
## 2801.803 2801.803 2899.567 2832.788 2636.725 2636.725 2636.725 2636.725 
##      184      191      192      193      194      195      196      197 
## 2899.567 2596.657 2596.657 2596.657 2596.657 2579.028 2579.028 2579.028 
##      198      199      200      201      202      203      204      205 
## 2579.028 2783.639 2783.639 2783.639 2832.788 2832.788 2623.369 2623.369 
##      206      207      208      209      210      211 
## 2623.369 2623.369 2605.739 2641.533 2641.533 2641.533
cor(Vrint$PricePremium,Vrint$FlightDuration)
## [1] 0.1279329
fit<-lm(PriceEconomy~SeatsEconomy,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Vrint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1072.2  -265.0   114.8   347.5   863.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   900.280    259.407   3.471 0.000969 ***
## SeatsEconomy    3.055      1.092   2.798 0.006903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 505.4 on 60 degrees of freedom
## Multiple R-squared:  0.1154, Adjusted R-squared:  0.1007 
## F-statistic: 7.829 on 1 and 60 DF,  p-value: 0.006903
Vrint$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 
##       70       71       72       73      156      157      158      159 
## 1465.503 1465.503 1465.503 1465.503 1505.222 1505.222 1505.222 1505.222 
##      160      161      162      163      164      165      166      167 
## 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 2046.003 2046.003 
##      168      169      170      171      172      173      174      175 
## 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 
##      176      177      178      179      180      181      182      183 
## 2046.003 2046.003 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 
##      184      191      192      193      194      195      196      197 
## 1505.222 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      198      199      200      201      202      203      204      205 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      206      207      208      209      210      211 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156
cor(Vrint$PricePremium,Vrint$SeatsEconomy)
## [1] 0.4124598
fit<-lm(PriceEconomy~SeatsPremium,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Vrint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1197.2  -331.0   118.2   304.7   949.5 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   564.120    259.600   2.173 0.033737 *  
## SeatsPremium   24.438      5.937   4.116 0.000119 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 474.5 on 60 degrees of freedom
## Multiple R-squared:  0.2202, Adjusted R-squared:  0.2072 
## F-statistic: 16.94 on 1 and 60 DF,  p-value: 0.0001194
Vrint$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 
##       70       71       72       73      156      157      158      159 
## 1737.154 1737.154 1737.154 1737.154 1419.457 1419.457 1419.457 1419.457 
##      160      161      162      163      164      165      166      167 
## 1419.457 1419.457 1419.457 1419.457 2177.042 2177.042 2177.042 2177.042 
##      168      169      170      171      172      173      174      175 
## 1419.457 1419.457 1419.457 1419.457 1419.457 1419.457 2177.042 2177.042 
##      176      177      178      179      180      181      182      183 
## 2177.042 2177.042 1419.457 1419.457 1419.457 1419.457 1419.457 1419.457 
##      184      191      192      193      194      195      196      197 
## 1419.457 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 
##      198      199      200      201      202      203      204      205 
## 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 
##      206      207      208      209      210      211 
## 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772
cor(Vrint$PricePremium,Vrint$SeatsPremium)
## [1] 0.3999636
fit<-lm(PriceEconomy~PriceRelative,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Vrint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1366.00   -23.32    43.60   273.32   726.71 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1951.8      118.1  16.530  < 2e-16 ***
## PriceRelative   -457.8      131.9  -3.472 0.000965 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 490.3 on 60 degrees of freedom
## Multiple R-squared:  0.1673, Adjusted R-squared:  0.1534 
## F-statistic: 12.05 on 1 and 60 DF,  p-value: 0.0009654
Vrint$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1617.563 1617.563 1617.563 1617.563 1773.229 1773.229 1773.229 1773.229 
##       70       71       72       73      156      157      158      159 
## 1832.748 1832.748 1832.748 1906.003 1118.516 1118.516 1118.516 1118.516 
##      160      161      162      163      164      165      166      167 
## 1159.721 1159.721 1159.721 1319.966 1507.681 1507.681 1507.681 1507.681 
##      168      169      170      171      172      173      174      175 
## 1535.151 1535.151 1535.151 1535.151 1567.200 1695.396 1718.288 1718.288 
##      176      177      178      179      180      181      182      183 
## 1718.288 1718.288 1722.866 1727.445 1768.651 1768.651 1768.651 1768.651 
##      184      191      192      193      194      195      196      197 
## 1832.748 1457.318 1457.318 1457.318 1457.318 1480.210 1480.210 1480.210 
##      198      199      200      201      202      203      204      205 
## 1480.210 1567.200 1567.200 1567.200 1727.445 1727.445 1764.072 1764.072 
##      206      207      208      209      210      211 
## 1764.072 1764.072 1832.748 1906.003 1906.003 1906.003
cor(Vrint$PricePremium,Vrint$PriceRelative)
## [1] 0.1651901
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Vrint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Vrint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1262.18   -98.41    63.82   246.76   873.65 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           957.60     442.67   2.163   0.0345 *
## PercentPremiumSeats    41.00      27.77   1.476   0.1451  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 527.8 on 60 degrees of freedom
## Multiple R-squared:  0.03505,    Adjusted R-squared:  0.01896 
## F-statistic: 2.179 on 1 and 60 DF,  p-value: 0.1451
Vrint$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 
##       70       71       72       73      156      157      158      159 
## 1802.179 1802.179 1802.179 1802.179 1573.405 1573.405 1573.405 1573.405 
##      160      161      162      163      164      165      166      167 
## 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 1571.355 1571.355 
##      168      169      170      171      172      173      174      175 
## 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 
##      176      177      178      179      180      181      182      183 
## 1571.355 1571.355 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 
##      184      191      192      193      194      195      196      197 
## 1573.405 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      198      199      200      201      202      203      204      205 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      206      207      208      209      210      211 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406
cor(Vrint$PricePremium,Vrint$PercentPremiumSeats)
## [1] -0.03284634

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Vrboeing$PriceEconomy,Vrboeing$TravelMonth,mean))
y2<-c(by(Vrboeing$PricePremium,Vrboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Vrairbus$PriceEconomy,Vrairbus$TravelMonth,mean))
y4<-c(by(Vrairbus$PricePremium,Vrairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of Virgin Airlines

mean(Virgin$PriceEconomy)
## [1] 1603.532
mean(Virgin$PricePremium)
## [1] 2721.694
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Virgin$PriceEconomy,Virgin$TravelMonth,mean))
y2<-c(by(Virgin$PricePremium,Virgin$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Virgin)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1092.6  -214.9   152.2   273.4   870.5 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1782.82     334.46   5.330 1.56e-06 ***
## FlightDuration   -19.38      35.40  -0.548    0.586    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 536 on 60 degrees of freedom
## Multiple R-squared:  0.004972,   Adjusted R-squared:  -0.01161 
## F-statistic: 0.2998 on 1 and 60 DF,  p-value: 0.586
Virgin$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1627.769 1627.769 1627.769 1627.769 1611.682 1611.682 1611.682 1611.682 
##       70       71       72       73      156      157      158      159 
## 1645.600 1645.600 1645.600 1632.614 1564.778 1564.778 1564.778 1564.778 
##      160      161      162      163      164      165      166      167 
## 1548.691 1548.691 1548.691 1548.691 1590.750 1590.750 1590.750 1590.750 
##      168      169      170      171      172      173      174      175 
## 1572.918 1572.918 1572.918 1572.918 1581.059 1539.000 1574.469 1574.469 
##      176      177      178      179      180      181      182      183 
## 1574.469 1574.469 1539.000 1563.227 1634.359 1634.359 1634.359 1634.359 
##      184      191      192      193      194      195      196      197 
## 1539.000 1648.895 1648.895 1648.895 1648.895 1655.291 1655.291 1655.291 
##      198      199      200      201      202      203      204      205 
## 1655.291 1581.059 1581.059 1581.059 1563.227 1563.227 1639.204 1639.204 
##      206      207      208      209      210      211 
## 1639.204 1639.204 1645.600 1632.614 1632.614 1632.614
cor(Virgin$PriceEconomy,Virgin$FlightDuration)
## [1] -0.0705092
fit<-lm(PriceEconomy~SeatsEconomy,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Virgin)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1072.2  -265.0   114.8   347.5   863.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   900.280    259.407   3.471 0.000969 ***
## SeatsEconomy    3.055      1.092   2.798 0.006903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 505.4 on 60 degrees of freedom
## Multiple R-squared:  0.1154, Adjusted R-squared:  0.1007 
## F-statistic: 7.829 on 1 and 60 DF,  p-value: 0.006903
Virgin$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 
##       70       71       72       73      156      157      158      159 
## 1465.503 1465.503 1465.503 1465.503 1505.222 1505.222 1505.222 1505.222 
##      160      161      162      163      164      165      166      167 
## 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 2046.003 2046.003 
##      168      169      170      171      172      173      174      175 
## 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 
##      176      177      178      179      180      181      182      183 
## 2046.003 2046.003 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 
##      184      191      192      193      194      195      196      197 
## 1505.222 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      198      199      200      201      202      203      204      205 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      206      207      208      209      210      211 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156
cor(Virgin$PriceEconomy,Virgin$SeatsEconomy)
## [1] 0.3397343
fit<-lm(PriceEconomy~PriceRelative,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Virgin)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1366.00   -23.32    43.60   273.32   726.71 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1951.8      118.1  16.530  < 2e-16 ***
## PriceRelative   -457.8      131.9  -3.472 0.000965 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 490.3 on 60 degrees of freedom
## Multiple R-squared:  0.1673, Adjusted R-squared:  0.1534 
## F-statistic: 12.05 on 1 and 60 DF,  p-value: 0.0009654
Virgin$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1617.563 1617.563 1617.563 1617.563 1773.229 1773.229 1773.229 1773.229 
##       70       71       72       73      156      157      158      159 
## 1832.748 1832.748 1832.748 1906.003 1118.516 1118.516 1118.516 1118.516 
##      160      161      162      163      164      165      166      167 
## 1159.721 1159.721 1159.721 1319.966 1507.681 1507.681 1507.681 1507.681 
##      168      169      170      171      172      173      174      175 
## 1535.151 1535.151 1535.151 1535.151 1567.200 1695.396 1718.288 1718.288 
##      176      177      178      179      180      181      182      183 
## 1718.288 1718.288 1722.866 1727.445 1768.651 1768.651 1768.651 1768.651 
##      184      191      192      193      194      195      196      197 
## 1832.748 1457.318 1457.318 1457.318 1457.318 1480.210 1480.210 1480.210 
##      198      199      200      201      202      203      204      205 
## 1480.210 1567.200 1567.200 1567.200 1727.445 1727.445 1764.072 1764.072 
##      206      207      208      209      210      211 
## 1764.072 1764.072 1832.748 1906.003 1906.003 1906.003
cor(Virgin$PriceEconomy,Virgin$PriceRelative)
## [1] -0.4089837
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Virgin)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1262.18   -98.41    63.82   246.76   873.65 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           957.60     442.67   2.163   0.0345 *
## PercentPremiumSeats    41.00      27.77   1.476   0.1451  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 527.8 on 60 degrees of freedom
## Multiple R-squared:  0.03505,    Adjusted R-squared:  0.01896 
## F-statistic: 2.179 on 1 and 60 DF,  p-value: 0.1451
Virgin$PriceEconomy
##  [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540  574  574
## [15]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [29] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1434
## [43] 1434 1434 1434 1476 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767
## [57] 1767 1767 1919  540  540  540
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 
##       70       71       72       73      156      157      158      159 
## 1802.179 1802.179 1802.179 1802.179 1573.405 1573.405 1573.405 1573.405 
##      160      161      162      163      164      165      166      167 
## 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 1571.355 1571.355 
##      168      169      170      171      172      173      174      175 
## 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 
##      176      177      178      179      180      181      182      183 
## 1571.355 1571.355 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 
##      184      191      192      193      194      195      196      197 
## 1573.405 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      198      199      200      201      202      203      204      205 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      206      207      208      209      210      211 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406
cor(Virgin$PriceEconomy,Virgin$PercentPremiumSeats)
## [1] 0.1872078
fit<-lm(PricePremium~FlightDuration,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Virgin)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2047.5  -124.4   184.8   473.1   892.2 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2227.50     505.17   4.409 4.37e-05 ***
## FlightDuration    53.42      53.47   0.999    0.322    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 809.6 on 60 degrees of freedom
## Multiple R-squared:  0.01637,    Adjusted R-squared:  -2.707e-05 
## F-statistic: 0.9983 on 1 and 60 DF,  p-value: 0.3217
Virgin$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2654.889 2654.889 2654.889 2654.889 2699.230 2699.230 2699.230 2699.230 
##       70       71       72       73      156      157      158      159 
## 2605.739 2605.739 2605.739 2641.533 2828.514 2828.514 2828.514 2828.514 
##      160      161      162      163      164      165      166      167 
## 2872.856 2872.856 2872.856 2872.856 2756.927 2756.927 2756.927 2756.927 
##      168      169      170      171      172      173      174      175 
## 2806.076 2806.076 2806.076 2806.076 2783.639 2899.567 2801.803 2801.803 
##      176      177      178      179      180      181      182      183 
## 2801.803 2801.803 2899.567 2832.788 2636.725 2636.725 2636.725 2636.725 
##      184      191      192      193      194      195      196      197 
## 2899.567 2596.657 2596.657 2596.657 2596.657 2579.028 2579.028 2579.028 
##      198      199      200      201      202      203      204      205 
## 2579.028 2783.639 2783.639 2783.639 2832.788 2832.788 2623.369 2623.369 
##      206      207      208      209      210      211 
## 2623.369 2623.369 2605.739 2641.533 2641.533 2641.533
cor(Virgin$PricePremium,Virgin$FlightDuration)
## [1] 0.1279329
fit<-lm(PriceEconomy~SeatsEconomy,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Virgin)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1072.2  -265.0   114.8   347.5   863.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   900.280    259.407   3.471 0.000969 ***
## SeatsEconomy    3.055      1.092   2.798 0.006903 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 505.4 on 60 degrees of freedom
## Multiple R-squared:  0.1154, Adjusted R-squared:  0.1007 
## F-statistic: 7.829 on 1 and 60 DF,  p-value: 0.006903
Virgin$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 1465.503 
##       70       71       72       73      156      157      158      159 
## 1465.503 1465.503 1465.503 1465.503 1505.222 1505.222 1505.222 1505.222 
##      160      161      162      163      164      165      166      167 
## 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 2046.003 2046.003 
##      168      169      170      171      172      173      174      175 
## 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 2046.003 2046.003 
##      176      177      178      179      180      181      182      183 
## 2046.003 2046.003 1505.222 1505.222 1505.222 1505.222 1505.222 1505.222 
##      184      191      192      193      194      195      196      197 
## 1505.222 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      198      199      200      201      202      203      204      205 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156 
##      206      207      208      209      210      211 
## 1612.156 1612.156 1612.156 1612.156 1612.156 1612.156
cor(Virgin$PricePremium,Virgin$SeatsEconomy)
## [1] 0.4124598
fit<-lm(PriceEconomy~SeatsPremium,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Virgin)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1197.2  -331.0   118.2   304.7   949.5 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   564.120    259.600   2.173 0.033737 *  
## SeatsPremium   24.438      5.937   4.116 0.000119 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 474.5 on 60 degrees of freedom
## Multiple R-squared:  0.2202, Adjusted R-squared:  0.2072 
## F-statistic: 16.94 on 1 and 60 DF,  p-value: 0.0001194
Virgin$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 1737.154 
##       70       71       72       73      156      157      158      159 
## 1737.154 1737.154 1737.154 1737.154 1419.457 1419.457 1419.457 1419.457 
##      160      161      162      163      164      165      166      167 
## 1419.457 1419.457 1419.457 1419.457 2177.042 2177.042 2177.042 2177.042 
##      168      169      170      171      172      173      174      175 
## 1419.457 1419.457 1419.457 1419.457 1419.457 1419.457 2177.042 2177.042 
##      176      177      178      179      180      181      182      183 
## 2177.042 2177.042 1419.457 1419.457 1419.457 1419.457 1419.457 1419.457 
##      184      191      192      193      194      195      196      197 
## 1419.457 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 
##      198      199      200      201      202      203      204      205 
## 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772 
##      206      207      208      209      210      211 
## 1492.772 1492.772 1492.772 1492.772 1492.772 1492.772
cor(Virgin$PricePremium,Virgin$SeatsPremium)
## [1] 0.3999636
fit<-lm(PriceEconomy~PriceRelative,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Virgin)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1366.00   -23.32    43.60   273.32   726.71 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1951.8      118.1  16.530  < 2e-16 ***
## PriceRelative   -457.8      131.9  -3.472 0.000965 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 490.3 on 60 degrees of freedom
## Multiple R-squared:  0.1673, Adjusted R-squared:  0.1534 
## F-statistic: 12.05 on 1 and 60 DF,  p-value: 0.0009654
Virgin$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1617.563 1617.563 1617.563 1617.563 1773.229 1773.229 1773.229 1773.229 
##       70       71       72       73      156      157      158      159 
## 1832.748 1832.748 1832.748 1906.003 1118.516 1118.516 1118.516 1118.516 
##      160      161      162      163      164      165      166      167 
## 1159.721 1159.721 1159.721 1319.966 1507.681 1507.681 1507.681 1507.681 
##      168      169      170      171      172      173      174      175 
## 1535.151 1535.151 1535.151 1535.151 1567.200 1695.396 1718.288 1718.288 
##      176      177      178      179      180      181      182      183 
## 1718.288 1718.288 1722.866 1727.445 1768.651 1768.651 1768.651 1768.651 
##      184      191      192      193      194      195      196      197 
## 1832.748 1457.318 1457.318 1457.318 1457.318 1480.210 1480.210 1480.210 
##      198      199      200      201      202      203      204      205 
## 1480.210 1567.200 1567.200 1567.200 1727.445 1727.445 1764.072 1764.072 
##      206      207      208      209      210      211 
## 1764.072 1764.072 1832.748 1906.003 1906.003 1906.003
cor(Virgin$PricePremium,Virgin$PriceRelative)
## [1] 0.1651901
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Virgin)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Virgin)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1262.18   -98.41    63.82   246.76   873.65 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           957.60     442.67   2.163   0.0345 *
## PercentPremiumSeats    41.00      27.77   1.476   0.1451  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 527.8 on 60 degrees of freedom
## Multiple R-squared:  0.03505,    Adjusted R-squared:  0.01896 
## F-statistic: 2.179 on 1 and 60 DF,  p-value: 0.1451
Virgin$PricePremium
##  [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 1619 1619
## [15] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [29] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 2982
## [43] 2982 2982 2982 2997 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499
## [57] 2499 2499 2409  594  594  594
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 1802.179 
##       70       71       72       73      156      157      158      159 
## 1802.179 1802.179 1802.179 1802.179 1573.405 1573.405 1573.405 1573.405 
##      160      161      162      163      164      165      166      167 
## 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 1571.355 1571.355 
##      168      169      170      171      172      173      174      175 
## 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 1571.355 1571.355 
##      176      177      178      179      180      181      182      183 
## 1571.355 1571.355 1573.405 1573.405 1573.405 1573.405 1573.405 1573.405 
##      184      191      192      193      194      195      196      197 
## 1573.405 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      198      199      200      201      202      203      204      205 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406 
##      206      207      208      209      210      211 
## 1532.406 1532.406 1532.406 1532.406 1532.406 1532.406
cor(Virgin$PricePremium,Virgin$PercentPremiumSeats)
## [1] -0.03284634

Delta Airlines

Analyse all about Delta Airlines:-

Delta <- airline[ which(airline$Airline=='Delta'),]
View(Delta)
summary(Delta)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus:12   Min.   :1.570   Aug:12     
##  British  : 0   Boeing:34   1st Qu.:2.270   Jul:10     
##  Delta    :46               Median :4.260   Oct:13     
##  Jet      : 0               Mean   :4.029   Sep:11     
##  Singapore: 0               3rd Qu.:4.645              
##  Virgin   : 0               Max.   :9.500              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :40     Min.   : 78.0   Min.   :18.00   Min.   :31.00  
##  International: 6     1st Qu.:120.0   1st Qu.:18.00   1st Qu.:31.00  
##                       Median :126.0   Median :20.00   Median :32.00  
##                       Mean   :137.2   Mean   :22.57   Mean   :31.72  
##                       3rd Qu.:139.0   3rd Qu.:21.00   3rd Qu.:32.00  
##                       Max.   :233.0   Max.   :38.00   Max.   :33.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy   
##  Min.   :34.00   Min.   :17.00   Min.   :17.00   Min.   : 158.0  
##  1st Qu.:34.00   1st Qu.:17.00   1st Qu.:17.00   1st Qu.: 293.0  
##  Median :34.00   Median :17.00   Median :17.00   Median : 363.0  
##  Mean   :34.72   Mean   :17.39   Mean   :17.78   Mean   : 560.9  
##  3rd Qu.:35.00   3rd Qu.:18.00   3rd Qu.:18.00   3rd Qu.: 449.2  
##  Max.   :38.00   Max.   :18.00   Max.   :21.00   Max.   :1999.0  
##   PricePremium    PriceRelative      SeatsTotal    PitchDifference
##  Min.   : 173.0   Min.   :0.0300   Min.   : 98.0   Min.   :2      
##  1st Qu.: 312.8   1st Qu.:0.0700   1st Qu.:138.0   1st Qu.:2      
##  Median : 406.5   Median :0.0900   Median :144.0   Median :2      
##  Mean   : 684.7   Mean   :0.1250   Mean   :159.8   Mean   :3      
##  3rd Qu.: 489.5   3rd Qu.:0.1175   3rd Qu.:160.0   3rd Qu.:3      
##  Max.   :2765.0   Max.   :0.4600   Max.   :271.0   Max.   :7      
##  WidthDifference  PercentPremiumSeats
##  Min.   :0.0000   Min.   :12.50      
##  1st Qu.:0.0000   1st Qu.:12.50      
##  Median :0.0000   Median :13.09      
##  Mean   :0.3913   Mean   :14.48      
##  3rd Qu.:0.0000   3rd Qu.:14.50      
##  Max.   :3.0000   Max.   :20.41

Check the all the means now all Delta aircrafts

mean(Delta$PriceEconomy)
## [1] 560.9348
mean(Delta$PricePremium)
## [1] 684.6739
mean(Delta$FlightDuration)
## [1] 4.028913
mean(Delta$PitchEconomy)
## [1] 31.71739
mean(Delta$PitchPremium)
## [1] 34.71739
mean(Delta$WidthEconomy)
## [1] 17.3913
mean(Delta$WidthPremium)
## [1] 17.78261
mean(Delta$PriceRelative)
## [1] 0.125
mean(Delta$PitchDifference)
## [1] 3
mean(Delta$WidthDifference)
## [1] 0.3913043

Now Analyse separately for Each Aircrafts in Delta Airlines i.e-Boeing and AirBus

Deboeing <- Delta[ which(Delta$Aircraft=='Boeing'),]
View(Deboeing)
summary(Deboeing)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 0   Min.   :1.570   Aug:10     
##  British  : 0   Boeing:34   1st Qu.:2.308   Jul:10     
##  Delta    :34               Median :4.260   Oct: 8     
##  Jet      : 0               Mean   :3.519   Sep: 6     
##  Singapore: 0               3rd Qu.:4.510              
##  Virgin   : 0               Max.   :4.700              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :34     Min.   : 78.0   Min.   :18.00   Min.   :31.00  
##  International: 0     1st Qu.:126.0   1st Qu.:18.00   1st Qu.:31.00  
##                       Median :126.0   Median :20.00   Median :32.00  
##                       Mean   :122.9   Mean   :20.59   Mean   :31.76  
##                       3rd Qu.:136.0   3rd Qu.:20.75   3rd Qu.:32.00  
##                       Max.   :171.0   Max.   :29.00   Max.   :33.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy  
##  Min.   :34.00   Min.   :17.00   Min.   :17.00   Min.   :158.0  
##  1st Qu.:34.00   1st Qu.:17.00   1st Qu.:17.00   1st Qu.:289.2  
##  Median :34.00   Median :17.00   Median :17.00   Median :358.5  
##  Mean   :34.24   Mean   :17.35   Mean   :17.35   Mean   :368.4  
##  3rd Qu.:34.00   3rd Qu.:18.00   3rd Qu.:18.00   3rd Qu.:413.0  
##  Max.   :35.00   Max.   :18.00   Max.   :18.00   Max.   :713.0  
##   PricePremium   PriceRelative       SeatsTotal    PitchDifference
##  Min.   :173.0   Min.   :0.03000   Min.   : 98.0   Min.   :2.000  
##  1st Qu.:327.0   1st Qu.:0.07000   1st Qu.:144.0   1st Qu.:2.000  
##  Median :392.5   Median :0.09000   Median :144.0   Median :2.000  
##  Mean   :399.8   Mean   :0.08824   Mean   :143.5   Mean   :2.471  
##  3rd Qu.:457.0   3rd Qu.:0.11000   3rd Qu.:157.5   3rd Qu.:3.000  
##  Max.   :757.0   Max.   :0.14000   Max.   :200.0   Max.   :3.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :0       Min.   :12.50      
##  1st Qu.:0       1st Qu.:12.50      
##  Median :0       Median :12.97      
##  Mean   :0       Mean   :14.82      
##  3rd Qu.:0       3rd Qu.:15.97      
##  Max.   :0       Max.   :20.41
mean(Deboeing$PriceEconomy)
## [1] 368.3824
mean(Deboeing$PricePremium)
## [1] 399.7647
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Deboeing$PriceEconomy,Deboeing$TravelMonth,mean))
y2<-c(by(Deboeing$PricePremium,Deboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Deboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -146.248  -79.818   -7.311   29.296  312.408 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      213.68      65.90   3.242  0.00277 **
## FlightDuration    43.96      17.76   2.475  0.01881 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 121.8 on 32 degrees of freedom
## Multiple R-squared:  0.1607, Adjusted R-squared:  0.1344 
## F-statistic: 6.126 on 1 and 32 DF,  p-value: 0.01881
Deboeing$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 243 626 354 293 636 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 304.2478 316.1179 304.2478 302.0497 316.1179 290.6192 314.7990 314.7990 
##       98      152      153      154      155      281      282      283 
## 400.9668 404.0443 411.9576 404.0443 411.9576 401.8461 400.5272 417.2332 
##      284      285      286      287      288      289      290      291 
## 418.1125 418.5521 420.3106 420.3106 420.3106 405.3632 400.5272 408.4406 
##      292      293      294      295      299      300      301      304 
## 420.3106 400.9668 407.1217 297.6533 325.7898 417.2332 339.4184 282.7059 
##      305      307 
## 323.5916 282.7059
cor(Deboeing$PriceEconomy,Deboeing$FlightDuration)
## [1] 0.4008461
fit<-lm(PriceEconomy~SeatsEconomy,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -227.18  -66.05  -18.27   35.08  297.45 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  136.1214    92.2911   1.475   0.1500  
## SeatsEconomy   1.8901     0.7318   2.583   0.0146 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 120.9 on 32 degrees of freedom
## Multiple R-squared:  0.1725, Adjusted R-squared:  0.1466 
## F-statistic:  6.67 on 1 and 32 DF,  p-value: 0.01458
Deboeing$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 243 626 354 293 636 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 
##       98      152      153      154      155      281      282      283 
## 385.6157 459.3299 459.3299 459.3299 459.3299 374.2750 374.2750 374.2750 
##      284      285      286      287      288      289      290      291 
## 374.2750 374.2750 398.8465 398.8465 398.8465 374.2750 374.2750 374.2750 
##      292      293      294      295      299      300      301      304 
## 398.8465 374.2750 374.2750 393.1761 393.1761 374.2750 393.1761 374.2750 
##      305      307 
## 393.1761 374.2750
cor(Deboeing$PriceEconomy,Deboeing$SeatsEconomy)
## [1] 0.4153204
fit<-lm(PriceEconomy~PriceRelative,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -208.47  -71.68  -14.52   68.22  314.00 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     464.05      68.88   6.737 1.31e-07 ***
## PriceRelative -1084.27     739.47  -1.466    0.152    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 128.7 on 32 degrees of freedom
## Multiple R-squared:  0.06296,    Adjusted R-squared:  0.03368 
## F-statistic:  2.15 on 1 and 32 DF,  p-value: 0.1523
Deboeing$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 243 626 354 293 636 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 366.4689 377.3117 388.1544 388.1544 388.1544 420.6825 420.6825 431.5252 
##       98      152      153      154      155      281      282      283 
## 366.4689 323.0981 355.6262 366.4689 398.9971 312.2553 312.2553 333.9408 
##      284      285      286      287      288      289      290      291 
## 333.9408 333.9408 344.7835 344.7835 344.7835 344.7835 344.7835 344.7835 
##      292      293      294      295      299      300      301      304 
## 355.6262 355.6262 355.6262 366.4689 377.3117 388.1544 388.1544 409.8398 
##      305      307 
## 420.6825 420.6825
cor(Deboeing$PriceEconomy,Deboeing$PriceRelative)
## [1] -0.2509141
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -222.47  -88.91  -28.68   37.37  341.36 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          516.959    104.322   4.955 2.26e-05 ***
## PercentPremiumSeats  -10.022      6.878  -1.457    0.155    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 128.8 on 32 degrees of freedom
## Multiple R-squared:  0.06223,    Adjusted R-squared:  0.03293 
## F-statistic: 2.124 on 1 and 32 DF,  p-value: 0.1548
Deboeing$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 243 626 354 293 636 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 
##       98      152      153      154      155      281      282      283 
## 351.9931 371.6366 371.6366 371.6366 371.6366 391.6811 391.6811 391.6811 
##      284      285      286      287      288      289      290      291 
## 391.6811 391.6811 385.3671 385.3671 385.3671 391.6811 391.6811 391.6811 
##      292      293      294      295      299      300      301      304 
## 385.3671 391.6811 391.6811 388.4740 388.4740 391.6811 388.4740 391.6811 
##      305      307 
## 388.4740 391.6811
cor(Deboeing$PriceEconomy,Deboeing$PercentPremiumSeats)
## [1] -0.2494613
fit<-lm(PricePremium~FlightDuration,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -147.10  -83.73   -7.27   27.42  315.88 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      207.60      66.49   3.122  0.00379 **
## FlightDuration    54.61      17.92   3.047  0.00460 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 122.9 on 32 degrees of freedom
## Multiple R-squared:  0.2249, Adjusted R-squared:  0.2007 
## F-statistic: 9.287 on 1 and 32 DF,  p-value: 0.0046
Deboeing$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 262 670 378 308 660 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 320.0965 334.8415 320.0965 317.3659 334.8415 303.1669 333.2032 333.2032 
##       98      152      153      154      155      281      282      283 
## 440.2413 444.0641 453.8941 444.0641 453.8941 441.3335 439.6952 460.4475 
##      284      285      286      287      288      289      290      291 
## 461.5397 462.0858 464.2703 464.2703 464.2703 445.7024 439.6952 449.5252 
##      292      293      294      295      299      300      301      304 
## 464.2703 440.2413 447.8869 311.9048 346.8560 460.4475 363.7855 293.3369 
##      305      307 
## 344.1254 293.3369
cor(Deboeing$PricePremium,Deboeing$FlightDuration)
## [1] 0.474279
fit<-lm(PriceEconomy~SeatsEconomy,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -227.18  -66.05  -18.27   35.08  297.45 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  136.1214    92.2911   1.475   0.1500  
## SeatsEconomy   1.8901     0.7318   2.583   0.0146 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 120.9 on 32 degrees of freedom
## Multiple R-squared:  0.1725, Adjusted R-squared:  0.1466 
## F-statistic:  6.67 on 1 and 32 DF,  p-value: 0.01458
Deboeing$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 262 670 378 308 660 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 283.5498 
##       98      152      153      154      155      281      282      283 
## 385.6157 459.3299 459.3299 459.3299 459.3299 374.2750 374.2750 374.2750 
##      284      285      286      287      288      289      290      291 
## 374.2750 374.2750 398.8465 398.8465 398.8465 374.2750 374.2750 374.2750 
##      292      293      294      295      299      300      301      304 
## 398.8465 374.2750 374.2750 393.1761 393.1761 374.2750 393.1761 374.2750 
##      305      307 
## 393.1761 374.2750
cor(Deboeing$PricePremium,Deboeing$SeatsEconomy)
## [1] 0.4615171
fit<-lm(PriceEconomy~SeatsPremium,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Deboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -203.419  -49.743    6.757   39.743  288.257 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   124.658    130.952   0.952   0.3483  
## SeatsPremium   11.838      6.273   1.887   0.0682 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.1 on 32 degrees of freedom
## Multiple R-squared:  0.1001, Adjusted R-squared:  0.07202 
## F-statistic: 3.561 on 1 and 32 DF,  p-value: 0.06825
Deboeing$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 262 670 378 308 660 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 361.4188 361.4188 361.4188 361.4188 361.4188 361.4188 361.4188 361.4188 
##       98      152      153      154      155      281      282      283 
## 432.4470 467.9611 467.9611 467.9611 467.9611 337.7427 337.7427 337.7427 
##      284      285      286      287      288      289      290      291 
## 337.7427 337.7427 373.2568 373.2568 373.2568 337.7427 337.7427 337.7427 
##      292      293      294      295      299      300      301      304 
## 373.2568 337.7427 337.7427 361.4188 361.4188 337.7427 361.4188 337.7427 
##      305      307 
## 361.4188 337.7427
cor(Deboeing$PricePremium,Deboeing$SeatsPremium)
## [1] 0.3243034
fit<-lm(PriceEconomy~PriceRelative,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -208.47  -71.68  -14.52   68.22  314.00 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     464.05      68.88   6.737 1.31e-07 ***
## PriceRelative -1084.27     739.47  -1.466    0.152    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 128.7 on 32 degrees of freedom
## Multiple R-squared:  0.06296,    Adjusted R-squared:  0.03368 
## F-statistic:  2.15 on 1 and 32 DF,  p-value: 0.1523
Deboeing$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 262 670 378 308 660 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 366.4689 377.3117 388.1544 388.1544 388.1544 420.6825 420.6825 431.5252 
##       98      152      153      154      155      281      282      283 
## 366.4689 323.0981 355.6262 366.4689 398.9971 312.2553 312.2553 333.9408 
##      284      285      286      287      288      289      290      291 
## 333.9408 333.9408 344.7835 344.7835 344.7835 344.7835 344.7835 344.7835 
##      292      293      294      295      299      300      301      304 
## 355.6262 355.6262 355.6262 366.4689 377.3117 388.1544 388.1544 409.8398 
##      305      307 
## 420.6825 420.6825
cor(Deboeing$PricePremium,Deboeing$PriceRelative)
## [1] -0.1722524
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Deboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Deboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -222.47  -88.91  -28.68   37.37  341.36 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          516.959    104.322   4.955 2.26e-05 ***
## PercentPremiumSeats  -10.022      6.878  -1.457    0.155    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 128.8 on 32 degrees of freedom
## Multiple R-squared:  0.06223,    Adjusted R-squared:  0.03293 
## F-statistic: 2.124 on 1 and 32 DF,  p-value: 0.1548
Deboeing$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 262 670 378 308 660 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 312.4052 
##       98      152      153      154      155      281      282      283 
## 351.9931 371.6366 371.6366 371.6366 371.6366 391.6811 391.6811 391.6811 
##      284      285      286      287      288      289      290      291 
## 391.6811 391.6811 385.3671 385.3671 385.3671 391.6811 391.6811 391.6811 
##      292      293      294      295      299      300      301      304 
## 385.3671 391.6811 391.6811 388.4740 388.4740 391.6811 388.4740 391.6811 
##      305      307 
## 388.4740 391.6811
cor(Deboeing$PricePremium,Deboeing$PercentPremiumSeats)
## [1] -0.2983363
Deairbus <-Delta[ which(Delta$Aircraft=='AirBus'),]
View(Deairbus)
summary(Deairbus)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus:12   Min.   :1.800   Aug:2      
##  British  : 0   Boeing: 0   1st Qu.:1.920   Jul:0      
##  Delta    :12               Median :5.440   Oct:5      
##  Jet      : 0               Mean   :5.474   Sep:5      
##  Singapore: 0               3rd Qu.:8.623              
##  Virgin   : 0               Max.   :9.500              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :6      Min.   :120.0   Min.   :18.00   Min.   :31.00  
##  International:6      1st Qu.:120.0   1st Qu.:18.00   1st Qu.:31.00  
##                       Median :184.5   Median :29.00   Median :31.50  
##                       Mean   :177.8   Mean   :28.17   Mean   :31.58  
##                       3rd Qu.:233.0   3rd Qu.:38.00   3rd Qu.:32.00  
##                       Max.   :233.0   Max.   :38.00   Max.   :33.00  
##   PitchPremium    WidthEconomy   WidthPremium  PriceEconomy 
##  Min.   :34.00   Min.   :17.0   Min.   :17    Min.   : 166  
##  1st Qu.:34.00   1st Qu.:17.0   1st Qu.:17    1st Qu.: 293  
##  Median :36.50   Median :17.5   Median :19    Median :1097  
##  Mean   :36.08   Mean   :17.5   Mean   :19    Mean   :1106  
##  3rd Qu.:38.00   3rd Qu.:18.0   3rd Qu.:21    3rd Qu.:1988  
##  Max.   :38.00   Max.   :18.0   Max.   :21    Max.   :1999  
##   PricePremium  PriceRelative      SeatsTotal    PitchDifference
##  Min.   : 181   Min.   :0.0400   Min.   :138.0   Min.   :2.0    
##  1st Qu.: 308   1st Qu.:0.0725   1st Qu.:138.0   1st Qu.:2.0    
##  Median :1510   Median :0.1950   Median :213.5   Median :4.5    
##  Mean   :1492   Mean   :0.2292   Mean   :206.0   Mean   :4.5    
##  3rd Qu.:2632   3rd Qu.:0.3800   3rd Qu.:271.0   3rd Qu.:7.0    
##  Max.   :2765   Max.   :0.4600   Max.   :271.0   Max.   :7.0    
##  WidthDifference PercentPremiumSeats
##  Min.   :0.0     Min.   :12.82      
##  1st Qu.:0.0     1st Qu.:13.04      
##  Median :1.5     Median :13.53      
##  Mean   :1.5     Mean   :13.51      
##  3rd Qu.:3.0     3rd Qu.:14.02      
##  Max.   :3.0     Max.   :14.02
mean(Deairbus$PriceEconomy)
## [1] 1106.5
mean(Deairbus$PricePremium)
## [1] 1491.917
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Deairbus$PriceEconomy,Deairbus$TravelMonth,mean))
y4<-c(by(Deairbus$PricePremium,Deairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: Ignoring 1 observations

## Warning: Ignoring 1 observations
fit<-lm(PriceEconomy~FlightDuration,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -177.05  -52.57  -10.94   43.15  208.09 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -178.571     61.416  -2.908   0.0156 *  
## FlightDuration  234.752      9.475  24.776 2.62e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 113.9 on 10 degrees of freedom
## Multiple R-squared:  0.984,  Adjusted R-squared:  0.9824 
## F-statistic: 613.9 on 1 and 10 DF,  p-value: 2.622e-10
Deairbus$PriceEconomy
##  [1] 1778 1778 1999 1999 1999 1985  166  329  243  293  293  416
fitted(fit)
##       185       186       187       188       189       190       296 
## 1776.9123 1776.9123 2051.5720 2051.5720 2051.5720 1776.9123  279.1952 
##       297       298       302       303       306 
##  351.9683  420.0463  246.3299  251.0249  243.9824
cor(Deairbus$PriceEconomy,Deairbus$FlightDuration)
## [1] 0.9919529
fit<-lm(PriceEconomy~SeatsEconomy,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -248.79 -102.80   52.09   81.87  159.31 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1506.6145   125.4989  -12.01 2.91e-07 ***
## SeatsEconomy    14.6942     0.6739   21.81 9.20e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 129.2 on 10 degrees of freedom
## Multiple R-squared:  0.9794, Adjusted R-squared:  0.9773 
## F-statistic: 475.5 on 1 and 10 DF,  p-value: 9.201e-10
Deairbus$PriceEconomy
##  [1] 1778 1778 1999 1999 1999 1985  166  329  243  293  293  416
fitted(fit)
##       185       186       187       188       189       190       296 
## 1917.1288 1917.1288 1917.1288 1917.1288 1917.1288 1917.1288  256.6868 
##       297       298       302       303       306 
##  256.6868  491.7936  256.6868  256.6868  256.6868
cor(Deairbus$PriceEconomy,Deairbus$SeatsEconomy)
## [1] 0.989648
fit<-lm(PriceEconomy~PriceRelative,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -385.57 -211.11    6.97  201.78  554.13 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      57.07     145.04   0.393    0.702    
## PriceRelative  4579.35     509.14   8.994 4.16e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 298.5 on 10 degrees of freedom
## Multiple R-squared:   0.89,  Adjusted R-squared:  0.879 
## F-statistic:  80.9 on 1 and 10 DF,  p-value: 4.161e-06
Deairbus$PriceEconomy
##  [1] 1778 1778 1999 1999 1999 1985  166  329  243  293  293  416
fitted(fit)
##       185       186       187       188       189       190       296 
## 2163.5670 2163.5670 1797.2189 1797.2189 1797.2189 1430.8707  469.2069 
##       297       298       302       303       306 
##  423.4134  423.4134  286.0328  286.0328  240.2393
cor(Deairbus$PriceEconomy,Deairbus$PriceRelative)
## [1] 0.9433913
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -191.07  -82.10   15.43   84.81  235.49 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         -20362.15     989.20  -20.58 1.62e-09 ***
## PercentPremiumSeats   1588.90      73.16   21.72 9.57e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 129.7 on 10 degrees of freedom
## Multiple R-squared:  0.9792, Adjusted R-squared:  0.9772 
## F-statistic: 471.7 on 1 and 10 DF,  p-value: 9.573e-10
Deairbus$PriceEconomy
##  [1] 1778 1778 1999 1999 1999 1985  166  329  243  293  293  416
fitted(fit)
##         185         186         187         188         189         190 
## 1914.189261 1914.189261 1914.189261 1914.189261 1914.189261 1914.189261 
##         296         297         298         302         303         306 
##  357.070292  357.070292    7.512973  357.070292  357.070292  357.070292
fit<-lm(PricePremium~FlightDuration,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Deairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -235.136  -96.476    5.661  124.549  189.009 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -370.36      73.72  -5.024 0.000519 ***
## FlightDuration   340.19      11.37  29.912 4.08e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 136.8 on 10 degrees of freedom
## Multiple R-squared:  0.9889, Adjusted R-squared:  0.9878 
## F-statistic: 894.7 on 1 and 10 DF,  p-value: 4.079e-11
Deairbus$PricePremium
##  [1] 2588 2588 2765 2765 2765 2588  181  354  262  308  308  431
fitted(fit)
##       185       186       187       188       189       190       296 
## 2463.4507 2463.4507 2861.4764 2861.4764 2861.4764 2463.4507  293.0204 
##       297       298       302       303       306 
##  398.4802  497.1361  245.3934  252.1972  241.9914
cor(Deairbus$PricePremium,Deairbus$FlightDuration)
## [1] 0.9944581
fit<-lm(PricePremium~SeatsEconomy,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -337.68  -80.53   49.57   96.47  172.57 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -2300.9765   141.2277  -16.29 1.58e-08 ***
## SeatsEconomy    21.3284     0.7583   28.13 7.50e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 145.3 on 10 degrees of freedom
## Multiple R-squared:  0.9875, Adjusted R-squared:  0.9863 
## F-statistic: 791.1 on 1 and 10 DF,  p-value: 7.498e-11
Deairbus$PricePremium
##  [1] 2588 2588 2765 2765 2765 2588  181  354  262  308  308  431
fitted(fit)
##       185       186       187       188       189       190       296 
## 2668.5311 2668.5311 2668.5311 2668.5311 2668.5311 2668.5311  258.4266 
##       297       298       302       303       306 
##  258.4266  599.6803  258.4266  258.4266  258.4266
cor(Deairbus$PricePremium,Deairbus$SeatsEconomy)
## [1] 0.9937389
fit<-lm(PricePremium~SeatsPremium,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -249.56  -84.34   36.52   92.66  159.52 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1889.30     108.02  -17.49 7.92e-09 ***
## SeatsPremium   120.04       3.62   33.16 1.47e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 123.5 on 10 degrees of freedom
## Multiple R-squared:  0.991,  Adjusted R-squared:  0.9901 
## F-statistic:  1100 on 1 and 10 DF,  p-value: 1.468e-11
Deairbus$PricePremium
##  [1] 2588 2588 2765 2765 2765 2588  181  354  262  308  308  431
fitted(fit)
##       185       186       187       188       189       190       296 
## 2672.3406 2672.3406 2672.3406 2672.3406 2672.3406 2672.3406  271.4784 
##       297       298       302       303       306 
##  271.4784  511.5646  271.4784  271.4784  271.4784
cor(Deairbus$PricePremium,Deairbus$SeatsPremium)
## [1] 0.9954839
fit<-lm(PricePremium~PriceRelative,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -462.30 -260.00   25.66  254.79  617.88 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -55.21     172.27   -0.32    0.755    
## PriceRelative  6751.11     604.70   11.16 5.74e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 354.5 on 10 degrees of freedom
## Multiple R-squared:  0.9257, Adjusted R-squared:  0.9183 
## F-statistic: 124.6 on 1 and 10 DF,  p-value: 5.742e-07
Deairbus$PricePremium
##  [1] 2588 2588 2765 2765 2765 2588  181  354  262  308  308  431
fitted(fit)
##       185       186       187       188       189       190       296 
## 3050.2972 3050.2972 2510.2086 2510.2086 2510.2086 1970.1201  552.3876 
##       297       298       302       303       306 
##  484.8766  484.8766  282.3434  282.3434  214.8323
cor(Deairbus$PricePremium,Deairbus$PriceRelative)
## [1] 0.9621487
fit<-lm(PricePremium~PercentPremiumSeats,data = Deairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = Deairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -224.39  -80.53  -63.15  102.10  363.39 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         -29633.30    1212.96  -24.43 3.01e-10 ***
## PercentPremiumSeats   2303.58      89.71   25.68 1.84e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 159 on 10 degrees of freedom
## Multiple R-squared:  0.9851, Adjusted R-squared:  0.9836 
## F-statistic: 659.4 on 1 and 10 DF,  p-value: 1.842e-10
Deairbus$PricePremium
##  [1] 2588 2588 2765 2765 2765 2588  181  354  262  308  308  431
fitted(fit)
##       185       186       187       188       189       190       296 
## 2662.9036 2662.9036 2662.9036 2662.9036 2662.9036 2662.9036  405.3943 
##       297       298       302       303       306 
##  405.3943 -101.3935  405.3943  405.3943  405.3943
cor(Deairbus$PricePremium,Deairbus$PercentPremiumSeats)
## [1] 0.9925027

Now We Should Analyse the international & domestic aircrafts of Delta Airlines

Dedom <- Delta[ which(Delta$IsInternational=='Domestic'),]
View(Dedom)
summary(Dedom)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 6   Min.   :1.570   Aug:10     
##  British  : 0   Boeing:34   1st Qu.:2.060   Jul:10     
##  Delta    :40               Median :3.555   Oct:11     
##  Jet      : 0               Mean   :3.296   Sep: 9     
##  Singapore: 0               3rd Qu.:4.450              
##  Virgin   : 0               Max.   :4.700              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :40     Min.   : 78.0   Min.   :18.00   Min.   :31.00  
##  International: 0     1st Qu.:120.0   1st Qu.:18.00   1st Qu.:31.00  
##                       Median :126.0   Median :20.00   Median :32.00  
##                       Mean   :122.8   Mean   :20.25   Mean   :31.82  
##                       3rd Qu.:136.0   3rd Qu.:20.00   3rd Qu.:32.00  
##                       Max.   :171.0   Max.   :29.00   Max.   :33.00  
##   PitchPremium    WidthEconomy   WidthPremium   PriceEconomy  
##  Min.   :34.00   Min.   :17.0   Min.   :17.0   Min.   :158.0  
##  1st Qu.:34.00   1st Qu.:17.0   1st Qu.:17.0   1st Qu.:288.0  
##  Median :34.00   Median :17.0   Median :17.0   Median :349.0  
##  Mean   :34.23   Mean   :17.3   Mean   :17.3   Mean   :356.6  
##  3rd Qu.:34.00   3rd Qu.:18.0   3rd Qu.:18.0   3rd Qu.:413.0  
##  Max.   :35.00   Max.   :18.0   Max.   :18.0   Max.   :713.0  
##   PricePremium   PriceRelative       SeatsTotal    PitchDifference
##  Min.   :173.0   Min.   :0.03000   Min.   : 98.0   Min.   :2.0    
##  1st Qu.:308.0   1st Qu.:0.06750   1st Qu.:138.0   1st Qu.:2.0    
##  Median :371.0   Median :0.09000   Median :144.0   Median :2.0    
##  Mean   :385.9   Mean   :0.08475   Mean   :143.1   Mean   :2.4    
##  3rd Qu.:457.0   3rd Qu.:0.11000   3rd Qu.:156.0   3rd Qu.:3.0    
##  Max.   :757.0   Max.   :0.14000   Max.   :200.0   Max.   :3.0    
##  WidthDifference PercentPremiumSeats
##  Min.   :0       Min.   :12.50      
##  1st Qu.:0       1st Qu.:12.50      
##  Median :0       Median :13.04      
##  Mean   :0       Mean   :14.55      
##  3rd Qu.:0       3rd Qu.:14.50      
##  Max.   :0       Max.   :20.41
mean(Dedom$PriceEconomy)
## [1] 356.625
mean(Dedom$PricePremium)
## [1] 385.9
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Dedom$PriceEconomy,Dedom$TravelMonth,mean))
y2<-c(by(Dedom$PricePremium,Dedom$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Dedom)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -143.391  -78.542   -6.366   23.225  314.946 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      209.33      53.32   3.926 0.000352 ***
## FlightDuration    44.69      15.18   2.943 0.005512 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 116.4 on 38 degrees of freedom
## Multiple R-squared:  0.1856, Adjusted R-squared:  0.1642 
## F-statistic: 8.662 on 1 and 38 DF,  p-value: 0.005512
Dedom$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 166 329 243 243 626 354
## [35] 293 293 293 636 416 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 301.3910 313.4567 301.3910 299.1566 313.4567 287.5379 312.1161 312.1161 
##       98      152      153      154      155      281      282      283 
## 399.7039 402.8321 410.8758 402.8321 410.8758 400.5977 399.2570 416.2384 
##      284      285      286      287      288      289      290      291 
## 417.1321 417.5790 419.3665 419.3665 419.3665 404.1727 399.2570 407.3008 
##      292      293      294      295      296      297      298      299 
## 419.3665 399.7039 405.9602 294.6879 296.4754 310.3286 323.2880 323.2880 
##      300      301      302      303      304      305      306      307 
## 416.2384 337.1412 290.2191 291.1129 279.4941 321.0536 289.7722 279.4941
cor(Dedom$PriceEconomy,Dedom$FlightDuration)
## [1] 0.4308594
fit<-lm(PriceEconomy~SeatsEconomy,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -214.97  -61.13  -22.40   40.56  307.40 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   129.198     90.064   1.435   0.1596  
## SeatsEconomy    1.851      0.717   2.582   0.0138 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 119 on 38 degrees of freedom
## Multiple R-squared:  0.1493, Adjusted R-squared:  0.1269 
## F-statistic: 6.667 on 1 and 38 DF,  p-value: 0.0138
Dedom$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 166 329 243 243 626 354
## [35] 293 293 293 636 416 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 
##       98      152      153      154      155      281      282      283 
## 373.5640 445.7630 445.7630 445.7630 445.7630 362.4565 362.4565 362.4565 
##      284      285      286      287      288      289      290      291 
## 362.4565 362.4565 386.5228 386.5228 386.5228 362.4565 362.4565 362.4565 
##      292      293      294      295      296      297      298      299 
## 386.5228 362.4565 362.4565 380.9690 351.3489 351.3489 380.9690 380.9690 
##      300      301      302      303      304      305      306      307 
## 362.4565 380.9690 351.3489 351.3489 362.4565 380.9690 351.3489 362.4565
cor(Dedom$PriceEconomy,Dedom$SeatsEconomy)
## [1] 0.3863472
fit<-lm(PriceEconomy~PriceRelative,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -194.15  -93.26  -15.41   77.91  335.27 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     428.91      60.46   7.094 1.84e-08 ***
## PriceRelative  -852.87     673.35  -1.267    0.213    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.3 on 38 degrees of freedom
## Multiple R-squared:  0.04051,    Adjusted R-squared:  0.01526 
## F-statistic: 1.604 on 1 and 38 DF,  p-value: 0.213
Dedom$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 166 329 243 243 626 354
## [35] 293 293 293 636 416 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 352.1475 360.6761 369.2048 369.2048 369.2048 394.7908 394.7908 403.3194 
##       98      152      153      154      155      281      282      283 
## 352.1475 318.0328 343.6188 352.1475 377.7334 309.5042 309.5042 326.5615 
##      284      285      286      287      288      289      290      291 
## 326.5615 326.5615 335.0901 335.0901 335.0901 335.0901 335.0901 335.0901 
##      292      293      294      295      296      297      298      299 
## 343.6188 343.6188 343.6188 352.1475 352.1475 360.6761 360.6761 360.6761 
##      300      301      302      303      304      305      306      307 
## 369.2048 369.2048 386.2621 386.2621 386.2621 394.7908 394.7908 394.7908
cor(Dedom$PriceEconomy,Dedom$PriceRelative)
## [1] -0.2012646
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -203.70  -84.11  -19.41   46.22  355.99 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          466.488     98.332   4.744 2.94e-05 ***
## PercentPremiumSeats   -7.550      6.616  -1.141    0.261    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.8 on 38 degrees of freedom
## Multiple R-squared:  0.03314,    Adjusted R-squared:  0.007695 
## F-statistic: 1.302 on 1 and 38 DF,  p-value: 0.2609
Dedom$PriceEconomy
##  [1] 158 189 228 222 216 391 349 581 458 298 423 483 713 288 288 363 363
## [18] 363 413 413 413 413 413 340 423 328 328 166 166 329 243 243 626 354
## [35] 293 293 293 636 416 349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 
##       98      152      153      154      155      281      282      283 
## 342.2159 357.0138 357.0138 357.0138 357.0138 372.1138 372.1138 372.1138 
##      284      285      286      287      288      289      290      291 
## 372.1138 372.1138 367.3573 367.3573 367.3573 372.1138 372.1138 372.1138 
##      292      293      294      295      296      297      298      299 
## 367.3573 372.1138 372.1138 369.6978 368.0368 368.0368 369.6978 369.6978 
##      300      301      302      303      304      305      306      307 
## 372.1138 369.6978 368.0368 368.0368 372.1138 369.6978 368.0368 372.1138
cor(Dedom$PriceEconomy,Dedom$PercentPremiumSeats)
## [1] -0.1820406
fit<-lm(PricePremium~FlightDuration,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -144.80  -82.80   -6.25   27.13  317.96 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      204.30      53.81   3.797 0.000514 ***
## FlightDuration    55.10      15.32   3.596 0.000918 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 117.5 on 38 degrees of freedom
## Multiple R-squared:  0.2538, Adjusted R-squared:  0.2342 
## F-statistic: 12.93 on 1 and 38 DF,  p-value: 0.0009183
Dedom$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 181 354 262 262 670 378
## [35] 308 308 308 660 431 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 317.8012 332.6771 317.8012 315.0464 332.6771 300.7214 331.0243 331.0243 
##       98      152      153      154      155      281      282      283 
## 439.0127 442.8694 452.7867 442.8694 452.7867 440.1146 438.4617 459.3982 
##      284      285      286      287      288      289      290      291 
## 460.5002 461.0511 463.2550 463.2550 463.2550 444.5223 438.4617 448.3790 
##      292      293      294      295      296      297      298      299 
## 463.2550 439.0127 446.7261 309.5368 311.7406 328.8204 344.7983 344.7983 
##      300      301      302      303      304      305      306      307 
## 459.3982 361.8781 304.0271 305.1291 290.8041 342.0435 303.4762 290.8041
cor(Dedom$PricePremium,Dedom$FlightDuration)
## [1] 0.5038332
fit<-lm(PriceEconomy~SeatsEconomy,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -214.97  -61.13  -22.40   40.56  307.40 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   129.198     90.064   1.435   0.1596  
## SeatsEconomy    1.851      0.717   2.582   0.0138 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 119 on 38 degrees of freedom
## Multiple R-squared:  0.1493, Adjusted R-squared:  0.1269 
## F-statistic: 6.667 on 1 and 38 DF,  p-value: 0.0138
Dedom$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 181 354 262 262 670 378
## [35] 308 308 308 660 431 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 273.5961 
##       98      152      153      154      155      281      282      283 
## 373.5640 445.7630 445.7630 445.7630 445.7630 362.4565 362.4565 362.4565 
##      284      285      286      287      288      289      290      291 
## 362.4565 362.4565 386.5228 386.5228 386.5228 362.4565 362.4565 362.4565 
##      292      293      294      295      296      297      298      299 
## 386.5228 362.4565 362.4565 380.9690 351.3489 351.3489 380.9690 380.9690 
##      300      301      302      303      304      305      306      307 
## 362.4565 380.9690 351.3489 351.3489 362.4565 380.9690 351.3489 362.4565
cor(Dedom$PricePremium,Dedom$SeatsEconomy)
## [1] 0.4286017
fit<-lm(PriceEconomy~SeatsPremium,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Dedom)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -195.400  -62.484    1.002   46.699  298.403 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)     95.37     119.61   0.797    0.430  
## SeatsPremium    12.90       5.83   2.213    0.033 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 121.4 on 38 degrees of freedom
## Multiple R-squared:  0.1142, Adjusted R-squared:  0.09085 
## F-statistic: 4.897 on 1 and 38 DF,  p-value: 0.03298
Dedom$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 181 354 262 262 670 378
## [35] 308 308 308 660 431 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 353.3997 353.3997 353.3997 353.3997 353.3997 353.3997 353.3997 353.3997 
##       98      152      153      154      155      281      282      283 
## 430.8080 469.5121 469.5121 469.5121 469.5121 327.5969 327.5969 327.5969 
##      284      285      286      287      288      289      290      291 
## 327.5969 327.5969 366.3010 366.3010 366.3010 327.5969 327.5969 327.5969 
##      292      293      294      295      296      297      298      299 
## 366.3010 327.5969 327.5969 353.3997 327.5969 327.5969 353.3997 353.3997 
##      300      301      302      303      304      305      306      307 
## 327.5969 353.3997 327.5969 327.5969 327.5969 353.3997 327.5969 327.5969
cor(Dedom$PricePremium,Dedom$SeatsPremium)
## [1] 0.3507328
fit<-lm(PriceEconomy~PriceRelative,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -194.15  -93.26  -15.41   77.91  335.27 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     428.91      60.46   7.094 1.84e-08 ***
## PriceRelative  -852.87     673.35  -1.267    0.213    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.3 on 38 degrees of freedom
## Multiple R-squared:  0.04051,    Adjusted R-squared:  0.01526 
## F-statistic: 1.604 on 1 and 38 DF,  p-value: 0.213
Dedom$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 181 354 262 262 670 378
## [35] 308 308 308 660 431 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 352.1475 360.6761 369.2048 369.2048 369.2048 394.7908 394.7908 403.3194 
##       98      152      153      154      155      281      282      283 
## 352.1475 318.0328 343.6188 352.1475 377.7334 309.5042 309.5042 326.5615 
##      284      285      286      287      288      289      290      291 
## 326.5615 326.5615 335.0901 335.0901 335.0901 335.0901 335.0901 335.0901 
##      292      293      294      295      296      297      298      299 
## 343.6188 343.6188 343.6188 352.1475 352.1475 360.6761 360.6761 360.6761 
##      300      301      302      303      304      305      306      307 
## 369.2048 369.2048 386.2621 386.2621 386.2621 394.7908 394.7908 394.7908
cor(Dedom$PricePremium,Dedom$PriceRelative)
## [1] -0.1206376
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Dedom)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Dedom)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -203.70  -84.11  -19.41   46.22  355.99 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          466.488     98.332   4.744 2.94e-05 ***
## PercentPremiumSeats   -7.550      6.616  -1.141    0.261    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.8 on 38 degrees of freedom
## Multiple R-squared:  0.03314,    Adjusted R-squared:  0.007695 
## F-statistic: 1.302 on 1 and 38 DF,  p-value: 0.2609
Dedom$PricePremium
##  [1] 173 204 243 237 231 406 364 596 497 337 467 527 757 327 327 407 407
## [18] 407 457 457 457 457 457 379 467 362 362 181 181 354 262 262 670 378
## [35] 308 308 308 660 431 364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 312.3935 
##       98      152      153      154      155      281      282      283 
## 342.2159 357.0138 357.0138 357.0138 357.0138 372.1138 372.1138 372.1138 
##      284      285      286      287      288      289      290      291 
## 372.1138 372.1138 367.3573 367.3573 367.3573 372.1138 372.1138 372.1138 
##      292      293      294      295      296      297      298      299 
## 367.3573 372.1138 372.1138 369.6978 368.0368 368.0368 369.6978 369.6978 
##      300      301      302      303      304      305      306      307 
## 372.1138 369.6978 368.0368 368.0368 372.1138 369.6978 368.0368 372.1138
cor(Dedom$PricePremium,Dedom$PercentPremiumSeats)
## [1] -0.2204297
Deint <- Delta[ which(Delta$IsInternational=='International'),]
View(Deint)
summary(Deint)
##       Airline    Aircraft FlightDuration  TravelMonth      IsInternational
##  AirFrance:0   AirBus:6   Min.   :8.330   Aug:2       Domestic     :0     
##  British  :0   Boeing:0   1st Qu.:8.330   Jul:0       International:6     
##  Delta    :6              Median :8.915   Oct:2                           
##  Jet      :0              Mean   :8.915   Sep:2                           
##  Singapore:0              3rd Qu.:9.500                                   
##  Virgin   :0              Max.   :9.500                                   
##   SeatsEconomy  SeatsPremium  PitchEconomy  PitchPremium  WidthEconomy
##  Min.   :233   Min.   :38    Min.   :31    Min.   :38    Min.   :18   
##  1st Qu.:233   1st Qu.:38    1st Qu.:31    1st Qu.:38    1st Qu.:18   
##  Median :233   Median :38    Median :31    Median :38    Median :18   
##  Mean   :233   Mean   :38    Mean   :31    Mean   :38    Mean   :18   
##  3rd Qu.:233   3rd Qu.:38    3rd Qu.:31    3rd Qu.:38    3rd Qu.:18   
##  Max.   :233   Max.   :38    Max.   :31    Max.   :38    Max.   :18   
##   WidthPremium  PriceEconomy   PricePremium  PriceRelative   
##  Min.   :21    Min.   :1778   Min.   :2588   Min.   :0.3000  
##  1st Qu.:21    1st Qu.:1830   1st Qu.:2588   1st Qu.:0.3800  
##  Median :21    Median :1992   Median :2676   Median :0.3800  
##  Mean   :21    Mean   :1923   Mean   :2676   Mean   :0.3933  
##  3rd Qu.:21    3rd Qu.:1999   3rd Qu.:2765   3rd Qu.:0.4400  
##  Max.   :21    Max.   :1999   Max.   :2765   Max.   :0.4600  
##    SeatsTotal  PitchDifference WidthDifference PercentPremiumSeats
##  Min.   :271   Min.   :7       Min.   :3       Min.   :14.02      
##  1st Qu.:271   1st Qu.:7       1st Qu.:3       1st Qu.:14.02      
##  Median :271   Median :7       Median :3       Median :14.02      
##  Mean   :271   Mean   :7       Mean   :3       Mean   :14.02      
##  3rd Qu.:271   3rd Qu.:7       3rd Qu.:3       3rd Qu.:14.02      
##  Max.   :271   Max.   :7       Max.   :3       Max.   :14.02
mean(Deint$PriceEconomy)
## [1] 1923
mean(Deint$PricePremium)
## [1] 2676.5
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Deint$PriceEconomy,Deint$TravelMonth,mean))
y2<-c(by(Deint$PricePremium,Deint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: Ignoring 1 observations

## Warning: Ignoring 1 observations
fit<-lm(PriceEconomy~FlightDuration,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Deint)
## 
## Residuals:
##        185        186        187        188        189        190 
## -6.900e+01 -6.900e+01  2.487e-14  2.487e-14  2.487e-14  1.380e+02 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      764.81     526.89   1.452   0.2203  
## FlightDuration   129.91      58.97   2.203   0.0924 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 84.51 on 4 degrees of freedom
## Multiple R-squared:  0.5482, Adjusted R-squared:  0.4352 
## F-statistic: 4.853 on 1 and 4 DF,  p-value: 0.09235
Deint$PriceEconomy
## [1] 1778 1778 1999 1999 1999 1985
fitted(fit)
##  185  186  187  188  189  190 
## 1847 1847 1999 1999 1999 1847
cor(Deint$PriceEconomy,Deint$FlightDuration)
## [1] 0.7403807
fit<-lm(PriceEconomy~SeatsEconomy,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Deint)
## 
## Residuals:
##  185  186  187  188  189  190 
## -145 -145   76   76   76   62 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1923.00      45.91   41.89 1.46e-07 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 5 degrees of freedom
Deint$PriceEconomy
## [1] 1778 1778 1999 1999 1999 1985
fitted(fit)
##  185  186  187  188  189  190 
## 1923 1923 1923 1923 1923 1923
cor(Deint$PriceEconomy,Deint$SeatsEconomy)
## Warning in cor(Deint$PriceEconomy, Deint$SeatsEconomy): the standard
## deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Deint)
## 
## Residuals:
##    185    186    187    188    189    190 
## -41.47 -41.47  55.29  55.29  55.29 -82.94 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2533.8      205.9  12.307  0.00025 ***
## PriceRelative  -1552.9      518.4  -2.996  0.04011 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 69.81 on 4 degrees of freedom
## Multiple R-squared:  0.6917, Adjusted R-squared:  0.6146 
## F-statistic: 8.974 on 1 and 4 DF,  p-value: 0.04011
Deint$PriceEconomy
## [1] 1778 1778 1999 1999 1999 1985
fitted(fit)
##      185      186      187      188      189      190 
## 1819.471 1819.471 1943.706 1943.706 1943.706 2067.941
cor(Deint$PriceEconomy,Deint$PriceRelative)
## [1] -0.8316866
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Deint)
## 
## Residuals:
##  185  186  187  188  189  190 
## -145 -145   76   76   76   62 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1923.00      45.91   41.89 1.46e-07 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 5 degrees of freedom
Deint$PriceEconomy
## [1] 1778 1778 1999 1999 1999 1985
fitted(fit)
##  185  186  187  188  189  190 
## 1923 1923 1923 1923 1923 1923
cor(Deint$PriceEconomy,Deint$PercentPremiumSeats)
## Warning in cor(Deint$PriceEconomy, Deint$PercentPremiumSeats): the standard
## deviation is zero
## [1] NA
fit<-lm(PricePremium~FlightDuration,data = Deint)
summary(fit)
## Warning in summary.lm(fit): essentially perfect fit: summary may be
## unreliable
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Deint)
## 
## Residuals:
##        185        186        187        188        189        190 
##  1.392e-12 -6.962e-13 -3.534e-28 -3.534e-28 -3.534e-28 -6.962e-13 
## 
## Coefficients:
##                 Estimate Std. Error   t value Pr(>|t|)    
## (Intercept)    1.328e+03  5.316e-12 2.498e+14   <2e-16 ***
## FlightDuration 1.513e+02  5.950e-13 2.542e+14   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.527e-13 on 4 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 6.464e+28 on 1 and 4 DF,  p-value: < 2.2e-16
Deint$PricePremium
## [1] 2588 2588 2765 2765 2765 2588
fitted(fit)
##  185  186  187  188  189  190 
## 2588 2588 2765 2765 2765 2588
cor(Deint$PricePremium,Deint$FlightDuration)
## [1] 1
fit<-lm(PriceEconomy~SeatsEconomy,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Deint)
## 
## Residuals:
##  185  186  187  188  189  190 
## -145 -145   76   76   76   62 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1923.00      45.91   41.89 1.46e-07 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 5 degrees of freedom
Deint$PricePremium
## [1] 2588 2588 2765 2765 2765 2588
fitted(fit)
##  185  186  187  188  189  190 
## 1923 1923 1923 1923 1923 1923
cor(Deint$PricePremium,Deint$SeatsEconomy)
## Warning in cor(Deint$PricePremium, Deint$SeatsEconomy): the standard
## deviation is zero
## [1] NA
fit<-lm(PriceEconomy~SeatsPremium,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Deint)
## 
## Residuals:
##  185  186  187  188  189  190 
## -145 -145   76   76   76   62 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1923.00      45.91   41.89 1.46e-07 ***
## SeatsPremium       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 5 degrees of freedom
Deint$PricePremium
## [1] 2588 2588 2765 2765 2765 2588
fitted(fit)
##  185  186  187  188  189  190 
## 1923 1923 1923 1923 1923 1923
cor(Deint$PricePremium,Deint$SeatsPremium)
## Warning in cor(Deint$PricePremium, Deint$SeatsPremium): the standard
## deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Deint)
## 
## Residuals:
##    185    186    187    188    189    190 
## -41.47 -41.47  55.29  55.29  55.29 -82.94 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2533.8      205.9  12.307  0.00025 ***
## PriceRelative  -1552.9      518.4  -2.996  0.04011 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 69.81 on 4 degrees of freedom
## Multiple R-squared:  0.6917, Adjusted R-squared:  0.6146 
## F-statistic: 8.974 on 1 and 4 DF,  p-value: 0.04011
Deint$PricePremium
## [1] 2588 2588 2765 2765 2765 2588
fitted(fit)
##      185      186      187      188      189      190 
## 1819.471 1819.471 1943.706 1943.706 1943.706 2067.941
cor(Deint$PricePremium,Deint$PriceRelative)
## [1] -0.2425356
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Deint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Deint)
## 
## Residuals:
##  185  186  187  188  189  190 
## -145 -145   76   76   76   62 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1923.00      45.91   41.89 1.46e-07 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 5 degrees of freedom
Deint$PricePremium
## [1] 2588 2588 2765 2765 2765 2588
fitted(fit)
##  185  186  187  188  189  190 
## 1923 1923 1923 1923 1923 1923
cor(Deint$PricePremium,Deint$PercentPremiumSeats)
## Warning in cor(Deint$PricePremium, Deint$PercentPremiumSeats): the standard
## deviation is zero
## [1] NA

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Deboeing$PriceEconomy,Deboeing$TravelMonth,mean))
y2<-c(by(Deboeing$PricePremium,Deboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Deairbus$PriceEconomy,Deairbus$TravelMonth,mean))
y4<-c(by(Deairbus$PricePremium,Deairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: Ignoring 1 observations
## Warning: Ignoring 1 observations
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of Delta Airlines

mean(Delta$PriceEconomy)
## [1] 560.9348
mean(Delta$PricePremium)
## [1] 684.6739
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Delta$PriceEconomy,Delta$TravelMonth,mean))
y2<-c(by(Delta$PricePremium,Delta$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -334.52 -283.12   22.98  243.54  493.18 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -311.05      79.02  -3.936 0.000291 ***
## FlightDuration   216.43      17.19  12.592 3.47e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 258.1 on 44 degrees of freedom
## Multiple R-squared:  0.7828, Adjusted R-squared:  0.7778 
## F-statistic: 158.6 on 1 and 44 DF,  p-value: 3.468e-16
Delta$PriceEconomy
##  [1]  158  189  228  222  216  391  349  581  458  298  423  483  713 1778
## [15] 1778 1999 1999 1999 1985  288  288  363  363  363  413  413  413  413
## [29]  413  340  423  328  328  166  166  329  243  243  626  354  293  293
## [43]  293  636  416  349
fitted(fit)
##         74         75         76         77         78         79 
##  134.80176  193.23802  134.80176  123.98023  193.23802   67.70828 
##         80         81         98        152        153        154 
##  186.74511  186.74511  610.94907  626.09921  665.05672  626.09921 
##        155        185        186        187        188        189 
##  665.05672 1491.82158 1491.82158 1745.04538 1745.04538 1745.04538 
##        190        281        282        283        284        285 
## 1491.82158  615.27768  608.78476  691.02839  695.35700  697.52131 
##        286        287        288        289        290        291 
##  706.17853  706.17853  706.17853  632.59213  608.78476  647.74227 
##        292        293        294        295        296        297 
##  706.17853  610.94907  641.24935  102.33718  110.99440  178.08788 
##        298        299        300        301        302        303 
##  240.85276  240.85276  691.02839  307.94624   80.69412   85.02273 
##        304        305        306        307 
##   28.75077  230.03123   78.52981   28.75077
cor(Delta$PriceEconomy,Delta$FlightDuration)
## [1] 0.8847487
fit<-lm(PriceEconomy~SeatsEconomy,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -616.70 -164.10  -80.47  216.39  640.18 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -875.9736   135.6704  -6.457 7.19e-08 ***
## SeatsEconomy   10.4718     0.9406  11.133 2.20e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 283.5 on 44 degrees of freedom
## Multiple R-squared:  0.738,  Adjusted R-squared:  0.732 
## F-statistic: 123.9 on 1 and 44 DF,  p-value: 2.204e-14
Delta$PriceEconomy
##  [1]  158  189  228  222  216  391  349  581  458  298  423  483  713 1778
## [15] 1778 1999 1999 1999 1985  288  288  363  363  363  413  413  413  413
## [29]  413  340  423  328  328  166  166  329  243  243  626  354  293  293
## [43]  293  636  416  349
fitted(fit)
##         74         75         76         77         78         79 
##  -59.17586  -59.17586  -59.17586  -59.17586  -59.17586  -59.17586 
##         80         81         98        152        153        154 
##  -59.17586  -59.17586  506.29948  914.69834  914.69834  914.69834 
##        155        185        186        187        188        189 
##  914.69834 1563.94781 1563.94781 1563.94781 1563.94781 1563.94781 
##        190        281        282        283        284        285 
## 1563.94781  443.46889  443.46889  443.46889  443.46889  443.46889 
##        286        287        288        289        290        291 
##  579.60184  579.60184  579.60184  443.46889  443.46889  443.46889 
##        292        293        294        295        296        297 
##  579.60184  443.46889  443.46889  548.18655  380.63830  380.63830 
##        298        299        300        301        302        303 
##  548.18655  548.18655  443.46889  548.18655  380.63830  380.63830 
##        304        305        306        307 
##  443.46889  548.18655  380.63830  443.46889
cor(Delta$PriceEconomy,Delta$SeatsEconomy)
## [1] 0.8590671
fit<-lm(PriceEconomy~PriceRelative,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -340.11 -166.25  -80.76  146.24  640.38 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1.159     52.983   0.022    0.983    
## PriceRelative 4478.206    319.007  14.038   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 236.6 on 44 degrees of freedom
## Multiple R-squared:  0.8175, Adjusted R-squared:  0.8133 
## F-statistic: 197.1 on 1 and 44 DF,  p-value: < 2.2e-16
Delta$PriceEconomy
##  [1]  158  189  228  222  216  391  349  581  458  298  423  483  713 1778
## [15] 1778 1999 1999 1999 1985  288  288  363  363  363  413  413  413  413
## [29]  413  340  423  328  328  166  166  329  243  243  626  354  293  293
## [43]  293  636  416  349
fitted(fit)
##        74        75        76        77        78        79        80 
##  404.1976  359.4155  314.6335  314.6335  314.6335  180.2873  180.2873 
##        81        98       152       153       154       155       185 
##  135.5052  404.1976  583.3258  448.9796  404.1976  269.8514 2061.1338 
##       186       187       188       189       190       281       282 
## 2061.1338 1702.8773 1702.8773 1702.8773 1344.6208  628.1079  628.1079 
##       283       284       285       286       287       288       289 
##  538.5438  538.5438  538.5438  493.7617  493.7617  493.7617  493.7617 
##       290       291       292       293       294       295       296 
##  493.7617  493.7617  448.9796  448.9796  448.9796  404.1976  404.1976 
##       297       298       299       300       301       302       303 
##  359.4155  359.4155  359.4155  314.6335  314.6335  225.0693  225.0693 
##       304       305       306       307 
##  225.0693  180.2873  180.2873  180.2873
cor(Delta$PriceEconomy,Delta$PriceRelative)
## [1] 0.9041439
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -427.00 -269.03 -221.56  -67.98 1429.15 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           840.35     423.33   1.985   0.0534 .
## PercentPremiumSeats   -19.29      28.69  -0.673   0.5048  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 551 on 44 degrees of freedom
## Multiple R-squared:  0.01018,    Adjusted R-squared:  -0.01232 
## F-statistic: 0.4523 on 1 and 44 DF,  p-value: 0.5048
Delta$PriceEconomy
##  [1]  158  189  228  222  216  391  349  581  458  298  423  483  713 1778
## [15] 1778 1999 1999 1999 1985  288  288  363  363  363  413  413  413  413
## [29]  413  340  423  328  328  166  166  329  243  243  626  354  293  293
## [43]  293  636  416  349
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 
##       98      152      153      154      155      185      186      187 
## 522.7747 560.5908 560.5908 560.5908 560.5908 569.8520 569.8520 569.8520 
##      188      189      190      281      282      283      284      285 
## 569.8520 569.8520 569.8520 599.1788 599.1788 599.1788 599.1788 599.1788 
##      286      287      288      289      290      291      292      293 
## 587.0236 587.0236 587.0236 599.1788 599.1788 599.1788 587.0236 599.1788 
##      294      295      296      297      298      299      300      301 
## 599.1788 593.0047 588.7600 588.7600 593.0047 593.0047 599.1788 593.0047 
##      302      303      304      305      306      307 
## 588.7600 588.7600 599.1788 593.0047 588.7600 599.1788
cor(Delta$PriceEconomy,Delta$PercentPremiumSeats)
## [1] -0.1008732
fit<-lm(PricePremium~FlightDuration,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -475.50 -419.01   55.82  353.68  555.04 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     -578.29     112.68  -5.132 6.23e-06 ***
## FlightDuration   313.48      24.51  12.790  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 368.1 on 44 degrees of freedom
## Multiple R-squared:  0.788,  Adjusted R-squared:  0.7832 
## F-statistic: 163.6 on 1 and 44 DF,  p-value: < 2.2e-16
Delta$PricePremium
##  [1]  173  204  243  237  231  406  364  596  497  337  467  527  757 2588
## [15] 2588 2765 2765 2765 2588  327  327  407  407  407  457  457  457  457
## [29]  457  379  467  362  362  181  181  354  262  262  670  378  308  308
## [43]  308  660  431  364
fitted(fit)
##          74          75          76          77          78          79 
##   67.467881  152.106270   67.467881   51.794105  152.106270  -29.709529 
##          80          81          98         152         153         154 
##  142.702004  142.702004  757.114016  779.057302  835.482895  779.057302 
##         155         185         186         187         188         189 
##  835.482895 2032.959366 2032.959366 2399.725720 2399.725720 2399.725720 
##         190         281         282         283         284         285 
## 2032.959366  763.383526  753.979261  873.099957  879.369467  882.504222 
##         286         287         288         289         290         291 
##  895.043243  895.043243  895.043243  788.461568  753.979261  810.404854 
##         292         293         294         295         296         297 
##  895.043243  757.114016  801.000588   20.446553   32.985574  130.162984 
##         298         299         300         301         302         303 
##  221.070884  221.070884  873.099957  318.248293  -10.900998   -4.631488 
##         304         305         306         307 
##  -86.135122  205.397108  -14.035754  -86.135122
cor(Delta$PricePremium,Delta$FlightDuration)
## [1] 0.8877077
fit<-lm(PriceEconomy~SeatsEconomy,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -616.70 -164.10  -80.47  216.39  640.18 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -875.9736   135.6704  -6.457 7.19e-08 ***
## SeatsEconomy   10.4718     0.9406  11.133 2.20e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 283.5 on 44 degrees of freedom
## Multiple R-squared:  0.738,  Adjusted R-squared:  0.732 
## F-statistic: 123.9 on 1 and 44 DF,  p-value: 2.204e-14
Delta$PricePremium
##  [1]  173  204  243  237  231  406  364  596  497  337  467  527  757 2588
## [15] 2588 2765 2765 2765 2588  327  327  407  407  407  457  457  457  457
## [29]  457  379  467  362  362  181  181  354  262  262  670  378  308  308
## [43]  308  660  431  364
fitted(fit)
##         74         75         76         77         78         79 
##  -59.17586  -59.17586  -59.17586  -59.17586  -59.17586  -59.17586 
##         80         81         98        152        153        154 
##  -59.17586  -59.17586  506.29948  914.69834  914.69834  914.69834 
##        155        185        186        187        188        189 
##  914.69834 1563.94781 1563.94781 1563.94781 1563.94781 1563.94781 
##        190        281        282        283        284        285 
## 1563.94781  443.46889  443.46889  443.46889  443.46889  443.46889 
##        286        287        288        289        290        291 
##  579.60184  579.60184  579.60184  443.46889  443.46889  443.46889 
##        292        293        294        295        296        297 
##  579.60184  443.46889  443.46889  548.18655  380.63830  380.63830 
##        298        299        300        301        302        303 
##  548.18655  548.18655  443.46889  548.18655  380.63830  380.63830 
##        304        305        306        307 
##  443.46889  548.18655  380.63830  443.46889
cor(Delta$PricePremium,Delta$SeatsEconomy)
## [1] 0.8609209
fit<-lm(PriceEconomy~SeatsPremium,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -729.61 -131.90   60.65  133.15  396.15 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1075.566    124.859  -8.614 5.39e-11 ***
## SeatsPremium    72.523      5.303  13.676  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 241.7 on 44 degrees of freedom
## Multiple R-squared:  0.8095, Adjusted R-squared:  0.8052 
## F-statistic:   187 on 1 and 44 DF,  p-value: < 2.2e-16
Delta$PricePremium
##  [1]  173  204  243  237  231  406  364  596  497  337  467  527  757 2588
## [15] 2588 2765 2765 2765 2588  327  327  407  407  407  457  457  457  457
## [29]  457  379  467  362  362  181  181  354  262  262  670  378  308  308
## [43]  308  660  431  364
fitted(fit)
##        74        75        76        77        78        79        80 
##  374.8971  374.8971  374.8971  374.8971  374.8971  374.8971  374.8971 
##        81        98       152       153       154       155       185 
##  374.8971  810.0361 1027.6056 1027.6056 1027.6056 1027.6056 1680.3141 
##       186       187       188       189       190       281       282 
## 1680.3141 1680.3141 1680.3141 1680.3141 1680.3141  229.8507  229.8507 
##       283       284       285       286       287       288       289 
##  229.8507  229.8507  229.8507  447.4203  447.4203  447.4203  229.8507 
##       290       291       292       293       294       295       296 
##  229.8507  229.8507  447.4203  229.8507  229.8507  374.8971  229.8507 
##       297       298       299       300       301       302       303 
##  229.8507  374.8971  374.8971  229.8507  374.8971  229.8507  229.8507 
##       304       305       306       307 
##  229.8507  374.8971  229.8507  229.8507
cor(Delta$PricePremium,Delta$SeatsPremium)
## [1] 0.9029489
fit<-lm(PriceEconomy~PriceRelative,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -340.11 -166.25  -80.76  146.24  640.38 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1.159     52.983   0.022    0.983    
## PriceRelative 4478.206    319.007  14.038   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 236.6 on 44 degrees of freedom
## Multiple R-squared:  0.8175, Adjusted R-squared:  0.8133 
## F-statistic: 197.1 on 1 and 44 DF,  p-value: < 2.2e-16
Delta$PricePremium
##  [1]  173  204  243  237  231  406  364  596  497  337  467  527  757 2588
## [15] 2588 2765 2765 2765 2588  327  327  407  407  407  457  457  457  457
## [29]  457  379  467  362  362  181  181  354  262  262  670  378  308  308
## [43]  308  660  431  364
fitted(fit)
##        74        75        76        77        78        79        80 
##  404.1976  359.4155  314.6335  314.6335  314.6335  180.2873  180.2873 
##        81        98       152       153       154       155       185 
##  135.5052  404.1976  583.3258  448.9796  404.1976  269.8514 2061.1338 
##       186       187       188       189       190       281       282 
## 2061.1338 1702.8773 1702.8773 1702.8773 1344.6208  628.1079  628.1079 
##       283       284       285       286       287       288       289 
##  538.5438  538.5438  538.5438  493.7617  493.7617  493.7617  493.7617 
##       290       291       292       293       294       295       296 
##  493.7617  493.7617  448.9796  448.9796  448.9796  404.1976  404.1976 
##       297       298       299       300       301       302       303 
##  359.4155  359.4155  359.4155  314.6335  314.6335  225.0693  225.0693 
##       304       305       306       307 
##  225.0693  180.2873  180.2873  180.2873
cor(Delta$PricePremium,Delta$PriceRelative)
## [1] 0.9309232
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Delta)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Delta)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -427.00 -269.03 -221.56  -67.98 1429.15 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           840.35     423.33   1.985   0.0534 .
## PercentPremiumSeats   -19.29      28.69  -0.673   0.5048  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 551 on 44 degrees of freedom
## Multiple R-squared:  0.01018,    Adjusted R-squared:  -0.01232 
## F-statistic: 0.4523 on 1 and 44 DF,  p-value: 0.5048
Delta$PricePremium
##  [1]  173  204  243  237  231  406  364  596  497  337  467  527  757 2588
## [15] 2588 2765 2765 2765 2588  327  327  407  407  407  457  457  457  457
## [29]  457  379  467  362  362  181  181  354  262  262  670  378  308  308
## [43]  308  660  431  364
fitted(fit)
##       74       75       76       77       78       79       80       81 
## 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 446.5635 
##       98      152      153      154      155      185      186      187 
## 522.7747 560.5908 560.5908 560.5908 560.5908 569.8520 569.8520 569.8520 
##      188      189      190      281      282      283      284      285 
## 569.8520 569.8520 569.8520 599.1788 599.1788 599.1788 599.1788 599.1788 
##      286      287      288      289      290      291      292      293 
## 587.0236 587.0236 587.0236 599.1788 599.1788 599.1788 587.0236 599.1788 
##      294      295      296      297      298      299      300      301 
## 599.1788 593.0047 588.7600 588.7600 593.0047 593.0047 599.1788 593.0047 
##      302      303      304      305      306      307 
## 588.7600 588.7600 599.1788 593.0047 588.7600 599.1788
cor(Delta$PricePremium,Delta$PercentPremiumSeats)
## [1] -0.09712995

Jet Airlines

Analyse all about Jet Airlines:-

Jet <- airline[ which(airline$Airline=='Jet'),]
View(Jet)
summary(Jet)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 7   Min.   :2.500   Aug:16     
##  British  : 0   Boeing:54   1st Qu.:2.660   Jul:15     
##  Delta    : 0               Median :3.250   Oct:15     
##  Jet      :61               Mean   :4.144   Sep:15     
##  Singapore: 0               3rd Qu.:4.330              
##  Virgin   : 0               Max.   :9.500              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     : 0     Min.   :124.0   Min.   : 8.00   Min.   :30.00  
##  International:61     1st Qu.:124.0   1st Qu.: 8.00   1st Qu.:30.00  
##                       Median :138.0   Median :16.00   Median :30.00  
##                       Mean   :140.3   Mean   :15.66   Mean   :30.23  
##                       3rd Qu.:162.0   3rd Qu.:16.00   3rd Qu.:30.00  
##                       Max.   :162.0   Max.   :28.00   Max.   :32.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy  
##  Min.   :38.00   Min.   :17.00   Min.   :19.00   Min.   :108.0  
##  1st Qu.:40.00   1st Qu.:17.00   1st Qu.:21.00   1st Qu.:154.0  
##  Median :40.00   Median :17.00   Median :21.00   Median :201.0  
##  Mean   :39.77   Mean   :17.11   Mean   :20.77   Mean   :276.2  
##  3rd Qu.:40.00   3rd Qu.:17.00   3rd Qu.:21.00   3rd Qu.:354.0  
##  Max.   :40.00   Max.   :18.00   Max.   :21.00   Max.   :676.0  
##   PricePremium   PriceRelative      SeatsTotal  PitchDifference 
##  Min.   :228.0   Min.   :0.1200   Min.   :140   Min.   : 6.000  
##  1st Qu.:318.0   1st Qu.:0.4800   1st Qu.:140   1st Qu.:10.000  
##  Median :483.0   Median :0.8200   Median :166   Median :10.000  
##  Mean   :483.4   Mean   :0.9397   Mean   :156   Mean   : 9.541  
##  3rd Qu.:569.0   3rd Qu.:1.2900   3rd Qu.:170   3rd Qu.:10.000  
##  Max.   :931.0   Max.   :1.8900   Max.   :170   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :1.000   Min.   : 4.71      
##  1st Qu.:4.000   1st Qu.: 4.71      
##  Median :4.000   Median :11.43      
##  Mean   :3.656   Mean   :10.17      
##  3rd Qu.:4.000   3rd Qu.:11.43      
##  Max.   :4.000   Max.   :16.87

Check the all the means now all Jet aircrafts

mean(Jet$PriceEconomy)
## [1] 276.1639
mean(Jet$PricePremium)
## [1] 483.3607
mean(Jet$FlightDuration)
## [1] 4.143934
mean(Jet$PitchEconomy)
## [1] 30.22951
mean(Jet$PitchPremium)
## [1] 39.77049
mean(Jet$WidthEconomy)
## [1] 17.11475
mean(Jet$WidthPremium)
## [1] 20.77049
mean(Jet$PriceRelative)
## [1] 0.9396721
mean(Jet$PitchDifference)
## [1] 9.540984
mean(Jet$WidthDifference)
## [1] 3.655738

Now Analyse separately for Each Aircrafts in Jet Airlines i.e-Boeing and AirBus

Jeboeing <- Jet[ which(Jet$Aircraft=='Boeing'),]
View(Jeboeing)
summary(Jeboeing)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 0   Min.   :2.500   Aug:14     
##  British  : 0   Boeing:54   1st Qu.:2.660   Jul:14     
##  Delta    : 0               Median :3.160   Oct:13     
##  Jet      :54               Mean   :3.482   Sep:13     
##  Singapore: 0               3rd Qu.:4.160              
##  Virgin   : 0               Max.   :5.660              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :124.0   Min.   : 8.00   Min.   :30   
##  International:54     1st Qu.:124.0   1st Qu.: 8.00   1st Qu.:30   
##                       Median :131.0   Median :16.00   Median :30   
##                       Mean   :139.4   Mean   :14.96   Mean   :30   
##                       3rd Qu.:162.0   3rd Qu.:16.00   3rd Qu.:30   
##                       Max.   :162.0   Max.   :28.00   Max.   :30   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy    PricePremium  
##  Min.   :40    Min.   :17    Min.   :21    Min.   :108.0   Min.   :228.0  
##  1st Qu.:40    1st Qu.:17    1st Qu.:21    1st Qu.:154.0   1st Qu.:304.0  
##  Median :40    Median :17    Median :21    Median :187.0   Median :457.5  
##  Mean   :40    Mean   :17    Mean   :21    Mean   :243.9   Mean   :435.6  
##  3rd Qu.:40    3rd Qu.:17    3rd Qu.:21    3rd Qu.:323.5   3rd Qu.:531.5  
##  Max.   :40    Max.   :17    Max.   :21    Max.   :594.0   Max.   :696.0  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.1200   Min.   :140.0   Min.   :10      Min.   :4      
##  1st Qu.:0.5200   1st Qu.:140.0   1st Qu.:10      1st Qu.:4      
##  Median :0.9750   Median :153.0   Median :10      Median :4      
##  Mean   :0.9707   Mean   :154.4   Mean   :10      Mean   :4      
##  3rd Qu.:1.2975   3rd Qu.:170.0   3rd Qu.:10      3rd Qu.:4      
##  Max.   :1.8900   Max.   :170.0   Max.   :10      Max.   :4      
##  PercentPremiumSeats
##  Min.   : 4.710     
##  1st Qu.: 4.710     
##  Median :11.430     
##  Mean   : 9.871     
##  3rd Qu.:11.430     
##  Max.   :16.870
mean(Jeboeing$PriceEconomy)
## [1] 243.8519
mean(Jeboeing$PricePremium)
## [1] 435.6481
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Jeboeing$PriceEconomy,Jeboeing$TravelMonth,mean))
y2<-c(by(Jeboeing$PricePremium,Jeboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -153.31  -91.01  -17.58   89.20  345.21 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      317.78      64.65   4.915 9.26e-06 ***
## FlightDuration   -21.23      17.90  -1.186    0.241    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 126.1 on 52 degrees of freedom
## Multiple R-squared:  0.02634,    Adjusted R-squared:  0.007614 
## F-statistic: 1.407 on 1 and 52 DF,  p-value: 0.241
Jeboeing$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 167 167 167 139 149 197 211 139 118
## [18] 118 118 108 108 108 297 234 156 156 324 147 127 154 154 154 154 322
## [35] 594 201 148 148 187 187 187 187 245 234 172 172 172 293 281 295 380
## [52] 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 252.3948 252.3948 252.3948 252.3948 252.3948 252.3948 252.3948 252.3948 
##      379      380      381      382      383      384      385      386 
## 248.7858 248.7858 248.7858 248.7858 248.7858 229.4669 229.4669 231.1652 
##      387      388      389      390      391      392      393      394 
## 264.7079 264.7079 264.7079 261.3112 261.3112 261.3112 229.4669 248.7858 
##      395      396      397      398      399      400      401      402 
## 231.1652 229.4669 229.4669 264.7079 261.3112 225.8579 225.8579 225.8579 
##      403      404      405      440      441      442      443      444 
## 225.8579 248.7858 248.7858 197.6226 250.6964 250.6964 197.6226 197.6226 
##      445      446      447      448      449      450      451      452 
## 197.6226 197.6226 197.6226 250.6964 263.0095 263.0095 263.0095 250.6964 
##      453      454      455      456      457      458 
## 263.0095 263.0095 263.0095 263.0095 248.7858 263.0095
cor(Jeboeing$PriceEconomy,Jeboeing$FlightDuration)
## [1] -0.1622921
fit<-lm(PriceEconomy~SeatsEconomy,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -135.55  -96.55  -55.17   96.45  377.33 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -1.5746   137.1688  -0.011   0.9909  
## SeatsEconomy   1.7600     0.9762   1.803   0.0772 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 124 on 52 degrees of freedom
## Multiple R-squared:  0.05883,    Adjusted R-squared:  0.04073 
## F-statistic:  3.25 on 1 and 52 DF,  p-value: 0.0772
Jeboeing$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 167 167 167 139 149 197 211 139 118
## [18] 118 118 108 108 108 297 234 156 156 324 147 127 154 154 154 154 322
## [35] 594 201 148 148 187 187 187 187 245 234 172 172 172 293 281 295 380
## [52] 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 
##      379      380      381      382      383      384      385      386 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      387      388      389      390      391      392      393      394 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      395      396      397      398      399      400      401      402 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      403      404      405      440      441      442      443      444 
## 216.6692 216.6692 216.6692 283.5503 283.5503 283.5503 283.5503 283.5503 
##      445      446      447      448      449      450      451      452 
## 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 
##      453      454      455      456      457      458 
## 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503
cor(Jeboeing$PriceEconomy,Jeboeing$SeatsEconomy)
## [1] 0.2425531
fit<-lm(PriceEconomy~PriceRelative,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jeboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -150.289  -74.363    7.586   70.187  202.008 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     423.44      26.47  15.996  < 2e-16 ***
## PriceRelative  -185.00      24.33  -7.605 5.37e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 87.91 on 52 degrees of freedom
## Multiple R-squared:  0.5266, Adjusted R-squared:  0.5175 
## F-statistic: 57.84 on 1 and 52 DF,  p-value: 5.374e-10
Jeboeing$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 167 167 167 139 149 197 211 139 118
## [18] 118 118 108 108 108 297 234 156 156 324 147 127 154 154 154 154 322
## [35] 594 201 148 148 187 187 187 187 245 234 172 172 172 293 281 295 380
## [52] 380 505 510
fitted(fit)
##        90        91        92        93        94        95        96 
## 334.64053 334.64053 334.64053 334.64053 362.39103 362.39103 362.39103 
##        97       379       380       381       382       383       384 
## 375.34126  73.78582  73.78582  73.78582  77.48589 114.48656 120.03666 
##       385       386       387       388       389       390       391 
## 140.38702 184.78782 190.33792 190.33792 190.33792 218.08842 218.08842 
##       392       393       394       395       396       397       398 
## 218.08842 221.78849 227.33859 231.03866 231.03866 255.08909 273.58942 
##       399       400       401       402       403       404       405 
## 277.28949 286.53966 286.53966 286.53966 286.53966 330.94046 391.99156 
##       440       441       442       443       444       445       446 
## 107.08642 112.63652 112.63652 182.93779 182.93779 182.93779 182.93779 
##       447       448       449       450       451       452       453 
## 197.73806 225.48856 280.98956 280.98956 280.98956 303.18996 312.44013 
##       454       455       456       457       458 
## 316.14019 340.19063 340.19063 353.14086 401.24173
cor(Jeboeing$PriceEconomy,Jeboeing$PriceRelative)
## [1] -0.7256655
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -144.97  -98.97  -34.15   69.20  341.03 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          186.096     43.329   4.295 7.66e-05 ***
## PercentPremiumSeats    5.851      4.035   1.450    0.153    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 125.3 on 52 degrees of freedom
## Multiple R-squared:  0.03885,    Adjusted R-squared:  0.02037 
## F-statistic: 2.102 on 1 and 52 DF,  p-value: 0.1531
Jeboeing$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 167 167 167 139 149 197 211 139 118
## [18] 118 118 108 108 108 297 234 156 156 324 147 127 154 154 154 154 322
## [35] 594 201 148 148 187 187 187 187 245 234 172 172 172 293 281 295 380
## [52] 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 
##      379      380      381      382      383      384      385      386 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      387      388      389      390      391      392      393      394 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      395      396      397      398      399      400      401      402 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      403      404      405      440      441      442      443      444 
## 252.9704 252.9704 252.9704 213.6532 213.6532 213.6532 213.6532 213.6532 
##      445      446      447      448      449      450      451      452 
## 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 
##      453      454      455      456      457      458 
## 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532
cor(Jeboeing$PriceEconomy,Jeboeing$PercentPremiumSeats)
## [1] 0.1971151
fit<-lm(PricePremium~FlightDuration,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -195.25 -126.66   35.46   94.42  263.86 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      383.15      69.47   5.515 1.11e-06 ***
## FlightDuration    15.08      19.23   0.784    0.437    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 135.5 on 52 degrees of freedom
## Multiple R-squared:  0.01168,    Adjusted R-squared:  -0.00733 
## F-statistic: 0.6143 on 1 and 52 DF,  p-value: 0.4367
Jeboeing$PricePremium
##  [1] 524 524 524 524 616 616 616 616 483 483 483 398 398 520 534 318 267
## [18] 267 267 228 228 228 620 483 318 318 620 267 228 267 267 267 267 483
## [35] 696 545 397 397 430 430 430 430 545 483 304 304 304 483 451 464 550
## [52] 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 429.5815 429.5815 429.5815 429.5815 429.5815 429.5815 429.5815 429.5815 
##      379      380      381      382      383      384      385      386 
## 432.1444 432.1444 432.1444 432.1444 432.1444 445.8634 445.8634 444.6573 
##      387      388      389      390      391      392      393      394 
## 420.8376 420.8376 420.8376 423.2497 423.2497 423.2497 445.8634 432.1444 
##      395      396      397      398      399      400      401      402 
## 444.6573 445.8634 445.8634 420.8376 423.2497 448.4263 448.4263 448.4263 
##      403      404      405      440      441      442      443      444 
## 448.4263 432.1444 432.1444 468.4771 430.7876 430.7876 468.4771 468.4771 
##      445      446      447      448      449      450      451      452 
## 468.4771 468.4771 468.4771 430.7876 422.0436 422.0436 422.0436 430.7876 
##      453      454      455      456      457      458 
## 422.0436 422.0436 422.0436 422.0436 432.1444 422.0436
cor(Jeboeing$PricePremium,Jeboeing$FlightDuration)
## [1] 0.108057
fit<-lm(PriceEconomy~SeatsEconomy,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -135.55  -96.55  -55.17   96.45  377.33 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -1.5746   137.1688  -0.011   0.9909  
## SeatsEconomy   1.7600     0.9762   1.803   0.0772 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 124 on 52 degrees of freedom
## Multiple R-squared:  0.05883,    Adjusted R-squared:  0.04073 
## F-statistic:  3.25 on 1 and 52 DF,  p-value: 0.0772
Jeboeing$PricePremium
##  [1] 524 524 524 524 616 616 616 616 483 483 483 398 398 520 534 318 267
## [18] 267 267 228 228 228 620 483 318 318 620 267 228 267 267 267 267 483
## [35] 696 545 397 397 430 430 430 430 545 483 304 304 304 483 451 464 550
## [52] 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 241.3096 
##      379      380      381      382      383      384      385      386 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      387      388      389      390      391      392      393      394 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      395      396      397      398      399      400      401      402 
## 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 216.6692 
##      403      404      405      440      441      442      443      444 
## 216.6692 216.6692 216.6692 283.5503 283.5503 283.5503 283.5503 283.5503 
##      445      446      447      448      449      450      451      452 
## 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503 
##      453      454      455      456      457      458 
## 283.5503 283.5503 283.5503 283.5503 283.5503 283.5503
cor(Jeboeing$PricePremium,Jeboeing$SeatsEconomy)
## [1] 0.2681908
fit<-lm(PriceEconomy~SeatsPremium,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -142.20  -96.20  -22.70   65.55  343.80 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   152.208     41.138   3.700 0.000521 ***
## SeatsPremium    6.125      2.519   2.431 0.018530 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 121.1 on 52 degrees of freedom
## Multiple R-squared:  0.1021, Adjusted R-squared:  0.0848 
## F-statistic: 5.911 on 1 and 52 DF,  p-value: 0.01853
Jeboeing$PricePremium
##  [1] 524 524 524 524 616 616 616 616 483 483 483 398 398 520 534 318 267
## [18] 267 267 228 228 228 620 483 318 318 620 267 228 267 267 267 267 483
## [35] 696 545 397 397 430 430 430 430 545 483 304 304 304 483 451 464 550
## [52] 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 323.7004 323.7004 323.7004 323.7004 323.7004 323.7004 323.7004 323.7004 
##      379      380      381      382      383      384      385      386 
## 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 
##      387      388      389      390      391      392      393      394 
## 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 
##      395      396      397      398      399      400      401      402 
## 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 250.2034 
##      403      404      405      440      441      442      443      444 
## 250.2034 250.2034 250.2034 201.2055 201.2055 201.2055 201.2055 201.2055 
##      445      446      447      448      449      450      451      452 
## 201.2055 201.2055 201.2055 201.2055 201.2055 201.2055 201.2055 201.2055 
##      453      454      455      456      457      458 
## 201.2055 201.2055 201.2055 201.2055 201.2055 201.2055
cor(Jeboeing$PricePremium,Jeboeing$SeatsPremium)
## [1] 0.1909838
fit<-lm(PriceEconomy~PriceRelative,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jeboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -150.289  -74.363    7.586   70.187  202.008 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     423.44      26.47  15.996  < 2e-16 ***
## PriceRelative  -185.00      24.33  -7.605 5.37e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 87.91 on 52 degrees of freedom
## Multiple R-squared:  0.5266, Adjusted R-squared:  0.5175 
## F-statistic: 57.84 on 1 and 52 DF,  p-value: 5.374e-10
Jeboeing$PricePremium
##  [1] 524 524 524 524 616 616 616 616 483 483 483 398 398 520 534 318 267
## [18] 267 267 228 228 228 620 483 318 318 620 267 228 267 267 267 267 483
## [35] 696 545 397 397 430 430 430 430 545 483 304 304 304 483 451 464 550
## [52] 550 696 569
fitted(fit)
##        90        91        92        93        94        95        96 
## 334.64053 334.64053 334.64053 334.64053 362.39103 362.39103 362.39103 
##        97       379       380       381       382       383       384 
## 375.34126  73.78582  73.78582  73.78582  77.48589 114.48656 120.03666 
##       385       386       387       388       389       390       391 
## 140.38702 184.78782 190.33792 190.33792 190.33792 218.08842 218.08842 
##       392       393       394       395       396       397       398 
## 218.08842 221.78849 227.33859 231.03866 231.03866 255.08909 273.58942 
##       399       400       401       402       403       404       405 
## 277.28949 286.53966 286.53966 286.53966 286.53966 330.94046 391.99156 
##       440       441       442       443       444       445       446 
## 107.08642 112.63652 112.63652 182.93779 182.93779 182.93779 182.93779 
##       447       448       449       450       451       452       453 
## 197.73806 225.48856 280.98956 280.98956 280.98956 303.18996 312.44013 
##       454       455       456       457       458 
## 316.14019 340.19063 340.19063 353.14086 401.24173
cor(Jeboeing$PricePremium,Jeboeing$PriceRelative)
## [1] -0.2920736
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jeboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jeboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -144.97  -98.97  -34.15   69.20  341.03 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          186.096     43.329   4.295 7.66e-05 ***
## PercentPremiumSeats    5.851      4.035   1.450    0.153    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 125.3 on 52 degrees of freedom
## Multiple R-squared:  0.03885,    Adjusted R-squared:  0.02037 
## F-statistic: 2.102 on 1 and 52 DF,  p-value: 0.1531
Jeboeing$PricePremium
##  [1] 524 524 524 524 616 616 616 616 483 483 483 398 398 520 534 318 267
## [18] 267 267 228 228 228 620 483 318 318 620 267 228 267 267 267 267 483
## [35] 696 545 397 397 430 430 430 430 545 483 304 304 304 483 451 464 550
## [52] 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 284.7986 
##      379      380      381      382      383      384      385      386 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      387      388      389      390      391      392      393      394 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      395      396      397      398      399      400      401      402 
## 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 252.9704 
##      403      404      405      440      441      442      443      444 
## 252.9704 252.9704 252.9704 213.6532 213.6532 213.6532 213.6532 213.6532 
##      445      446      447      448      449      450      451      452 
## 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532 
##      453      454      455      456      457      458 
## 213.6532 213.6532 213.6532 213.6532 213.6532 213.6532
cor(Jeboeing$PricePremium,Jeboeing$PercentPremiumSeats)
## [1] 0.08490088
Jeairbus <-Jet[ which(Jet$Aircraft=='AirBus'),]
View(Jeairbus)
summary(Jeairbus)
##       Airline    Aircraft FlightDuration  TravelMonth      IsInternational
##  AirFrance:0   AirBus:7   Min.   :8.910   Aug:2       Domestic     :0     
##  British  :0   Boeing:0   1st Qu.:8.910   Jul:1       International:7     
##  Delta    :0              Median :9.500   Oct:2                           
##  Jet      :7              Mean   :9.247   Sep:2                           
##  Singapore:0              3rd Qu.:9.500                                   
##  Virgin   :0              Max.   :9.500                                   
##   SeatsEconomy  SeatsPremium  PitchEconomy  PitchPremium  WidthEconomy
##  Min.   :147   Min.   :21    Min.   :32    Min.   :38    Min.   :18   
##  1st Qu.:147   1st Qu.:21    1st Qu.:32    1st Qu.:38    1st Qu.:18   
##  Median :147   Median :21    Median :32    Median :38    Median :18   
##  Mean   :147   Mean   :21    Mean   :32    Mean   :38    Mean   :18   
##  3rd Qu.:147   3rd Qu.:21    3rd Qu.:32    3rd Qu.:38    3rd Qu.:18   
##  Max.   :147   Max.   :21    Max.   :32    Max.   :38    Max.   :18   
##   WidthPremium  PriceEconomy    PricePremium   PriceRelative 
##  Min.   :19    Min.   :336.0   Min.   :789.0   Min.   :0.38  
##  1st Qu.:19    1st Qu.:445.5   1st Qu.:815.0   1st Qu.:0.41  
##  Median :19    Median :557.0   Median :841.0   Median :0.42  
##  Mean   :19    Mean   :525.4   Mean   :851.4   Mean   :0.70  
##  3rd Qu.:19    3rd Qu.:609.0   3rd Qu.:884.5   3rd Qu.:0.89  
##  Max.   :19    Max.   :676.0   Max.   :931.0   Max.   :1.50  
##    SeatsTotal  PitchDifference WidthDifference PercentPremiumSeats
##  Min.   :168   Min.   :6       Min.   :1       Min.   :12.5       
##  1st Qu.:168   1st Qu.:6       1st Qu.:1       1st Qu.:12.5       
##  Median :168   Median :6       Median :1       Median :12.5       
##  Mean   :168   Mean   :6       Mean   :1       Mean   :12.5       
##  3rd Qu.:168   3rd Qu.:6       3rd Qu.:1       3rd Qu.:12.5       
##  Max.   :168   Max.   :6       Max.   :1       Max.   :12.5
mean(Jeairbus$PriceEconomy)
## [1] 525.4286
mean(Jeairbus$PricePremium)
## [1] 851.4286
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Jeairbus$PriceEconomy,Jeairbus$TravelMonth,mean))
y4<-c(by(Jeairbus$PricePremium,Jeairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Jeairbus)
## 
## Residuals:
##     308     309     310     311     312     313     314 
## -136.00  -43.00  -10.00  -39.67  -39.67  189.00   79.33 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)
## (Intercept)      2479.3     1371.9   1.807    0.131
## FlightDuration   -211.3      148.3  -1.425    0.213
## 
## Residual standard error: 114.5 on 5 degrees of freedom
## Multiple R-squared:  0.2888, Adjusted R-squared:  0.1466 
## F-statistic: 2.031 on 1 and 5 DF,  p-value: 0.2135
Jeairbus$PriceEconomy
## [1] 336 429 462 557 557 661 676
fitted(fit)
##      308      309      310      311      312      313      314 
## 472.0000 472.0000 472.0000 596.6667 596.6667 472.0000 596.6667
cor(Jeairbus$PriceEconomy,Jeairbus$FlightDuration)
## [1] -0.5374146
fit<-lm(PriceEconomy~SeatsEconomy,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jeairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -189.43  -79.93   31.57   83.57  150.57 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    525.43      46.87   11.21 3.01e-05 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 124 on 6 degrees of freedom
Jeairbus$PriceEconomy
## [1] 336 429 462 557 557 661 676
fitted(fit)
##      308      309      310      311      312      313      314 
## 525.4286 525.4286 525.4286 525.4286 525.4286 525.4286 525.4286
cor(Jeairbus$PriceEconomy,Jeairbus$SeatsEconomy)
## Warning in cor(Jeairbus$PriceEconomy, Jeairbus$SeatsEconomy): the standard
## deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jeairbus)
## 
## Residuals:
##    308    309    310    311    312    313    314 
##  27.72 -25.86 -30.86 -44.43 -44.43  54.14  63.71 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     715.43      40.00  17.885    1e-05 ***
## PriceRelative  -271.43      49.88  -5.441  0.00285 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 51.63 on 5 degrees of freedom
## Multiple R-squared:  0.8555, Adjusted R-squared:  0.8266 
## F-statistic: 29.61 on 1 and 5 DF,  p-value: 0.002846
Jeairbus$PriceEconomy
## [1] 336 429 462 557 557 661 676
fitted(fit)
##      308      309      310      311      312      313      314 
## 308.2814 454.8558 492.8565 601.4301 601.4301 606.8587 612.2874
cor(Jeairbus$PriceEconomy,Jeairbus$PriceRelative)
## [1] -0.924947
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jeairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -189.43  -79.93   31.57   83.57  150.57 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           525.43      46.87   11.21 3.01e-05 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 124 on 6 degrees of freedom
Jeairbus$PriceEconomy
## [1] 336 429 462 557 557 661 676
fitted(fit)
##      308      309      310      311      312      313      314 
## 525.4286 525.4286 525.4286 525.4286 525.4286 525.4286 525.4286
fit<-lm(PricePremium~FlightDuration,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Jeairbus)
## 
## Residuals:
##    308    309    310    311    312    313    314 
## -21.75 -21.75 -21.75 -47.33 -47.33  65.25  94.67 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)
## (Intercept)      437.40     740.60   0.591     0.58
## FlightDuration    44.77      80.05   0.559     0.60
## 
## Residual standard error: 61.84 on 5 degrees of freedom
## Multiple R-squared:  0.05889,    Adjusted R-squared:  -0.1293 
## F-statistic: 0.3128 on 1 and 5 DF,  p-value: 0.6001
Jeairbus$PricePremium
## [1] 841 841 841 789 789 928 931
fitted(fit)
##      308      309      310      311      312      313      314 
## 862.7500 862.7500 862.7500 836.3333 836.3333 862.7500 836.3333
cor(Jeairbus$PricePremium,Jeairbus$FlightDuration)
## [1] 0.242663
fit<-lm(PricePremium~SeatsEconomy,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = Jeairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -62.43 -36.43 -10.43  33.07  79.57 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    851.43      21.99   38.71 1.98e-08 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 58.19 on 6 degrees of freedom
Jeairbus$PricePremium
## [1] 841 841 841 789 789 928 931
fitted(fit)
##      308      309      310      311      312      313      314 
## 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286
cor(Jeairbus$PricePremium,Jeairbus$SeatsEconomy)
## Warning in cor(Jeairbus$PricePremium, Jeairbus$SeatsEconomy): the standard
## deviation is zero
## [1] NA
fit<-lm(PricePremium~SeatsPremium,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = Jeairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -62.43 -36.43 -10.43  33.07  79.57 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    851.43      21.99   38.71 1.98e-08 ***
## SeatsPremium       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 58.19 on 6 degrees of freedom
Jeairbus$PricePremium
## [1] 841 841 841 789 789 928 931
fitted(fit)
##      308      309      310      311      312      313      314 
## 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286
cor(Jeairbus$PricePremium,Jeairbus$SeatsPremium)
## Warning in cor(Jeairbus$PricePremium, Jeairbus$SeatsPremium): the standard
## deviation is zero
## [1] NA
fit<-lm(PricePremium~PriceRelative,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = Jeairbus)
## 
## Residuals:
##     308     309     310     311     312     313     314 
##   8.825  -4.171  -7.541 -69.167 -69.167  69.351  71.870 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     868.28      48.63  17.856 1.01e-05 ***
## PriceRelative   -24.07      60.64  -0.397    0.708    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 62.76 on 5 degrees of freedom
## Multiple R-squared:  0.03054,    Adjusted R-squared:  -0.1634 
## F-statistic: 0.1575 on 1 and 5 DF,  p-value: 0.7078
Jeairbus$PricePremium
## [1] 841 841 841 789 789 928 931
fitted(fit)
##      308      309      310      311      312      313      314 
## 832.1754 845.1713 848.5406 858.1672 858.1672 858.6485 859.1298
cor(Jeairbus$PricePremium,Jeairbus$PriceRelative)
## [1] -0.1747558
fit<-lm(PricePremium~PercentPremiumSeats,data = Jeairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = Jeairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -62.43 -36.43 -10.43  33.07  79.57 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           851.43      21.99   38.71 1.98e-08 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 58.19 on 6 degrees of freedom
Jeairbus$PricePremium
## [1] 841 841 841 789 789 928 931
fitted(fit)
##      308      309      310      311      312      313      314 
## 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286 851.4286
cor(Jeairbus$PricePremium,Jeairbus$PercentPremiumSeats)
## Warning in cor(Jeairbus$PricePremium, Jeairbus$PercentPremiumSeats): the
## standard deviation is zero
## [1] NA

Now We Should Analyse the international aircrafts of Jet Airlines

Jeint <- Jet[ which(Jet$IsInternational=='International'),]
View(Jeint)
summary(Jeint)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 7   Min.   :2.500   Aug:16     
##  British  : 0   Boeing:54   1st Qu.:2.660   Jul:15     
##  Delta    : 0               Median :3.250   Oct:15     
##  Jet      :61               Mean   :4.144   Sep:15     
##  Singapore: 0               3rd Qu.:4.330              
##  Virgin   : 0               Max.   :9.500              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     : 0     Min.   :124.0   Min.   : 8.00   Min.   :30.00  
##  International:61     1st Qu.:124.0   1st Qu.: 8.00   1st Qu.:30.00  
##                       Median :138.0   Median :16.00   Median :30.00  
##                       Mean   :140.3   Mean   :15.66   Mean   :30.23  
##                       3rd Qu.:162.0   3rd Qu.:16.00   3rd Qu.:30.00  
##                       Max.   :162.0   Max.   :28.00   Max.   :32.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy  
##  Min.   :38.00   Min.   :17.00   Min.   :19.00   Min.   :108.0  
##  1st Qu.:40.00   1st Qu.:17.00   1st Qu.:21.00   1st Qu.:154.0  
##  Median :40.00   Median :17.00   Median :21.00   Median :201.0  
##  Mean   :39.77   Mean   :17.11   Mean   :20.77   Mean   :276.2  
##  3rd Qu.:40.00   3rd Qu.:17.00   3rd Qu.:21.00   3rd Qu.:354.0  
##  Max.   :40.00   Max.   :18.00   Max.   :21.00   Max.   :676.0  
##   PricePremium   PriceRelative      SeatsTotal  PitchDifference 
##  Min.   :228.0   Min.   :0.1200   Min.   :140   Min.   : 6.000  
##  1st Qu.:318.0   1st Qu.:0.4800   1st Qu.:140   1st Qu.:10.000  
##  Median :483.0   Median :0.8200   Median :166   Median :10.000  
##  Mean   :483.4   Mean   :0.9397   Mean   :156   Mean   : 9.541  
##  3rd Qu.:569.0   3rd Qu.:1.2900   3rd Qu.:170   3rd Qu.:10.000  
##  Max.   :931.0   Max.   :1.8900   Max.   :170   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :1.000   Min.   : 4.71      
##  1st Qu.:4.000   1st Qu.: 4.71      
##  Median :4.000   Median :11.43      
##  Mean   :3.656   Mean   :10.17      
##  3rd Qu.:4.000   3rd Qu.:11.43      
##  Max.   :4.000   Max.   :16.87
mean(Jeint$PriceEconomy)
## [1] 276.1639
mean(Jeint$PricePremium)
## [1] 483.3607
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Jeint$PriceEconomy,Jeint$TravelMonth,mean))
y2<-c(by(Jeint$PricePremium,Jeint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -141.72 -116.72  -65.72  114.72  348.82 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     132.512     39.881   3.323 0.001535 ** 
## FlightDuration   34.666      8.627   4.018 0.000168 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 138.1 on 59 degrees of freedom
## Multiple R-squared:  0.2149, Adjusted R-squared:  0.2016 
## F-statistic: 16.15 on 1 and 59 DF,  p-value: 0.0001684
Jeint$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 
##      308      309      310      311      312      313      314      379 
## 461.8353 461.8353 461.8353 441.3826 441.3826 461.8353 441.3826 245.1751 
##      380      381      382      383      384      385      386      387 
## 245.1751 245.1751 245.1751 245.1751 276.7209 276.7209 273.9476 219.1759 
##      388      389      390      391      392      393      394      395 
## 219.1759 219.1759 224.7224 224.7224 224.7224 276.7209 245.1751 273.9476 
##      396      397      398      399      400      401      402      403 
## 276.7209 276.7209 219.1759 224.7224 282.6140 282.6140 282.6140 282.6140 
##      404      405      440      441      442      443      444      445 
## 245.1751 245.1751 328.7193 242.0552 242.0552 328.7193 328.7193 328.7193 
##      446      447      448      449      450      451      452      453 
## 328.7193 328.7193 242.0552 221.9492 221.9492 221.9492 242.0552 221.9492 
##      454      455      456      457      458 
## 221.9492 221.9492 221.9492 245.1751 221.9492
cor(Jeint$PriceEconomy,Jeint$FlightDuration)
## [1] 0.4635422
fit<-lm(PriceEconomy~SeatsEconomy,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -182.87 -117.02  -68.02   83.67  382.97 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -77.750    165.094  -0.471    0.639  
## SeatsEconomy    2.522      1.169   2.158    0.035 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150 on 59 degrees of freedom
## Multiple R-squared:  0.07318,    Adjusted R-squared:  0.05747 
## F-statistic: 4.659 on 1 and 59 DF,  p-value: 0.03498
Jeint$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 
##      308      309      310      311      312      313      314      379 
## 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 235.0208 
##      380      381      382      383      384      385      386      387 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      388      389      390      391      392      393      394      395 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      396      397      398      399      400      401      402      403 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      404      405      440      441      442      443      444      445 
## 235.0208 235.0208 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      446      447      448      449      450      451      452      453 
## 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      454      455      456      457      458 
## 330.8699 330.8699 330.8699 330.8699 330.8699
cor(Jeint$PriceEconomy,Jeint$SeatsEconomy)
## [1] 0.2705179
fit<-lm(PriceEconomy~PriceRelative,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -181.79  -88.34  -10.62   64.69  277.84 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     480.99      31.05  15.491  < 2e-16 ***
## PriceRelative  -217.97      29.31  -7.436 4.93e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112 on 59 degrees of freedom
## Multiple R-squared:  0.4838, Adjusted R-squared:  0.4751 
## F-statistic:  55.3 on 1 and 59 DF,  p-value: 4.929e-10
Jeint$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##        90        91        92        93        94        95        96 
## 376.36087 376.36087 376.36087 376.36087 409.05708 409.05708 409.05708 
##        97       308       309       310       311       312       313 
## 424.31532 154.02659 271.73297 302.24944 389.43935 389.43935 393.79885 
##       314       379       380       381       382       383       384 
## 398.15835  69.01642  69.01642  69.01642  73.37592 116.97088 123.51012 
##       385       386       387       388       389       390       391 
## 147.48735 199.80129 206.34054 206.34054 206.34054 239.03675 239.03675 
##       392       393       394       395       396       397       398 
## 239.03675 243.39625 249.93549 254.29499 254.29499 282.63171 304.42919 
##       399       400       401       402       403       404       405 
## 308.78868 319.68742 319.68742 319.68742 319.68742 372.00137 443.93305 
##       440       441       442       443       444       445       446 
## 108.25188 114.79113 114.79113 197.62155 197.62155 197.62155 197.62155 
##       447       448       449       450       451       452       453 
## 215.05953 247.75575 313.14818 313.14818 313.14818 339.30515 350.20389 
##       454       455       456       457       458 
## 354.56339 382.90011 382.90011 398.15835 454.83179
cor(Jeint$PriceEconomy,Jeint$PriceRelative)
## [1] -0.6955696
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -180.93 -132.93  -33.66   74.34  376.20 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           172.81      51.82   3.335  0.00148 **
## PercentPremiumSeats    10.16       4.73   2.148  0.03586 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150.1 on 59 degrees of freedom
## Multiple R-squared:  0.07251,    Adjusted R-squared:  0.05679 
## F-statistic: 4.612 on 1 and 59 DF,  p-value: 0.03586
Jeint$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 
##      308      309      310      311      312      313      314      379 
## 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 288.9327 
##      380      381      382      383      384      385      386      387 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      388      389      390      391      392      393      394      395 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      396      397      398      399      400      401      402      403 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      404      405      440      441      442      443      444      445 
## 288.9327 288.9327 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      446      447      448      449      450      451      452      453 
## 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      454      455      456      457      458 
## 220.6638 220.6638 220.6638 220.6638 220.6638
cor(Jeint$PriceEconomy,Jeint$PercentPremiumSeats)
## [1] 0.2692723
fit<-lm(PricePremium~FlightDuration,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -227.71 -116.06   30.86  105.55  267.18 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     230.535     39.510   5.835 2.43e-07 ***
## FlightDuration   61.011      8.546   7.139 1.58e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 136.8 on 59 degrees of freedom
## Multiple R-squared:  0.4634, Adjusted R-squared:  0.4544 
## F-statistic: 50.96 on 1 and 59 DF,  p-value: 1.575e-09
Jeint$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 
##      308      309      310      311      312      313      314      379 
## 810.1396 810.1396 810.1396 774.1431 774.1431 810.1396 774.1431 428.8208 
##      380      381      382      383      384      385      386      387 
## 428.8208 428.8208 428.8208 428.8208 484.3408 484.3408 479.4600 383.0626 
##      388      389      390      391      392      393      394      395 
## 383.0626 383.0626 392.8243 392.8243 392.8243 484.3408 428.8208 479.4600 
##      396      397      398      399      400      401      402      403 
## 484.3408 484.3408 383.0626 392.8243 494.7127 494.7127 494.7127 494.7127 
##      404      405      440      441      442      443      444      445 
## 428.8208 428.8208 575.8573 423.3298 423.3298 575.8573 575.8573 575.8573 
##      446      447      448      449      450      451      452      453 
## 575.8573 575.8573 423.3298 387.9435 387.9435 387.9435 423.3298 387.9435 
##      454      455      456      457      458 
## 387.9435 387.9435 387.9435 428.8208 387.9435
cor(Jeint$PricePremium,Jeint$FlightDuration)
## [1] 0.6807696
fit<-lm(PriceEconomy~SeatsEconomy,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -182.87 -117.02  -68.02   83.67  382.97 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -77.750    165.094  -0.471    0.639  
## SeatsEconomy    2.522      1.169   2.158    0.035 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150 on 59 degrees of freedom
## Multiple R-squared:  0.07318,    Adjusted R-squared:  0.05747 
## F-statistic: 4.659 on 1 and 59 DF,  p-value: 0.03498
Jeint$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 
##      308      309      310      311      312      313      314      379 
## 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 235.0208 
##      380      381      382      383      384      385      386      387 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      388      389      390      391      392      393      394      395 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      396      397      398      399      400      401      402      403 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      404      405      440      441      442      443      444      445 
## 235.0208 235.0208 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      446      447      448      449      450      451      452      453 
## 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      454      455      456      457      458 
## 330.8699 330.8699 330.8699 330.8699 330.8699
cor(Jeint$PricePremium,Jeint$SeatsEconomy)
## [1] 0.2874964
fit<-lm(PriceEconomy~SeatsPremium,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -171.51 -123.51  -29.65   67.69  347.82 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   123.782     47.797   2.590  0.01208 * 
## SeatsPremium    9.733      2.823   3.448  0.00105 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 142.2 on 59 degrees of freedom
## Multiple R-squared:  0.1677, Adjusted R-squared:  0.1536 
## F-statistic: 11.89 on 1 and 59 DF,  p-value: 0.001048
Jeint$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 
##      308      309      310      311      312      313      314      379 
## 328.1813 328.1813 328.1813 328.1813 328.1813 328.1813 328.1813 279.5147 
##      380      381      382      383      384      385      386      387 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      388      389      390      391      392      393      394      395 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      396      397      398      399      400      401      402      403 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      404      405      440      441      442      443      444      445 
## 279.5147 279.5147 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 
##      446      447      448      449      450      451      452      453 
## 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 
##      454      455      456      457      458 
## 201.6483 201.6483 201.6483 201.6483 201.6483
cor(Jeint$PricePremium,Jeint$SeatsPremium)
## [1] 0.340239
fit<-lm(PriceEconomy~PriceRelative,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -181.79  -88.34  -10.62   64.69  277.84 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     480.99      31.05  15.491  < 2e-16 ***
## PriceRelative  -217.97      29.31  -7.436 4.93e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112 on 59 degrees of freedom
## Multiple R-squared:  0.4838, Adjusted R-squared:  0.4751 
## F-statistic:  55.3 on 1 and 59 DF,  p-value: 4.929e-10
Jeint$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##        90        91        92        93        94        95        96 
## 376.36087 376.36087 376.36087 376.36087 409.05708 409.05708 409.05708 
##        97       308       309       310       311       312       313 
## 424.31532 154.02659 271.73297 302.24944 389.43935 389.43935 393.79885 
##       314       379       380       381       382       383       384 
## 398.15835  69.01642  69.01642  69.01642  73.37592 116.97088 123.51012 
##       385       386       387       388       389       390       391 
## 147.48735 199.80129 206.34054 206.34054 206.34054 239.03675 239.03675 
##       392       393       394       395       396       397       398 
## 239.03675 243.39625 249.93549 254.29499 254.29499 282.63171 304.42919 
##       399       400       401       402       403       404       405 
## 308.78868 319.68742 319.68742 319.68742 319.68742 372.00137 443.93305 
##       440       441       442       443       444       445       446 
## 108.25188 114.79113 114.79113 197.62155 197.62155 197.62155 197.62155 
##       447       448       449       450       451       452       453 
## 215.05953 247.75575 313.14818 313.14818 313.14818 339.30515 350.20389 
##       454       455       456       457       458 
## 354.56339 382.90011 382.90011 398.15835 454.83179
cor(Jeint$PricePremium,Jeint$PriceRelative)
## [1] -0.3214004
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jeint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jeint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -180.93 -132.93  -33.66   74.34  376.20 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           172.81      51.82   3.335  0.00148 **
## PercentPremiumSeats    10.16       4.73   2.148  0.03586 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150.1 on 59 degrees of freedom
## Multiple R-squared:  0.07251,    Adjusted R-squared:  0.05679 
## F-statistic: 4.612 on 1 and 59 DF,  p-value: 0.03586
Jeint$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 
##      308      309      310      311      312      313      314      379 
## 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 288.9327 
##      380      381      382      383      384      385      386      387 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      388      389      390      391      392      393      394      395 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      396      397      398      399      400      401      402      403 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      404      405      440      441      442      443      444      445 
## 288.9327 288.9327 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      446      447      448      449      450      451      452      453 
## 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      454      455      456      457      458 
## 220.6638 220.6638 220.6638 220.6638 220.6638
cor(Jeint$PricePremium,Jeint$PercentPremiumSeats)
## [1] 0.2057525

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Jeboeing$PriceEconomy,Jeboeing$TravelMonth,mean))
y2<-c(by(Jeboeing$PricePremium,Jeboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(Jeairbus$PriceEconomy,Jeairbus$TravelMonth,mean))
y4<-c(by(Jeairbus$PricePremium,Jeairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of Jet Airlines

mean(Jet$PriceEconomy)
## [1] 276.1639
mean(Jet$PricePremium)
## [1] 483.3607
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Jet$PriceEconomy,Jet$TravelMonth,mean))
y2<-c(by(Jet$PricePremium,Jet$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -141.72 -116.72  -65.72  114.72  348.82 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     132.512     39.881   3.323 0.001535 ** 
## FlightDuration   34.666      8.627   4.018 0.000168 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 138.1 on 59 degrees of freedom
## Multiple R-squared:  0.2149, Adjusted R-squared:  0.2016 
## F-statistic: 16.15 on 1 and 59 DF,  p-value: 0.0001684
Jet$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 239.2820 
##      308      309      310      311      312      313      314      379 
## 461.8353 461.8353 461.8353 441.3826 441.3826 461.8353 441.3826 245.1751 
##      380      381      382      383      384      385      386      387 
## 245.1751 245.1751 245.1751 245.1751 276.7209 276.7209 273.9476 219.1759 
##      388      389      390      391      392      393      394      395 
## 219.1759 219.1759 224.7224 224.7224 224.7224 276.7209 245.1751 273.9476 
##      396      397      398      399      400      401      402      403 
## 276.7209 276.7209 219.1759 224.7224 282.6140 282.6140 282.6140 282.6140 
##      404      405      440      441      442      443      444      445 
## 245.1751 245.1751 328.7193 242.0552 242.0552 328.7193 328.7193 328.7193 
##      446      447      448      449      450      451      452      453 
## 328.7193 328.7193 242.0552 221.9492 221.9492 221.9492 242.0552 221.9492 
##      454      455      456      457      458 
## 221.9492 221.9492 221.9492 245.1751 221.9492
cor(Jet$PriceEconomy,Jet$FlightDuration)
## [1] 0.4635422
fit<-lm(PriceEconomy~SeatsEconomy,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -182.87 -117.02  -68.02   83.67  382.97 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -77.750    165.094  -0.471    0.639  
## SeatsEconomy    2.522      1.169   2.158    0.035 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150 on 59 degrees of freedom
## Multiple R-squared:  0.07318,    Adjusted R-squared:  0.05747 
## F-statistic: 4.659 on 1 and 59 DF,  p-value: 0.03498
Jet$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 
##      308      309      310      311      312      313      314      379 
## 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 235.0208 
##      380      381      382      383      384      385      386      387 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      388      389      390      391      392      393      394      395 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      396      397      398      399      400      401      402      403 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      404      405      440      441      442      443      444      445 
## 235.0208 235.0208 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      446      447      448      449      450      451      452      453 
## 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      454      455      456      457      458 
## 330.8699 330.8699 330.8699 330.8699 330.8699
cor(Jet$PriceEconomy,Jet$SeatsEconomy)
## [1] 0.2705179
fit<-lm(PriceEconomy~PriceRelative,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -181.79  -88.34  -10.62   64.69  277.84 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     480.99      31.05  15.491  < 2e-16 ***
## PriceRelative  -217.97      29.31  -7.436 4.93e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112 on 59 degrees of freedom
## Multiple R-squared:  0.4838, Adjusted R-squared:  0.4751 
## F-statistic:  55.3 on 1 and 59 DF,  p-value: 4.929e-10
Jet$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##        90        91        92        93        94        95        96 
## 376.36087 376.36087 376.36087 376.36087 409.05708 409.05708 409.05708 
##        97       308       309       310       311       312       313 
## 424.31532 154.02659 271.73297 302.24944 389.43935 389.43935 393.79885 
##       314       379       380       381       382       383       384 
## 398.15835  69.01642  69.01642  69.01642  73.37592 116.97088 123.51012 
##       385       386       387       388       389       390       391 
## 147.48735 199.80129 206.34054 206.34054 206.34054 239.03675 239.03675 
##       392       393       394       395       396       397       398 
## 239.03675 243.39625 249.93549 254.29499 254.29499 282.63171 304.42919 
##       399       400       401       402       403       404       405 
## 308.78868 319.68742 319.68742 319.68742 319.68742 372.00137 443.93305 
##       440       441       442       443       444       445       446 
## 108.25188 114.79113 114.79113 197.62155 197.62155 197.62155 197.62155 
##       447       448       449       450       451       452       453 
## 215.05953 247.75575 313.14818 313.14818 313.14818 339.30515 350.20389 
##       454       455       456       457       458 
## 354.56339 382.90011 382.90011 398.15835 454.83179
cor(Jet$PriceEconomy,Jet$PriceRelative)
## [1] -0.6955696
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -180.93 -132.93  -33.66   74.34  376.20 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           172.81      51.82   3.335  0.00148 **
## PercentPremiumSeats    10.16       4.73   2.148  0.03586 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150.1 on 59 degrees of freedom
## Multiple R-squared:  0.07251,    Adjusted R-squared:  0.05679 
## F-statistic: 4.612 on 1 and 59 DF,  p-value: 0.03586
Jet$PriceEconomy
##  [1] 354 354 354 354 464 464 464 489 336 429 462 557 557 661 676 167 167
## [18] 167 139 149 197 211 139 118 118 118 108 108 108 297 234 156 156 324
## [35] 147 127 154 154 154 154 322 594 201 148 148 187 187 187 187 245 234
## [52] 172 172 172 293 281 295 380 380 505 510
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 
##      308      309      310      311      312      313      314      379 
## 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 288.9327 
##      380      381      382      383      384      385      386      387 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      388      389      390      391      392      393      394      395 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      396      397      398      399      400      401      402      403 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      404      405      440      441      442      443      444      445 
## 288.9327 288.9327 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      446      447      448      449      450      451      452      453 
## 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      454      455      456      457      458 
## 220.6638 220.6638 220.6638 220.6638 220.6638
cor(Jet$PriceEconomy,Jet$PercentPremiumSeats)
## [1] 0.2692723
fit<-lm(PricePremium~FlightDuration,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -227.71 -116.06   30.86  105.55  267.18 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     230.535     39.510   5.835 2.43e-07 ***
## FlightDuration   61.011      8.546   7.139 1.58e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 136.8 on 59 degrees of freedom
## Multiple R-squared:  0.4634, Adjusted R-squared:  0.4544 
## F-statistic: 50.96 on 1 and 59 DF,  p-value: 1.575e-09
Jet$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 418.4490 
##      308      309      310      311      312      313      314      379 
## 810.1396 810.1396 810.1396 774.1431 774.1431 810.1396 774.1431 428.8208 
##      380      381      382      383      384      385      386      387 
## 428.8208 428.8208 428.8208 428.8208 484.3408 484.3408 479.4600 383.0626 
##      388      389      390      391      392      393      394      395 
## 383.0626 383.0626 392.8243 392.8243 392.8243 484.3408 428.8208 479.4600 
##      396      397      398      399      400      401      402      403 
## 484.3408 484.3408 383.0626 392.8243 494.7127 494.7127 494.7127 494.7127 
##      404      405      440      441      442      443      444      445 
## 428.8208 428.8208 575.8573 423.3298 423.3298 575.8573 575.8573 575.8573 
##      446      447      448      449      450      451      452      453 
## 575.8573 575.8573 423.3298 387.9435 387.9435 387.9435 423.3298 387.9435 
##      454      455      456      457      458 
## 387.9435 387.9435 387.9435 428.8208 387.9435
cor(Jet$PricePremium,Jet$FlightDuration)
## [1] 0.6807696
fit<-lm(PriceEconomy~SeatsEconomy,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -182.87 -117.02  -68.02   83.67  382.97 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -77.750    165.094  -0.471    0.639  
## SeatsEconomy    2.522      1.169   2.158    0.035 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150 on 59 degrees of freedom
## Multiple R-squared:  0.07318,    Adjusted R-squared:  0.05747 
## F-statistic: 4.659 on 1 and 59 DF,  p-value: 0.03498
Jet$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 270.3336 
##      308      309      310      311      312      313      314      379 
## 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 293.0347 235.0208 
##      380      381      382      383      384      385      386      387 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      388      389      390      391      392      393      394      395 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      396      397      398      399      400      401      402      403 
## 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 235.0208 
##      404      405      440      441      442      443      444      445 
## 235.0208 235.0208 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      446      447      448      449      450      451      452      453 
## 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 330.8699 
##      454      455      456      457      458 
## 330.8699 330.8699 330.8699 330.8699 330.8699
cor(Jet$PricePremium,Jet$SeatsEconomy)
## [1] 0.2874964
fit<-lm(PriceEconomy~SeatsPremium,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -171.51 -123.51  -29.65   67.69  347.82 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   123.782     47.797   2.590  0.01208 * 
## SeatsPremium    9.733      2.823   3.448  0.00105 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 142.2 on 59 degrees of freedom
## Multiple R-squared:  0.1677, Adjusted R-squared:  0.1536 
## F-statistic: 11.89 on 1 and 59 DF,  p-value: 0.001048
Jet$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 396.3145 
##      308      309      310      311      312      313      314      379 
## 328.1813 328.1813 328.1813 328.1813 328.1813 328.1813 328.1813 279.5147 
##      380      381      382      383      384      385      386      387 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      388      389      390      391      392      393      394      395 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      396      397      398      399      400      401      402      403 
## 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 279.5147 
##      404      405      440      441      442      443      444      445 
## 279.5147 279.5147 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 
##      446      447      448      449      450      451      452      453 
## 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 201.6483 
##      454      455      456      457      458 
## 201.6483 201.6483 201.6483 201.6483 201.6483
cor(Jet$PricePremium,Jet$SeatsPremium)
## [1] 0.340239
fit<-lm(PriceEconomy~PriceRelative,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -181.79  -88.34  -10.62   64.69  277.84 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     480.99      31.05  15.491  < 2e-16 ***
## PriceRelative  -217.97      29.31  -7.436 4.93e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112 on 59 degrees of freedom
## Multiple R-squared:  0.4838, Adjusted R-squared:  0.4751 
## F-statistic:  55.3 on 1 and 59 DF,  p-value: 4.929e-10
Jet$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##        90        91        92        93        94        95        96 
## 376.36087 376.36087 376.36087 376.36087 409.05708 409.05708 409.05708 
##        97       308       309       310       311       312       313 
## 424.31532 154.02659 271.73297 302.24944 389.43935 389.43935 393.79885 
##       314       379       380       381       382       383       384 
## 398.15835  69.01642  69.01642  69.01642  73.37592 116.97088 123.51012 
##       385       386       387       388       389       390       391 
## 147.48735 199.80129 206.34054 206.34054 206.34054 239.03675 239.03675 
##       392       393       394       395       396       397       398 
## 239.03675 243.39625 249.93549 254.29499 254.29499 282.63171 304.42919 
##       399       400       401       402       403       404       405 
## 308.78868 319.68742 319.68742 319.68742 319.68742 372.00137 443.93305 
##       440       441       442       443       444       445       446 
## 108.25188 114.79113 114.79113 197.62155 197.62155 197.62155 197.62155 
##       447       448       449       450       451       452       453 
## 215.05953 247.75575 313.14818 313.14818 313.14818 339.30515 350.20389 
##       454       455       456       457       458 
## 354.56339 382.90011 382.90011 398.15835 454.83179
cor(Jet$PricePremium,Jet$PriceRelative)
## [1] -0.3214004
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Jet)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Jet)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -180.93 -132.93  -33.66   74.34  376.20 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)   
## (Intercept)           172.81      51.82   3.335  0.00148 **
## PercentPremiumSeats    10.16       4.73   2.148  0.03586 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 150.1 on 59 degrees of freedom
## Multiple R-squared:  0.07251,    Adjusted R-squared:  0.05679 
## F-statistic: 4.612 on 1 and 59 DF,  p-value: 0.03586
Jet$PricePremium
##  [1] 524 524 524 524 616 616 616 616 841 841 841 789 789 928 931 483 483
## [18] 483 398 398 520 534 318 267 267 267 228 228 228 620 483 318 318 620
## [35] 267 228 267 267 267 267 483 696 545 397 397 430 430 430 430 545 483
## [52] 304 304 304 483 451 464 550 550 696 569
fitted(fit)
##       90       91       92       93       94       95       96       97 
## 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 344.1980 
##      308      309      310      311      312      313      314      379 
## 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 299.8029 288.9327 
##      380      381      382      383      384      385      386      387 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      388      389      390      391      392      393      394      395 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      396      397      398      399      400      401      402      403 
## 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 288.9327 
##      404      405      440      441      442      443      444      445 
## 288.9327 288.9327 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      446      447      448      449      450      451      452      453 
## 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 220.6638 
##      454      455      456      457      458 
## 220.6638 220.6638 220.6638 220.6638 220.6638
cor(Jet$PricePremium,Jet$PercentPremiumSeats)
## [1] 0.2057525

AirFrance Airlines

Analyse all about AF Airlines:-

AF <- airline[ which(airline$Airline=='AirFrance'),]
View(AF)
summary(AF)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance:74   AirBus:36   Min.   : 6.830   Aug:20     
##  British  : 0   Boeing:38   1st Qu.: 7.770   Jul:12     
##  Delta    : 0               Median : 8.750   Oct:20     
##  Jet      : 0               Mean   : 8.989   Sep:22     
##  Singapore: 0               3rd Qu.: 9.500              
##  Virgin   : 0               Max.   :13.000              
##       IsInternational  SeatsEconomy    SeatsPremium   PitchEconomy
##  Domestic     : 0     Min.   :147.0   Min.   :21.0   Min.   :32   
##  International:74     1st Qu.:147.0   1st Qu.:21.0   1st Qu.:32   
##                       Median :200.0   Median :24.0   Median :32   
##                       Mean   :214.5   Mean   :26.7   Mean   :32   
##                       3rd Qu.:200.0   3rd Qu.:28.0   3rd Qu.:32   
##                       Max.   :389.0   Max.   :38.0   Max.   :32   
##   PitchPremium  WidthEconomy    WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :17.00   Min.   :19    Min.   : 630   Min.   :1611  
##  1st Qu.:38    1st Qu.:17.00   1st Qu.:19    1st Qu.:2659   1st Qu.:2859  
##  Median :38    Median :18.00   Median :19    Median :2988   Median :3196  
##  Mean   :38    Mean   :17.57   Mean   :19    Mean   :2770   Mean   :3065  
##  3rd Qu.:38    3rd Qu.:18.00   3rd Qu.:19    3rd Qu.:3165   3rd Qu.:3289  
##  Max.   :38    Max.   :18.00   Max.   :19    Max.   :3593   Max.   :3972  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0200   Min.   :168.0   Min.   :6       Min.   :1.000  
##  1st Qu.:0.0300   1st Qu.:168.0   1st Qu.:6       1st Qu.:1.000  
##  Median :0.0700   Median :228.0   Median :6       Median :1.000  
##  Mean   :0.2047   Mean   :241.2   Mean   :6       Mean   :1.432  
##  3rd Qu.:0.0800   3rd Qu.:228.0   3rd Qu.:6       3rd Qu.:2.000  
##  Max.   :1.6400   Max.   :427.0   Max.   :6       Max.   :2.000  
##  PercentPremiumSeats
##  Min.   : 8.90      
##  1st Qu.:12.12      
##  Median :12.28      
##  Mean   :11.59      
##  3rd Qu.:12.50      
##  Max.   :12.50

Check the all the means now all AF aircrafts

mean(AF$PriceEconomy)
## [1] 2769.784
mean(AF$PricePremium)
## [1] 3065.216
mean(AF$FlightDuration)
## [1] 8.988514
mean(AF$PitchEconomy)
## [1] 32
mean(AF$PitchPremium)
## [1] 38
mean(AF$WidthEconomy)
## [1] 17.56757
mean(AF$WidthPremium)
## [1] 19
mean(AF$PriceRelative)
## [1] 0.2047297
mean(AF$PitchDifference)
## [1] 6
mean(AF$WidthDifference)
## [1] 1.432432

Now Analyse separately for Each Aircrafts in AF Airlines i.e-Boeing and AirBus

AFboeing <- AF[ which(AF$Aircraft=='Boeing'),]
View(AFboeing)
summary(AFboeing)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance:38   AirBus: 0   Min.   : 6.830   Aug:11     
##  British  : 0   Boeing:38   1st Qu.: 7.750   Jul: 6     
##  Delta    : 0               Median : 8.750   Oct:11     
##  Jet      : 0               Mean   : 9.117   Sep:10     
##  Singapore: 0               3rd Qu.:10.660              
##  Virgin   : 0               Max.   :11.910              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :174.0   Min.   :24.00   Min.   :32   
##  International:38     1st Qu.:200.0   1st Qu.:25.00   1st Qu.:32   
##                       Median :200.0   Median :28.00   Median :32   
##                       Mean   :227.4   Mean   :28.53   Mean   :32   
##                       3rd Qu.:212.0   3rd Qu.:28.00   3rd Qu.:32   
##                       Max.   :389.0   Max.   :38.00   Max.   :32   
##   PitchPremium  WidthEconomy    WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :17.00   Min.   :19    Min.   : 648   Min.   :1710  
##  1st Qu.:38    1st Qu.:17.00   1st Qu.:19    1st Qu.:2983   1st Qu.:3174  
##  Median :38    Median :17.00   Median :19    Median :3108   Median :3243  
##  Mean   :38    Mean   :17.16   Mean   :19    Mean   :2933   Mean   :3221  
##  3rd Qu.:38    3rd Qu.:17.00   3rd Qu.:19    3rd Qu.:3414   3rd Qu.:3573  
##  Max.   :38    Max.   :18.00   Max.   :19    Max.   :3593   Max.   :3972  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0300   Min.   :198.0   Min.   :6       Min.   :1.000  
##  1st Qu.:0.0300   1st Qu.:228.0   1st Qu.:6       1st Qu.:2.000  
##  Median :0.0350   Median :228.0   Median :6       Median :2.000  
##  Mean   :0.2016   Mean   :255.9   Mean   :6       Mean   :1.842  
##  3rd Qu.:0.0700   3rd Qu.:237.0   3rd Qu.:6       3rd Qu.:2.000  
##  Max.   :1.6400   Max.   :427.0   Max.   :6       Max.   :2.000  
##  PercentPremiumSeats
##  Min.   : 8.90      
##  1st Qu.:10.53      
##  Median :12.28      
##  Mean   :11.48      
##  3rd Qu.:12.28      
##  Max.   :12.28
mean(AFboeing$PriceEconomy)
## [1] 2933.289
mean(AFboeing$PricePremium)
## [1] 3221
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(AFboeing$PriceEconomy,AFboeing$TravelMonth,mean))
y2<-c(by(AFboeing$PricePremium,AFboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = AFboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1742.3  -316.8   180.8   474.7   686.4 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      690.33     582.53   1.185 0.243756    
## FlightDuration   246.01      62.77   3.919 0.000381 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 670.8 on 36 degrees of freedom
## Multiple R-squared:  0.2991, Adjusted R-squared:  0.2796 
## F-statistic: 15.36 on 1 and 36 DF,  p-value: 0.0003812
AFboeing$PriceEconomy
##  [1] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [15] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [29]  648  648  700 1094 2996 2996 2996 2979 3593 3593
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 2739.589 2739.589 2739.589 2535.402 2370.575 2842.913 2842.913 2842.913 
##      347      348      349      350      351      352      353      354 
## 2574.763 2370.575 2370.575 3027.420 3027.420 3027.420 3027.420 2596.904 
##      355      356      357      358      359      360      361      362 
## 2596.904 2596.904 2616.585 3005.280 3005.280 3005.280 3580.941 3580.941 
##      363      364      365      366      406      407      408      409 
## 3620.303 3620.303 3620.303 3620.303 2390.256 2390.256 2390.256 2390.256 
##      430      431      432      436      437      438 
## 3312.791 3312.791 3312.791 2781.411 3519.439 3519.439
cor(AFboeing$PriceEconomy,AFboeing$FlightDuration)
## [1] 0.5468897
fit<-lm(PriceEconomy~SeatsEconomy,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2279.80   -11.71   187.88   493.88   685.37 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2824.0399   436.5193   6.469 1.65e-07 ***
## SeatsEconomy    0.4804     1.8325   0.262    0.795    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 800.5 on 36 degrees of freedom
## Multiple R-squared:  0.001905,   Adjusted R-squared:  -0.02582 
## F-statistic: 0.06872 on 1 and 36 DF,  p-value: 0.7947
AFboeing$PriceEconomy
##  [1] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [15] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [29]  648  648  700 1094 2996 2996 2996 2979 3593 3593
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 
##      347      348      349      350      351      352      353      354 
## 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2907.627 
##      355      356      357      358      359      360      361      362 
## 2907.627 2907.627 2907.627 2920.117 2920.117 2920.117 2907.627 2907.627 
##      363      364      365      366      406      407      408      409 
## 2920.117 2920.117 2920.117 2920.117 2927.803 2927.803 2927.803 2927.803 
##      430      431      432      436      437      438 
## 3010.910 3010.910 3010.910 3010.910 3010.910 3010.910
cor(AFboeing$PriceEconomy,AFboeing$SeatsEconomy)
## [1] 0.04364893
fit<-lm(PriceEconomy~PriceRelative,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1222.07  -149.37   -13.76   236.37   364.24 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3280.42      54.66   60.02   <2e-16 ***
## PriceRelative -1722.06     117.52  -14.65   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 303.6 on 36 degrees of freedom
## Multiple R-squared:  0.8564, Adjusted R-squared:  0.8524 
## F-statistic: 214.7 on 1 and 36 DF,  p-value: < 2.2e-16
AFboeing$PriceEconomy
##  [1] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [15] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [29]  648  648  700 1094 2996 2996 2996 2979 3593 3593
fitted(fit)
##       339       340       341       342       343       344       345 
## 2660.4794 2660.4794 2660.4794 3142.6554 3159.8759 3159.8759 3159.8759 
##       346       347       348       349       350       351       352 
## 3159.8759 3211.5377 3211.5377 3211.5377 3228.7582 3228.7582 3228.7582 
##       353       354       355       356       357       358       359 
## 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 
##       360       361       362       363       364       365       366 
## 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 
##       406       407       408       409       430       431       432 
##  456.2462  456.2462  800.6576 2316.0679 3159.8759 3159.8759 3159.8759 
##       436       437       438 
## 3211.5377 3228.7582 3228.7582
cor(AFboeing$PriceEconomy,AFboeing$PriceRelative)
## [1] -0.9254236
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1965.98   -79.54    98.71   374.46  1216.18 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           458.02    1068.56   0.429   0.6707  
## PercentPremiumSeats   215.60      92.47   2.332   0.0254 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 746.9 on 36 degrees of freedom
## Multiple R-squared:  0.1312, Adjusted R-squared:  0.1071 
## F-statistic: 5.436 on 1 and 36 DF,  p-value: 0.02544
AFboeing$PriceEconomy
##  [1] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [15] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [29]  648  648  700 1094 2996 2996 2996 2979 3593 3593
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 
##      347      348      349      350      351      352      353      354 
## 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3071.044 
##      355      356      357      358      359      360      361      362 
## 3071.044 3071.044 3071.044 3105.539 3105.539 3105.539 3071.044 3071.044 
##      363      364      365      366      406      407      408      409 
## 3105.539 3105.539 3105.539 3105.539 2613.980 2613.980 2613.980 2613.980 
##      430      431      432      436      437      438 
## 2376.824 2376.824 2376.824 2376.824 2376.824 2376.824
cor(AFboeing$PriceEconomy,AFboeing$PercentPremiumSeats)
## [1] 0.3621991
fit<-lm(PricePremium~FlightDuration,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = AFboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1158.8  -271.1   100.9   310.9   876.6 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1766.45     455.55   3.878  0.00043 ***
## FlightDuration   159.54      49.09   3.250  0.00250 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 524.6 on 36 degrees of freedom
## Multiple R-squared:  0.2269, Adjusted R-squared:  0.2054 
## F-statistic: 10.56 on 1 and 36 DF,  p-value: 0.002504
AFboeing$PricePremium
##  [1] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [15] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [29] 1710 1710 1710 1710 3196 3196 3196 3088 3702 3702
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 3095.387 3095.387 3095.387 2962.972 2856.083 3162.392 3162.392 3162.392 
##      347      348      349      350      351      352      353      354 
## 2988.498 2856.083 2856.083 3282.043 3282.043 3282.043 3282.043 3002.856 
##      355      356      357      358      359      360      361      362 
## 3002.856 3002.856 3015.619 3267.685 3267.685 3267.685 3640.999 3640.999 
##      363      364      365      366      406      407      408      409 
## 3666.525 3666.525 3666.525 3666.525 2868.846 2868.846 2868.846 2868.846 
##      430      431      432      436      437      438 
## 3467.105 3467.105 3467.105 3122.508 3601.115 3601.115
cor(AFboeing$PricePremium,AFboeing$FlightDuration)
## [1] 0.4762987
fit<-lm(PriceEconomy~SeatsEconomy,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2279.80   -11.71   187.88   493.88   685.37 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2824.0399   436.5193   6.469 1.65e-07 ***
## SeatsEconomy    0.4804     1.8325   0.262    0.795    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 800.5 on 36 degrees of freedom
## Multiple R-squared:  0.001905,   Adjusted R-squared:  -0.02582 
## F-statistic: 0.06872 on 1 and 36 DF,  p-value: 0.7947
AFboeing$PricePremium
##  [1] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [15] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [29] 1710 1710 1710 1710 3196 3196 3196 3088 3702 3702
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 
##      347      348      349      350      351      352      353      354 
## 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2920.117 2907.627 
##      355      356      357      358      359      360      361      362 
## 2907.627 2907.627 2907.627 2920.117 2920.117 2920.117 2907.627 2907.627 
##      363      364      365      366      406      407      408      409 
## 2920.117 2920.117 2920.117 2920.117 2927.803 2927.803 2927.803 2927.803 
##      430      431      432      436      437      438 
## 3010.910 3010.910 3010.910 3010.910 3010.910 3010.910
cor(AFboeing$PricePremium,AFboeing$SeatsEconomy)
## [1] 0.006377831
fit<-lm(PriceEconomy~SeatsPremium,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2041.78   -30.47   152.03   509.03   903.22 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   1398.63     804.38   1.739   0.0906 .
## SeatsPremium    53.80      27.86   1.931   0.0614 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 762.8 on 36 degrees of freedom
## Multiple R-squared:  0.09384,    Adjusted R-squared:  0.06867 
## F-statistic: 3.728 on 1 and 36 DF,  p-value: 0.0614
AFboeing$PricePremium
##  [1] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [15] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [29] 1710 1710 1710 1710 3196 3196 3196 3088 3702 3702
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 2904.975 2904.975 2904.975 2904.975 2904.975 2904.975 2904.975 2904.975 
##      347      348      349      350      351      352      353      354 
## 2904.975 2904.975 2904.975 2904.975 2904.975 2904.975 2904.975 2689.783 
##      355      356      357      358      359      360      361      362 
## 2689.783 2689.783 2689.783 2904.975 2904.975 2904.975 2689.783 2689.783 
##      363      364      365      366      406      407      408      409 
## 2904.975 2904.975 2904.975 2904.975 2689.783 2689.783 2689.783 2689.783 
##      430      431      432      436      437      438 
## 3442.955 3442.955 3442.955 3442.955 3442.955 3442.955
cor(AFboeing$PricePremium,AFboeing$SeatsPremium)
## [1] 0.2673746
fit<-lm(PriceEconomy~PriceRelative,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1222.07  -149.37   -13.76   236.37   364.24 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3280.42      54.66   60.02   <2e-16 ***
## PriceRelative -1722.06     117.52  -14.65   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 303.6 on 36 degrees of freedom
## Multiple R-squared:  0.8564, Adjusted R-squared:  0.8524 
## F-statistic: 214.7 on 1 and 36 DF,  p-value: < 2.2e-16
AFboeing$PricePremium
##  [1] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [15] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [29] 1710 1710 1710 1710 3196 3196 3196 3088 3702 3702
fitted(fit)
##       339       340       341       342       343       344       345 
## 2660.4794 2660.4794 2660.4794 3142.6554 3159.8759 3159.8759 3159.8759 
##       346       347       348       349       350       351       352 
## 3159.8759 3211.5377 3211.5377 3211.5377 3228.7582 3228.7582 3228.7582 
##       353       354       355       356       357       358       359 
## 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 
##       360       361       362       363       364       365       366 
## 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 3228.7582 
##       406       407       408       409       430       431       432 
##  456.2462  456.2462  800.6576 2316.0679 3159.8759 3159.8759 3159.8759 
##       436       437       438 
## 3211.5377 3228.7582 3228.7582
cor(AFboeing$PricePremium,AFboeing$PriceRelative)
## [1] -0.7662207
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AFboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AFboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1965.98   -79.54    98.71   374.46  1216.18 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           458.02    1068.56   0.429   0.6707  
## PercentPremiumSeats   215.60      92.47   2.332   0.0254 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 746.9 on 36 degrees of freedom
## Multiple R-squared:  0.1312, Adjusted R-squared:  0.1071 
## F-statistic: 5.436 on 1 and 36 DF,  p-value: 0.02544
AFboeing$PricePremium
##  [1] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [15] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [29] 1710 1710 1710 1710 3196 3196 3196 3088 3702 3702
fitted(fit)
##      339      340      341      342      343      344      345      346 
## 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 
##      347      348      349      350      351      352      353      354 
## 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3105.539 3071.044 
##      355      356      357      358      359      360      361      362 
## 3071.044 3071.044 3071.044 3105.539 3105.539 3105.539 3071.044 3071.044 
##      363      364      365      366      406      407      408      409 
## 3105.539 3105.539 3105.539 3105.539 2613.980 2613.980 2613.980 2613.980 
##      430      431      432      436      437      438 
## 2376.824 2376.824 2376.824 2376.824 2376.824 2376.824
cor(AFboeing$PricePremium,AFboeing$PercentPremiumSeats)
## [1] 0.3808213
AFairbus <-AF[ which(AF$Aircraft=='AirBus'),]
View(AFairbus)
summary(AFairbus)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance:36   AirBus:36   Min.   : 6.830   Aug: 9     
##  British  : 0   Boeing: 0   1st Qu.: 8.330   Jul: 6     
##  Delta    : 0               Median : 8.500   Oct: 9     
##  Jet      : 0               Mean   : 8.852   Sep:12     
##  Singapore: 0               3rd Qu.: 9.250              
##  Virgin   : 0               Max.   :13.000              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy
##  Domestic     : 0     Min.   :147.0   Min.   :21.00   Min.   :32   
##  International:36     1st Qu.:147.0   1st Qu.:21.00   1st Qu.:32   
##                       Median :147.0   Median :21.00   Median :32   
##                       Mean   :200.8   Mean   :24.78   Mean   :32   
##                       3rd Qu.:147.0   3rd Qu.:21.00   3rd Qu.:32   
##                       Max.   :389.0   Max.   :38.00   Max.   :32   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :18    Min.   :19    Min.   : 630   Min.   :1611  
##  1st Qu.:38    1st Qu.:18    1st Qu.:19    1st Qu.:2607   1st Qu.:2807  
##  Median :38    Median :18    Median :19    Median :2659   Median :2859  
##  Mean   :38    Mean   :18    Mean   :19    Mean   :2597   Mean   :2901  
##  3rd Qu.:38    3rd Qu.:18    3rd Qu.:19    3rd Qu.:3026   3rd Qu.:3275  
##  Max.   :38    Max.   :18    Max.   :19    Max.   :3220   Max.   :3289  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0200   Min.   :168.0   Min.   :6       Min.   :1      
##  1st Qu.:0.0375   1st Qu.:168.0   1st Qu.:6       1st Qu.:1      
##  Median :0.0750   Median :168.0   Median :6       Median :1      
##  Mean   :0.2081   Mean   :225.6   Mean   :6       Mean   :1      
##  3rd Qu.:0.0800   3rd Qu.:168.0   3rd Qu.:6       3rd Qu.:1      
##  Max.   :1.5600   Max.   :427.0   Max.   :6       Max.   :1      
##  PercentPremiumSeats
##  Min.   : 8.9       
##  1st Qu.:12.5       
##  Median :12.5       
##  Mean   :11.7       
##  3rd Qu.:12.5       
##  Max.   :12.5
mean(AFairbus$PriceEconomy)
## [1] 2597.194
mean(AFairbus$PricePremium)
## [1] 2900.778
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(AFairbus$PriceEconomy,AFairbus$TravelMonth,mean))
y4<-c(by(AFairbus$PricePremium,AFairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = AFairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1880.62  -193.76    -7.83   403.24  1177.35 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     3780.82     671.55   5.630 2.61e-06 ***
## FlightDuration  -133.71      74.86  -1.786    0.083 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 652.3 on 34 degrees of freedom
## Multiple R-squared:  0.08578,    Adjusted R-squared:  0.05889 
## F-statistic:  3.19 on 1 and 34 DF,  p-value: 0.08301
AFairbus$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2510.620 2510.620 2510.620 2667.056 2667.056 2667.056 2667.056 2667.056 
##      220      221      222      223      224      225      226      227 
## 2667.056 2667.056 2667.056 2800.761 2800.761 2800.761 2867.614 2867.614 
##      228      229      230      231      232      233      234      235 
## 2589.506 2589.506 2589.506 2700.482 2553.406 2553.406 2544.046 2544.046 
##      236      237      238      239      426      427      428      429 
## 2556.080 2556.080 2544.046 2544.046 2042.650 2042.650 2778.031 2778.031 
##      433      434      435      439 
## 2656.359 2644.326 2644.326 2042.650
cor(AFairbus$PriceEconomy,AFairbus$FlightDuration)
## [1] -0.2928807
fit<-lm(PriceEconomy~SeatsEconomy,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AFairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1982.0    -3.0    47.0   463.5   674.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2652.4706   253.5784  10.460 3.64e-12 ***
## SeatsEconomy   -0.2753     1.1291  -0.244    0.809    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 681.6 on 34 degrees of freedom
## Multiple R-squared:  0.001745,   Adjusted R-squared:  -0.02761 
## F-statistic: 0.05945 on 1 and 34 DF,  p-value: 0.8088
AFairbus$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      220      221      222      223      224      225      226      227 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      228      229      230      231      232      233      234      235 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      236      237      238      239      426      427      428      429 
## 2612.000 2612.000 2612.000 2612.000 2545.375 2545.375 2545.375 2545.375 
##      433      434      435      439 
## 2545.375 2545.375 2545.375 2545.375
cor(AFairbus$PriceEconomy,AFairbus$SeatsEconomy)
## [1] -0.04177842
fit<-lm(PriceEconomy~PriceRelative,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AFairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -952.42 -188.91  -90.95  291.50  402.03 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    2920.05      53.16   54.93  < 2e-16 ***
## PriceRelative -1551.80     120.45  -12.88 1.23e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 281.3 on 34 degrees of freedom
## Multiple R-squared:   0.83,  Adjusted R-squared:  0.825 
## F-statistic:   166 on 1 and 34 DF,  p-value: 1.229e-14
AFairbus$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       212       213       214       215       216       217       218 
##  499.2507 1104.4517 1942.4222 2795.9107 2795.9107 2795.9107 2795.9107 
##       219       220       221       222       223       224       225 
## 2795.9107 2795.9107 2795.9107 2795.9107 2795.9107 2795.9107 2795.9107 
##       226       227       228       229       230       231       232 
## 2811.4287 2811.4287 2811.4287 2811.4287 2811.4287 2857.9826 2873.5006 
##       233       234       235       236       237       238       239 
## 2873.5006 2873.5006 2873.5006 2873.5006 2873.5006 2873.5006 2873.5006 
##       426       427       428       429       433       434       435 
## 1119.9696 1119.9696 2795.9107 2795.9107 2857.9826 2857.9826 2857.9826 
##       439 
## 2889.0185
cor(AFairbus$PriceEconomy,AFairbus$PriceRelative)
## [1] -0.911031
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AFairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1982.0    -3.0    47.0   463.5   674.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          2380.66     895.31   2.659   0.0119 *
## PercentPremiumSeats    18.51      75.90   0.244   0.8088  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 681.6 on 34 degrees of freedom
## Multiple R-squared:  0.001745,   Adjusted R-squared:  -0.02761 
## F-statistic: 0.05945 on 1 and 34 DF,  p-value: 0.8088
AFairbus$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      220      221      222      223      224      225      226      227 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      228      229      230      231      232      233      234      235 
## 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 2612.000 
##      236      237      238      239      426      427      428      429 
## 2612.000 2612.000 2612.000 2612.000 2545.375 2545.375 2545.375 2545.375 
##      433      434      435      439 
## 2545.375 2545.375 2545.375 2545.375
fit<-lm(PricePremium~FlightDuration,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = AFairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1318.90   -25.29   -18.28   253.20   360.39 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2502.59     456.18   5.486 4.01e-06 ***
## FlightDuration    44.98      50.85   0.885    0.383    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 443.1 on 34 degrees of freedom
## Multiple R-squared:  0.02249,    Adjusted R-squared:  -0.006256 
## F-statistic: 0.7824 on 1 and 34 DF,  p-value: 0.3826
AFairbus$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2929.903 2929.903 2929.903 2877.275 2877.275 2877.275 2877.275 2877.275 
##      220      221      222      223      224      225      226      227 
## 2877.275 2877.275 2877.275 2832.295 2832.295 2832.295 2809.805 2809.805 
##      228      229      230      231      232      233      234      235 
## 2903.364 2903.364 2903.364 2866.030 2915.509 2915.509 2918.658 2918.658 
##      236      237      238      239      426      427      428      429 
## 2914.609 2914.609 2918.658 2918.658 3087.335 3087.335 2839.942 2839.942 
##      433      434      435      439 
## 2880.874 2884.922 2884.922 3087.335
cor(AFairbus$PricePremium,AFairbus$FlightDuration)
## [1] 0.149982
fit<-lm(PricePremium~SeatsEconomy,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = AFairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1236.68   -40.68    11.32   215.32   427.32 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2702.5334   162.3369  16.648   <2e-16 ***
## SeatsEconomy    0.9874     0.7229   1.366    0.181    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 436.4 on 34 degrees of freedom
## Multiple R-squared:  0.05202,    Adjusted R-squared:  0.02414 
## F-statistic: 1.866 on 1 and 34 DF,  p-value: 0.1809
AFairbus$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      220      221      222      223      224      225      226      227 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      228      229      230      231      232      233      234      235 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      236      237      238      239      426      427      428      429 
## 2847.679 2847.679 2847.679 2847.679 3086.625 3086.625 3086.625 3086.625 
##      433      434      435      439 
## 3086.625 3086.625 3086.625 3086.625
cor(AFairbus$PricePremium,AFairbus$SeatsEconomy)
## [1] 0.2280809
fit<-lm(PricePremium~SeatsPremium,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = AFairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1236.68   -40.68    11.32   215.32   427.32 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2552.51     265.14   9.627 3.06e-11 ***
## SeatsPremium    14.06      10.29   1.366    0.181    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 436.4 on 34 degrees of freedom
## Multiple R-squared:  0.05202,    Adjusted R-squared:  0.02414 
## F-statistic: 1.866 on 1 and 34 DF,  p-value: 0.1809
AFairbus$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      220      221      222      223      224      225      226      227 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      228      229      230      231      232      233      234      235 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      236      237      238      239      426      427      428      429 
## 2847.679 2847.679 2847.679 2847.679 3086.625 3086.625 3086.625 3086.625 
##      433      434      435      439 
## 3086.625 3086.625 3086.625 3086.625
cor(AFairbus$PricePremium,AFairbus$SeatsPremium)
## [1] 0.2280809
fit<-lm(PricePremium~PriceRelative,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = AFairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1028.2  -173.2  -121.2   263.8   978.5 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3029.78      70.51  42.972  < 2e-16 ***
## PriceRelative  -620.04     159.75  -3.881 0.000454 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 373.1 on 34 degrees of freedom
## Multiple R-squared:  0.307,  Adjusted R-squared:  0.2867 
## F-statistic: 15.06 on 1 and 34 DF,  p-value: 0.0004545
AFairbus$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2062.518 2304.334 2639.155 2980.177 2980.177 2980.177 2980.177 2980.177 
##      220      221      222      223      224      225      226      227 
## 2980.177 2980.177 2980.177 2980.177 2980.177 2980.177 2986.378 2986.378 
##      228      229      230      231      232      233      234      235 
## 2986.378 2986.378 2986.378 3004.979 3011.179 3011.179 3011.179 3011.179 
##      236      237      238      239      426      427      428      429 
## 3011.179 3011.179 3011.179 3011.179 2310.534 2310.534 2980.177 2980.177 
##      433      434      435      439 
## 3004.979 3004.979 3004.979 3017.380
cor(AFairbus$PricePremium,AFairbus$PriceRelative)
## [1] -0.5541042
fit<-lm(PricePremium~PercentPremiumSeats,data = AFairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = AFairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1236.68   -40.68    11.32   215.32   427.32 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          3677.35     573.16   6.416  2.5e-07 ***
## PercentPremiumSeats   -66.37      48.59  -1.366    0.181    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 436.4 on 34 degrees of freedom
## Multiple R-squared:  0.05202,    Adjusted R-squared:  0.02414 
## F-statistic: 1.866 on 1 and 34 DF,  p-value: 0.1809
AFairbus$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      220      221      222      223      224      225      226      227 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      228      229      230      231      232      233      234      235 
## 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 2847.679 
##      236      237      238      239      426      427      428      429 
## 2847.679 2847.679 2847.679 2847.679 3086.625 3086.625 3086.625 3086.625 
##      433      434      435      439 
## 3086.625 3086.625 3086.625 3086.625
cor(AFairbus$PricePremium,AFairbus$PercentPremiumSeats)
## [1] -0.2280809

Now We Should Analyse the international aircrafts of AirFrance

AFint <- AF[ which(AF$IsInternational=='International'),]
View(AFint)
summary(AFint)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance:74   AirBus:36   Min.   : 6.830   Aug:20     
##  British  : 0   Boeing:38   1st Qu.: 7.770   Jul:12     
##  Delta    : 0               Median : 8.750   Oct:20     
##  Jet      : 0               Mean   : 8.989   Sep:22     
##  Singapore: 0               3rd Qu.: 9.500              
##  Virgin   : 0               Max.   :13.000              
##       IsInternational  SeatsEconomy    SeatsPremium   PitchEconomy
##  Domestic     : 0     Min.   :147.0   Min.   :21.0   Min.   :32   
##  International:74     1st Qu.:147.0   1st Qu.:21.0   1st Qu.:32   
##                       Median :200.0   Median :24.0   Median :32   
##                       Mean   :214.5   Mean   :26.7   Mean   :32   
##                       3rd Qu.:200.0   3rd Qu.:28.0   3rd Qu.:32   
##                       Max.   :389.0   Max.   :38.0   Max.   :32   
##   PitchPremium  WidthEconomy    WidthPremium  PriceEconomy   PricePremium 
##  Min.   :38    Min.   :17.00   Min.   :19    Min.   : 630   Min.   :1611  
##  1st Qu.:38    1st Qu.:17.00   1st Qu.:19    1st Qu.:2659   1st Qu.:2859  
##  Median :38    Median :18.00   Median :19    Median :2988   Median :3196  
##  Mean   :38    Mean   :17.57   Mean   :19    Mean   :2770   Mean   :3065  
##  3rd Qu.:38    3rd Qu.:18.00   3rd Qu.:19    3rd Qu.:3165   3rd Qu.:3289  
##  Max.   :38    Max.   :18.00   Max.   :19    Max.   :3593   Max.   :3972  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0200   Min.   :168.0   Min.   :6       Min.   :1.000  
##  1st Qu.:0.0300   1st Qu.:168.0   1st Qu.:6       1st Qu.:1.000  
##  Median :0.0700   Median :228.0   Median :6       Median :1.000  
##  Mean   :0.2047   Mean   :241.2   Mean   :6       Mean   :1.432  
##  3rd Qu.:0.0800   3rd Qu.:228.0   3rd Qu.:6       3rd Qu.:2.000  
##  Max.   :1.6400   Max.   :427.0   Max.   :6       Max.   :2.000  
##  PercentPremiumSeats
##  Min.   : 8.90      
##  1st Qu.:12.12      
##  Median :12.28      
##  Mean   :11.59      
##  3rd Qu.:12.50      
##  Max.   :12.50
mean(AFint$PriceEconomy)
## [1] 2769.784
mean(AFint$PricePremium)
## [1] 3065.216
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(AFint$PriceEconomy,AFint$TravelMonth,mean))
y2<-c(by(AFint$PricePremium,AFint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = AFint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2192.13   -43.38   215.62   377.66   667.08 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1849.8      485.8   3.808 0.000292 ***
## FlightDuration    102.3       53.2   1.924 0.058344 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 736.2 on 72 degrees of freedom
## Multiple R-squared:  0.04889,    Adjusted R-squared:  0.03568 
## F-statistic: 3.701 on 1 and 72 DF,  p-value: 0.05834
AFint$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2822.135 2822.135 2822.135 2702.384 2702.384 2702.384 2702.384 2702.384 
##      220      221      222      223      224      225      226      227 
## 2702.384 2702.384 2702.384 2600.034 2600.034 2600.034 2548.858 2548.858 
##      228      229      230      231      232      233      234      235 
## 2761.748 2761.748 2761.748 2676.797 2789.383 2789.383 2796.547 2796.547 
##      236      237      238      239      339      340      341      342 
## 2787.336 2787.336 2796.547 2796.547 2702.384 2702.384 2702.384 2617.433 
##      343      344      345      346      347      348      349      350 
## 2548.858 2745.372 2745.372 2745.372 2633.809 2548.858 2548.858 2822.135 
##      351      352      353      354      355      356      357      358 
## 2822.135 2822.135 2822.135 2643.021 2643.021 2643.021 2651.209 2812.923 
##      359      360      361      362      363      364      365      366 
## 2812.923 2812.923 3052.424 3052.424 3068.800 3068.800 3068.800 3068.800 
##      406      407      408      409      426      427      428      429 
## 2557.046 2557.046 2557.046 2557.046 3180.362 3180.362 2617.433 2617.433 
##      430      431      432      433      434      435      436      437 
## 2940.862 2940.862 2940.862 2710.573 2719.784 2719.784 2719.784 3026.836 
##      438      439 
## 3026.836 3180.362
cor(AFint$PriceEconomy,AFint$FlightDuration)
## [1] 0.2211007
fit<-lm(PriceEconomy~SeatsEconomy,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AFint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2122.21   -92.16   169.54   413.84   834.38 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2710.583    231.850  11.691   <2e-16 ***
## SeatsEconomy    0.276      1.001   0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 754.5 on 72 degrees of freedom
## Multiple R-squared:  0.001056,   Adjusted R-squared:  -0.01282 
## F-statistic: 0.07609 on 1 and 72 DF,  p-value: 0.7835
AFint$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      220      221      222      223      224      225      226      227 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      228      229      230      231      232      233      234      235 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      236      237      238      239      339      340      341      342 
## 2751.162 2751.162 2751.162 2751.162 2765.792 2765.792 2765.792 2765.792 
##      343      344      345      346      347      348      349      350 
## 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 
##      351      352      353      354      355      356      357      358 
## 2765.792 2765.792 2765.792 2758.615 2758.615 2758.615 2758.615 2765.792 
##      359      360      361      362      363      364      365      366 
## 2765.792 2765.792 2758.615 2758.615 2765.792 2765.792 2765.792 2765.792 
##      406      407      408      409      426      427      428      429 
## 2770.209 2770.209 2770.209 2770.209 2817.965 2817.965 2817.965 2817.965 
##      430      431      432      433      434      435      436      437 
## 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 
##      438      439 
## 2817.965 2817.965
cor(AFint$PriceEconomy,AFint$SeatsEconomy)
## [1] 0.03249046
fit<-lm(PriceEconomy~PriceRelative,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AFint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1090.05  -316.43    34.09   157.14   535.14 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3107.32      43.57   71.32   <2e-16 ***
## PriceRelative -1648.71      96.03  -17.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 334.5 on 72 degrees of freedom
## Multiple R-squared:  0.8037, Adjusted R-squared:  0.801 
## F-statistic: 294.8 on 1 and 72 DF,  p-value: < 2.2e-16
AFint$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##       212       213       214       215       216       217       218 
##  535.3341 1178.3316 2068.6358 2975.4271 2975.4271 2975.4271 2975.4271 
##       219       220       221       222       223       224       225 
## 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 
##       226       227       228       229       230       231       232 
## 2991.9142 2991.9142 2991.9142 2991.9142 2991.9142 3041.3756 3057.8627 
##       233       234       235       236       237       238       239 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       339       340       341       342       343       344       345 
## 2513.7879 2513.7879 2513.7879 2975.4271 2991.9142 2991.9142 2991.9142 
##       346       347       348       349       350       351       352 
## 2991.9142 3041.3756 3041.3756 3041.3756 3057.8627 3057.8627 3057.8627 
##       353       354       355       356       357       358       359 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       360       361       362       363       364       365       366 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       406       407       408       409       426       427       428 
##  403.4371  403.4371  733.1795 2184.0456 1194.8187 1194.8187 2975.4271 
##       429       430       431       432       433       434       435 
## 2975.4271 2991.9142 2991.9142 2991.9142 3041.3756 3041.3756 3041.3756 
##       436       437       438       439 
## 3041.3756 3057.8627 3057.8627 3074.3498
cor(AFint$PriceEconomy,AFint$PriceRelative)
## [1] -0.8964835
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AFint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2228.1  -199.1   220.2   450.3  1083.2 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          1648.88     715.06   2.306    0.024 *
## PercentPremiumSeats    96.73      61.26   1.579    0.119  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 742.1 on 72 degrees of freedom
## Multiple R-squared:  0.03347,    Adjusted R-squared:  0.02005 
## F-statistic: 2.494 on 1 and 72 DF,  p-value: 0.1187
AFint$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      220      221      222      223      224      225      226      227 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      228      229      230      231      232      233      234      235 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      236      237      238      239      339      340      341      342 
## 2858.047 2858.047 2858.047 2858.047 2836.765 2836.765 2836.765 2836.765 
##      343      344      345      346      347      348      349      350 
## 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 
##      351      352      353      354      355      356      357      358 
## 2836.765 2836.765 2836.765 2821.288 2821.288 2821.288 2821.288 2836.765 
##      359      360      361      362      363      364      365      366 
## 2836.765 2836.765 2821.288 2821.288 2836.765 2836.765 2836.765 2836.765 
##      406      407      408      409      426      427      428      429 
## 2616.213 2616.213 2616.213 2616.213 2509.805 2509.805 2509.805 2509.805 
##      430      431      432      433      434      435      436      437 
## 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 
##      438      439 
## 2509.805 2509.805
cor(AFint$PriceEconomy,AFint$PercentPremiumSeats)
## [1] 0.1829589
fit<-lm(PricePremium~FlightDuration,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = AFint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1516.2  -126.4    82.0   302.1   986.6 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1975.68     336.57   5.870 1.23e-07 ***
## FlightDuration   121.21      36.86   3.289  0.00156 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 510 on 72 degrees of freedom
## Multiple R-squared:  0.1306, Adjusted R-squared:  0.1185 
## F-statistic: 10.82 on 1 and 72 DF,  p-value: 0.001559
AFint$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 3127.216 3127.216 3127.216 2985.395 2985.395 2985.395 2985.395 2985.395 
##      220      221      222      223      224      225      226      227 
## 2985.395 2985.395 2985.395 2864.181 2864.181 2864.181 2803.573 2803.573 
##      228      229      230      231      232      233      234      235 
## 3055.699 3055.699 3055.699 2955.091 3088.427 3088.427 3096.912 3096.912 
##      236      237      238      239      339      340      341      342 
## 3086.003 3086.003 3096.912 3096.912 2985.395 2985.395 2985.395 2884.787 
##      343      344      345      346      347      348      349      350 
## 2803.573 3036.305 3036.305 3036.305 2904.181 2803.573 2803.573 3127.216 
##      351      352      353      354      355      356      357      358 
## 3127.216 3127.216 3127.216 2915.091 2915.091 2915.091 2924.788 3116.306 
##      359      360      361      362      363      364      365      366 
## 3116.306 3116.306 3399.948 3399.948 3419.342 3419.342 3419.342 3419.342 
##      406      407      408      409      426      427      428      429 
## 2813.271 2813.271 2813.271 2813.271 3551.466 3551.466 2884.787 2884.787 
##      430      431      432      433      434      435      436      437 
## 3267.824 3267.824 3267.824 2995.092 3006.001 3006.001 3006.001 3369.644 
##      438      439 
## 3369.644 3551.466
cor(AFint$PricePremium,AFint$FlightDuration)
## [1] 0.3613764
fit<-lm(PriceEconomy~SeatsEconomy,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AFint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2122.21   -92.16   169.54   413.84   834.38 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2710.583    231.850  11.691   <2e-16 ***
## SeatsEconomy    0.276      1.001   0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 754.5 on 72 degrees of freedom
## Multiple R-squared:  0.001056,   Adjusted R-squared:  -0.01282 
## F-statistic: 0.07609 on 1 and 72 DF,  p-value: 0.7835
AFint$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      220      221      222      223      224      225      226      227 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      228      229      230      231      232      233      234      235 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      236      237      238      239      339      340      341      342 
## 2751.162 2751.162 2751.162 2751.162 2765.792 2765.792 2765.792 2765.792 
##      343      344      345      346      347      348      349      350 
## 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 
##      351      352      353      354      355      356      357      358 
## 2765.792 2765.792 2765.792 2758.615 2758.615 2758.615 2758.615 2765.792 
##      359      360      361      362      363      364      365      366 
## 2765.792 2765.792 2758.615 2758.615 2765.792 2765.792 2765.792 2765.792 
##      406      407      408      409      426      427      428      429 
## 2770.209 2770.209 2770.209 2770.209 2817.965 2817.965 2817.965 2817.965 
##      430      431      432      433      434      435      436      437 
## 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 
##      438      439 
## 2817.965 2817.965
cor(AFint$PricePremium,AFint$SeatsEconomy)
## [1] 0.1507589
fit<-lm(PriceEconomy~SeatsPremium,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = AFint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2067.3   -18.4   140.1   507.5   877.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2231.79     384.95   5.798 1.66e-07 ***
## SeatsPremium    20.15      14.05   1.434    0.156    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 744.3 on 72 degrees of freedom
## Multiple R-squared:  0.02778,    Adjusted R-squared:  0.01427 
## F-statistic: 2.057 on 1 and 72 DF,  p-value: 0.1558
AFint$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      220      221      222      223      224      225      226      227 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      228      229      230      231      232      233      234      235 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      236      237      238      239      339      340      341      342 
## 2654.889 2654.889 2654.889 2654.889 2795.921 2795.921 2795.921 2795.921 
##      343      344      345      346      347      348      349      350 
## 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 
##      351      352      353      354      355      356      357      358 
## 2795.921 2795.921 2795.921 2715.331 2715.331 2715.331 2715.331 2795.921 
##      359      360      361      362      363      364      365      366 
## 2795.921 2795.921 2715.331 2715.331 2795.921 2795.921 2795.921 2795.921 
##      406      407      408      409      426      427      428      429 
## 2715.331 2715.331 2715.331 2715.331 2997.396 2997.396 2997.396 2997.396 
##      430      431      432      433      434      435      436      437 
## 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 
##      438      439 
## 2997.396 2997.396
cor(AFint$PricePremium,AFint$SeatsPremium)
## [1] 0.2995749
fit<-lm(PriceEconomy~PriceRelative,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AFint)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1090.05  -316.43    34.09   157.14   535.14 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3107.32      43.57   71.32   <2e-16 ***
## PriceRelative -1648.71      96.03  -17.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 334.5 on 72 degrees of freedom
## Multiple R-squared:  0.8037, Adjusted R-squared:  0.801 
## F-statistic: 294.8 on 1 and 72 DF,  p-value: < 2.2e-16
AFint$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##       212       213       214       215       216       217       218 
##  535.3341 1178.3316 2068.6358 2975.4271 2975.4271 2975.4271 2975.4271 
##       219       220       221       222       223       224       225 
## 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 
##       226       227       228       229       230       231       232 
## 2991.9142 2991.9142 2991.9142 2991.9142 2991.9142 3041.3756 3057.8627 
##       233       234       235       236       237       238       239 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       339       340       341       342       343       344       345 
## 2513.7879 2513.7879 2513.7879 2975.4271 2991.9142 2991.9142 2991.9142 
##       346       347       348       349       350       351       352 
## 2991.9142 3041.3756 3041.3756 3041.3756 3057.8627 3057.8627 3057.8627 
##       353       354       355       356       357       358       359 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       360       361       362       363       364       365       366 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       406       407       408       409       426       427       428 
##  403.4371  403.4371  733.1795 2184.0456 1194.8187 1194.8187 2975.4271 
##       429       430       431       432       433       434       435 
## 2975.4271 2991.9142 2991.9142 2991.9142 3041.3756 3041.3756 3041.3756 
##       436       437       438       439 
## 3041.3756 3057.8627 3057.8627 3074.3498
cor(AFint$PricePremium,AFint$PriceRelative)
## [1] -0.6500079
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AFint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AFint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2228.1  -199.1   220.2   450.3  1083.2 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          1648.88     715.06   2.306    0.024 *
## PercentPremiumSeats    96.73      61.26   1.579    0.119  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 742.1 on 72 degrees of freedom
## Multiple R-squared:  0.03347,    Adjusted R-squared:  0.02005 
## F-statistic: 2.494 on 1 and 72 DF,  p-value: 0.1187
AFint$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      220      221      222      223      224      225      226      227 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      228      229      230      231      232      233      234      235 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      236      237      238      239      339      340      341      342 
## 2858.047 2858.047 2858.047 2858.047 2836.765 2836.765 2836.765 2836.765 
##      343      344      345      346      347      348      349      350 
## 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 
##      351      352      353      354      355      356      357      358 
## 2836.765 2836.765 2836.765 2821.288 2821.288 2821.288 2821.288 2836.765 
##      359      360      361      362      363      364      365      366 
## 2836.765 2836.765 2821.288 2821.288 2836.765 2836.765 2836.765 2836.765 
##      406      407      408      409      426      427      428      429 
## 2616.213 2616.213 2616.213 2616.213 2509.805 2509.805 2509.805 2509.805 
##      430      431      432      433      434      435      436      437 
## 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 
##      438      439 
## 2509.805 2509.805
cor(AFint$PricePremium,AFint$PercentPremiumSeats)
## [1] 0.0775941

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(AFboeing$PriceEconomy,AFboeing$TravelMonth,mean))
y2<-c(by(AFboeing$PricePremium,AFboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(AFairbus$PriceEconomy,AFairbus$TravelMonth,mean))
y4<-c(by(AFairbus$PricePremium,AFairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of Delta Airlines

mean(AF$PriceEconomy)
## [1] 2769.784
mean(AF$PricePremium)
## [1] 3065.216
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(AF$PriceEconomy,AF$TravelMonth,mean))
y2<-c(by(AF$PricePremium,AF$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = AF)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2192.13   -43.38   215.62   377.66   667.08 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1849.8      485.8   3.808 0.000292 ***
## FlightDuration    102.3       53.2   1.924 0.058344 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 736.2 on 72 degrees of freedom
## Multiple R-squared:  0.04889,    Adjusted R-squared:  0.03568 
## F-statistic: 3.701 on 1 and 72 DF,  p-value: 0.05834
AF$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2822.135 2822.135 2822.135 2702.384 2702.384 2702.384 2702.384 2702.384 
##      220      221      222      223      224      225      226      227 
## 2702.384 2702.384 2702.384 2600.034 2600.034 2600.034 2548.858 2548.858 
##      228      229      230      231      232      233      234      235 
## 2761.748 2761.748 2761.748 2676.797 2789.383 2789.383 2796.547 2796.547 
##      236      237      238      239      339      340      341      342 
## 2787.336 2787.336 2796.547 2796.547 2702.384 2702.384 2702.384 2617.433 
##      343      344      345      346      347      348      349      350 
## 2548.858 2745.372 2745.372 2745.372 2633.809 2548.858 2548.858 2822.135 
##      351      352      353      354      355      356      357      358 
## 2822.135 2822.135 2822.135 2643.021 2643.021 2643.021 2651.209 2812.923 
##      359      360      361      362      363      364      365      366 
## 2812.923 2812.923 3052.424 3052.424 3068.800 3068.800 3068.800 3068.800 
##      406      407      408      409      426      427      428      429 
## 2557.046 2557.046 2557.046 2557.046 3180.362 3180.362 2617.433 2617.433 
##      430      431      432      433      434      435      436      437 
## 2940.862 2940.862 2940.862 2710.573 2719.784 2719.784 2719.784 3026.836 
##      438      439 
## 3026.836 3180.362
cor(AF$PriceEconomy,AF$FlightDuration)
## [1] 0.2211007
fit<-lm(PriceEconomy~SeatsEconomy,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AF)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2122.21   -92.16   169.54   413.84   834.38 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2710.583    231.850  11.691   <2e-16 ***
## SeatsEconomy    0.276      1.001   0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 754.5 on 72 degrees of freedom
## Multiple R-squared:  0.001056,   Adjusted R-squared:  -0.01282 
## F-statistic: 0.07609 on 1 and 72 DF,  p-value: 0.7835
AF$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      220      221      222      223      224      225      226      227 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      228      229      230      231      232      233      234      235 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      236      237      238      239      339      340      341      342 
## 2751.162 2751.162 2751.162 2751.162 2765.792 2765.792 2765.792 2765.792 
##      343      344      345      346      347      348      349      350 
## 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 
##      351      352      353      354      355      356      357      358 
## 2765.792 2765.792 2765.792 2758.615 2758.615 2758.615 2758.615 2765.792 
##      359      360      361      362      363      364      365      366 
## 2765.792 2765.792 2758.615 2758.615 2765.792 2765.792 2765.792 2765.792 
##      406      407      408      409      426      427      428      429 
## 2770.209 2770.209 2770.209 2770.209 2817.965 2817.965 2817.965 2817.965 
##      430      431      432      433      434      435      436      437 
## 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 
##      438      439 
## 2817.965 2817.965
cor(AF$PriceEconomy,AF$SeatsEconomy)
## [1] 0.03249046
fit<-lm(PriceEconomy~PriceRelative,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AF)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1090.05  -316.43    34.09   157.14   535.14 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3107.32      43.57   71.32   <2e-16 ***
## PriceRelative -1648.71      96.03  -17.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 334.5 on 72 degrees of freedom
## Multiple R-squared:  0.8037, Adjusted R-squared:  0.801 
## F-statistic: 294.8 on 1 and 72 DF,  p-value: < 2.2e-16
AF$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##       212       213       214       215       216       217       218 
##  535.3341 1178.3316 2068.6358 2975.4271 2975.4271 2975.4271 2975.4271 
##       219       220       221       222       223       224       225 
## 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 
##       226       227       228       229       230       231       232 
## 2991.9142 2991.9142 2991.9142 2991.9142 2991.9142 3041.3756 3057.8627 
##       233       234       235       236       237       238       239 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       339       340       341       342       343       344       345 
## 2513.7879 2513.7879 2513.7879 2975.4271 2991.9142 2991.9142 2991.9142 
##       346       347       348       349       350       351       352 
## 2991.9142 3041.3756 3041.3756 3041.3756 3057.8627 3057.8627 3057.8627 
##       353       354       355       356       357       358       359 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       360       361       362       363       364       365       366 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       406       407       408       409       426       427       428 
##  403.4371  403.4371  733.1795 2184.0456 1194.8187 1194.8187 2975.4271 
##       429       430       431       432       433       434       435 
## 2975.4271 2991.9142 2991.9142 2991.9142 3041.3756 3041.3756 3041.3756 
##       436       437       438       439 
## 3041.3756 3057.8627 3057.8627 3074.3498
cor(AF$PriceEconomy,AF$PriceRelative)
## [1] -0.8964835
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AF)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2228.1  -199.1   220.2   450.3  1083.2 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          1648.88     715.06   2.306    0.024 *
## PercentPremiumSeats    96.73      61.26   1.579    0.119  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 742.1 on 72 degrees of freedom
## Multiple R-squared:  0.03347,    Adjusted R-squared:  0.02005 
## F-statistic: 2.494 on 1 and 72 DF,  p-value: 0.1187
AF$PriceEconomy
##  [1]  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607 2607 2607
## [15] 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165 3165 3165
## [29] 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414 3414
## [43] 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159 3159
## [57]  648  648  700 1094 1522 1522 2581 2581 2996 2996 2996 2979 2979 2979
## [71] 2979 3593 3593 3220
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      220      221      222      223      224      225      226      227 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      228      229      230      231      232      233      234      235 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      236      237      238      239      339      340      341      342 
## 2858.047 2858.047 2858.047 2858.047 2836.765 2836.765 2836.765 2836.765 
##      343      344      345      346      347      348      349      350 
## 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 
##      351      352      353      354      355      356      357      358 
## 2836.765 2836.765 2836.765 2821.288 2821.288 2821.288 2821.288 2836.765 
##      359      360      361      362      363      364      365      366 
## 2836.765 2836.765 2821.288 2821.288 2836.765 2836.765 2836.765 2836.765 
##      406      407      408      409      426      427      428      429 
## 2616.213 2616.213 2616.213 2616.213 2509.805 2509.805 2509.805 2509.805 
##      430      431      432      433      434      435      436      437 
## 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 
##      438      439 
## 2509.805 2509.805
cor(AF$PriceEconomy,AF$PercentPremiumSeats)
## [1] 0.1829589
fit<-lm(PricePremium~FlightDuration,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = AF)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1516.2  -126.4    82.0   302.1   986.6 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1975.68     336.57   5.870 1.23e-07 ***
## FlightDuration   121.21      36.86   3.289  0.00156 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 510 on 72 degrees of freedom
## Multiple R-squared:  0.1306, Adjusted R-squared:  0.1185 
## F-statistic: 10.82 on 1 and 72 DF,  p-value: 0.001559
AF$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 3127.216 3127.216 3127.216 2985.395 2985.395 2985.395 2985.395 2985.395 
##      220      221      222      223      224      225      226      227 
## 2985.395 2985.395 2985.395 2864.181 2864.181 2864.181 2803.573 2803.573 
##      228      229      230      231      232      233      234      235 
## 3055.699 3055.699 3055.699 2955.091 3088.427 3088.427 3096.912 3096.912 
##      236      237      238      239      339      340      341      342 
## 3086.003 3086.003 3096.912 3096.912 2985.395 2985.395 2985.395 2884.787 
##      343      344      345      346      347      348      349      350 
## 2803.573 3036.305 3036.305 3036.305 2904.181 2803.573 2803.573 3127.216 
##      351      352      353      354      355      356      357      358 
## 3127.216 3127.216 3127.216 2915.091 2915.091 2915.091 2924.788 3116.306 
##      359      360      361      362      363      364      365      366 
## 3116.306 3116.306 3399.948 3399.948 3419.342 3419.342 3419.342 3419.342 
##      406      407      408      409      426      427      428      429 
## 2813.271 2813.271 2813.271 2813.271 3551.466 3551.466 2884.787 2884.787 
##      430      431      432      433      434      435      436      437 
## 3267.824 3267.824 3267.824 2995.092 3006.001 3006.001 3006.001 3369.644 
##      438      439 
## 3369.644 3551.466
cor(AF$PricePremium,AF$FlightDuration)
## [1] 0.3613764
fit<-lm(PriceEconomy~SeatsEconomy,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = AF)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2122.21   -92.16   169.54   413.84   834.38 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2710.583    231.850  11.691   <2e-16 ***
## SeatsEconomy    0.276      1.001   0.276    0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 754.5 on 72 degrees of freedom
## Multiple R-squared:  0.001056,   Adjusted R-squared:  -0.01282 
## F-statistic: 0.07609 on 1 and 72 DF,  p-value: 0.7835
AF$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      220      221      222      223      224      225      226      227 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      228      229      230      231      232      233      234      235 
## 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 2751.162 
##      236      237      238      239      339      340      341      342 
## 2751.162 2751.162 2751.162 2751.162 2765.792 2765.792 2765.792 2765.792 
##      343      344      345      346      347      348      349      350 
## 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 2765.792 
##      351      352      353      354      355      356      357      358 
## 2765.792 2765.792 2765.792 2758.615 2758.615 2758.615 2758.615 2765.792 
##      359      360      361      362      363      364      365      366 
## 2765.792 2765.792 2758.615 2758.615 2765.792 2765.792 2765.792 2765.792 
##      406      407      408      409      426      427      428      429 
## 2770.209 2770.209 2770.209 2770.209 2817.965 2817.965 2817.965 2817.965 
##      430      431      432      433      434      435      436      437 
## 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 2817.965 
##      438      439 
## 2817.965 2817.965
cor(AF$PricePremium,AF$SeatsEconomy)
## [1] 0.1507589
fit<-lm(PriceEconomy~SeatsPremium,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = AF)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2067.3   -18.4   140.1   507.5   877.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2231.79     384.95   5.798 1.66e-07 ***
## SeatsPremium    20.15      14.05   1.434    0.156    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 744.3 on 72 degrees of freedom
## Multiple R-squared:  0.02778,    Adjusted R-squared:  0.01427 
## F-statistic: 2.057 on 1 and 72 DF,  p-value: 0.1558
AF$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      220      221      222      223      224      225      226      227 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      228      229      230      231      232      233      234      235 
## 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 2654.889 
##      236      237      238      239      339      340      341      342 
## 2654.889 2654.889 2654.889 2654.889 2795.921 2795.921 2795.921 2795.921 
##      343      344      345      346      347      348      349      350 
## 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 2795.921 
##      351      352      353      354      355      356      357      358 
## 2795.921 2795.921 2795.921 2715.331 2715.331 2715.331 2715.331 2795.921 
##      359      360      361      362      363      364      365      366 
## 2795.921 2795.921 2715.331 2715.331 2795.921 2795.921 2795.921 2795.921 
##      406      407      408      409      426      427      428      429 
## 2715.331 2715.331 2715.331 2715.331 2997.396 2997.396 2997.396 2997.396 
##      430      431      432      433      434      435      436      437 
## 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 2997.396 
##      438      439 
## 2997.396 2997.396
cor(AF$PricePremium,AF$SeatsPremium)
## [1] 0.2995749
fit<-lm(PriceEconomy~PriceRelative,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = AF)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1090.05  -316.43    34.09   157.14   535.14 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3107.32      43.57   71.32   <2e-16 ***
## PriceRelative -1648.71      96.03  -17.17   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 334.5 on 72 degrees of freedom
## Multiple R-squared:  0.8037, Adjusted R-squared:  0.801 
## F-statistic: 294.8 on 1 and 72 DF,  p-value: < 2.2e-16
AF$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##       212       213       214       215       216       217       218 
##  535.3341 1178.3316 2068.6358 2975.4271 2975.4271 2975.4271 2975.4271 
##       219       220       221       222       223       224       225 
## 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 2975.4271 
##       226       227       228       229       230       231       232 
## 2991.9142 2991.9142 2991.9142 2991.9142 2991.9142 3041.3756 3057.8627 
##       233       234       235       236       237       238       239 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       339       340       341       342       343       344       345 
## 2513.7879 2513.7879 2513.7879 2975.4271 2991.9142 2991.9142 2991.9142 
##       346       347       348       349       350       351       352 
## 2991.9142 3041.3756 3041.3756 3041.3756 3057.8627 3057.8627 3057.8627 
##       353       354       355       356       357       358       359 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       360       361       362       363       364       365       366 
## 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 3057.8627 
##       406       407       408       409       426       427       428 
##  403.4371  403.4371  733.1795 2184.0456 1194.8187 1194.8187 2975.4271 
##       429       430       431       432       433       434       435 
## 2975.4271 2991.9142 2991.9142 2991.9142 3041.3756 3041.3756 3041.3756 
##       436       437       438       439 
## 3041.3756 3057.8627 3057.8627 3074.3498
cor(AF$PricePremium,AF$PriceRelative)
## [1] -0.6500079
fit<-lm(PriceEconomy~PercentPremiumSeats,data = AF)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = AF)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2228.1  -199.1   220.2   450.3  1083.2 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          1648.88     715.06   2.306    0.024 *
## PercentPremiumSeats    96.73      61.26   1.579    0.119  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 742.1 on 72 degrees of freedom
## Multiple R-squared:  0.03347,    Adjusted R-squared:  0.02005 
## F-statistic: 2.494 on 1 and 72 DF,  p-value: 0.1187
AF$PricePremium
##  [1] 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807 2807 2807
## [15] 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275 3275 3275
## [29] 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524 3524
## [43] 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243 3243
## [57] 1710 1710 1710 1710 3289 3289 2781 2781 3196 3196 3196 3088 3088 3088
## [71] 3088 3702 3702 3289
fitted(fit)
##      212      213      214      215      216      217      218      219 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      220      221      222      223      224      225      226      227 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      228      229      230      231      232      233      234      235 
## 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 2858.047 
##      236      237      238      239      339      340      341      342 
## 2858.047 2858.047 2858.047 2858.047 2836.765 2836.765 2836.765 2836.765 
##      343      344      345      346      347      348      349      350 
## 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 2836.765 
##      351      352      353      354      355      356      357      358 
## 2836.765 2836.765 2836.765 2821.288 2821.288 2821.288 2821.288 2836.765 
##      359      360      361      362      363      364      365      366 
## 2836.765 2836.765 2821.288 2821.288 2836.765 2836.765 2836.765 2836.765 
##      406      407      408      409      426      427      428      429 
## 2616.213 2616.213 2616.213 2616.213 2509.805 2509.805 2509.805 2509.805 
##      430      431      432      433      434      435      436      437 
## 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 2509.805 
##      438      439 
## 2509.805 2509.805
cor(AF$PricePremium,AF$PercentPremiumSeats)
## [1] 0.0775941

Singapore Airlines

Analyse all about SGP Airlines:-

SGP <- airline[ which(airline$Airline=='Singapore'),]
View(SGP)
summary(SGP)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus:16   Min.   : 3.83   Aug:11     
##  British  : 0   Boeing:24   1st Qu.: 6.50   Jul: 8     
##  Delta    : 0               Median :12.41   Oct:10     
##  Jet      : 0               Mean   :10.48   Sep:11     
##  Singapore:40               3rd Qu.:13.33              
##  Virgin   : 0               Max.   :14.66              
##       IsInternational  SeatsEconomy    SeatsPremium   PitchEconomy
##  Domestic     : 0     Min.   :184.0   Min.   :28.0   Min.   :32   
##  International:40     1st Qu.:184.0   1st Qu.:28.0   1st Qu.:32   
##                       Median :184.0   Median :28.0   Median :32   
##                       Mean   :243.6   Mean   :31.2   Mean   :32   
##                       3rd Qu.:333.0   3rd Qu.:36.0   3rd Qu.:32   
##                       Max.   :333.0   Max.   :36.0   Max.   :32   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy     PricePremium 
##  Min.   :38    Min.   :19    Min.   :20    Min.   : 505.0   Min.   : 619  
##  1st Qu.:38    1st Qu.:19    1st Qu.:20    1st Qu.: 563.0   1st Qu.:1004  
##  Median :38    Median :19    Median :20    Median : 690.0   Median :1110  
##  Mean   :38    Mean   :19    Mean   :20    Mean   : 860.2   Mean   :1240  
##  3rd Qu.:38    3rd Qu.:19    3rd Qu.:20    3rd Qu.:1223.0   3rd Qu.:1564  
##  Max.   :38    Max.   :19    Max.   :20    Max.   :1431.0   Max.   :1947  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0900   Min.   :212.0   Min.   :6       Min.   :1      
##  1st Qu.:0.1300   1st Qu.:212.0   1st Qu.:6       1st Qu.:1      
##  Median :0.6050   Median :212.0   Median :6       Median :1      
##  Mean   :0.5298   Mean   :274.8   Mean   :6       Mean   :1      
##  3rd Qu.:0.8300   3rd Qu.:369.0   3rd Qu.:6       3rd Qu.:1      
##  Max.   :1.1100   Max.   :369.0   Max.   :6       Max.   :1      
##  PercentPremiumSeats
##  Min.   : 9.76      
##  1st Qu.: 9.76      
##  Median :13.21      
##  Mean   :11.83      
##  3rd Qu.:13.21      
##  Max.   :13.21

Check the all the means now all SGP aircrSGPts

mean(SGP$PriceEconomy)
## [1] 860.25
mean(SGP$PricePremium)
## [1] 1239.925
mean(SGP$FlightDuration)
## [1] 10.481
mean(SGP$PitchEconomy)
## [1] 32
mean(SGP$PitchPremium)
## [1] 38
mean(SGP$WidthEconomy)
## [1] 19
mean(SGP$WidthPremium)
## [1] 20
mean(SGP$PriceRelative)
## [1] 0.52975
mean(SGP$PitchDifference)
## [1] 6
mean(SGP$WidthDifference)
## [1] 1

Now Analyse separately for Each AircrSGPts in SGP Airlines i.e-Boeing and AirBus

SGPboeing <- SGP[ which(SGP$Aircraft=='Boeing'),]
View(SGPboeing)
summary(SGPboeing)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus: 0   Min.   : 3.83   Aug:7      
##  British  : 0   Boeing:24   1st Qu.: 9.66   Jul:4      
##  Delta    : 0               Median :12.41   Oct:6      
##  Jet      : 0               Mean   :11.03   Sep:7      
##  Singapore:24               3rd Qu.:13.91              
##  Virgin   : 0               Max.   :14.66              
##       IsInternational  SeatsEconomy  SeatsPremium  PitchEconomy
##  Domestic     : 0     Min.   :184   Min.   :28    Min.   :32   
##  International:24     1st Qu.:184   1st Qu.:28    1st Qu.:32   
##                       Median :184   Median :28    Median :32   
##                       Mean   :184   Mean   :28    Mean   :32   
##                       3rd Qu.:184   3rd Qu.:28    3rd Qu.:32   
##                       Max.   :184   Max.   :28    Max.   :32   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy     PricePremium 
##  Min.   :38    Min.   :19    Min.   :20    Min.   : 563.0   Min.   : 619  
##  1st Qu.:38    1st Qu.:19    1st Qu.:20    1st Qu.: 747.8   1st Qu.:1242  
##  Median :38    Median :19    Median :20    Median :1215.0   Median :1452  
##  Mean   :38    Mean   :19    Mean   :20    Mean   :1035.4   Mean   :1362  
##  3rd Qu.:38    3rd Qu.:19    3rd Qu.:20    3rd Qu.:1406.0   3rd Qu.:1584  
##  Max.   :38    Max.   :19    Max.   :20    Max.   :1431.0   Max.   :1947  
##  PriceRelative      SeatsTotal  PitchDifference WidthDifference
##  Min.   :0.0900   Min.   :212   Min.   :6       Min.   :1      
##  1st Qu.:0.1000   1st Qu.:212   1st Qu.:6       1st Qu.:1      
##  Median :0.1300   Median :212   Median :6       Median :1      
##  Mean   :0.3496   Mean   :212   Mean   :6       Mean   :1      
##  3rd Qu.:0.6000   3rd Qu.:212   3rd Qu.:6       3rd Qu.:1      
##  Max.   :1.1100   Max.   :212   Max.   :6       Max.   :1      
##  PercentPremiumSeats
##  Min.   :13.21      
##  1st Qu.:13.21      
##  Median :13.21      
##  Mean   :13.21      
##  3rd Qu.:13.21      
##  Max.   :13.21
mean(SGPboeing$PriceEconomy)
## [1] 1035.417
mean(SGPboeing$PricePremium)
## [1] 1361.875
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(SGPboeing$PriceEconomy,SGPboeing$TravelMonth,mean))
y2<-c(by(SGPboeing$PricePremium,SGPboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = SGPboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -414.97 -213.29   99.06  291.13  295.27 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      393.59     187.93   2.094  0.04797 * 
## FlightDuration    58.21      16.22   3.588  0.00164 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 282.5 on 22 degrees of freedom
## Multiple R-squared:  0.3692, Adjusted R-squared:  0.3405 
## F-statistic: 12.88 on 1 and 22 DF,  p-value: 0.001637
SGPboeing$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431
fitted(fit)
##       315       316       317       318       319       320       321 
## 1203.2475 1203.2475 1203.2475 1203.2475 1115.9366 1115.9366 1115.9366 
##       322       323       324       325       326       327       328 
## 1023.9692 1023.9692 1023.9692 1246.9029 1246.9029 1246.9029  955.8668 
##       329       330       331       332       333       334       335 
##  955.8668  955.8668  616.5187  616.5187  616.5187  616.5187 1135.7271 
##       336       337       338 
## 1135.7271 1135.7271 1135.7271
cor(SGPboeing$PriceEconomy,SGPboeing$FlightDuration)
## [1] 0.6076207
fit<-lm(PriceEconomy~SeatsEconomy,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -287.7  179.6  370.6  395.6 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1035.42      71.02   14.58 4.14e-13 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 347.9 on 23 degrees of freedom
SGPboeing$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417
cor(SGPboeing$PriceEconomy,SGPboeing$SeatsEconomy)
## Warning in cor(SGPboeing$PriceEconomy, SGPboeing$SeatsEconomy): the
## standard deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -565.0 -158.7  130.2  289.2  299.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1165.0      103.3  11.276  1.3e-10 ***
## PriceRelative   -370.8      221.6  -1.674    0.108    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 335 on 22 degrees of freedom
## Multiple R-squared:  0.1129, Adjusted R-squared:  0.07261 
## F-statistic: 2.801 on 1 and 22 DF,  p-value: 0.1084
SGPboeing$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431
fitted(fit)
##       315       316       317       318       319       320       321 
##  753.4758  857.2919  857.2919  879.5381  942.5693  942.5693  942.5693 
##       322       323       324       325       326       327       328 
##  961.1079  987.0619  987.0619 1116.8319 1116.8319 1116.8319 1116.8319 
##       329       330       331       332       333       334       335 
## 1116.8319 1116.8319 1127.9551 1127.9551 1127.9551 1127.9551 1131.6628 
##       336       337       338 
## 1131.6628 1131.6628 1131.6628
cor(SGPboeing$PriceEconomy,SGPboeing$PriceRelative)
## [1] -0.3360486
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -287.7  179.6  370.6  395.6 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1035.42      71.02   14.58 4.14e-13 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 347.9 on 23 degrees of freedom
SGPboeing$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417
cor(SGPboeing$PriceEconomy,SGPboeing$PercentPremiumSeats)
## Warning in cor(SGPboeing$PriceEconomy, SGPboeing$PercentPremiumSeats): the
## standard deviation is zero
## [1] NA
fit<-lm(PricePremium~FlightDuration,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = SGPboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -442.96 -127.23  -18.93   71.45  452.11 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      301.63     160.95   1.874   0.0743 .  
## FlightDuration    96.15      13.89   6.921 5.98e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 242 on 22 degrees of freedom
## Multiple R-squared:  0.6853, Adjusted R-squared:  0.671 
## F-statistic: 47.91 on 1 and 22 DF,  p-value: 5.982e-07
SGPboeing$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564
fitted(fit)
##       315       316       317       318       319       320       321 
## 1639.1159 1639.1159 1639.1159 1639.1159 1494.8865 1494.8865 1494.8865 
##       322       323       324       325       326       327       328 
## 1342.9649 1342.9649 1342.9649 1711.2306 1711.2306 1711.2306 1230.4660 
##       329       330       331       332       333       334       335 
## 1230.4660 1230.4660  669.8945  669.8945  669.8945  669.8945 1527.5785 
##       336       337       338 
## 1527.5785 1527.5785 1527.5785
cor(SGPboeing$PricePremium,SGPboeing$FlightDuration)
## [1] 0.8278255
fit<-lm(PriceEconomy~SeatsEconomy,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -287.7  179.6  370.6  395.6 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1035.42      71.02   14.58 4.14e-13 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 347.9 on 23 degrees of freedom
SGPboeing$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417
cor(SGPboeing$PricePremium,SGPboeing$SeatsEconomy)
## Warning in cor(SGPboeing$PricePremium, SGPboeing$SeatsEconomy): the
## standard deviation is zero
## [1] NA
fit<-lm(PriceEconomy~SeatsPremium,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -287.7  179.6  370.6  395.6 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1035.42      71.02   14.58 4.14e-13 ***
## SeatsPremium       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 347.9 on 23 degrees of freedom
SGPboeing$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417
cor(SGPboeing$PricePremium,SGPboeing$SeatsPremium)
## Warning in cor(SGPboeing$PricePremium, SGPboeing$SeatsPremium): the
## standard deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -565.0 -158.7  130.2  289.2  299.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1165.0      103.3  11.276  1.3e-10 ***
## PriceRelative   -370.8      221.6  -1.674    0.108    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 335 on 22 degrees of freedom
## Multiple R-squared:  0.1129, Adjusted R-squared:  0.07261 
## F-statistic: 2.801 on 1 and 22 DF,  p-value: 0.1084
SGPboeing$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564
fitted(fit)
##       315       316       317       318       319       320       321 
##  753.4758  857.2919  857.2919  879.5381  942.5693  942.5693  942.5693 
##       322       323       324       325       326       327       328 
##  961.1079  987.0619  987.0619 1116.8319 1116.8319 1116.8319 1116.8319 
##       329       330       331       332       333       334       335 
## 1116.8319 1116.8319 1127.9551 1127.9551 1127.9551 1127.9551 1131.6628 
##       336       337       338 
## 1131.6628 1131.6628 1131.6628
cor(SGPboeing$PricePremium,SGPboeing$PriceRelative)
## [1] 0.3316675
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGPboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGPboeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -287.7  179.6  370.6  395.6 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1035.42      71.02   14.58 4.14e-13 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 347.9 on 23 degrees of freedom
SGPboeing$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417
cor(SGPboeing$PricePremium,SGPboeing$PercentPremiumSeats)
## Warning in cor(SGPboeing$PricePremium, SGPboeing$PercentPremiumSeats): the
## standard deviation is zero
## [1] NA
SGPairbus <-SGP[ which(SGP$Aircraft=='AirBus'),]
View(SGPairbus)
summary(SGPairbus)
##       Airline     Aircraft  FlightDuration   TravelMonth
##  AirFrance: 0   AirBus:16   Min.   : 6.160   Aug:4      
##  British  : 0   Boeing: 0   1st Qu.: 6.415   Jul:4      
##  Delta    : 0               Median : 9.580   Oct:4      
##  Jet      : 0               Mean   : 9.662   Sep:4      
##  Singapore:16               3rd Qu.:12.828              
##  Virgin   : 0               Max.   :13.330              
##       IsInternational  SeatsEconomy  SeatsPremium  PitchEconomy
##  Domestic     : 0     Min.   :333   Min.   :36    Min.   :32   
##  International:16     1st Qu.:333   1st Qu.:36    1st Qu.:32   
##                       Median :333   Median :36    Median :32   
##                       Mean   :333   Mean   :36    Mean   :32   
##                       3rd Qu.:333   3rd Qu.:36    3rd Qu.:32   
##                       Max.   :333   Max.   :36    Max.   :32   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy    PricePremium 
##  Min.   :38    Min.   :19    Min.   :20    Min.   :505.0   Min.   :1004  
##  1st Qu.:38    1st Qu.:19    1st Qu.:20    1st Qu.:505.0   1st Qu.:1004  
##  Median :38    Median :19    Median :20    Median :597.5   Median :1057  
##  Mean   :38    Mean   :19    Mean   :20    Mean   :597.5   Mean   :1057  
##  3rd Qu.:38    3rd Qu.:19    3rd Qu.:20    3rd Qu.:690.0   3rd Qu.:1110  
##  Max.   :38    Max.   :19    Max.   :20    Max.   :690.0   Max.   :1110  
##  PriceRelative    SeatsTotal  PitchDifference WidthDifference
##  Min.   :0.61   Min.   :369   Min.   :6       Min.   :1      
##  1st Qu.:0.61   1st Qu.:369   1st Qu.:6       1st Qu.:1      
##  Median :0.80   Median :369   Median :6       Median :1      
##  Mean   :0.80   Mean   :369   Mean   :6       Mean   :1      
##  3rd Qu.:0.99   3rd Qu.:369   3rd Qu.:6       3rd Qu.:1      
##  Max.   :0.99   Max.   :369   Max.   :6       Max.   :1      
##  PercentPremiumSeats
##  Min.   :9.76       
##  1st Qu.:9.76       
##  Median :9.76       
##  Mean   :9.76       
##  3rd Qu.:9.76       
##  Max.   :9.76
mean(SGPairbus$PriceEconomy)
## [1] 597.5
mean(SGPairbus$PricePremium)
## [1] 1057
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(SGPairbus$PriceEconomy,SGPairbus$TravelMonth,mean))
y4<-c(by(SGPairbus$PricePremium,SGPairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = SGPairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -94.892 -91.220   0.172  91.392  94.547 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    604.0977    75.5860   7.992 1.39e-06 ***
## FlightDuration  -0.6828     7.3926  -0.092    0.928    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 98.86 on 14 degrees of freedom
## Multiple R-squared:  0.000609,   Adjusted R-squared:  -0.07078 
## F-statistic: 0.008531 on 1 and 14 DF,  p-value: 0.9277
SGPairbus$PriceEconomy
##  [1] 505 505 505 505 505 505 505 505 690 690 690 690 690 690 690 690
fitted(fit)
##      410      411      412      413      414      415      416      417 
## 594.9958 594.9958 594.9958 594.9958 599.8916 599.8916 599.8916 599.8916 
##      418      419      420      421      422      423      424      425 
## 595.4533 595.4533 595.4533 595.4533 599.6594 599.6594 599.6594 599.6594
cor(SGPairbus$PriceEconomy,SGPairbus$FlightDuration)
## [1] -0.02467791
fit<-lm(PriceEconomy~SeatsEconomy,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGPairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -92.5  -92.5    0.0   92.5   92.5 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    597.50      23.88   25.02 1.21e-13 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 95.53 on 15 degrees of freedom
SGPairbus$PriceEconomy
##  [1] 505 505 505 505 505 505 505 505 690 690 690 690 690 690 690 690
fitted(fit)
##   410   411   412   413   414   415   416   417   418   419   420   421 
## 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 
##   422   423   424   425 
## 597.5 597.5 597.5 597.5
cor(SGPairbus$PriceEconomy,SGPairbus$SeatsEconomy)
## Warning in cor(SGPairbus$PriceEconomy, SGPairbus$SeatsEconomy): the
## standard deviation is zero
## [1] NA
fit<-lm(PriceEconomy~PriceRelative,data = SGPairbus)
summary(fit)
## Warning in summary.lm(fit): essentially perfect fit: summary may be
## unreliable
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGPairbus)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -2.984e-13  0.000e+00  0.000e+00  1.421e-14  2.132e-13 
## 
## Coefficients:
##                 Estimate Std. Error    t value Pr(>|t|)    
## (Intercept)    9.870e+02  1.065e-13  9.266e+15   <2e-16 ***
## PriceRelative -4.868e+02  1.295e-13 -3.758e+15   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.846e-14 on 14 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 1.412e+31 on 1 and 14 DF,  p-value: < 2.2e-16
SGPairbus$PriceEconomy
##  [1] 505 505 505 505 505 505 505 505 690 690 690 690 690 690 690 690
fitted(fit)
## 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 
## 505 505 505 505 505 505 505 505 690 690 690 690 690 690 690 690
cor(SGPairbus$PriceEconomy,SGPairbus$PriceRelative)
## [1] -1
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGPairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -92.5  -92.5    0.0   92.5   92.5 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           597.50      23.88   25.02 1.21e-13 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 95.53 on 15 degrees of freedom
SGPairbus$PriceEconomy
##  [1] 505 505 505 505 505 505 505 505 690 690 690 690 690 690 690 690
fitted(fit)
##   410   411   412   413   414   415   416   417   418   419   420   421 
## 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 597.5 
##   422   423   424   425 
## 597.5 597.5 597.5 597.5
fit<-lm(PricePremium~FlightDuration,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = SGPairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -54.370 -52.266   0.099  52.365  54.173 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1060.7803    43.3087  24.493 6.79e-13 ***
## FlightDuration   -0.3912     4.2358  -0.092    0.928    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 56.64 on 14 degrees of freedom
## Multiple R-squared:  0.000609,   Adjusted R-squared:  -0.07078 
## F-statistic: 0.008531 on 1 and 14 DF,  p-value: 0.9277
SGPairbus$PricePremium
##  [1] 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110
## [15] 1110 1110
fitted(fit)
##      410      411      412      413      414      415      416      417 
## 1055.565 1055.565 1055.565 1055.565 1058.370 1058.370 1058.370 1058.370 
##      418      419      420      421      422      423      424      425 
## 1055.827 1055.827 1055.827 1055.827 1058.237 1058.237 1058.237 1058.237
cor(SGPairbus$PricePremium,SGPairbus$FlightDuration)
## [1] -0.02467791
fit<-lm(PricePremium~SeatsEconomy,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = SGPairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##    -53    -53      0     53     53 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1057.00      13.68   77.24   <2e-16 ***
## SeatsEconomy       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 54.74 on 15 degrees of freedom
SGPairbus$PricePremium
##  [1] 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110
## [15] 1110 1110
fitted(fit)
##  410  411  412  413  414  415  416  417  418  419  420  421  422  423  424 
## 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 
##  425 
## 1057
cor(SGPairbus$PricePremium,SGPairbus$SeatsEconomy)
## Warning in cor(SGPairbus$PricePremium, SGPairbus$SeatsEconomy): the
## standard deviation is zero
## [1] NA
fit<-lm(PricePremium~SeatsPremium,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = SGPairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##    -53    -53      0     53     53 
## 
## Coefficients: (1 not defined because of singularities)
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   1057.00      13.68   77.24   <2e-16 ***
## SeatsPremium       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 54.74 on 15 degrees of freedom
SGPairbus$PricePremium
##  [1] 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110
## [15] 1110 1110
fitted(fit)
##  410  411  412  413  414  415  416  417  418  419  420  421  422  423  424 
## 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 
##  425 
## 1057
cor(SGPairbus$PricePremium,SGPairbus$SeatsPremium)
## Warning in cor(SGPairbus$PricePremium, SGPairbus$SeatsPremium): the
## standard deviation is zero
## [1] NA
fit<-lm(PricePremium~PriceRelative,data = SGPairbus)
summary(fit)
## Warning in summary.lm(fit): essentially perfect fit: summary may be
## unreliable
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = SGPairbus)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -3.197e-14 -3.197e-14  0.000e+00  0.000e+00  1.528e-13 
## 
## Coefficients:
##                 Estimate Std. Error    t value Pr(>|t|)    
## (Intercept)    1.280e+03  5.091e-14  2.515e+16   <2e-16 ***
## PriceRelative -2.789e+02  6.192e-14 -4.505e+15   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.706e-14 on 14 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 2.03e+31 on 1 and 14 DF,  p-value: < 2.2e-16
SGPairbus$PricePremium
##  [1] 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110
## [15] 1110 1110
fitted(fit)
##  410  411  412  413  414  415  416  417  418  419  420  421  422  423  424 
## 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 
##  425 
## 1110
cor(SGPairbus$PricePremium,SGPairbus$PriceRelative)
## [1] -1
fit<-lm(PricePremium~PercentPremiumSeats,data = SGPairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = SGPairbus)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##    -53    -53      0     53     53 
## 
## Coefficients: (1 not defined because of singularities)
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1057.00      13.68   77.24   <2e-16 ***
## PercentPremiumSeats       NA         NA      NA       NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 54.74 on 15 degrees of freedom
SGPairbus$PricePremium
##  [1] 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110
## [15] 1110 1110
fitted(fit)
##  410  411  412  413  414  415  416  417  418  419  420  421  422  423  424 
## 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 1057 
##  425 
## 1057
cor(SGPairbus$PricePremium,SGPairbus$PercentPremiumSeats)
## Warning in cor(SGPairbus$PricePremium, SGPairbus$PercentPremiumSeats): the
## standard deviation is zero
## [1] NA

Now We Should Analyse the international aircrafts of Singapore Airlines

SGPint <- SGP[ which(SGP$IsInternational=='International'),]
View(SGPint)
summary(SGPint)
##       Airline     Aircraft  FlightDuration  TravelMonth
##  AirFrance: 0   AirBus:16   Min.   : 3.83   Aug:11     
##  British  : 0   Boeing:24   1st Qu.: 6.50   Jul: 8     
##  Delta    : 0               Median :12.41   Oct:10     
##  Jet      : 0               Mean   :10.48   Sep:11     
##  Singapore:40               3rd Qu.:13.33              
##  Virgin   : 0               Max.   :14.66              
##       IsInternational  SeatsEconomy    SeatsPremium   PitchEconomy
##  Domestic     : 0     Min.   :184.0   Min.   :28.0   Min.   :32   
##  International:40     1st Qu.:184.0   1st Qu.:28.0   1st Qu.:32   
##                       Median :184.0   Median :28.0   Median :32   
##                       Mean   :243.6   Mean   :31.2   Mean   :32   
##                       3rd Qu.:333.0   3rd Qu.:36.0   3rd Qu.:32   
##                       Max.   :333.0   Max.   :36.0   Max.   :32   
##   PitchPremium  WidthEconomy  WidthPremium  PriceEconomy     PricePremium 
##  Min.   :38    Min.   :19    Min.   :20    Min.   : 505.0   Min.   : 619  
##  1st Qu.:38    1st Qu.:19    1st Qu.:20    1st Qu.: 563.0   1st Qu.:1004  
##  Median :38    Median :19    Median :20    Median : 690.0   Median :1110  
##  Mean   :38    Mean   :19    Mean   :20    Mean   : 860.2   Mean   :1240  
##  3rd Qu.:38    3rd Qu.:19    3rd Qu.:20    3rd Qu.:1223.0   3rd Qu.:1564  
##  Max.   :38    Max.   :19    Max.   :20    Max.   :1431.0   Max.   :1947  
##  PriceRelative      SeatsTotal    PitchDifference WidthDifference
##  Min.   :0.0900   Min.   :212.0   Min.   :6       Min.   :1      
##  1st Qu.:0.1300   1st Qu.:212.0   1st Qu.:6       1st Qu.:1      
##  Median :0.6050   Median :212.0   Median :6       Median :1      
##  Mean   :0.5298   Mean   :274.8   Mean   :6       Mean   :1      
##  3rd Qu.:0.8300   3rd Qu.:369.0   3rd Qu.:6       3rd Qu.:1      
##  Max.   :1.1100   Max.   :369.0   Max.   :6       Max.   :1      
##  PercentPremiumSeats
##  Min.   : 9.76      
##  1st Qu.: 9.76      
##  Median :13.21      
##  Mean   :11.83      
##  3rd Qu.:13.21      
##  Max.   :13.21
mean(SGPint$PriceEconomy)
## [1] 860.25
mean(SGPint$PricePremium)
## [1] 1239.925
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(SGPint$PriceEconomy,SGPint$TravelMonth,mean))
y2<-c(by(SGPint$PricePremium,SGPint$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = SGPint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -487.83 -236.24   12.27  286.55  465.16 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      372.49     153.91   2.420  0.02040 * 
## FlightDuration    46.54      13.91   3.345  0.00186 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 311.1 on 38 degrees of freedom
## Multiple R-squared:  0.2274, Adjusted R-squared:  0.2071 
## F-statistic: 11.19 on 1 and 38 DF,  p-value: 0.001863
SGPint$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##       315       316       317       318       319       320       321 
## 1019.8265 1019.8265 1019.8265 1019.8265  950.0205  950.0205  950.0205 
##       322       323       324       325       326       327       328 
##  876.4915  876.4915  876.4915 1054.7295 1054.7295 1054.7295  822.0429 
##       329       330       331       332       333       334       335 
##  822.0429  822.0429  550.7303  550.7303  550.7303  550.7303  965.8432 
##       336       337       338       410       411       412       413 
##  965.8432  965.8432  965.8432  992.8348  992.8348  992.8348  992.8348 
##       414       415       416       417       418       419       420 
##  659.1622  659.1622  659.1622  659.1622  961.6548  961.6548  961.6548 
##       421       422       423       424       425 
##  961.6548  674.9849  674.9849  674.9849  674.9849
cor(SGPint$PriceEconomy,SGPint$FlightDuration)
## [1] 0.4768936
fit<-lm(PriceEconomy~SeatsEconomy,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGPint)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1576.1997   152.7167  10.321 1.41e-12 ***
## SeatsEconomy   -2.9390     0.6005  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGPint$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGPint$PriceEconomy,SGPint$SeatsEconomy)
## [1] -0.6217862
fit<-lm(PriceEconomy~PriceRelative,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGPint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -567.19 -119.84  -66.15  294.53  398.88 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1193.01      79.23   15.06  < 2e-16 ***
## PriceRelative  -628.14     125.13   -5.02 1.25e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 274.5 on 38 degrees of freedom
## Multiple R-squared:  0.3987, Adjusted R-squared:  0.3829 
## F-statistic:  25.2 on 1 and 38 DF,  p-value: 1.248e-05
SGPint$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##       315       316       317       318       319       320       321 
##  495.7722  671.6512  671.6512  709.3395  816.1232  816.1232  816.1232 
##       322       323       324       325       326       327       328 
##  847.5302  891.4999  891.4999 1111.3487 1111.3487 1111.3487 1111.3487 
##       329       330       331       332       333       334       335 
## 1111.3487 1111.3487 1130.1929 1130.1929 1130.1929 1130.1929 1136.4743 
##       336       337       338       410       411       412       413 
## 1136.4743 1136.4743 1136.4743  571.1489  571.1489  571.1489  571.1489 
##       414       415       416       417       418       419       420 
##  571.1489  571.1489  571.1489  571.1489  809.8418  809.8418  809.8418 
##       421       422       423       424       425 
##  809.8418  809.8418  809.8418  809.8418  809.8418
cor(SGPint$PriceEconomy,SGPint$PriceRelative)
## [1] -0.6314474
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGPint)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -641.36     309.94  -2.069   0.0454 *  
## PercentPremiumSeats   126.93      25.94   4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGPint$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGPint$PriceEconomy,SGPint$PercentPremiumSeats)
## [1] 0.6217862
fit<-lm(PricePremium~FlightDuration,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = SGPint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -424.47 -204.11   50.03  173.92  579.42 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      546.31     135.23   4.040 0.000251 ***
## FlightDuration    66.18      12.23   5.413 3.63e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 273.4 on 38 degrees of freedom
## Multiple R-squared:  0.4354, Adjusted R-squared:  0.4205 
## F-statistic:  29.3 on 1 and 38 DF,  p-value: 3.63e-06
SGPint$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##       315       316       317       318       319       320       321 
## 1466.8490 1466.8490 1466.8490 1466.8490 1367.5822 1367.5822 1367.5822 
##       322       323       324       325       326       327       328 
## 1263.0211 1263.0211 1263.0211 1516.4824 1516.4824 1516.4824 1185.5929 
##       329       330       331       332       333       334       335 
## 1185.5929 1185.5929  799.7758  799.7758  799.7758  799.7758 1390.0827 
##       336       337       338       410       411       412       413 
## 1390.0827 1390.0827 1390.0827 1428.4658 1428.4658 1428.4658 1428.4658 
##       414       415       416       417       418       419       420 
##  953.9703  953.9703  953.9703  953.9703 1384.1266 1384.1266 1384.1266 
##       421       422       423       424       425 
## 1384.1266  976.4708  976.4708  976.4708  976.4708
cor(SGPint$PricePremium,SGPint$FlightDuration)
## [1] 0.6598354
fit<-lm(PriceEconomy~SeatsEconomy,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGPint)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1576.1997   152.7167  10.321 1.41e-12 ***
## SeatsEconomy   -2.9390     0.6005  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGPint$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGPint$PricePremium,SGPint$SeatsEconomy)
## [1] -0.4211861
fit<-lm(PriceEconomy~SeatsPremium,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = SGPint)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2568.13     351.71   7.302 9.64e-09 ***
## SeatsPremium   -54.74      11.18  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGPint$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGPint$PricePremium,SGPint$SeatsPremium)
## [1] -0.4211861
fit<-lm(PriceEconomy~PriceRelative,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGPint)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -567.19 -119.84  -66.15  294.53  398.88 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1193.01      79.23   15.06  < 2e-16 ***
## PriceRelative  -628.14     125.13   -5.02 1.25e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 274.5 on 38 degrees of freedom
## Multiple R-squared:  0.3987, Adjusted R-squared:  0.3829 
## F-statistic:  25.2 on 1 and 38 DF,  p-value: 1.248e-05
SGPint$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##       315       316       317       318       319       320       321 
##  495.7722  671.6512  671.6512  709.3395  816.1232  816.1232  816.1232 
##       322       323       324       325       326       327       328 
##  847.5302  891.4999  891.4999 1111.3487 1111.3487 1111.3487 1111.3487 
##       329       330       331       332       333       334       335 
## 1111.3487 1111.3487 1130.1929 1130.1929 1130.1929 1130.1929 1136.4743 
##       336       337       338       410       411       412       413 
## 1136.4743 1136.4743 1136.4743  571.1489  571.1489  571.1489  571.1489 
##       414       415       416       417       418       419       420 
##  571.1489  571.1489  571.1489  571.1489  809.8418  809.8418  809.8418 
##       421       422       423       424       425 
##  809.8418  809.8418  809.8418  809.8418  809.8418
cor(SGPint$PricePremium,SGPint$PriceRelative)
## [1] -0.09445655
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGPint)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGPint)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -641.36     309.94  -2.069   0.0454 *  
## PercentPremiumSeats   126.93      25.94   4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGPint$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGPint$PricePremium,SGPint$PercentPremiumSeats)
## [1] 0.4211861

Now It’s time for comparison-

par(mfrow=c(1, 2))
main="Boeing vs AirBus"
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(SGPboeing$PriceEconomy,SGPboeing$TravelMonth,mean))
y2<-c(by(SGPboeing$PricePremium,SGPboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(SGPairbus$PriceEconomy,SGPairbus$TravelMonth,mean))
y4<-c(by(SGPairbus$PricePremium,SGPairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(main="mean prices of economy & premium tickets in Boeing",data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Boeing)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'
plot_ly(main="mean prices of economy & premium tickets in Airbus"
,data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price(In Airbus)"),
            margin = list(b = 100),
            barmode = 'group')
## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

## Warning: 'bar' objects don't have these attributes: 'main'
## Valid attributes include:
## 'type', 'visible', 'showlegend', 'legendgroup', 'opacity', 'name', 'uid', 'ids', 'customdata', 'hoverinfo', 'hoverlabel', 'stream', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'textposition', 'textfont', 'insidetextfont', 'outsidetextfont', 'orientation', 'base', 'offset', 'width', 'marker', 'r', 't', 'error_y', 'error_x', '_deprecated', 'xaxis', 'yaxis', 'xcalendar', 'ycalendar', 'idssrc', 'customdatasrc', 'hoverinfosrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'textpositionsrc', 'basesrc', 'offsetsrc', 'widthsrc', 'rsrc', 'tsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule'

short Analysis of Singapore Airlines

mean(SGP$PriceEconomy)
## [1] 860.25
mean(SGP$PricePremium)
## [1] 1239.925
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(SGP$PriceEconomy,SGP$TravelMonth,mean))
y2<-c(by(SGP$PricePremium,SGP$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = SGP)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -487.83 -236.24   12.27  286.55  465.16 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      372.49     153.91   2.420  0.02040 * 
## FlightDuration    46.54      13.91   3.345  0.00186 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 311.1 on 38 degrees of freedom
## Multiple R-squared:  0.2274, Adjusted R-squared:  0.2071 
## F-statistic: 11.19 on 1 and 38 DF,  p-value: 0.001863
SGP$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##       315       316       317       318       319       320       321 
## 1019.8265 1019.8265 1019.8265 1019.8265  950.0205  950.0205  950.0205 
##       322       323       324       325       326       327       328 
##  876.4915  876.4915  876.4915 1054.7295 1054.7295 1054.7295  822.0429 
##       329       330       331       332       333       334       335 
##  822.0429  822.0429  550.7303  550.7303  550.7303  550.7303  965.8432 
##       336       337       338       410       411       412       413 
##  965.8432  965.8432  965.8432  992.8348  992.8348  992.8348  992.8348 
##       414       415       416       417       418       419       420 
##  659.1622  659.1622  659.1622  659.1622  961.6548  961.6548  961.6548 
##       421       422       423       424       425 
##  961.6548  674.9849  674.9849  674.9849  674.9849
cor(SGP$PriceEconomy,SGP$FlightDuration)
## [1] 0.4768936
fit<-lm(PriceEconomy~SeatsEconomy,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGP)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1576.1997   152.7167  10.321 1.41e-12 ***
## SeatsEconomy   -2.9390     0.6005  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGP$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGP$PriceEconomy,SGP$SeatsEconomy)
## [1] -0.6217862
fit<-lm(PriceEconomy~PriceRelative,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGP)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -567.19 -119.84  -66.15  294.53  398.88 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1193.01      79.23   15.06  < 2e-16 ***
## PriceRelative  -628.14     125.13   -5.02 1.25e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 274.5 on 38 degrees of freedom
## Multiple R-squared:  0.3987, Adjusted R-squared:  0.3829 
## F-statistic:  25.2 on 1 and 38 DF,  p-value: 1.248e-05
SGP$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##       315       316       317       318       319       320       321 
##  495.7722  671.6512  671.6512  709.3395  816.1232  816.1232  816.1232 
##       322       323       324       325       326       327       328 
##  847.5302  891.4999  891.4999 1111.3487 1111.3487 1111.3487 1111.3487 
##       329       330       331       332       333       334       335 
## 1111.3487 1111.3487 1130.1929 1130.1929 1130.1929 1130.1929 1136.4743 
##       336       337       338       410       411       412       413 
## 1136.4743 1136.4743 1136.4743  571.1489  571.1489  571.1489  571.1489 
##       414       415       416       417       418       419       420 
##  571.1489  571.1489  571.1489  571.1489  809.8418  809.8418  809.8418 
##       421       422       423       424       425 
##  809.8418  809.8418  809.8418  809.8418  809.8418
cor(SGP$PriceEconomy,SGP$PriceRelative)
## [1] -0.6314474
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGP)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -641.36     309.94  -2.069   0.0454 *  
## PercentPremiumSeats   126.93      25.94   4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGP$PriceEconomy
##  [1]  794  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247
## [15] 1247 1247  563  563  563  563 1431 1431 1431 1431  505  505  505  505
## [29]  505  505  505  505  690  690  690  690  690  690  690  690
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGP$PriceEconomy,SGP$PercentPremiumSeats)
## [1] 0.6217862
fit<-lm(PricePremium~FlightDuration,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = SGP)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -424.47 -204.11   50.03  173.92  579.42 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      546.31     135.23   4.040 0.000251 ***
## FlightDuration    66.18      12.23   5.413 3.63e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 273.4 on 38 degrees of freedom
## Multiple R-squared:  0.4354, Adjusted R-squared:  0.4205 
## F-statistic:  29.3 on 1 and 38 DF,  p-value: 3.63e-06
SGP$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##       315       316       317       318       319       320       321 
## 1466.8490 1466.8490 1466.8490 1466.8490 1367.5822 1367.5822 1367.5822 
##       322       323       324       325       326       327       328 
## 1263.0211 1263.0211 1263.0211 1516.4824 1516.4824 1516.4824 1185.5929 
##       329       330       331       332       333       334       335 
## 1185.5929 1185.5929  799.7758  799.7758  799.7758  799.7758 1390.0827 
##       336       337       338       410       411       412       413 
## 1390.0827 1390.0827 1390.0827 1428.4658 1428.4658 1428.4658 1428.4658 
##       414       415       416       417       418       419       420 
##  953.9703  953.9703  953.9703  953.9703 1384.1266 1384.1266 1384.1266 
##       421       422       423       424       425 
## 1384.1266  976.4708  976.4708  976.4708  976.4708
cor(SGP$PricePremium,SGP$FlightDuration)
## [1] 0.6598354
fit<-lm(PriceEconomy~SeatsEconomy,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = SGP)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1576.1997   152.7167  10.321 1.41e-12 ***
## SeatsEconomy   -2.9390     0.6005  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGP$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGP$PricePremium,SGP$SeatsEconomy)
## [1] -0.4211861
fit<-lm(PriceEconomy~SeatsPremium,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = SGP)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2568.13     351.71   7.302 9.64e-09 ***
## SeatsPremium   -54.74      11.18  -4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGP$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGP$PricePremium,SGP$SeatsPremium)
## [1] -0.4211861
fit<-lm(PriceEconomy~PriceRelative,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = SGP)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -567.19 -119.84  -66.15  294.53  398.88 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1193.01      79.23   15.06  < 2e-16 ***
## PriceRelative  -628.14     125.13   -5.02 1.25e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 274.5 on 38 degrees of freedom
## Multiple R-squared:  0.3987, Adjusted R-squared:  0.3829 
## F-statistic:  25.2 on 1 and 38 DF,  p-value: 1.248e-05
SGP$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##       315       316       317       318       319       320       321 
##  495.7722  671.6512  671.6512  709.3395  816.1232  816.1232  816.1232 
##       322       323       324       325       326       327       328 
##  847.5302  891.4999  891.4999 1111.3487 1111.3487 1111.3487 1111.3487 
##       329       330       331       332       333       334       335 
## 1111.3487 1111.3487 1130.1929 1130.1929 1130.1929 1130.1929 1136.4743 
##       336       337       338       410       411       412       413 
## 1136.4743 1136.4743 1136.4743  571.1489  571.1489  571.1489  571.1489 
##       414       415       416       417       418       419       420 
##  571.1489  571.1489  571.1489  571.1489  809.8418  809.8418  809.8418 
##       421       422       423       424       425 
##  809.8418  809.8418  809.8418  809.8418  809.8418
cor(SGP$PricePremium,SGP$PriceRelative)
## [1] -0.09445655
fit<-lm(PriceEconomy~PercentPremiumSeats,data = SGP)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = SGP)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -472.4 -179.9   92.5  187.6  395.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -641.36     309.94  -2.069   0.0454 *  
## PercentPremiumSeats   126.93      25.94   4.894 1.85e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 277.2 on 38 degrees of freedom
## Multiple R-squared:  0.3866, Adjusted R-squared:  0.3705 
## F-statistic: 23.95 on 1 and 38 DF,  p-value: 1.848e-05
SGP$PricePremium
##  [1] 1671 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407
## [15] 1407 1407  619  619  619  619 1564 1564 1564 1564 1004 1004 1004 1004
## [29] 1004 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110
fitted(fit)
##      315      316      317      318      319      320      321      322 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      323      324      325      326      327      328      329      330 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      331      332      333      334      335      336      337      338 
## 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 1035.417 
##      410      411      412      413      414      415      416      417 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500 
##      418      419      420      421      422      423      424      425 
##  597.500  597.500  597.500  597.500  597.500  597.500  597.500  597.500
cor(SGP$PricePremium,SGP$PercentPremiumSeats)
## [1] 0.4211861

Now we should analysis all international aircrafts because Only Delta Airlines has domestic aircrafts.If we want to analyse domestic aircrafts,then we can analyse Delta-Domestic Aircrafts only.

International Aircrafts

Analyse all about International aircrafts of all airlines:-

INTL <- airline[ which(airline$IsInternational=='International'),]
View(INTL)
summary(INTL)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance: 74   AirBus:145   Min.   : 1.250   Aug:117    
##  British  :175   Boeing:273   1st Qu.: 5.473   Jul: 65    
##  Delta    :  6                Median : 8.330   Oct:116    
##  Jet      : 61                Mean   : 7.988   Sep:120    
##  Singapore: 40                3rd Qu.:10.830              
##  Virgin   : 62                Max.   :14.660              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :  0    Min.   :122.0   Min.   : 8.00   Min.   :30.00  
##  International:418    1st Qu.:147.0   1st Qu.:28.00   1st Qu.:31.00  
##                       Median :198.0   Median :36.00   Median :31.00  
##                       Mean   :209.9   Mean   :34.93   Mean   :31.16  
##                       3rd Qu.:243.0   3rd Qu.:40.00   3rd Qu.:32.00  
##                       Max.   :389.0   Max.   :66.00   Max.   :32.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy 
##  Min.   :38.00   Min.   :17.00   Min.   :19.00   Min.   :  65  
##  1st Qu.:38.00   1st Qu.:18.00   1st Qu.:19.00   1st Qu.: 509  
##  Median :38.00   Median :18.00   Median :19.00   Median :1434  
##  Mean   :38.26   Mean   :17.89   Mean   :19.68   Mean   :1420  
##  3rd Qu.:38.00   3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:2052  
##  Max.   :40.00   Max.   :19.00   Max.   :21.00   Max.   :3593  
##   PricePremium  PriceRelative      SeatsTotal    PitchDifference 
##  Min.   :  86   Min.   :0.0200   Min.   :140.0   Min.   : 6.000  
##  1st Qu.: 789   1st Qu.:0.1400   1st Qu.:168.0   1st Qu.: 6.000  
##  Median :2084   Median :0.4000   Median :228.0   Median : 7.000  
##  Mean   :1985   Mean   :0.5257   Mean   :244.8   Mean   : 7.098  
##  3rd Qu.:2999   3rd Qu.:0.7975   3rd Qu.:279.0   3rd Qu.: 7.000  
##  Max.   :7414   Max.   :1.8900   Max.   :441.0   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :1.000   Min.   : 4.71      
##  1st Qu.:1.000   1st Qu.:12.28      
##  Median :1.000   Median :13.21      
##  Mean   :1.789   Mean   :14.65      
##  3rd Qu.:3.000   3rd Qu.:15.36      
##  Max.   :4.000   Max.   :24.69

Check the all the means now all INTL aircrafts

mean(INTL$PriceEconomy)
## [1] 1419.943
mean(INTL$PricePremium)
## [1] 1984.909
mean(INTL$FlightDuration)
## [1] 7.987584
mean(INTL$PitchEconomy)
## [1] 31.16029
mean(INTL$PitchPremium)
## [1] 38.25837
mean(INTL$WidthEconomy)
## [1] 17.88995
mean(INTL$WidthPremium)
## [1] 19.67943
mean(INTL$PriceRelative)
## [1] 0.5257177
mean(INTL$PitchDifference)
## [1] 7.098086
mean(INTL$WidthDifference)
## [1] 1.789474

Now Analyse separately for Each Aircrafts in INTL Airlines i.e-Boeing and AirBus

INTLboeing <- INTL[ which(INTL$Aircraft=='Boeing'),]
View(INTLboeing)
summary(INTLboeing)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance: 38   AirBus:  0   Min.   : 1.250   Aug:78     
##  British  :128   Boeing:273   1st Qu.: 4.910   Jul:40     
##  Delta    :  0                Median : 8.660   Oct:78     
##  Jet      : 54                Mean   : 8.162   Sep:77     
##  Singapore: 24                3rd Qu.:11.080              
##  Virgin   : 29                Max.   :14.660              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :  0    Min.   :122.0   Min.   : 8.00   Min.   :30.00  
##  International:273    1st Qu.:124.0   1st Qu.:28.00   1st Qu.:31.00  
##                       Median :184.0   Median :35.00   Median :31.00  
##                       Mean   :188.3   Mean   :32.23   Mean   :31.03  
##                       3rd Qu.:243.0   3rd Qu.:40.00   3rd Qu.:31.00  
##                       Max.   :389.0   Max.   :66.00   Max.   :32.00  
##   PitchPremium   WidthEconomy    WidthPremium   PriceEconomy 
##  Min.   :38.0   Min.   :17.00   Min.   :19.0   Min.   :  65  
##  1st Qu.:38.0   1st Qu.:17.00   1st Qu.:19.0   1st Qu.: 563  
##  Median :38.0   Median :18.00   Median :19.0   Median :1406  
##  Mean   :38.4   Mean   :17.77   Mean   :19.7   Mean   :1423  
##  3rd Qu.:38.0   3rd Qu.:18.00   3rd Qu.:21.0   3rd Qu.:1824  
##  Max.   :40.0   Max.   :19.00   Max.   :21.0   Max.   :3593  
##   PricePremium  PriceRelative     SeatsTotal    PitchDifference 
##  Min.   :  86   Min.   :0.030   Min.   :140.0   Min.   : 6.000  
##  1st Qu.: 797   1st Qu.:0.240   1st Qu.:162.0   1st Qu.: 7.000  
##  Median :1866   Median :0.420   Median :212.0   Median : 7.000  
##  Mean   :2012   Mean   :0.577   Mean   :220.5   Mean   : 7.366  
##  3rd Qu.:3019   3rd Qu.:0.830   3rd Qu.:279.0   3rd Qu.: 7.000  
##  Max.   :7414   Max.   :1.890   Max.   :441.0   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :1.000   Min.   : 4.71      
##  1st Qu.:1.000   1st Qu.:12.12      
##  Median :1.000   Median :12.90      
##  Mean   :1.923   Mean   :15.07      
##  3rd Qu.:3.000   3rd Qu.:18.73      
##  Max.   :4.000   Max.   :24.69
mean(INTLboeing$PriceEconomy)
## [1] 1422.758
mean(INTLboeing$PricePremium)
## [1] 2011.872
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(INTLboeing$PriceEconomy,INTLboeing$TravelMonth,mean))
y2<-c(by(INTLboeing$PricePremium,INTLboeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = INTLboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1581.6  -558.8  -113.8   449.8  1875.6 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      234.79     126.41   1.857   0.0644 .  
## FlightDuration   145.55      14.22  10.238   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 828.9 on 271 degrees of freedom
## Multiple R-squared:  0.2789, Adjusted R-squared:  0.2762 
## F-statistic: 104.8 on 1 and 271 DF,  p-value: < 2.2e-16
INTLboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  354
##  [71]  354  354  354  464  464  464  489  137  109   77   77   69   65  574
##  [85]  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580
##  [99] 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356
## [113] 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281
## [127] 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140
## [141] 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  794
## [155]  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247 1247
## [169] 1247  563  563  563  563 1431 1431 1431 1431 2918 2918 2918 2581 2860
## [183] 3026 3026 3026 3057 3057 3057 3414 3414 3414 3414 3215 3215 3215 3215
## [197] 3480 3480 3480 3593 3593 3159 3159 3159 3159 3102 3102 3102 2166 2166
## [211] 2166  649  575  575  797  524  582  167  167  167  139  149  197  211
## [225]  139  118  118  118  108  108  108  297  234  156  156  324  147  127
## [239]  154  154  154  154  322  594  648  648  700 1094 2996 2996 2996 2979
## [253] 3593 3593  201  148  148  187  187  187  187  245  234  172  172  172
## [267]  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 2017.8081 2017.8081 2017.8081 2017.8081 1422.4970 1422.4970 1422.4970 
##         8         9        10        11        12        13        14 
## 1180.8793 1180.8793 1908.6435 1908.6435 1908.6435 1908.6435 1920.2877 
##        15        16        17        18        19        20        21 
## 1920.2877 1920.2877 1568.0498 1568.0498 1568.0498 1217.2675 1217.2675 
##        22        23        24        25        26        27        28 
## 1217.2675 1204.1677 1204.1677 1204.1677 1508.3732 1508.3732 1508.3732 
##        29        30        31        32        33        34        35 
##  949.4503  949.4503  949.4503  792.2532  792.2532  792.2532  792.2532 
##        36        37        38        39        40        41        42 
## 2199.7491 2199.7491 2199.7491  792.2532  792.2532  792.2532  792.2532 
##        43        44        45        46        47        48        49 
## 1022.2267 1022.2267 1022.2267 1435.5967 1435.5967 1435.5967 2090.5845 
##        50        51        52        53        54        55        56 
## 2090.5845 2090.5845 1180.8793 1847.5113 1847.5113 1847.5113 1119.7471 
##        57        58        59        60        61        82        83 
## 1119.7471 1119.7471 2054.1963 1988.6975 2054.1963 1228.9117 1228.9117 
##        84        85        86        87        88        89        90 
## 1228.9117 1228.9117 1338.0763 1338.0763 1338.0763 1338.0763  683.0886 
##        91        92        93        94        95        96        97 
##  683.0886  683.0886  683.0886  683.0886  683.0886  683.0886  683.0886 
##       138       144       147       148       149       151       156 
##  416.7269  416.7269  428.3711  428.3711  416.7269  428.3711 1872.2553 
##       157       158       159       160       161       162       163 
## 1872.2553 1872.2553 1872.2553 1993.0641 1993.0641 1993.0641 1993.0641 
##       164       165       166       167       168       169       170 
## 1677.2145 1677.2145 1677.2145 1677.2145 1811.1231 1811.1231 1811.1231 
##       171       172       173       174       175       176       177 
## 1811.1231 1749.9909 2065.8405 1799.4788 1799.4788 1799.4788 1799.4788 
##       178       179       180       181       182       183       184 
## 2065.8405 1883.8995 1349.7206 1349.7206 1349.7206 1349.7206 2065.8405 
##       240       241       242       243       244       245       246 
## 1749.9909 1749.9909 1749.9909 1835.8670 1835.8670 1835.8670 1677.2145 
##       247       248       249       250       251       252       253 
## 1677.2145 1677.2145 1677.2145 1483.6292 1483.6292 1483.6292 1895.5437 
##       254       255       256       257       258       259       260 
## 1895.5437 1895.5437 1895.5437 1592.7938 1592.7938 1592.7938 1531.6616 
##       261       262       263       264       265       266       267 
## 1495.2734 1495.2734 1495.2734 1290.0439 1290.0439 1290.0439 1531.6616 
##       268       269       270       271       272       273       274 
## 1265.2999 1265.2999 1265.2999 1895.5437 1895.5437 1895.5437 1895.5437 
##       275       276       277       278       279       280       315 
## 1531.6616 1847.5113 1847.5113 1847.5113 1265.2999 1847.5113 2259.4258 
##       316       317       318       319       320       321       322 
## 2259.4258 2259.4258 2259.4258 2041.0965 2041.0965 2041.0965 1811.1231 
##       323       324       325       326       327       328       329 
## 1811.1231 1811.1231 2368.5904 2368.5904 2368.5904 1640.8262 1640.8262 
##       330       331       332       333       334       335       336 
## 1640.8262  792.2532  792.2532  792.2532  792.2532 2090.5845 2090.5845 
##       337       338       339       340       341       342       343 
## 2090.5845 2090.5845 1447.2410 1447.2410 1447.2410 1326.4321 1228.9117 
##       344       345       346       347       348       349       350 
## 1508.3732 1508.3732 1508.3732 1349.7206 1228.9117 1228.9117 1617.5378 
##       351       352       353       354       355       356       357 
## 1617.5378 1617.5378 1617.5378 1362.8203 1362.8203 1362.8203 1374.4646 
##       358       359       360       361       362       363       364 
## 1604.4380 1604.4380 1604.4380 1945.0317 1945.0317 1968.3201 1968.3201 
##       365       366       367       368       369       370       371 
## 1968.3201 1968.3201 2247.7816 2247.7816 2247.7816 2175.0052 2175.0052 
##       372       373       374       375       376       377       378 
## 2175.0052 1531.6616 1531.6616 1531.6616 1629.1820 1629.1820 1629.1820 
##       379       380       381       382       383       384       385 
##  707.8326  707.8326  707.8326  707.8326  707.8326  840.2856  840.2856 
##       386       387       388       389       390       391       392 
##  828.6414  598.6679  598.6679  598.6679  621.9564  621.9564  621.9564 
##       393       394       395       396       397       398       399 
##  840.2856  707.8326  828.6414  840.2856  840.2856  598.6679  621.9564 
##       400       401       402       403       404       405       406 
##  865.0296  865.0296  865.0296  865.0296  707.8326  707.8326 1240.5559 
##       407       408       409       430       431       432       436 
## 1240.5559 1240.5559 1240.5559 1786.3791 1786.3791 1786.3791 1471.9850 
##       437       438       440       441       442       443       444 
## 1908.6435 1908.6435 1058.6149  694.7328  694.7328 1058.6149 1058.6149 
##       445       446       447       448       449       450       451 
## 1058.6149 1058.6149 1058.6149  694.7328  610.3122  610.3122  610.3122 
##       452       453       454       455       456       457       458 
##  694.7328  610.3122  610.3122  610.3122  610.3122  707.8326  610.3122
cor(INTLboeing$PriceEconomy,INTLboeing$FlightDuration)
## [1] 0.5281179
fit<-lm(PriceEconomy~SeatsEconomy,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = INTLboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1939.70  -813.74   -49.35   564.42  2242.65 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  467.7409   169.4286   2.761  0.00616 ** 
## SeatsEconomy   5.0725     0.8502   5.966 7.56e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 917.7 on 271 degrees of freedom
## Multiple R-squared:  0.1161, Adjusted R-squared:  0.1128 
## F-statistic:  35.6 on 1 and 271 DF,  p-value: 7.559e-09
INTLboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  354
##  [71]  354  354  354  464  464  464  489  137  109   77   77   69   65  574
##  [85]  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580
##  [99] 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356
## [113] 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281
## [127] 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140
## [141] 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  794
## [155]  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247 1247
## [169] 1247  563  563  563  563 1431 1431 1431 1431 2918 2918 2918 2581 2860
## [183] 3026 3026 3026 3057 3057 3057 3414 3414 3414 3414 3215 3215 3215 3215
## [197] 3480 3480 3480 3593 3593 3159 3159 3159 3159 3102 3102 3102 2166 2166
## [211] 2166  649  575  575  797  524  582  167  167  167  139  149  197  211
## [225]  139  118  118  118  108  108  108  297  234  156  156  324  147  127
## [239]  154  154  154  154  322  594  648  648  700 1094 2996 2996 2996 2979
## [253] 3593 3593  201  148  148  187  187  187  187  245  234  172  172  172
## [267]  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##        9       10       11       12       13       14       15       16 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       17       18       19       20       21       22       23       24 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       25       26       27       28       29       30       31       32 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       33       34       35       36       37       38       39       40 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       41       42       43       44       45       46       47       48 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       49       50       51       52       53       54       55       56 
## 1086.582 1086.582 1086.582 1111.944 1111.944 1111.944 1111.944 1111.944 
##       57       58       59       60       61       82       83       84 
## 1111.944 1111.944 1111.944 1111.944 1111.944 1700.350 1700.350 1700.350 
##       85       86       87       88       89       90       91       92 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1167.741 1167.741 1167.741 
##       93       94       95       96       97      138      144      147 
## 1167.741 1167.741 1167.741 1167.741 1167.741 2004.698 2004.698 2004.698 
##      148      149      151      156      157      158      159      160 
## 2004.698 2004.698 2004.698 1472.089 1472.089 1472.089 1472.089 1472.089 
##      161      162      163      164      165      166      167      168 
## 1472.089 1472.089 1472.089 2369.916 2369.916 2369.916 2369.916 1472.089 
##      169      170      171      172      173      174      175      176 
## 1472.089 1472.089 1472.089 1472.089 1472.089 2369.916 2369.916 2369.916 
##      177      178      179      180      181      182      183      184 
## 2369.916 1472.089 1472.089 1472.089 1472.089 1472.089 1472.089 1472.089 
##      240      241      242      243      244      245      246      247 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      248      249      250      251      252      253      254      255 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      256      257      258      259      260      261      262      263 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      264      265      266      267      268      269      270      271 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      272      273      274      275      276      277      278      279 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      280      315      316      317      318      319      320      321 
## 1700.350 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      322      323      324      325      326      327      328      329 
## 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      330      331      332      333      334      335      336      337 
## 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      338      339      340      341      342      343      344      345 
## 1401.075 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 
##      346      347      348      349      350      351      352      353 
## 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 
##      354      355      356      357      358      359      360      361 
## 1350.350 1350.350 1350.350 1350.350 1482.234 1482.234 1482.234 1350.350 
##      362      363      364      365      366      367      368      369 
## 1350.350 1482.234 1482.234 1482.234 1482.234 1497.452 1497.452 1497.452 
##      370      371      372      373      374      375      376      377 
## 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 
##      378      379      380      381      382      383      384      385 
## 1497.452 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      386      387      388      389      390      391      392      393 
## 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      394      395      396      397      398      399      400      401 
## 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      402      403      404      405      406      407      408      409 
## 1096.727 1096.727 1096.727 1096.727 1563.394 1563.394 1563.394 1563.394 
##      430      431      432      436      437      438      440      441 
## 2440.931 2440.931 2440.931 2440.931 2440.931 2440.931 1289.481 1289.481 
##      442      443      444      445      446      447      448      449 
## 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 
##      450      451      452      453      454      455      456      457 
## 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 
##      458 
## 1289.481
cor(INTLboeing$PriceEconomy,INTLboeing$SeatsEconomy)
## [1] 0.3407435
fit<-lm(PriceEconomy~PriceRelative,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = INTLboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1635.86  -627.61   -28.31   608.58  2501.19 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    2006.04      80.31  24.979   <2e-16 ***
## PriceRelative -1010.95     107.16  -9.434   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 846.9 on 271 degrees of freedom
## Multiple R-squared:  0.2472, Adjusted R-squared:  0.2445 
## F-statistic: 89.01 on 1 and 271 DF,  p-value: < 2.2e-16
INTLboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  354
##  [71]  354  354  354  464  464  464  489  137  109   77   77   69   65  574
##  [85]  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580
##  [99] 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356
## [113] 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281
## [127] 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140
## [141] 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  794
## [155]  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247 1247
## [169] 1247  563  563  563  563 1431 1431 1431 1431 2918 2918 2918 2581 2860
## [183] 3026 3026 3026 3057 3057 3057 3414 3414 3414 3414 3215 3215 3215 3215
## [197] 3480 3480 3480 3593 3593 3159 3159 3159 3159 3102 3102 3102 2166 2166
## [211] 2166  649  575  575  797  524  582  167  167  167  139  149  197  211
## [225]  139  118  118  118  108  108  108  297  234  156  156  324  147  127
## [239]  154  154  154  154  322  594  648  648  700 1094 2996 2996 2996 2979
## [253] 3593 3593  201  148  148  187  187  187  187  245  234  172  172  172
## [267]  293  281  295  380  380  505  510
fitted(fit)
##          1          2          3          4          5          6 
## 1621.87481 1621.87481 1621.87481 1621.87481 1328.69909 1328.69909 
##          7          8          9         10         11         12 
## 1328.69909  964.75682  964.75682 1247.82303 1247.82303 1439.90367 
##         13         14         15         16         17         18 
## 1743.18890 1480.34170 1480.34170 1480.34170 1621.87481 1621.87481 
##         19         20         21         22         23         24 
## 1621.87481 1662.31284 1662.31284 1662.31284 1672.42234 1672.42234 
##         25         26         27         28         29         30 
## 1672.42234 1652.20333 1672.42234 1672.42234 1662.31284 1662.31284 
##         31         32         33         34         35         36 
## 1662.31284 1581.43678 1581.43678 1581.43678 1581.43678 1348.91810 
##         37         38         39         40         41         42 
## 1348.91810 1348.91810 1763.40791 1763.40791 1763.40791 1763.40791 
##         43         44         45         46         47         48 
## 1834.17446 1834.17446 1834.17446 1925.16003 1925.16003 1925.16003 
##         49         50         51         52         53         54 
## 1480.34170 1480.34170 1480.34170  964.75682 1642.09382 1642.09382 
##         55         56         57         58         59         60 
## 1642.09382 1662.31284 1662.31284 1662.31284 1793.73643 1793.73643 
##         61         82         83         84         85         86 
## 1389.35613  924.31879  924.31879  924.31879  924.31879 1601.65579 
##         87         88         89         90         91         92 
## 1601.65579 1601.65579 1601.65579 1520.77973 1520.77973 1520.77973 
##         93         94         95         96         97        138 
## 1520.77973 1672.42234 1672.42234 1672.42234 1743.18890 1743.18890 
##        144        147        148        149        151        156 
## 1702.75087 1712.86037 1712.86037 1601.65579 1672.42234  166.10572 
##        157        158        159        160        161        162 
##  166.10572  166.10572  166.10572  257.09129  257.09129  257.09129 
##        163        164        165        166        167        168 
##  610.92405 1025.41386 1025.41386 1025.41386 1025.41386 1086.07091 
##        169        170        171        172        173        174 
## 1086.07091 1086.07091 1086.07091 1156.83746 1439.90367 1490.45121 
##        175        176        177        178        179        180 
## 1490.45121 1490.45121 1490.45121 1500.56072 1510.67022 1601.65579 
##        181        182        183        184        240        241 
## 1601.65579 1601.65579 1601.65579 1743.18890  863.66174  863.66174 
##        242        243        244        245        246        247 
## 1743.18890 1551.10825 1551.10825 1551.10825 1642.09382 1642.09382 
##        248        249        250        251        252        253 
## 1642.09382 1642.09382 1015.30435 1015.30435 1015.30435 1672.42234 
##        254        255        256        257        258        259 
## 1672.42234 1672.42234 1672.42234 1642.09382 1642.09382 1642.09382 
##        260        261        262        263        264        265 
##  863.66174 1581.43678 1581.43678 1581.43678 1601.65579 1601.65579 
##        266        267        268        269        270        271 
## 1601.65579 1197.27549 1935.26954 1935.26954 1935.26954  883.88076 
##        272        273        274        275        276        277 
##  883.88076 1086.07091 1803.84594 1197.27549 1834.17446 1834.17446 
##        278        279        280        315        316        317 
## 1834.17446 1793.73643 1429.79416  883.88076 1166.94697 1166.94697 
##        318        319        320        321        322        323 
## 1227.60401 1399.46564 1399.46564 1399.46564 1450.01318 1520.77973 
##        324        325        326        327        328        329 
## 1520.77973 1874.61249 1874.61249 1874.61249 1874.61249 1874.61249 
##        330        331        332        333        334        335 
## 1874.61249 1904.94102 1904.94102 1904.94102 1904.94102 1915.05052 
##        336        337        338        339        340        341 
## 1915.05052 1915.05052 1915.05052 1642.09382 1642.09382 1642.09382 
##        342        343        344        345        346        347 
## 1925.16003 1935.26954 1935.26954 1935.26954 1935.26954 1965.59806 
##        348        349        350        351        352        353 
## 1965.59806 1965.59806 1975.70757 1975.70757 1975.70757 1975.70757 
##        354        355        356        357        358        359 
## 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 
##        360        361        362        363        364        365 
## 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 
##        366        367        368        369        370        371 
## 1975.70757  600.81455  600.81455  600.81455 1864.50299 1864.50299 
##        372        373        374        375        376        377 
## 1864.50299 1227.60401 1520.77973 1520.77973 1965.59806 1480.34170 
##        378        379        380        381        382        383 
## 1631.98431   95.33917   95.33917   95.33917  115.55818  317.74834 
##        384        385        386        387        388        389 
##  348.07686  459.28144  701.90962  732.23814  732.23814  732.23814 
##        390        391        392        393        394        395 
##  883.88076  883.88076  883.88076  904.09977  934.42829  954.64731 
##        396        397        398        399        400        401 
##  954.64731 1086.07091 1187.16598 1207.38500 1257.93253 1257.93253 
##        402        403        404        405        406        407 
## 1257.93253 1257.93253 1500.56072 1834.17446  348.07686  348.07686 
##        408        409        430        431        432        436 
##  550.26701 1439.90367 1935.26954 1935.26954 1935.26954 1965.59806 
##        437        438        440        441        442        443 
## 1975.70757 1975.70757  277.31031  307.63883  307.63883  691.80011 
##        444        445        446        447        448        449 
##  691.80011  691.80011  691.80011  772.67617  924.31879 1227.60401 
##        450        451        452        453        454        455 
## 1227.60401 1227.60401 1348.91810 1399.46564 1419.68466 1551.10825 
##        456        457        458 
## 1551.10825 1621.87481 1884.72200
cor(INTLboeing$PriceEconomy,INTLboeing$PriceRelative)
## [1] -0.497232
fit<-lm(PriceEconomy~PercentPremiumSeats,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = INTLboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1363.8  -821.4   -79.5   435.0  2297.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1111.56     164.40   6.761 8.37e-11 ***
## PercentPremiumSeats    20.65      10.19   2.026   0.0437 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 968.8 on 271 degrees of freedom
## Multiple R-squared:  0.01492,    Adjusted R-squared:  0.01129 
## F-statistic: 4.105 on 1 and 271 DF,  p-value: 0.04372
INTLboeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1444 1444 1444 1444 1824 1824 1824 1823  354
##  [71]  354  354  354  464  464  464  489  137  109   77   77   69   65  574
##  [85]  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580
##  [99] 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356
## [113] 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281
## [127] 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140
## [141] 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  794
## [155]  794  794  794 1215 1215 1215  876  609  609 1406 1406 1406 1247 1247
## [169] 1247  563  563  563  563 1431 1431 1431 1431 2918 2918 2918 2581 2860
## [183] 3026 3026 3026 3057 3057 3057 3414 3414 3414 3414 3215 3215 3215 3215
## [197] 3480 3480 3480 3593 3593 3159 3159 3159 3159 3102 3102 3102 2166 2166
## [211] 2166  649  575  575  797  524  582  167  167  167  139  149  197  211
## [225]  139  118  118  118  108  108  108  297  234  156  156  324  147  127
## [239]  154  154  154  154  322  594  648  648  700 1094 2996 2996 2996 2979
## [253] 3593 3593  201  148  148  187  187  187  187  245  234  172  172  172
## [267]  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##        9       10       11       12       13       14       15       16 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       17       18       19       20       21       22       23       24 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       25       26       27       28       29       30       31       32 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       33       34       35       36       37       38       39       40 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       41       42       43       44       45       46       47       48 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       49       50       51       52       53       54       55       56 
## 1621.501 1621.501 1621.501 1596.717 1596.717 1596.717 1596.717 1596.717 
##       57       58       59       60       61       82       83       84 
## 1596.717 1596.717 1596.717 1596.717 1596.717 1498.405 1498.405 1498.405 
##       85       86       87       88       89       90       91       92 
## 1498.405 1498.405 1498.405 1498.405 1498.405 1459.989 1459.989 1459.989 
##       93       94       95       96       97      138      144      147 
## 1459.989 1459.989 1459.989 1459.989 1459.989 1428.802 1428.802 1428.802 
##      148      149      151      156      157      158      159      160 
## 1428.802 1428.802 1428.802 1421.780 1421.780 1421.780 1421.780 1421.780 
##      161      162      163      164      165      166      167      168 
## 1421.780 1421.780 1421.780 1420.747 1420.747 1420.747 1420.747 1421.780 
##      169      170      171      172      173      174      175      176 
## 1421.780 1421.780 1421.780 1421.780 1421.780 1420.747 1420.747 1420.747 
##      177      178      179      180      181      182      183      184 
## 1420.747 1421.780 1421.780 1421.780 1421.780 1421.780 1421.780 1421.780 
##      240      241      242      243      244      245      246      247 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      248      249      250      251      252      253      254      255 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      256      257      258      259      260      261      262      263 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      264      265      266      267      268      269      270      271 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      272      273      274      275      276      277      278      279 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      280      315      316      317      318      319      320      321 
## 1377.994 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      322      323      324      325      326      327      328      329 
## 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      330      331      332      333      334      335      336      337 
## 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      338      339      340      341      342      343      344      345 
## 1384.397 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 
##      346      347      348      349      350      351      352      353 
## 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 
##      354      355      356      357      358      359      360      361 
## 1361.884 1361.884 1361.884 1361.884 1365.189 1365.189 1365.189 1361.884 
##      362      363      364      365      366      367      368      369 
## 1361.884 1365.189 1365.189 1365.189 1365.189 1329.871 1329.871 1329.871 
##      370      371      372      373      374      375      376      377 
## 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 
##      378      379      380      381      382      383      384      385 
## 1329.871 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      386      387      388      389      390      391      392      393 
## 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      394      395      396      397      398      399      400      401 
## 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      402      403      404      405      406      407      408      409 
## 1347.633 1347.633 1347.633 1347.633 1318.099 1318.099 1318.099 1318.099 
##      430      431      432      436      437      438      440      441 
## 1295.380 1295.380 1295.380 1295.380 1295.380 1295.380 1208.841 1208.841 
##      442      443      444      445      446      447      448      449 
## 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 
##      450      451      452      453      454      455      456      457 
## 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 
##      458 
## 1208.841
cor(INTLboeing$PriceEconomy,INTLboeing$PercentPremiumSeats)
## [1] 0.1221607
fit<-lm(PricePremium~FlightDuration,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = INTLboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2221.0  -648.1    85.7   661.7  4188.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      264.84     157.27   1.684   0.0933 .  
## FlightDuration   214.05      17.69  12.102   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1031 on 271 degrees of freedom
## Multiple R-squared:  0.3508, Adjusted R-squared:  0.3484 
## F-statistic: 146.5 on 1 and 271 DF,  p-value: < 2.2e-16
INTLboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  524
##  [71]  524  524  524  616  616  616  616  172  141   99   99   97   86 1619
##  [85] 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019
##  [99] 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710
## [113] 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025
## [127] 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049
## [141] 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837 1671
## [155] 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407 1407
## [169] 1407  619  619  619  619 1564 1564 1564 1564 3972 3972 3972 2781 3063
## [183] 3226 3226 3226 3167 3167 3167 3524 3524 3524 3524 3325 3325 3325 3325
## [197] 3589 3589 3589 3702 3702 3243 3243 3243 3243 7414 7414 7414 2470 2470
## [211] 2470 1152  853  853  826  797  797  483  483  483  398  398  520  534
## [225]  318  267  267  267  228  228  228  620  483  318  318  620  267  228
## [239]  267  267  267  267  483  696 1710 1710 1710 1710 3196 3196 3196 3088
## [253] 3702 3702  545  397  397  430  430  430  430  545  483  304  304  304
## [267]  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 2886.9523 2886.9523 2886.9523 2886.9523 2011.4876 2011.4876 2011.4876 
##         8         9        10        11        12        13        14 
## 1656.1645 1656.1645 2726.4148 2726.4148 2726.4148 2726.4148 2743.5388 
##        15        16        17        18        19        20        21 
## 2743.5388 2743.5388 2225.5377 2225.5377 2225.5377 1709.6770 1709.6770 
##        22        23        24        25        26        27        28 
## 1709.6770 1690.4125 1690.4125 1690.4125 2137.7771 2137.7771 2137.7771 
##        29        30        31        32        33        34        35 
## 1315.8249 1315.8249 1315.8249 1084.6508 1084.6508 1084.6508 1084.6508 
##        36        37        38        39        40        41        42 
## 3154.5149 3154.5149 3154.5149 1084.6508 1084.6508 1084.6508 1084.6508 
##        43        44        45        46        47        48        49 
## 1422.8499 1422.8499 1422.8499 2030.7521 2030.7521 2030.7521 2993.9774 
##        50        51        52        53        54        55        56 
## 2993.9774 2993.9774 1656.1645 2636.5138 2636.5138 2636.5138 1566.2635 
##        57        58        59        60        61        82        83 
## 1566.2635 1566.2635 2940.4649 2844.1423 2940.4649 1726.8010 1726.8010 
##        84        85        86        87        88        89        90 
## 1726.8010 1726.8010 1887.3386 1887.3386 1887.3386 1887.3386  924.1133 
##        91        92        93        94        95        96        97 
##  924.1133  924.1133  924.1133  924.1133  924.1133  924.1133  924.1133 
##       138       144       147       148       149       151       156 
##  532.4017  532.4017  549.5257  549.5257  532.4017  549.5257 2672.9023 
##       157       158       159       160       161       162       163 
## 2672.9023 2672.9023 2672.9023 2850.5638 2850.5638 2850.5638 2850.5638 
##       164       165       166       167       168       169       170 
## 2386.0752 2386.0752 2386.0752 2386.0752 2583.0013 2583.0013 2583.0013 
##       171       172       173       174       175       176       177 
## 2583.0013 2493.1002 2957.5889 2565.8773 2565.8773 2565.8773 2565.8773 
##       178       179       180       181       182       183       184 
## 2957.5889 2690.0263 1904.4626 1904.4626 1904.4626 1904.4626 2957.5889 
##       240       241       242       243       244       245       246 
## 2493.1002 2493.1002 2493.1002 2619.3898 2619.3898 2619.3898 2386.0752 
##       247       248       249       250       251       252       253 
## 2386.0752 2386.0752 2386.0752 2101.3886 2101.3886 2101.3886 2707.1503 
##       254       255       256       257       258       259       260 
## 2707.1503 2707.1503 2707.1503 2261.9262 2261.9262 2261.9262 2172.0251 
##       261       262       263       264       265       266       267 
## 2118.5126 2118.5126 2118.5126 1816.7020 1816.7020 1816.7020 2172.0251 
##       268       269       270       271       272       273       274 
## 1780.3135 1780.3135 1780.3135 2707.1503 2707.1503 2707.1503 2707.1503 
##       275       276       277       278       279       280       315 
## 2172.0251 2636.5138 2636.5138 2636.5138 1780.3135 2636.5138 3242.2754 
##       316       317       318       319       320       321       322 
## 3242.2754 3242.2754 3242.2754 2921.2004 2921.2004 2921.2004 2583.0013 
##       323       324       325       326       327       328       329 
## 2583.0013 2583.0013 3402.8130 3402.8130 3402.8130 2332.5627 2332.5627 
##       330       331       332       333       334       335       336 
## 2332.5627 1084.6508 1084.6508 1084.6508 1084.6508 2993.9774 2993.9774 
##       337       338       339       340       341       342       343 
## 2993.9774 2993.9774 2047.8761 2047.8761 2047.8761 1870.2146 1726.8010 
##       344       345       346       347       348       349       350 
## 2137.7771 2137.7771 2137.7771 1904.4626 1726.8010 1726.8010 2298.3147 
##       351       352       353       354       355       356       357 
## 2298.3147 2298.3147 2298.3147 1923.7271 1923.7271 1923.7271 1940.8511 
##       358       359       360       361       362       363       364 
## 2279.0502 2279.0502 2279.0502 2779.9273 2779.9273 2814.1753 2814.1753 
##       365       366       367       368       369       370       371 
## 2814.1753 2814.1753 3225.1514 3225.1514 3225.1514 3118.1264 3118.1264 
##       372       373       374       375       376       377       378 
## 3118.1264 2172.0251 2172.0251 2172.0251 2315.4387 2315.4387 2315.4387 
##       379       380       381       382       383       384       385 
##  960.5018  960.5018  960.5018  960.5018  960.5018 1155.2874 1155.2874 
##       386       387       388       389       390       391       392 
## 1138.1634  799.9643  799.9643  799.9643  834.2123  834.2123  834.2123 
##       393       394       395       396       397       398       399 
## 1155.2874  960.5018 1138.1634 1155.2874 1155.2874  799.9643  834.2123 
##       400       401       402       403       404       405       406 
## 1191.6759 1191.6759 1191.6759 1191.6759  960.5018  960.5018 1743.9250 
##       407       408       409       430       431       432       436 
## 1743.9250 1743.9250 1743.9250 2546.6127 2546.6127 2546.6127 2084.2646 
##       437       438       440       441       442       443       444 
## 2726.4148 2726.4148 1476.3625  941.2373  941.2373 1476.3625 1476.3625 
##       445       446       447       448       449       450       451 
## 1476.3625 1476.3625 1476.3625  941.2373  817.0883  817.0883  817.0883 
##       452       453       454       455       456       457       458 
##  941.2373  817.0883  817.0883  817.0883  817.0883  960.5018  817.0883
cor(INTLboeing$PricePremium,INTLboeing$FlightDuration)
## [1] 0.5923196
fit<-lm(PriceEconomy~SeatsEconomy,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = INTLboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1939.70  -813.74   -49.35   564.42  2242.65 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  467.7409   169.4286   2.761  0.00616 ** 
## SeatsEconomy   5.0725     0.8502   5.966 7.56e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 917.7 on 271 degrees of freedom
## Multiple R-squared:  0.1161, Adjusted R-squared:  0.1128 
## F-statistic:  35.6 on 1 and 271 DF,  p-value: 7.559e-09
INTLboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  524
##  [71]  524  524  524  616  616  616  616  172  141   99   99   97   86 1619
##  [85] 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019
##  [99] 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710
## [113] 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025
## [127] 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049
## [141] 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837 1671
## [155] 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407 1407
## [169] 1407  619  619  619  619 1564 1564 1564 1564 3972 3972 3972 2781 3063
## [183] 3226 3226 3226 3167 3167 3167 3524 3524 3524 3524 3325 3325 3325 3325
## [197] 3589 3589 3589 3702 3702 3243 3243 3243 3243 7414 7414 7414 2470 2470
## [211] 2470 1152  853  853  826  797  797  483  483  483  398  398  520  534
## [225]  318  267  267  267  228  228  228  620  483  318  318  620  267  228
## [239]  267  267  267  267  483  696 1710 1710 1710 1710 3196 3196 3196 3088
## [253] 3702 3702  545  397  397  430  430  430  430  545  483  304  304  304
## [267]  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##        9       10       11       12       13       14       15       16 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       17       18       19       20       21       22       23       24 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       25       26       27       28       29       30       31       32 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       33       34       35       36       37       38       39       40 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       41       42       43       44       45       46       47       48 
## 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 1086.582 
##       49       50       51       52       53       54       55       56 
## 1086.582 1086.582 1086.582 1111.944 1111.944 1111.944 1111.944 1111.944 
##       57       58       59       60       61       82       83       84 
## 1111.944 1111.944 1111.944 1111.944 1111.944 1700.350 1700.350 1700.350 
##       85       86       87       88       89       90       91       92 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1167.741 1167.741 1167.741 
##       93       94       95       96       97      138      144      147 
## 1167.741 1167.741 1167.741 1167.741 1167.741 2004.698 2004.698 2004.698 
##      148      149      151      156      157      158      159      160 
## 2004.698 2004.698 2004.698 1472.089 1472.089 1472.089 1472.089 1472.089 
##      161      162      163      164      165      166      167      168 
## 1472.089 1472.089 1472.089 2369.916 2369.916 2369.916 2369.916 1472.089 
##      169      170      171      172      173      174      175      176 
## 1472.089 1472.089 1472.089 1472.089 1472.089 2369.916 2369.916 2369.916 
##      177      178      179      180      181      182      183      184 
## 2369.916 1472.089 1472.089 1472.089 1472.089 1472.089 1472.089 1472.089 
##      240      241      242      243      244      245      246      247 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      248      249      250      251      252      253      254      255 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      256      257      258      259      260      261      262      263 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      264      265      266      267      268      269      270      271 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      272      273      274      275      276      277      278      279 
## 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 1700.350 
##      280      315      316      317      318      319      320      321 
## 1700.350 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      322      323      324      325      326      327      328      329 
## 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      330      331      332      333      334      335      336      337 
## 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 1401.075 
##      338      339      340      341      342      343      344      345 
## 1401.075 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 
##      346      347      348      349      350      351      352      353 
## 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 1482.234 
##      354      355      356      357      358      359      360      361 
## 1350.350 1350.350 1350.350 1350.350 1482.234 1482.234 1482.234 1350.350 
##      362      363      364      365      366      367      368      369 
## 1350.350 1482.234 1482.234 1482.234 1482.234 1497.452 1497.452 1497.452 
##      370      371      372      373      374      375      376      377 
## 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 1497.452 
##      378      379      380      381      382      383      384      385 
## 1497.452 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      386      387      388      389      390      391      392      393 
## 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      394      395      396      397      398      399      400      401 
## 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 1096.727 
##      402      403      404      405      406      407      408      409 
## 1096.727 1096.727 1096.727 1096.727 1563.394 1563.394 1563.394 1563.394 
##      430      431      432      436      437      438      440      441 
## 2440.931 2440.931 2440.931 2440.931 2440.931 2440.931 1289.481 1289.481 
##      442      443      444      445      446      447      448      449 
## 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 
##      450      451      452      453      454      455      456      457 
## 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 1289.481 
##      458 
## 1289.481
cor(INTLboeing$PricePremium,INTLboeing$SeatsEconomy)
## [1] 0.3563493
fit<-lm(PriceEconomy~SeatsPremium,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = INTLboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1944.3  -626.6  -211.1   293.1  2382.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   592.471    155.435   3.812 0.000171 ***
## SeatsPremium   25.761      4.501   5.723 2.77e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 922 on 271 degrees of freedom
## Multiple R-squared:  0.1078, Adjusted R-squared:  0.1045 
## F-statistic: 32.76 on 1 and 271 DF,  p-value: 2.765e-08
INTLboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  524
##  [71]  524  524  524  616  616  616  616  172  141   99   99   97   86 1619
##  [85] 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019
##  [99] 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710
## [113] 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025
## [127] 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049
## [141] 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837 1671
## [155] 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407 1407
## [169] 1407  619  619  619  619 1564 1564 1564 1564 3972 3972 3972 2781 3063
## [183] 3226 3226 3226 3167 3167 3167 3524 3524 3524 3524 3325 3325 3325 3325
## [197] 3589 3589 3589 3702 3702 3243 3243 3243 3243 7414 7414 7414 2470 2470
## [211] 2470 1152  853  853  826  797  797  483  483  483  398  398  520  534
## [225]  318  267  267  267  228  228  228  620  483  318  318  620  267  228
## [239]  267  267  267  267  483  696 1710 1710 1710 1710 3196 3196 3196 3088
## [253] 3702 3702  545  397  397  430  430  430  430  545  483  304  304  304
## [267]  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##         8         9        10        11        12        13        14 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        15        16        17        18        19        20        21 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        22        23        24        25        26        27        28 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        29        30        31        32        33        34        35 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        36        37        38        39        40        41        42 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        43        44        45        46        47        48        49 
## 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 1622.8990 
##        50        51        52        53        54        55        56 
## 1622.8990 1622.8990 1597.1383 1597.1383 1597.1383 1597.1383 1597.1383 
##        57        58        59        60        61        82        83 
## 1597.1383 1597.1383 1597.1383 1597.1383 1597.1383 2035.0702 2035.0702 
##        84        85        86        87        88        89        90 
## 2035.0702 2035.0702 2035.0702 2035.0702 2035.0702 2035.0702 1313.7707 
##        91        92        93        94        95        96        97 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       138       144       147       148       149       151       156 
## 2009.3095 2009.3095 2009.3095 2009.3095 2009.3095 2009.3095 1494.0956 
##       157       158       159       160       161       162       163 
## 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 
##       164       165       166       167       168       169       170 
## 2292.6772 2292.6772 2292.6772 2292.6772 1494.0956 1494.0956 1494.0956 
##       171       172       173       174       175       176       177 
## 1494.0956 1494.0956 1494.0956 2292.6772 2292.6772 2292.6772 2292.6772 
##       178       179       180       181       182       183       184 
## 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 1494.0956 
##       240       241       242       243       244       245       246 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 
##       247       248       249       250       251       252       253 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 
##       254       255       256       257       258       259       260 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 
##       261       262       263       264       265       266       267 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 
##       268       269       270       271       272       273       274 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 
##       275       276       277       278       279       280       315 
## 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1519.8563 1313.7707 
##       316       317       318       319       320       321       322 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       323       324       325       326       327       328       329 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       330       331       332       333       334       335       336 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       337       338       339       340       341       342       343 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       344       345       346       347       348       349       350 
## 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 1313.7707 
##       351       352       353       354       355       356       357 
## 1313.7707 1313.7707 1313.7707 1210.7279 1210.7279 1210.7279 1210.7279 
##       358       359       360       361       362       363       364 
## 1313.7707 1313.7707 1313.7707 1210.7279 1210.7279 1313.7707 1313.7707 
##       365       366       367       368       369       370       371 
## 1313.7707 1313.7707 1210.7279 1210.7279 1210.7279 1210.7279 1210.7279 
##       372       373       374       375       376       377       378 
## 1210.7279 1210.7279 1210.7279 1210.7279 1210.7279 1210.7279 1210.7279 
##       379       380       381       382       383       384       385 
## 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 
##       386       387       388       389       390       391       392 
## 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 
##       393       394       395       396       397       398       399 
## 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 
##       400       401       402       403       404       405       406 
## 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1004.6423 1210.7279 
##       407       408       409       430       431       432       436 
## 1210.7279 1210.7279 1210.7279 1571.3776 1571.3776 1571.3776 1571.3776 
##       437       438       440       441       442       443       444 
## 1571.3776 1571.3776  798.5567  798.5567  798.5567  798.5567  798.5567 
##       445       446       447       448       449       450       451 
##  798.5567  798.5567  798.5567  798.5567  798.5567  798.5567  798.5567 
##       452       453       454       455       456       457       458 
##  798.5567  798.5567  798.5567  798.5567  798.5567  798.5567  798.5567
cor(INTLboeing$PricePremium,INTLboeing$SeatsPremium)
## [1] 0.4141117
fit<-lm(PriceEconomy~PriceRelative,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = INTLboeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1635.86  -627.61   -28.31   608.58  2501.19 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    2006.04      80.31  24.979   <2e-16 ***
## PriceRelative -1010.95     107.16  -9.434   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 846.9 on 271 degrees of freedom
## Multiple R-squared:  0.2472, Adjusted R-squared:  0.2445 
## F-statistic: 89.01 on 1 and 271 DF,  p-value: < 2.2e-16
INTLboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  524
##  [71]  524  524  524  616  616  616  616  172  141   99   99   97   86 1619
##  [85] 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019
##  [99] 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710
## [113] 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025
## [127] 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049
## [141] 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837 1671
## [155] 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407 1407
## [169] 1407  619  619  619  619 1564 1564 1564 1564 3972 3972 3972 2781 3063
## [183] 3226 3226 3226 3167 3167 3167 3524 3524 3524 3524 3325 3325 3325 3325
## [197] 3589 3589 3589 3702 3702 3243 3243 3243 3243 7414 7414 7414 2470 2470
## [211] 2470 1152  853  853  826  797  797  483  483  483  398  398  520  534
## [225]  318  267  267  267  228  228  228  620  483  318  318  620  267  228
## [239]  267  267  267  267  483  696 1710 1710 1710 1710 3196 3196 3196 3088
## [253] 3702 3702  545  397  397  430  430  430  430  545  483  304  304  304
## [267]  483  451  464  550  550  696  569
fitted(fit)
##          1          2          3          4          5          6 
## 1621.87481 1621.87481 1621.87481 1621.87481 1328.69909 1328.69909 
##          7          8          9         10         11         12 
## 1328.69909  964.75682  964.75682 1247.82303 1247.82303 1439.90367 
##         13         14         15         16         17         18 
## 1743.18890 1480.34170 1480.34170 1480.34170 1621.87481 1621.87481 
##         19         20         21         22         23         24 
## 1621.87481 1662.31284 1662.31284 1662.31284 1672.42234 1672.42234 
##         25         26         27         28         29         30 
## 1672.42234 1652.20333 1672.42234 1672.42234 1662.31284 1662.31284 
##         31         32         33         34         35         36 
## 1662.31284 1581.43678 1581.43678 1581.43678 1581.43678 1348.91810 
##         37         38         39         40         41         42 
## 1348.91810 1348.91810 1763.40791 1763.40791 1763.40791 1763.40791 
##         43         44         45         46         47         48 
## 1834.17446 1834.17446 1834.17446 1925.16003 1925.16003 1925.16003 
##         49         50         51         52         53         54 
## 1480.34170 1480.34170 1480.34170  964.75682 1642.09382 1642.09382 
##         55         56         57         58         59         60 
## 1642.09382 1662.31284 1662.31284 1662.31284 1793.73643 1793.73643 
##         61         82         83         84         85         86 
## 1389.35613  924.31879  924.31879  924.31879  924.31879 1601.65579 
##         87         88         89         90         91         92 
## 1601.65579 1601.65579 1601.65579 1520.77973 1520.77973 1520.77973 
##         93         94         95         96         97        138 
## 1520.77973 1672.42234 1672.42234 1672.42234 1743.18890 1743.18890 
##        144        147        148        149        151        156 
## 1702.75087 1712.86037 1712.86037 1601.65579 1672.42234  166.10572 
##        157        158        159        160        161        162 
##  166.10572  166.10572  166.10572  257.09129  257.09129  257.09129 
##        163        164        165        166        167        168 
##  610.92405 1025.41386 1025.41386 1025.41386 1025.41386 1086.07091 
##        169        170        171        172        173        174 
## 1086.07091 1086.07091 1086.07091 1156.83746 1439.90367 1490.45121 
##        175        176        177        178        179        180 
## 1490.45121 1490.45121 1490.45121 1500.56072 1510.67022 1601.65579 
##        181        182        183        184        240        241 
## 1601.65579 1601.65579 1601.65579 1743.18890  863.66174  863.66174 
##        242        243        244        245        246        247 
## 1743.18890 1551.10825 1551.10825 1551.10825 1642.09382 1642.09382 
##        248        249        250        251        252        253 
## 1642.09382 1642.09382 1015.30435 1015.30435 1015.30435 1672.42234 
##        254        255        256        257        258        259 
## 1672.42234 1672.42234 1672.42234 1642.09382 1642.09382 1642.09382 
##        260        261        262        263        264        265 
##  863.66174 1581.43678 1581.43678 1581.43678 1601.65579 1601.65579 
##        266        267        268        269        270        271 
## 1601.65579 1197.27549 1935.26954 1935.26954 1935.26954  883.88076 
##        272        273        274        275        276        277 
##  883.88076 1086.07091 1803.84594 1197.27549 1834.17446 1834.17446 
##        278        279        280        315        316        317 
## 1834.17446 1793.73643 1429.79416  883.88076 1166.94697 1166.94697 
##        318        319        320        321        322        323 
## 1227.60401 1399.46564 1399.46564 1399.46564 1450.01318 1520.77973 
##        324        325        326        327        328        329 
## 1520.77973 1874.61249 1874.61249 1874.61249 1874.61249 1874.61249 
##        330        331        332        333        334        335 
## 1874.61249 1904.94102 1904.94102 1904.94102 1904.94102 1915.05052 
##        336        337        338        339        340        341 
## 1915.05052 1915.05052 1915.05052 1642.09382 1642.09382 1642.09382 
##        342        343        344        345        346        347 
## 1925.16003 1935.26954 1935.26954 1935.26954 1935.26954 1965.59806 
##        348        349        350        351        352        353 
## 1965.59806 1965.59806 1975.70757 1975.70757 1975.70757 1975.70757 
##        354        355        356        357        358        359 
## 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 
##        360        361        362        363        364        365 
## 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 1975.70757 
##        366        367        368        369        370        371 
## 1975.70757  600.81455  600.81455  600.81455 1864.50299 1864.50299 
##        372        373        374        375        376        377 
## 1864.50299 1227.60401 1520.77973 1520.77973 1965.59806 1480.34170 
##        378        379        380        381        382        383 
## 1631.98431   95.33917   95.33917   95.33917  115.55818  317.74834 
##        384        385        386        387        388        389 
##  348.07686  459.28144  701.90962  732.23814  732.23814  732.23814 
##        390        391        392        393        394        395 
##  883.88076  883.88076  883.88076  904.09977  934.42829  954.64731 
##        396        397        398        399        400        401 
##  954.64731 1086.07091 1187.16598 1207.38500 1257.93253 1257.93253 
##        402        403        404        405        406        407 
## 1257.93253 1257.93253 1500.56072 1834.17446  348.07686  348.07686 
##        408        409        430        431        432        436 
##  550.26701 1439.90367 1935.26954 1935.26954 1935.26954 1965.59806 
##        437        438        440        441        442        443 
## 1975.70757 1975.70757  277.31031  307.63883  307.63883  691.80011 
##        444        445        446        447        448        449 
##  691.80011  691.80011  691.80011  772.67617  924.31879 1227.60401 
##        450        451        452        453        454        455 
## 1227.60401 1227.60401 1348.91810 1399.46564 1419.68466 1551.10825 
##        456        457        458 
## 1551.10825 1621.87481 1884.72200
cor(INTLboeing$PricePremium,INTLboeing$PriceRelative)
## [1] -0.1652608
fit<-lm(PriceEconomy~PercentPremiumSeats,data = INTLboeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = INTLboeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1363.8  -821.4   -79.5   435.0  2297.6 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1111.56     164.40   6.761 8.37e-11 ***
## PercentPremiumSeats    20.65      10.19   2.026   0.0437 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 968.8 on 271 degrees of freedom
## Multiple R-squared:  0.01492,    Adjusted R-squared:  0.01129 
## F-statistic: 4.105 on 1 and 271 DF,  p-value: 0.04372
INTLboeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 2982 2982 2982 2982 2549 2549 2549 2548  524
##  [71]  524  524  524  616  616  616  616  172  141   99   99   97   86 1619
##  [85] 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019
##  [99] 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710
## [113] 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025
## [127] 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049
## [141] 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837 1671
## [155] 1452 1452 1408 1947 1947 1947 1356  900  900 1584 1584 1584 1407 1407
## [169] 1407  619  619  619  619 1564 1564 1564 1564 3972 3972 3972 2781 3063
## [183] 3226 3226 3226 3167 3167 3167 3524 3524 3524 3524 3325 3325 3325 3325
## [197] 3589 3589 3589 3702 3702 3243 3243 3243 3243 7414 7414 7414 2470 2470
## [211] 2470 1152  853  853  826  797  797  483  483  483  398  398  520  534
## [225]  318  267  267  267  228  228  228  620  483  318  318  620  267  228
## [239]  267  267  267  267  483  696 1710 1710 1710 1710 3196 3196 3196 3088
## [253] 3702 3702  545  397  397  430  430  430  430  545  483  304  304  304
## [267]  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##        9       10       11       12       13       14       15       16 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       17       18       19       20       21       22       23       24 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       25       26       27       28       29       30       31       32 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       33       34       35       36       37       38       39       40 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       41       42       43       44       45       46       47       48 
## 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 1621.501 
##       49       50       51       52       53       54       55       56 
## 1621.501 1621.501 1621.501 1596.717 1596.717 1596.717 1596.717 1596.717 
##       57       58       59       60       61       82       83       84 
## 1596.717 1596.717 1596.717 1596.717 1596.717 1498.405 1498.405 1498.405 
##       85       86       87       88       89       90       91       92 
## 1498.405 1498.405 1498.405 1498.405 1498.405 1459.989 1459.989 1459.989 
##       93       94       95       96       97      138      144      147 
## 1459.989 1459.989 1459.989 1459.989 1459.989 1428.802 1428.802 1428.802 
##      148      149      151      156      157      158      159      160 
## 1428.802 1428.802 1428.802 1421.780 1421.780 1421.780 1421.780 1421.780 
##      161      162      163      164      165      166      167      168 
## 1421.780 1421.780 1421.780 1420.747 1420.747 1420.747 1420.747 1421.780 
##      169      170      171      172      173      174      175      176 
## 1421.780 1421.780 1421.780 1421.780 1421.780 1420.747 1420.747 1420.747 
##      177      178      179      180      181      182      183      184 
## 1420.747 1421.780 1421.780 1421.780 1421.780 1421.780 1421.780 1421.780 
##      240      241      242      243      244      245      246      247 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      248      249      250      251      252      253      254      255 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      256      257      258      259      260      261      262      263 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      264      265      266      267      268      269      270      271 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      272      273      274      275      276      277      278      279 
## 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 1377.994 
##      280      315      316      317      318      319      320      321 
## 1377.994 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      322      323      324      325      326      327      328      329 
## 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      330      331      332      333      334      335      336      337 
## 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 1384.397 
##      338      339      340      341      342      343      344      345 
## 1384.397 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 
##      346      347      348      349      350      351      352      353 
## 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 1365.189 
##      354      355      356      357      358      359      360      361 
## 1361.884 1361.884 1361.884 1361.884 1365.189 1365.189 1365.189 1361.884 
##      362      363      364      365      366      367      368      369 
## 1361.884 1365.189 1365.189 1365.189 1365.189 1329.871 1329.871 1329.871 
##      370      371      372      373      374      375      376      377 
## 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 1329.871 
##      378      379      380      381      382      383      384      385 
## 1329.871 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      386      387      388      389      390      391      392      393 
## 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      394      395      396      397      398      399      400      401 
## 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 1347.633 
##      402      403      404      405      406      407      408      409 
## 1347.633 1347.633 1347.633 1347.633 1318.099 1318.099 1318.099 1318.099 
##      430      431      432      436      437      438      440      441 
## 1295.380 1295.380 1295.380 1295.380 1295.380 1295.380 1208.841 1208.841 
##      442      443      444      445      446      447      448      449 
## 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 
##      450      451      452      453      454      455      456      457 
## 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 1208.841 
##      458 
## 1208.841
cor(INTLboeing$PricePremium,INTLboeing$PercentPremiumSeats)
## [1] 0.1666565
INTLairbus <-INTL[ which(INTL$Aircraft=='AirBus'),]
View(INTLairbus)
summary(INTLairbus)
##       Airline     Aircraft   FlightDuration  TravelMonth
##  AirFrance:36   AirBus:145   Min.   : 1.25   Aug:39     
##  British  :47   Boeing:  0   1st Qu.: 6.16   Jul:25     
##  Delta    : 6                Median : 8.08   Oct:38     
##  Jet      : 7                Mean   : 7.66   Sep:43     
##  Singapore:16                3rd Qu.: 9.50              
##  Virgin   :33                Max.   :13.33              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :  0    Min.   :147.0   Min.   :21.00   Min.   :31.00  
##  International:145    1st Qu.:185.0   1st Qu.:36.00   1st Qu.:31.00  
##                       Median :233.0   Median :38.00   Median :31.00  
##                       Mean   :250.7   Mean   :40.01   Mean   :31.41  
##                       3rd Qu.:303.0   3rd Qu.:55.00   3rd Qu.:32.00  
##                       Max.   :389.0   Max.   :55.00   Max.   :32.00  
##   PitchPremium  WidthEconomy    WidthPremium    PriceEconomy 
##  Min.   :38    Min.   :18.00   Min.   :19.00   Min.   :  74  
##  1st Qu.:38    1st Qu.:18.00   1st Qu.:19.00   1st Qu.: 505  
##  Median :38    Median :18.00   Median :19.00   Median :1476  
##  Mean   :38    Mean   :18.11   Mean   :19.65   Mean   :1415  
##  3rd Qu.:38    3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:2369  
##  Max.   :38    Max.   :19.00   Max.   :21.00   Max.   :3220  
##   PricePremium  PriceRelative      SeatsTotal    PitchDifference
##  Min.   :  97   Min.   :0.0200   Min.   :168.0   Min.   :6.000  
##  1st Qu.: 594   1st Qu.:0.0800   1st Qu.:233.0   1st Qu.:6.000  
##  Median :2499   Median :0.3100   Median :271.0   Median :7.000  
##  Mean   :1934   Mean   :0.4292   Mean   :290.7   Mean   :6.593  
##  3rd Qu.:2997   3rd Qu.:0.6300   3rd Qu.:358.0   3rd Qu.:7.000  
##  Max.   :3563   Max.   :1.5600   Max.   :427.0   Max.   :7.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :1.000   Min.   : 8.90      
##  1st Qu.:1.000   1st Qu.:12.50      
##  Median :1.000   Median :14.02      
##  Mean   :1.538   Mean   :13.88      
##  3rd Qu.:3.000   3rd Qu.:15.36      
##  Max.   :3.000   Max.   :20.60
mean(INTLairbus$PriceEconomy)
## [1] 1414.641
mean(INTLairbus$PricePremium)
## [1] 1934.145
library(plotly)
x1<-c('Jul','Aug','Sept','Oct')
y3<-c(by(INTLairbus$PriceEconomy,INTLairbus$TravelMonth,mean))
y4<-c(by(INTLairbus$PricePremium,INTLairbus$TravelMonth,mean))
data<-data.frame(x1,y3,y4)
data$x1 <- factor(data$x, levels = data[["x1"]])
plot_ly(data, x = ~x1, y = ~y3, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y4, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = INTLairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1796.81  -672.36   -11.04   454.24  1575.15 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      216.25     191.64   1.128    0.261    
## FlightDuration   156.46      23.13   6.765 3.17e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 880.1 on 143 degrees of freedom
## Multiple R-squared:  0.2424, Adjusted R-squared:  0.2371 
## F-statistic: 45.76 on 1 and 143 DF,  p-value: 3.171e-10
INTLairbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  336  429  462  557  557  661  676  505  505  505  505  505
## [127]  505  505  505  690  690  690  690  690  690  690  690 1522 1522 2581
## [141] 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1467.9014 1467.9014 1467.9014 1467.9014 1597.7603 1597.7603 1597.7603 
##        69        70        71        72        73        99       100 
## 1597.7603 1323.9613 1323.9613 1323.9613 1428.7872 1962.3041 1962.3041 
##       101       102       103       104       105       106       107 
## 1962.3041 1962.3041 1859.0428 1859.0428 1859.0428 1859.0428 2262.7008 
##       108       109       110       111       112       113       114 
## 2262.7008 2262.7008 1962.3041 1962.3041 1962.3041  854.5916  776.3633 
##       115       116       117       118       119       120       121 
##  776.3633  593.3091  724.7326  724.7326  776.3633  632.4232  593.3091 
##       122       123       124       125       126       127       128 
##  593.3091  593.3091  724.7326  502.5643  776.3633  920.3033  593.3091 
##       129       130       131       132       133       134       135 
##  920.3033  502.5643  593.3091  776.3633  854.5916  659.0208  920.3033 
##       136       137       139       140       141       142       143 
##  411.8194  854.5916  593.3091  502.5643  502.5643  411.8194  411.8194 
##       145       146       150       185       186       187       188 
##  776.3633  659.0208  593.3091 1519.5320 1519.5320 1702.5862 1702.5862 
##       189       190       191       192       193       194       195 
## 1702.5862 1519.5320 1297.3637 1297.3637 1297.3637 1297.3637 1245.7330 
##       196       197       198       199       200       201       202 
## 1245.7330 1245.7330 1245.7330 1844.9617 1844.9617 1844.9617 1988.9018 
##       203       204       205       206       207       208       209 
## 1988.9018 1375.5920 1375.5920 1375.5920 1375.5920 1323.9613 1428.7872 
##       210       211       212       213       214       215       216 
## 1428.7872 1428.7872 1702.5862 1702.5862 1702.5862 1519.5320 1519.5320 
##       217       218       219       220       221       222       223 
## 1519.5320 1519.5320 1519.5320 1519.5320 1519.5320 1519.5320 1363.0754 
##       224       225       226       227       228       229       230 
## 1363.0754 1363.0754 1284.8472 1284.8472 1610.2768 1610.2768 1610.2768 
##       231       232       233       234       235       236       237 
## 1480.4179 1652.5201 1652.5201 1663.4721 1663.4721 1649.3910 1649.3910 
##       238       239       308       309       310       311       312 
## 1663.4721 1663.4721 1702.5862 1702.5862 1702.5862 1610.2768 1610.2768 
##       313       314       410       411       412       413       414 
## 1702.5862 1610.2768 2301.8149 2301.8149 2301.8149 2301.8149 1180.0213 
##       415       416       417       418       419       420       421 
## 1180.0213 1180.0213 1180.0213 2196.9890 2196.9890 2196.9890 2196.9890 
##       422       423       424       425       426       427       428 
## 1233.2165 1233.2165 1233.2165 1233.2165 2250.1843 2250.1843 1389.6731 
##       429       433       434       435       439 
## 1389.6731 1532.0486 1546.1296 1546.1296 2250.1843
cor(INTLairbus$PriceEconomy,INTLairbus$FlightDuration)
## [1] 0.4923677
fit<-lm(PriceEconomy~SeatsEconomy,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = INTLairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1688.91  -830.53   -42.62   634.09  2619.76 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2890.3027   260.9009  11.078  < 2e-16 ***
## SeatsEconomy   -5.8871     0.9966  -5.907 2.43e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 906.6 on 143 degrees of freedom
## Multiple R-squared:  0.1962, Adjusted R-squared:  0.1905 
## F-statistic:  34.9 on 1 and 143 DF,  p-value: 2.428e-08
INTLairbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  336  429  462  557  557  661  676  505  505  505  505  505
## [127]  505  505  505  690  690  690  690  690  690  690  690 1522 1522 2581
## [141] 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1801.1976 1801.1976 1801.1976 1801.1976 1801.1976 1801.1976 1801.1976 
##        69        70        71        72        73        99       100 
## 1801.1976 1801.1976 1801.1976 1801.1976 1801.1976 1106.5251 1106.5251 
##       101       102       103       104       105       106       107 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       108       109       110       111       112       113       114 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       115       116       117       118       119       120       121 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       122       123       124       125       126       127       128 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       129       130       131       132       133       134       135 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       136       137       139       140       141       142       143 
## 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 1106.5251 
##       145       146       150       185       186       187       188 
## 1106.5251 1106.5251 1053.5416 1518.6189 1518.6189 1518.6189 1518.6189 
##       189       190       191       192       193       194       195 
## 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 
##       196       197       198       199       200       201       202 
## 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 
##       203       204       205       206       207       208       209 
## 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 1518.6189 
##       210       211       212       213       214       215       216 
## 1518.6189 1518.6189 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 
##       217       218       219       220       221       222       223 
## 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 
##       224       225       226       227       228       229       230 
## 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 
##       231       232       233       234       235       236       237 
## 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 
##       238       239       308       309       310       311       312 
## 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 2024.9056 
##       313       314       410       411       412       413       414 
## 2024.9056 2024.9056  929.9135  929.9135  929.9135  929.9135  929.9135 
##       415       416       417       418       419       420       421 
##  929.9135  929.9135  929.9135  929.9135  929.9135  929.9135  929.9135 
##       422       423       424       425       426       427       428 
##  929.9135  929.9135  929.9135  929.9135  600.2384  600.2384  600.2384 
##       429       433       434       435       439 
##  600.2384  600.2384  600.2384  600.2384  600.2384
cor(INTLairbus$PriceEconomy,INTLairbus$SeatsEconomy)
## [1] -0.4429021
fit<-lm(PriceEconomy~PriceRelative,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1421.4 -1073.8   368.0   955.1  1557.8 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1674.3      123.0  13.613   <2e-16 ***
## PriceRelative   -605.0      214.1  -2.825   0.0054 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 984.1 on 143 degrees of freedom
## Multiple R-squared:  0.05287,    Adjusted R-squared:  0.04624 
## F-statistic: 7.982 on 1 and 143 DF,  p-value: 0.005401
INTLairbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  336  429  462  557  557  661  676  505  505  505  505  505
## [127]  505  505  505  690  690  690  690  690  690  690  690 1522 1522 2581
## [141] 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1232.6858 1232.6858 1232.6858 1232.6858 1438.3820 1438.3820 1438.3820 
##        69        70        71        72        73        99       100 
## 1438.3820 1517.0305 1517.0305 1517.0305 1613.8287 1377.8831 1377.8831 
##       101       102       103       104       105       106       107 
## 1377.8831 1377.8831 1123.7878 1123.7878 1123.7878 1123.7878 1389.9829 
##       108       109       110       111       112       113       114 
## 1389.9829 1389.9829  905.9918  905.9918 1456.5316 1638.0283 1613.8287 
##       115       116       117       118       119       120       121 
## 1613.8287 1650.1281 1607.7788 1607.7788 1625.9285 1619.8786 1644.0782 
##       122       123       124       125       126       127       128 
## 1644.0782 1607.7788 1589.6292 1571.4795 1577.5294 1583.5793 1631.9784 
##       129       130       131       132       133       134       135 
## 1571.4795 1565.4296 1589.6292 1595.6791 1577.5294 1565.4296 1565.4296 
##       136       137       139       140       141       142       143 
## 1523.0804 1553.3298 1559.3797 1535.1802 1535.1802 1492.8310 1492.8310 
##       145       146       150       185       186       187       188 
## 1523.0804 1498.8809 1486.7811 1396.0328 1396.0328 1444.4319 1444.4319 
##       189       190       191       192       193       194       195 
## 1444.4319 1492.8310 1020.9397 1020.9397 1020.9397 1020.9397 1051.1891 
##       196       197       198       199       200       201       202 
## 1051.1891 1051.1891 1051.1891 1166.1370 1166.1370 1166.1370 1377.8831 
##       203       204       205       206       207       208       209 
## 1377.8831 1426.2822 1426.2822 1426.2822 1426.2822 1517.0305 1613.8287 
##       210       211       212       213       214       215       216 
## 1613.8287 1613.8287  730.5451  966.4907 1293.1847 1625.9285 1625.9285 
##       217       218       219       220       221       222       223 
## 1625.9285 1625.9285 1625.9285 1625.9285 1625.9285 1625.9285 1625.9285 
##       224       225       226       227       228       229       230 
## 1625.9285 1625.9285 1631.9784 1631.9784 1631.9784 1631.9784 1631.9784 
##       231       232       233       234       235       236       237 
## 1650.1281 1656.1779 1656.1779 1656.1779 1656.1779 1656.1779 1656.1779 
##       238       239       308       309       310       311       312 
## 1656.1779 1656.1779  766.8444 1093.5384 1178.2368 1420.2323 1420.2323 
##       313       314       410       411       412       413       414 
## 1432.3321 1444.4319 1075.3887 1075.3887 1075.3887 1075.3887 1075.3887 
##       415       416       417       418       419       420       421 
## 1075.3887 1075.3887 1075.3887 1305.2844 1305.2844 1305.2844 1305.2844 
##       422       423       424       425       426       427       428 
## 1305.2844 1305.2844 1305.2844 1305.2844  972.5406  972.5406 1625.9285 
##       429       433       434       435       439 
## 1625.9285 1650.1281 1650.1281 1650.1281 1662.2278
cor(INTLairbus$PriceEconomy,INTLairbus$PriceRelative)
## [1] -0.2299241
fit<-lm(PriceEconomy~PercentPremiumSeats,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = INTLairbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1297.44 -1035.08    66.91   959.91  1696.92 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1953.26     414.31   4.714 5.69e-06 ***
## PercentPremiumSeats   -38.81      29.24  -1.327    0.187    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1005 on 143 degrees of freedom
## Multiple R-squared:  0.01217,    Adjusted R-squared:  0.005261 
## F-statistic: 1.762 on 1 and 143 DF,  p-value: 0.1865
INTLairbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  336  429  462  557  557  661  676  505  505  505  505  505
## [127]  505  505  505  690  690  690  690  690  690  690  690 1522 1522 2581
## [141] 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1153.691 1153.691 1153.691 1153.691 1153.691 1153.691 1153.691 1153.691 
##       70       71       72       73       99      100      101      102 
## 1153.691 1153.691 1153.691 1153.691 1357.076 1357.076 1357.076 1357.076 
##      103      104      105      106      107      108      109      110 
## 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 
##      111      112      113      114      115      116      117      118 
## 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 
##      119      120      121      122      123      124      125      126 
## 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 
##      127      128      129      130      131      132      133      134 
## 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 
##      135      136      137      139      140      141      142      143 
## 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 1357.076 
##      145      146      150      185      186      187      188      189 
## 1357.076 1357.076 1371.437 1409.087 1409.087 1409.087 1409.087 1409.087 
##      190      191      192      193      194      195      196      197 
## 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 
##      198      199      200      201      202      203      204      205 
## 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 
##      206      207      208      209      210      211      212      213 
## 1409.087 1409.087 1409.087 1409.087 1409.087 1409.087 1468.084 1468.084 
##      214      215      216      217      218      219      220      221 
## 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 
##      222      223      224      225      226      227      228      229 
## 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 
##      230      231      232      233      234      235      236      237 
## 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 
##      238      239      308      309      310      311      312      313 
## 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 1468.084 
##      314      410      411      412      413      414      415      416 
## 1468.084 1574.435 1574.435 1574.435 1574.435 1574.435 1574.435 1574.435 
##      417      418      419      420      421      422      423      424 
## 1574.435 1574.435 1574.435 1574.435 1574.435 1574.435 1574.435 1574.435 
##      425      426      427      428      429      433      434      435 
## 1574.435 1607.815 1607.815 1607.815 1607.815 1607.815 1607.815 1607.815 
##      439 
## 1607.815
fit<-lm(PricePremium~FlightDuration,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2278.3  -630.8   393.3   884.8  1326.1 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      113.11     213.82   0.529    0.598    
## FlightDuration   237.75      25.81   9.213 3.66e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 982 on 143 degrees of freedom
## Multiple R-squared:  0.3725, Adjusted R-squared:  0.3681 
## F-statistic: 84.88 on 1 and 143 DF,  p-value: 3.664e-16
INTLairbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  841  841  841  789  789  928  931 1004 1004 1004 1004 1004
## [127] 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781
## [141] 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 2015.0768 2015.0768 2015.0768 2015.0768 2212.4060 2212.4060 2212.4060 
##        69        70        71        72        73        99       100 
## 2212.4060 1796.3505 1796.3505 1796.3505 1955.6403 2766.3541 2766.3541 
##       101       102       103       104       105       106       107 
## 2766.3541 2766.3541 2609.4417 2609.4417 2609.4417 2609.4417 3222.8263 
##       108       109       110       111       112       113       114 
## 3222.8263 3222.8263 2766.3541 2766.3541 2766.3541 1083.1127  964.2397 
##       115       116       117       118       119       120       121 
##  964.2397  686.0769  885.7835  885.7835  964.2397  745.5134  686.0769 
##       122       123       124       125       126       127       128 
##  686.0769  686.0769  885.7835  548.1843  964.2397 1182.9660  686.0769 
##       129       130       131       132       133       134       135 
## 1182.9660  548.1843  686.0769  964.2397 1083.1127  785.9302 1182.9660 
##       136       137       139       140       141       142       143 
##  410.2916 1083.1127  686.0769  548.1843  548.1843  410.2916  410.2916 
##       145       146       150       185       186       187       188 
##  964.2397  785.9302  686.0769 2093.5330 2093.5330 2371.6958 2371.6958 
##       189       190       191       192       193       194       195 
## 2371.6958 2093.5330 1755.9337 1755.9337 1755.9337 1755.9337 1677.4776 
##       196       197       198       199       200       201       202 
## 1677.4776 1677.4776 1677.4776 2588.0446 2588.0446 2588.0446 2806.7709 
##       203       204       205       206       207       208       209 
## 2806.7709 1874.8067 1874.8067 1874.8067 1874.8067 1796.3505 1955.6403 
##       210       211       212       213       214       215       216 
## 1955.6403 1955.6403 2371.6958 2371.6958 2371.6958 2093.5330 2093.5330 
##       217       218       219       220       221       222       223 
## 2093.5330 2093.5330 2093.5330 2093.5330 2093.5330 2093.5330 1855.7870 
##       224       225       226       227       228       229       230 
## 1855.7870 1855.7870 1736.9141 1736.9141 2231.4257 2231.4257 2231.4257 
##       231       232       233       234       235       236       237 
## 2034.0965 2295.6171 2295.6171 2312.2593 2312.2593 2290.8621 2290.8621 
##       238       239       308       309       310       311       312 
## 2312.2593 2312.2593 2371.6958 2371.6958 2371.6958 2231.4257 2231.4257 
##       313       314       410       411       412       413       414 
## 2371.6958 2231.4257 3282.2628 3282.2628 3282.2628 3282.2628 1577.6243 
##       415       416       417       418       419       420       421 
## 1577.6243 1577.6243 1577.6243 3122.9730 3122.9730 3122.9730 3122.9730 
##       422       423       424       425       426       427       428 
## 1658.4579 1658.4579 1658.4579 1658.4579 3203.8066 3203.8066 1896.2039 
##       429       433       434       435       439 
## 1896.2039 2112.5527 2133.9498 2133.9498 3203.8066
cor(INTLairbus$PricePremium,INTLairbus$FlightDuration)
## [1] 0.6103023
fit<-lm(PricePremium~SeatsEconomy,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1750.1 -1305.7   267.9   735.9  2162.1 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3396.894    333.082  10.198  < 2e-16 ***
## SeatsEconomy   -5.836      1.272  -4.587 9.75e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1157 on 143 degrees of freedom
## Multiple R-squared:  0.1282, Adjusted R-squared:  0.1222 
## F-statistic: 21.04 on 1 and 143 DF,  p-value: 9.753e-06
INTLairbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  841  841  841  789  789  928  931 1004 1004 1004 1004 1004
## [127] 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781
## [141] 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2317.319 2317.319 2317.319 2317.319 2317.319 2317.319 2317.319 2317.319 
##       70       71       72       73       99      100      101      102 
## 2317.319 2317.319 2317.319 2317.319 1628.725 1628.725 1628.725 1628.725 
##      103      104      105      106      107      108      109      110 
## 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 
##      111      112      113      114      115      116      117      118 
## 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 
##      119      120      121      122      123      124      125      126 
## 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 
##      127      128      129      130      131      132      133      134 
## 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 
##      135      136      137      139      140      141      142      143 
## 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 1628.725 
##      145      146      150      185      186      187      188      189 
## 1628.725 1628.725 1576.205 2037.213 2037.213 2037.213 2037.213 2037.213 
##      190      191      192      193      194      195      196      197 
## 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 
##      198      199      200      201      202      203      204      205 
## 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 
##      206      207      208      209      210      211      212      213 
## 2037.213 2037.213 2037.213 2037.213 2037.213 2037.213 2539.069 2539.069 
##      214      215      216      217      218      219      220      221 
## 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 
##      222      223      224      225      226      227      228      229 
## 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 
##      230      231      232      233      234      235      236      237 
## 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 
##      238      239      308      309      310      311      312      313 
## 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 2539.069 
##      314      410      411      412      413      414      415      416 
## 2539.069 1453.658 1453.658 1453.658 1453.658 1453.658 1453.658 1453.658 
##      417      418      419      420      421      422      423      424 
## 1453.658 1453.658 1453.658 1453.658 1453.658 1453.658 1453.658 1453.658 
##      425      426      427      428      429      433      434      435 
## 1453.658 1126.868 1126.868 1126.868 1126.868 1126.868 1126.868 1126.868 
##      439 
## 1126.868
cor(INTLairbus$PricePremium,INTLairbus$SeatsEconomy)
## [1] -0.3581187
fit<-lm(PricePremium~SeatsPremium,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1842.7 -1077.4   227.3   974.0  2178.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3402.141    308.045  11.044  < 2e-16 ***
## SeatsPremium  -36.687      7.324  -5.009 1.59e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1143 on 143 degrees of freedom
## Multiple R-squared:  0.1493, Adjusted R-squared:  0.1433 
## F-statistic: 25.09 on 1 and 143 DF,  p-value: 1.586e-06
INTLairbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  841  841  841  789  789  928  931 1004 1004 1004 1004 1004
## [127] 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781
## [141] 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1641.153 1641.153 1641.153 1641.153 1641.153 1641.153 1641.153 1641.153 
##       70       71       72       73       99      100      101      102 
## 1641.153 1641.153 1641.153 1641.153 1384.342 1384.342 1384.342 1384.342 
##      103      104      105      106      107      108      109      110 
## 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 
##      111      112      113      114      115      116      117      118 
## 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 
##      119      120      121      122      123      124      125      126 
## 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 
##      127      128      129      130      131      132      133      134 
## 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 
##      135      136      137      139      140      141      142      143 
## 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 1384.342 
##      145      146      150      185      186      187      188      189 
## 1384.342 1384.342 1384.342 2008.025 2008.025 2008.025 2008.025 2008.025 
##      190      191      192      193      194      195      196      197 
## 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 
##      198      199      200      201      202      203      204      205 
## 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 
##      206      207      208      209      210      211      212      213 
## 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2631.709 2631.709 
##      214      215      216      217      218      219      220      221 
## 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 
##      222      223      224      225      226      227      228      229 
## 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 
##      230      231      232      233      234      235      236      237 
## 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 
##      238      239      308      309      310      311      312      313 
## 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 2631.709 
##      314      410      411      412      413      414      415      416 
## 2631.709 2081.400 2081.400 2081.400 2081.400 2081.400 2081.400 2081.400 
##      417      418      419      420      421      422      423      424 
## 2081.400 2081.400 2081.400 2081.400 2081.400 2081.400 2081.400 2081.400 
##      425      426      427      428      429      433      434      435 
## 2081.400 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 2008.025 
##      439 
## 2008.025
cor(INTLairbus$PricePremium,INTLairbus$SeatsPremium)
## [1] -0.3863785
fit<-lm(PricePremium~PriceRelative,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1785.4 -1197.4   573.2  1063.4  1602.5 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1748.0      153.5  11.386   <2e-16 ***
## PriceRelative    433.6      267.3   1.622    0.107    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1228 on 143 degrees of freedom
## Multiple R-squared:  0.01807,    Adjusted R-squared:  0.0112 
## F-statistic: 2.631 on 1 and 143 DF,  p-value: 0.107
INTLairbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  841  841  841  789  789  928  931 1004 1004 1004 1004 1004
## [127] 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781
## [141] 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2064.557 2064.557 2064.557 2064.557 1917.129 1917.129 1917.129 1917.129 
##       70       71       72       73       99      100      101      102 
## 1860.760 1860.760 1860.760 1791.383 1960.490 1960.490 1960.490 1960.490 
##      103      104      105      106      107      108      109      110 
## 2142.606 2142.606 2142.606 2142.606 1951.818 1951.818 1951.818 2298.706 
##      111      112      113      114      115      116      117      118 
## 2298.706 1904.121 1774.038 1791.383 1791.383 1765.366 1795.719 1795.719 
##      119      120      121      122      123      124      125      126 
## 1782.710 1787.046 1769.702 1769.702 1795.719 1808.727 1821.735 1817.399 
##      127      128      129      130      131      132      133      134 
## 1813.063 1778.374 1821.735 1826.071 1808.727 1804.391 1817.399 1826.071 
##      135      136      137      139      140      141      142      143 
## 1826.071 1856.424 1834.744 1830.407 1847.752 1847.752 1878.105 1878.105 
##      145      146      150      185      186      187      188      189 
## 1856.424 1873.768 1882.441 1947.482 1947.482 1912.793 1912.793 1912.793 
##      190      191      192      193      194      195      196      197 
## 1878.105 2216.320 2216.320 2216.320 2216.320 2194.640 2194.640 2194.640 
##      198      199      200      201      202      203      204      205 
## 2194.640 2112.254 2112.254 2112.254 1960.490 1960.490 1925.802 1925.802 
##      206      207      208      209      210      211      212      213 
## 1925.802 1925.802 1860.760 1791.383 1791.383 1791.383 2424.453 2255.345 
##      214      215      216      217      218      219      220      221 
## 2021.196 1782.710 1782.710 1782.710 1782.710 1782.710 1782.710 1782.710 
##      222      223      224      225      226      227      228      229 
## 1782.710 1782.710 1782.710 1782.710 1778.374 1778.374 1778.374 1778.374 
##      230      231      232      233      234      235      236      237 
## 1778.374 1765.366 1761.030 1761.030 1761.030 1761.030 1761.030 1761.030 
##      238      239      308      309      310      311      312      313 
## 1761.030 1761.030 2398.436 2164.287 2103.582 1930.138 1930.138 1921.465 
##      314      410      411      412      413      414      415      416 
## 1912.793 2177.295 2177.295 2177.295 2177.295 2177.295 2177.295 2177.295 
##      417      418      419      420      421      422      423      424 
## 2177.295 2012.524 2012.524 2012.524 2012.524 2012.524 2012.524 2012.524 
##      425      426      427      428      429      433      434      435 
## 2012.524 2251.009 2251.009 1782.710 1782.710 1765.366 1765.366 1765.366 
##      439 
## 1756.694
cor(INTLairbus$PricePremium,INTLairbus$PriceRelative)
## [1] 0.1344226
fit<-lm(PricePremium~PercentPremiumSeats,data = INTLairbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = INTLairbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1824.7 -1265.2   566.5  1064.5  1645.4 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          2088.93     510.86   4.089  7.2e-05 ***
## PercentPremiumSeats   -11.15      36.06  -0.309    0.758    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1239 on 143 degrees of freedom
## Multiple R-squared:  0.0006686,  Adjusted R-squared:  -0.00632 
## F-statistic: 0.09568 on 1 and 143 DF,  p-value: 0.7575
INTLairbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  841  841  841  789  789  928  931 1004 1004 1004 1004 1004
## [127] 1004 1004 1004 1110 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781
## [141] 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1859.156 1859.156 1859.156 1859.156 1859.156 1859.156 1859.156 1859.156 
##       70       71       72       73       99      100      101      102 
## 1859.156 1859.156 1859.156 1859.156 1917.602 1917.602 1917.602 1917.602 
##      103      104      105      106      107      108      109      110 
## 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 
##      111      112      113      114      115      116      117      118 
## 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 
##      119      120      121      122      123      124      125      126 
## 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 
##      127      128      129      130      131      132      133      134 
## 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 
##      135      136      137      139      140      141      142      143 
## 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 1917.602 
##      145      146      150      185      186      187      188      189 
## 1917.602 1917.602 1921.729 1932.549 1932.549 1932.549 1932.549 1932.549 
##      190      191      192      193      194      195      196      197 
## 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 
##      198      199      200      201      202      203      204      205 
## 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 
##      206      207      208      209      210      211      212      213 
## 1932.549 1932.549 1932.549 1932.549 1932.549 1932.549 1949.503 1949.503 
##      214      215      216      217      218      219      220      221 
## 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 
##      222      223      224      225      226      227      228      229 
## 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 
##      230      231      232      233      234      235      236      237 
## 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 
##      238      239      308      309      310      311      312      313 
## 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 1949.503 
##      314      410      411      412      413      414      415      416 
## 1949.503 1980.064 1980.064 1980.064 1980.064 1980.064 1980.064 1980.064 
##      417      418      419      420      421      422      423      424 
## 1980.064 1980.064 1980.064 1980.064 1980.064 1980.064 1980.064 1980.064 
##      425      426      427      428      429      433      434      435 
## 1980.064 1989.657 1989.657 1989.657 1989.657 1989.657 1989.657 1989.657 
##      439 
## 1989.657
cor(INTLairbus$PricePremium,INTLairbus$PercentPremiumSeats)
## [1] -0.02585822

Now It’s time for comparison-

mean(INTL$PriceEconomy)
## [1] 1419.943
mean(INTL$PricePremium)
## [1] 1984.909
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(INTL$PriceEconomy,INTL$TravelMonth,mean))
y2<-c(by(INTL$PricePremium,INTL$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
mean(INTL$PriceEconomy)
## [1] 1419.943
mean(INTL$PricePremium)
## [1] 1984.909
library(plotly)
x<-c('British','Virgin','Delta','Jet','AirFrance','Singapore')
y1<-c(by(INTL$PriceEconomy,INTL$Airline,mean))
y2<-c(by(INTL$PricePremium,INTL$Airline,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Airlines", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')

short Analysis of all International flights

fit<-lm(PriceEconomy~FlightDuration,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1706.5  -576.5  -125.9   450.5  1849.3 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      236.50     105.25   2.247   0.0252 *  
## FlightDuration   148.16      12.12  12.228   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 845.7 on 416 degrees of freedom
## Multiple R-squared:  0.2644, Adjusted R-squared:  0.2626 
## F-statistic: 149.5 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 2051.4611 2051.4611 2051.4611 2051.4611 1445.4877 1445.4877 1445.4877 
##         8         9        10        11        12        13        14 
## 1199.5426 1199.5426 1940.3413 1940.3413 1940.3413 1940.3413 1952.1941 
##        15        16        17        18        19        20        21 
## 1952.1941 1952.1941 1593.6475 1593.6475 1593.6475 1236.5825 1236.5825 
##        22        23        24        25        26        27        28 
## 1236.5825 1223.2481 1223.2481 1223.2481 1532.9020 1532.9020 1532.9020 
##        29        30        31        32        33        34        35 
##  963.9686  963.9686  963.9686  803.9560  803.9560  803.9560  803.9560 
##        36        37        38        39        40        41        42 
## 2236.6608 2236.6608 2236.6608  803.9560  803.9560  803.9560  803.9560 
##        43        44        45        46        47        48        49 
## 1038.0484 1038.0484 1038.0484 1458.8221 1458.8221 1458.8221 2125.5410 
##        50        51        52        53        54        55        56 
## 2125.5410 2125.5410 1199.5426 1878.1142 1878.1142 1878.1142 1137.3155 
##        57        58        59        60        61        62        63 
## 1137.3155 1137.3155 2088.5010 2021.8291 2088.5010 1421.7822 1421.7822 
##        64        65        66        67        68        69        70 
## 1421.7822 1421.7822 1544.7548 1544.7548 1544.7548 1544.7548 1285.4752 
##        71        72        73        82        83        84        85 
## 1285.4752 1285.4752 1384.7422 1248.4353 1248.4353 1248.4353 1248.4353 
##        86        87        88        89        90        91        92 
## 1359.5551 1359.5551 1359.5551 1359.5551  692.8362  692.8362  692.8362 
##        93        94        95        96        97        99       100 
##  692.8362  692.8362  692.8362  692.8362  692.8362 1889.9670 1889.9670 
##       101       102       103       104       105       106       107 
## 1889.9670 1889.9670 1792.1815 1792.1815 1792.1815 1792.1815 2174.4337 
##       108       109       110       111       112       113       114 
## 2174.4337 2174.4337 1889.9670 1889.9670 1889.9670  840.9960  766.9161 
##       115       116       117       118       119       120       121 
##  766.9161  593.5692  718.0234  718.0234  766.9161  630.6091  593.5692 
##       122       123       124       125       126       127       128 
##  593.5692  593.5692  718.0234  507.6365  766.9161  903.2231  593.5692 
##       129       130       131       132       133       134       135 
##  903.2231  507.6365  593.5692  766.9161  840.9960  655.7963  903.2231 
##       136       137       138       139       140       141       142 
##  421.7039  840.9960  421.7039  593.5692  507.6365  507.6365  421.7039 
##       143       144       145       146       147       148       149 
##  421.7039  421.7039  766.9161  655.7963  433.5567  433.5567  421.7039 
##       150       151       156       157       158       159       160 
##  593.5692  433.5567 1903.3013 1903.3013 1903.3013 1903.3013 2026.2739 
##       161       162       163       164       165       166       167 
## 2026.2739 2026.2739 2026.2739 1704.7673 1704.7673 1704.7673 1704.7673 
##       168       169       170       171       172       173       174 
## 1841.0743 1841.0743 1841.0743 1841.0743 1778.8472 2100.3538 1829.2215 
##       175       176       177       178       179       180       181 
## 1829.2215 1829.2215 1829.2215 2100.3538 1915.1541 1371.4079 1371.4079 
##       182       183       184       185       186       187       188 
## 1371.4079 1371.4079 2100.3538 1470.6749 1470.6749 1644.0218 1644.0218 
##       189       190       191       192       193       194       195 
## 1644.0218 1470.6749 1260.2881 1260.2881 1260.2881 1260.2881 1211.3953 
##       196       197       198       199       200       201       202 
## 1211.3953 1211.3953 1211.3953 1778.8472 1778.8472 1778.8472 1915.1541 
##       203       204       205       206       207       208       209 
## 1915.1541 1334.3679 1334.3679 1334.3679 1334.3679 1285.4752 1384.7422 
##       210       211       212       213       214       215       216 
## 1384.7422 1384.7422 1644.0218 1644.0218 1644.0218 1470.6749 1470.6749 
##       217       218       219       220       221       222       223 
## 1470.6749 1470.6749 1470.6749 1470.6749 1470.6749 1470.6749 1322.5151 
##       224       225       226       227       228       229       230 
## 1322.5151 1322.5151 1248.4353 1248.4353 1556.6075 1556.6075 1556.6075 
##       231       232       233       234       235       236       237 
## 1433.6350 1596.6107 1596.6107 1606.9819 1606.9819 1593.6475 1593.6475 
##       238       239       240       241       242       243       244 
## 1606.9819 1606.9819 1778.8472 1778.8472 1778.8472 1866.2614 1866.2614 
##       245       246       247       248       249       250       251 
## 1866.2614 1704.7673 1704.7673 1704.7673 1704.7673 1507.7148 1507.7148 
##       252       253       254       255       256       257       258 
## 1507.7148 1927.0069 1927.0069 1927.0069 1927.0069 1618.8346 1618.8346 
##       259       260       261       262       263       264       265 
## 1618.8346 1556.6075 1519.5676 1519.5676 1519.5676 1310.6624 1310.6624 
##       266       267       268       269       270       271       272 
## 1310.6624 1556.6075 1285.4752 1285.4752 1285.4752 1927.0069 1927.0069 
##       273       274       275       276       277       278       279 
## 1927.0069 1927.0069 1556.6075 1878.1142 1878.1142 1878.1142 1285.4752 
##       280       308       309       310       311       312       313 
## 1878.1142 1644.0218 1644.0218 1644.0218 1556.6075 1556.6075 1644.0218 
##       314       315       316       317       318       319       320 
## 1556.6075 2297.4063 2297.4063 2297.4063 2297.4063 2075.1667 2075.1667 
##       321       322       323       324       325       326       327 
## 2075.1667 1841.0743 1841.0743 1841.0743 2408.5261 2408.5261 2408.5261 
##       328       329       330       331       332       333       334 
## 1667.7274 1667.7274 1667.7274  803.9560  803.9560  803.9560  803.9560 
##       335       336       337       338       339       340       341 
## 2125.5410 2125.5410 2125.5410 2125.5410 1470.6749 1470.6749 1470.6749 
##       342       343       344       345       346       347       348 
## 1347.7023 1248.4353 1532.9020 1532.9020 1532.9020 1371.4079 1248.4353 
##       349       350       351       352       353       354       355 
## 1248.4353 1644.0218 1644.0218 1644.0218 1644.0218 1384.7422 1384.7422 
##       356       357       358       359       360       361       362 
## 1384.7422 1396.5950 1630.6874 1630.6874 1630.6874 1977.3812 1977.3812 
##       363       364       365       366       367       368       369 
## 2001.0868 2001.0868 2001.0868 2001.0868 2285.5535 2285.5535 2285.5535 
##       370       371       372       373       374       375       376 
## 2211.4736 2211.4736 2211.4736 1556.6075 1556.6075 1556.6075 1655.8746 
##       377       378       379       380       381       382       383 
## 1655.8746 1655.8746  718.0234  718.0234  718.0234  718.0234  718.0234 
##       384       385       386       387       388       389       390 
##  852.8488  852.8488  840.9960  606.9036  606.9036  606.9036  630.6091 
##       391       392       393       394       395       396       397 
##  630.6091  630.6091  852.8488  718.0234  840.9960  852.8488  852.8488 
##       398       399       400       401       402       403       404 
##  606.9036  630.6091  878.0359  878.0359  878.0359  878.0359  718.0234 
##       405       406       407       408       409       410       411 
##  718.0234 1260.2881 1260.2881 1260.2881 1260.2881 2211.4736 2211.4736 
##       412       413       414       415       416       417       418 
## 2211.4736 2211.4736 1149.1682 1149.1682 1149.1682 1149.1682 2112.2066 
##       419       420       421       422       423       424       425 
## 2112.2066 2112.2066 2112.2066 1199.5426 1199.5426 1199.5426 1199.5426 
##       426       427       428       429       430       431       432 
## 2162.5809 2162.5809 1347.7023 1347.7023 1815.8871 1815.8871 1815.8871 
##       433       434       435       436       437       438       439 
## 1482.5277 1495.8620 1495.8620 1495.8620 1940.3413 1940.3413 2162.5809 
##       440       441       442       443       444       445       446 
## 1075.0884  704.6890  704.6890 1075.0884 1075.0884 1075.0884 1075.0884 
##       447       448       449       450       451       452       453 
## 1075.0884  704.6890  618.7564  618.7564  618.7564  704.6890  618.7564 
##       454       455       456       457       458 
##  618.7564  618.7564  618.7564  718.0234  618.7564
cor(INTL$PriceEconomy,INTL$FlightDuration)
## [1] 0.5141957
fit<-lm(PriceEconomy~SeatsEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1393.98  -889.79    10.18   642.51  2188.12 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1331.9162   142.9923   9.315   <2e-16 ***
## SeatsEconomy    0.4193     0.6413   0.654    0.514    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 985.5 on 416 degrees of freedom
## Multiple R-squared:  0.001027,   Adjusted R-squared:  -0.001375 
## F-statistic: 0.4276 on 1 and 416 DF,  p-value: 0.5136
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##        9       10       11       12       13       14       15       16 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##       17       18       19       20       21       22       23       24 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##       25       26       27       28       29       30       31       32 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##       33       34       35       36       37       38       39       40 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##       41       42       43       44       45       46       47       48 
## 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 1383.076 
##       49       50       51       52       53       54       55       56 
## 1383.076 1383.076 1383.076 1385.172 1385.172 1385.172 1385.172 1385.172 
##       57       58       59       60       61       62       63       64 
## 1385.172 1385.172 1385.172 1385.172 1385.172 1409.494 1409.494 1409.494 
##       65       66       67       68       69       70       71       72 
## 1409.494 1409.494 1409.494 1409.494 1409.494 1409.494 1409.494 1409.494 
##       73       82       83       84       85       86       87       88 
## 1409.494 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##       89       90       91       92       93       94       95       96 
## 1433.816 1389.785 1389.785 1389.785 1389.785 1389.785 1389.785 1389.785 
##       97       99      100      101      102      103      104      105 
## 1389.785 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      106      107      108      109      110      111      112      113 
## 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      114      115      116      117      118      119      120      121 
## 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      122      123      124      125      126      127      128      129 
## 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      130      131      132      133      134      135      136      137 
## 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      138      139      140      141      142      143      144      145 
## 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 1458.976 
##      146      147      148      149      150      151      156      157 
## 1458.976 1458.976 1458.976 1458.976 1462.750 1458.976 1414.946 1414.946 
##      158      159      160      161      162      163      164      165 
## 1414.946 1414.946 1414.946 1414.946 1414.946 1414.946 1489.169 1489.169 
##      166      167      168      169      170      171      172      173 
## 1489.169 1489.169 1414.946 1414.946 1414.946 1414.946 1414.946 1414.946 
##      174      175      176      177      178      179      180      181 
## 1489.169 1489.169 1489.169 1489.169 1414.946 1414.946 1414.946 1414.946 
##      182      183      184      185      186      187      188      189 
## 1414.946 1414.946 1414.946 1429.623 1429.623 1429.623 1429.623 1429.623 
##      190      191      192      193      194      195      196      197 
## 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 
##      198      199      200      201      202      203      204      205 
## 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 
##      206      207      208      209      210      211      212      213 
## 1429.623 1429.623 1429.623 1429.623 1429.623 1429.623 1393.559 1393.559 
##      214      215      216      217      218      219      220      221 
## 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 
##      222      223      224      225      226      227      228      229 
## 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 
##      230      231      232      233      234      235      236      237 
## 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 1393.559 
##      238      239      240      241      242      243      244      245 
## 1393.559 1393.559 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##      246      247      248      249      250      251      252      253 
## 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##      254      255      256      257      258      259      260      261 
## 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##      262      263      264      265      266      267      268      269 
## 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##      270      271      272      273      274      275      276      277 
## 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 1433.816 
##      278      279      280      308      309      310      311      312 
## 1433.816 1433.816 1433.816 1393.559 1393.559 1393.559 1393.559 1393.559 
##      313      314      315      316      317      318      319      320 
## 1393.559 1393.559 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 
##      321      322      323      324      325      326      327      328 
## 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 
##      329      330      331      332      333      334      335      336 
## 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 1409.075 
##      337      338      339      340      341      342      343      344 
## 1409.075 1409.075 1415.784 1415.784 1415.784 1415.784 1415.784 1415.784 
##      345      346      347      348      349      350      351      352 
## 1415.784 1415.784 1415.784 1415.784 1415.784 1415.784 1415.784 1415.784 
##      353      354      355      356      357      358      359      360 
## 1415.784 1404.881 1404.881 1404.881 1404.881 1415.784 1415.784 1415.784 
##      361      362      363      364      365      366      367      368 
## 1404.881 1404.881 1415.784 1415.784 1415.784 1415.784 1417.042 1417.042 
##      369      370      371      372      373      374      375      376 
## 1417.042 1417.042 1417.042 1417.042 1417.042 1417.042 1417.042 1417.042 
##      377      378      379      380      381      382      383      384 
## 1417.042 1417.042 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 
##      385      386      387      388      389      390      391      392 
## 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 
##      393      394      395      396      397      398      399      400 
## 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 1383.914 
##      401      402      403      404      405      406      407      408 
## 1383.914 1383.914 1383.914 1383.914 1383.914 1422.494 1422.494 1422.494 
##      409      410      411      412      413      414      415      416 
## 1422.494 1471.557 1471.557 1471.557 1471.557 1471.557 1471.557 1471.557 
##      417      418      419      420      421      422      423      424 
## 1471.557 1471.557 1471.557 1471.557 1471.557 1471.557 1471.557 1471.557 
##      425      426      427      428      429      430      431      432 
## 1471.557 1495.040 1495.040 1495.040 1495.040 1495.040 1495.040 1495.040 
##      433      434      435      436      437      438      439      440 
## 1495.040 1495.040 1495.040 1495.040 1495.040 1495.040 1495.040 1399.849 
##      441      442      443      444      445      446      447      448 
## 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 
##      449      450      451      452      453      454      455      456 
## 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 1399.849 
##      457      458 
## 1399.849 1399.849
cor(INTL$PriceEconomy,INTL$SeatsEconomy)
## [1] 0.03204234
fit<-lm(PriceEconomy~PriceRelative,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1592.31  -661.40    57.82   740.28  2447.06 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1885.3       67.5  27.929   <2e-16 ***
## PriceRelative   -885.1       97.3  -9.097   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 900.5 on 416 degrees of freedom
## Multiple R-squared:  0.1659, Adjusted R-squared:  0.1639 
## F-statistic: 82.75 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1548.9223 1548.9223 1548.9223 1548.9223 1292.2334 1292.2334 1292.2334 
##         8         9        10        11        12        13        14 
##  973.5851  973.5851 1221.4227 1221.4227 1389.5982 1655.1384 1425.0035 
##        15        16        17        18        19        20        21 
## 1425.0035 1425.0035 1548.9223 1548.9223 1548.9223 1584.3277 1584.3277 
##        22        23        24        25        26        27        28 
## 1584.3277 1593.1790 1593.1790 1593.1790 1575.4763 1593.1790 1593.1790 
##        29        30        31        32        33        34        35 
## 1584.3277 1584.3277 1584.3277 1513.5169 1513.5169 1513.5169 1513.5169 
##        36        37        38        39        40        41        42 
## 1309.9361 1309.9361 1309.9361 1672.8411 1672.8411 1672.8411 1672.8411 
##        43        44        45        46        47        48        49 
## 1734.8005 1734.8005 1734.8005 1814.4626 1814.4626 1814.4626 1425.0035 
##        50        51        52        53        54        55        56 
## 1425.0035 1425.0035  973.5851 1566.6250 1566.6250 1566.6250 1584.3277 
##        57        58        59        60        61        62        63 
## 1584.3277 1584.3277 1699.3951 1699.3951 1345.3414 1239.1253 1239.1253 
##        64        65        66        67        68        69        70 
## 1239.1253 1239.1253 1540.0710 1540.0710 1540.0710 1540.0710 1655.1384 
##        71        72        73        82        83        84        85 
## 1655.1384 1655.1384 1796.7599  938.1797  938.1797  938.1797  938.1797 
##        86        87        88        89        90        91        92 
## 1531.2196 1531.2196 1531.2196 1531.2196 1460.4089 1460.4089 1460.4089 
##        93        94        95        96        97        99       100 
## 1460.4089 1593.1790 1593.1790 1593.1790 1655.1384 1451.5575 1451.5575 
##       101       102       103       104       105       106       107 
## 1451.5575 1451.5575 1079.8012 1079.8012 1079.8012 1079.8012 1469.2602 
##       108       109       110       111       112       113       114 
## 1469.2602 1469.2602  761.1529  761.1529 1566.6250 1832.1653 1796.7599 
##       115       116       117       118       119       120       121 
## 1796.7599 1849.8679 1787.9085 1787.9085 1814.4626 1805.6112 1841.0166 
##       122       123       124       125       126       127       128 
## 1841.0166 1787.9085 1761.3545 1734.8005 1743.6518 1752.5032 1823.3139 
##       129       130       131       132       133       134       135 
## 1734.8005 1725.9491 1761.3545 1770.2059 1743.6518 1725.9491 1725.9491 
##       136       137       138       139       140       141       142 
## 1663.9898 1708.2465 1655.1384 1717.0978 1681.6924 1681.6924 1619.7330 
##       143       144       145       146       147       148       149 
## 1619.7330 1619.7330 1663.9898 1628.5844 1628.5844 1628.5844 1531.2196 
##       150       151       156       157       158       159       160 
## 1610.8817 1593.1790  274.3290  274.3290  274.3290  274.3290  353.9911 
##       161       162       163       164       165       166       167 
##  353.9911  353.9911  663.7881 1026.6931 1026.6931 1026.6931 1026.6931 
##       168       169       170       171       172       173       174 
## 1079.8012 1079.8012 1079.8012 1079.8012 1141.7606 1389.5982 1433.8549 
##       175       176       177       178       179       180       181 
## 1433.8549 1433.8549 1433.8549 1442.7062 1451.5575 1531.2196 1531.2196 
##       182       183       184       185       186       187       188 
## 1531.2196 1531.2196 1655.1384 1478.1116 1478.1116 1548.9223 1548.9223 
##       189       190       191       192       193       194       195 
## 1548.9223 1619.7330  929.3284  929.3284  929.3284  929.3284  973.5851 
##       196       197       198       199       200       201       202 
##  973.5851  973.5851  973.5851 1141.7606 1141.7606 1141.7606 1451.5575 
##       203       204       205       206       207       208       209 
## 1451.5575 1522.3683 1522.3683 1522.3683 1522.3683 1655.1384 1796.7599 
##       210       211       212       213       214       215       216 
## 1796.7599 1796.7599  504.4639  849.6663 1327.6388 1814.4626 1814.4626 
##       217       218       219       220       221       222       223 
## 1814.4626 1814.4626 1814.4626 1814.4626 1814.4626 1814.4626 1814.4626 
##       224       225       226       227       228       229       230 
## 1814.4626 1814.4626 1823.3139 1823.3139 1823.3139 1823.3139 1823.3139 
##       231       232       233       234       235       236       237 
## 1849.8679 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 
##       238       239       240       241       242       243       244 
## 1858.7193 1858.7193  885.0717  885.0717 1655.1384 1486.9629 1486.9629 
##       245       246       247       248       249       250       251 
## 1486.9629 1566.6250 1566.6250 1566.6250 1566.6250 1017.8418 1017.8418 
##       252       253       254       255       256       257       258 
## 1017.8418 1593.1790 1593.1790 1593.1790 1593.1790 1566.6250 1566.6250 
##       259       260       261       262       263       264       265 
## 1566.6250  885.0717 1513.5169 1513.5169 1513.5169 1531.2196 1531.2196 
##       266       267       268       269       270       271       272 
## 1531.2196 1177.1659 1823.3139 1823.3139 1823.3139  902.7743  902.7743 
##       273       274       275       276       277       278       279 
## 1079.8012 1708.2465 1177.1659 1734.8005 1734.8005 1734.8005 1699.3951 
##       280       308       309       310       311       312       313 
## 1380.7468  557.5720 1035.5445 1159.4633 1513.5169 1513.5169 1531.2196 
##       314       315       316       317       318       319       320 
## 1548.9223  902.7743 1150.6119 1150.6119 1203.7200 1354.1928 1354.1928 
##       321       322       323       324       325       326       327 
## 1354.1928 1398.4495 1460.4089 1460.4089 1770.2059 1770.2059 1770.2059 
##       328       329       330       331       332       333       334 
## 1770.2059 1770.2059 1770.2059 1796.7599 1796.7599 1796.7599 1796.7599 
##       335       336       337       338       339       340       341 
## 1805.6112 1805.6112 1805.6112 1805.6112 1566.6250 1566.6250 1566.6250 
##       342       343       344       345       346       347       348 
## 1814.4626 1823.3139 1823.3139 1823.3139 1823.3139 1849.8679 1849.8679 
##       349       350       351       352       353       354       355 
## 1849.8679 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 
##       356       357       358       359       360       361       362 
## 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 1858.7193 
##       363       364       365       366       367       368       369 
## 1858.7193 1858.7193 1858.7193 1858.7193  654.9368  654.9368  654.9368 
##       370       371       372       373       374       375       376 
## 1761.3545 1761.3545 1761.3545 1203.7200 1460.4089 1460.4089 1849.8679 
##       377       378       379       380       381       382       383 
## 1425.0035 1557.7736  212.3697  212.3697  212.3697  230.0723  407.0992 
##       384       385       386       387       388       389       390 
##  433.6532  531.0180  743.4502  770.0042  770.0042  770.0042  902.7743 
##       391       392       393       394       395       396       397 
##  902.7743  902.7743  920.4770  947.0310  964.7337  964.7337 1079.8012 
##       398       399       400       401       402       403       404 
## 1168.3146 1186.0173 1230.2740 1230.2740 1230.2740 1230.2740 1442.7062 
##       405       406       407       408       409       410       411 
## 1734.8005  433.6532  433.6532  610.6800 1389.5982 1008.9904 1008.9904 
##       412       413       414       415       416       417       418 
## 1008.9904 1008.9904 1008.9904 1008.9904 1008.9904 1008.9904 1345.3414 
##       419       420       421       422       423       424       425 
## 1345.3414 1345.3414 1345.3414 1345.3414 1345.3414 1345.3414 1345.3414 
##       426       427       428       429       430       431       432 
##  858.5176  858.5176 1814.4626 1814.4626 1823.3139 1823.3139 1823.3139 
##       433       434       435       436       437       438       439 
## 1849.8679 1849.8679 1849.8679 1849.8679 1858.7193 1858.7193 1867.5706 
##       440       441       442       443       444       445       446 
##  371.6938  398.2478  398.2478  734.5988  734.5988  734.5988  734.5988 
##       447       448       449       450       451       452       453 
##  805.4096  938.1797 1203.7200 1203.7200 1203.7200 1309.9361 1354.1928 
##       454       455       456       457       458 
## 1371.8955 1486.9629 1486.9629 1548.9223 1779.0572
cor(INTL$PriceEconomy,INTL$PriceRelative)
## [1] -0.4073316
fit<-lm(PriceEconomy~PercentPremiumSeats,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1364.60  -850.95    -4.74   584.24  2251.82 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         1219.364    149.643   8.148 4.36e-15 ***
## PercentPremiumSeats   13.687      9.669   1.416    0.158    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 983.6 on 416 degrees of freedom
## Multiple R-squared:  0.004794,   Adjusted R-squared:  0.002401 
## F-statistic: 2.004 on 1 and 416 DF,  p-value: 0.1577
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##        9       10       11       12       13       14       15       16 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##       17       18       19       20       21       22       23       24 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##       25       26       27       28       29       30       31       32 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##       33       34       35       36       37       38       39       40 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##       41       42       43       44       45       46       47       48 
## 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 1557.302 
##       49       50       51       52       53       54       55       56 
## 1557.302 1557.302 1557.302 1540.878 1540.878 1540.878 1540.878 1540.878 
##       57       58       59       60       61       62       63       64 
## 1540.878 1540.878 1540.878 1540.878 1540.878 1501.321 1501.321 1501.321 
##       65       66       67       68       69       70       71       72 
## 1501.321 1501.321 1501.321 1501.321 1501.321 1501.321 1501.321 1501.321 
##       73       82       83       84       85       86       87       88 
## 1501.321 1475.726 1475.726 1475.726 1475.726 1475.726 1475.726 1475.726 
##       89       90       91       92       93       94       95       96 
## 1475.726 1450.268 1450.268 1450.268 1450.268 1450.268 1450.268 1450.268 
##       97       99      100      101      102      103      104      105 
## 1450.268 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      106      107      108      109      110      111      112      113 
## 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      114      115      116      117      118      119      120      121 
## 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      122      123      124      125      126      127      128      129 
## 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      130      131      132      133      134      135      136      137 
## 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      138      139      140      141      142      143      144      145 
## 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 1429.600 
##      146      147      148      149      150      151      156      157 
## 1429.600 1429.600 1429.600 1429.600 1424.536 1429.600 1424.947 1424.947 
##      158      159      160      161      162      163      164      165 
## 1424.947 1424.947 1424.947 1424.947 1424.947 1424.947 1424.262 1424.262 
##      166      167      168      169      170      171      172      173 
## 1424.262 1424.262 1424.947 1424.947 1424.947 1424.947 1424.947 1424.947 
##      174      175      176      177      178      179      180      181 
## 1424.262 1424.262 1424.262 1424.262 1424.947 1424.947 1424.947 1424.947 
##      182      183      184      185      186      187      188      189 
## 1424.947 1424.947 1424.947 1411.259 1411.259 1411.259 1411.259 1411.259 
##      190      191      192      193      194      195      196      197 
## 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 
##      198      199      200      201      202      203      204      205 
## 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 
##      206      207      208      209      210      211      212      213 
## 1411.259 1411.259 1411.259 1411.259 1411.259 1411.259 1390.455 1390.455 
##      214      215      216      217      218      219      220      221 
## 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 
##      222      223      224      225      226      227      228      229 
## 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 
##      230      231      232      233      234      235      236      237 
## 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 1390.455 
##      238      239      240      241      242      243      244      245 
## 1390.455 1390.455 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 
##      246      247      248      249      250      251      252      253 
## 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 
##      254      255      256      257      258      259      260      261 
## 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 
##      262      263      264      265      266      267      268      269 
## 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 
##      270      271      272      273      274      275      276      277 
## 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 1395.930 
##      278      279      280      308      309      310      311      312 
## 1395.930 1395.930 1395.930 1390.455 1390.455 1390.455 1390.455 1390.455 
##      313      314      315      316      317      318      319      320 
## 1390.455 1390.455 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 
##      321      322      323      324      325      326      327      328 
## 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 
##      329      330      331      332      333      334      335      336 
## 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 1400.173 
##      337      338      339      340      341      342      343      344 
## 1400.173 1400.173 1387.444 1387.444 1387.444 1387.444 1387.444 1387.444 
##      345      346      347      348      349      350      351      352 
## 1387.444 1387.444 1387.444 1387.444 1387.444 1387.444 1387.444 1387.444 
##      353      354      355      356      357      358      359      360 
## 1387.444 1385.254 1385.254 1385.254 1385.254 1387.444 1387.444 1387.444 
##      361      362      363      364      365      366      367      368 
## 1385.254 1385.254 1387.444 1387.444 1387.444 1387.444 1364.038 1364.038 
##      369      370      371      372      373      374      375      376 
## 1364.038 1364.038 1364.038 1364.038 1364.038 1364.038 1364.038 1364.038 
##      377      378      379      380      381      382      383      384 
## 1364.038 1364.038 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 
##      385      386      387      388      389      390      391      392 
## 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 
##      393      394      395      396      397      398      399      400 
## 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 1375.809 
##      401      402      403      404      405      406      407      408 
## 1375.809 1375.809 1375.809 1375.809 1375.809 1356.237 1356.237 1356.237 
##      409      410      411      412      413      414      415      416 
## 1356.237 1352.952 1352.952 1352.952 1352.952 1352.952 1352.952 1352.952 
##      417      418      419      420      421      422      423      424 
## 1352.952 1352.952 1352.952 1352.952 1352.952 1352.952 1352.952 1352.952 
##      425      426      427      428      429      430      431      432 
## 1352.952 1341.181 1341.181 1341.181 1341.181 1341.181 1341.181 1341.181 
##      433      434      435      436      437      438      439      440 
## 1341.181 1341.181 1341.181 1341.181 1341.181 1341.181 1341.181 1283.831 
##      441      442      443      444      445      446      447      448 
## 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 
##      449      450      451      452      453      454      455      456 
## 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 1283.831 
##      457      458 
## 1283.831 1283.831
cor(INTL$PriceEconomy,INTL$PercentPremiumSeats)
## [1] 0.06923571
fit<-lm(PricePremium~FlightDuration,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2263.5  -661.9    78.5   798.5  4139.1 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      221.22     126.06   1.755     0.08 .  
## FlightDuration   220.80      14.51  15.215   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1013 on 416 degrees of freedom
## Multiple R-squared:  0.3575, Adjusted R-squared:  0.356 
## F-statistic: 231.5 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 2926.0652 2926.0652 2926.0652 2926.0652 2022.9792 2022.9792 2022.9792 
##         8         9        10        11        12        13        14 
## 1656.4455 1656.4455 2760.4626 2760.4626 2760.4626 2760.4626 2778.1269 
##        15        16        17        18        19        20        21 
## 2778.1269 2778.1269 2243.7826 2243.7826 2243.7826 1711.6464 1711.6464 
##        22        23        24        25        26        27        28 
## 1711.6464 1691.7741 1691.7741 1691.7741 2153.2532 2153.2532 2153.2532 
##        29        30        31        32        33        34        35 
## 1305.3681 1305.3681 1305.3681 1066.9004 1066.9004 1066.9004 1066.9004 
##        36        37        38        39        40        41        42 
## 3202.0695 3202.0695 3202.0695 1066.9004 1066.9004 1066.9004 1066.9004 
##        43        44        45        46        47        48        49 
## 1415.7698 1415.7698 1415.7698 2042.8515 2042.8515 2042.8515 3036.4669 
##        50        51        52        53        54        55        56 
## 3036.4669 3036.4669 1656.4455 2667.7252 2667.7252 2667.7252 1563.7081 
##        57        58        59        60        61        62        63 
## 1563.7081 1563.7081 2981.2661 2881.9045 2981.2661 1987.6506 1987.6506 
##        64        65        66        67        68        69        70 
## 1987.6506 1987.6506 2170.9175 2170.9175 2170.9175 2170.9175 1784.5115 
##        71        72        73        82        83        84        85 
## 1784.5115 1784.5115 1932.4498 1729.3106 1729.3106 1729.3106 1729.3106 
##        86        87        88        89        90        91        92 
## 1894.9132 1894.9132 1894.9132 1894.9132  901.2978  901.2978  901.2978 
##        93        94        95        96        97        99       100 
##  901.2978  901.2978  901.2978  901.2978  901.2978 2685.3895 2685.3895 
##       101       102       103       104       105       106       107 
## 2685.3895 2685.3895 2539.6592 2539.6592 2539.6592 2539.6592 3109.3321 
##       108       109       110       111       112       113       114 
## 3109.3321 3109.3321 2685.3895 2685.3895 2685.3895 1122.1012 1011.6995 
##       115       116       117       118       119       120       121 
## 1011.6995  753.3595  938.8344  938.8344 1011.6995  808.5603  753.3595 
##       122       123       124       125       126       127       128 
##  753.3595  753.3595  938.8344  625.2935 1011.6995 1214.8386  753.3595 
##       129       130       131       132       133       134       135 
## 1214.8386  625.2935  753.3595 1011.6995 1122.1012  846.0969 1214.8386 
##       136       137       138       139       140       141       142 
##  497.2275 1122.1012  497.2275  753.3595  625.2935  625.2935  497.2275 
##       143       144       145       146       147       148       149 
##  497.2275  497.2275 1011.6995  846.0969  514.8918  514.8918  497.2275 
##       150       151       156       157       158       159       160 
##  753.3595  514.8918 2705.2618 2705.2618 2705.2618 2705.2618 2888.5286 
##       161       162       163       164       165       166       167 
## 2888.5286 2888.5286 2888.5286 2409.3852 2409.3852 2409.3852 2409.3852 
##       168       169       170       171       172       173       174 
## 2612.5243 2612.5243 2612.5243 2612.5243 2519.7869 2998.9303 2594.8601 
##       175       176       177       178       179       180       181 
## 2594.8601 2594.8601 2594.8601 2998.9303 2722.9261 1912.5775 1912.5775 
##       182       183       184       185       186       187       188 
## 1912.5775 1912.5775 2998.9303 2060.5158 2060.5158 2318.8558 2318.8558 
##       189       190       191       192       193       194       195 
## 2318.8558 2060.5158 1746.9749 1746.9749 1746.9749 1746.9749 1674.1098 
##       196       197       198       199       200       201       202 
## 1674.1098 1674.1098 1674.1098 2519.7869 2519.7869 2519.7869 2722.9261 
##       203       204       205       206       207       208       209 
## 2722.9261 1857.3766 1857.3766 1857.3766 1857.3766 1784.5115 1932.4498 
##       210       211       212       213       214       215       216 
## 1932.4498 1932.4498 2318.8558 2318.8558 2318.8558 2060.5158 2060.5158 
##       217       218       219       220       221       222       223 
## 2060.5158 2060.5158 2060.5158 2060.5158 2060.5158 2060.5158 1839.7123 
##       224       225       226       227       228       229       230 
## 1839.7123 1839.7123 1729.3106 1729.3106 2188.5818 2188.5818 2188.5818 
##       231       232       233       234       235       236       237 
## 2005.3149 2248.1987 2248.1987 2263.6549 2263.6549 2243.7826 2243.7826 
##       238       239       240       241       242       243       244 
## 2263.6549 2263.6549 2519.7869 2519.7869 2519.7869 2650.0609 2650.0609 
##       245       246       247       248       249       250       251 
## 2650.0609 2409.3852 2409.3852 2409.3852 2409.3852 2115.7166 2115.7166 
##       252       253       254       255       256       257       258 
## 2115.7166 2740.5903 2740.5903 2740.5903 2740.5903 2281.3192 2281.3192 
##       259       260       261       262       263       264       265 
## 2281.3192 2188.5818 2133.3809 2133.3809 2133.3809 1822.0481 1822.0481 
##       266       267       268       269       270       271       272 
## 1822.0481 2188.5818 1784.5115 1784.5115 1784.5115 2740.5903 2740.5903 
##       273       274       275       276       277       278       279 
## 2740.5903 2740.5903 2188.5818 2667.7252 2667.7252 2667.7252 1784.5115 
##       280       308       309       310       311       312       313 
## 2667.7252 2318.8558 2318.8558 2318.8558 2188.5818 2188.5818 2318.8558 
##       314       315       316       317       318       319       320 
## 2188.5818 3292.5989 3292.5989 3292.5989 3292.5989 2961.3938 2961.3938 
##       321       322       323       324       325       326       327 
## 2961.3938 2612.5243 2612.5243 2612.5243 3458.2015 3458.2015 3458.2015 
##       328       329       330       331       332       333       334 
## 2354.1843 2354.1843 2354.1843 1066.9004 1066.9004 1066.9004 1066.9004 
##       335       336       337       338       339       340       341 
## 3036.4669 3036.4669 3036.4669 3036.4669 2060.5158 2060.5158 2060.5158 
##       342       343       344       345       346       347       348 
## 1877.2489 1729.3106 2153.2532 2153.2532 2153.2532 1912.5775 1729.3106 
##       349       350       351       352       353       354       355 
## 1729.3106 2318.8558 2318.8558 2318.8558 2318.8558 1932.4498 1932.4498 
##       356       357       358       359       360       361       362 
## 1932.4498 1950.1141 2298.9835 2298.9835 2298.9835 2815.6635 2815.6635 
##       363       364       365       366       367       368       369 
## 2850.9920 2850.9920 2850.9920 2850.9920 3274.9346 3274.9346 3274.9346 
##       370       371       372       373       374       375       376 
## 3164.5329 3164.5329 3164.5329 2188.5818 2188.5818 2188.5818 2336.5201 
##       377       378       379       380       381       382       383 
## 2336.5201 2336.5201  938.8344  938.8344  938.8344  938.8344  938.8344 
##       384       385       386       387       388       389       390 
## 1139.7655 1139.7655 1122.1012  773.2318  773.2318  773.2318  808.5603 
##       391       392       393       394       395       396       397 
##  808.5603  808.5603 1139.7655  938.8344 1122.1012 1139.7655 1139.7655 
##       398       399       400       401       402       403       404 
##  773.2318  808.5603 1177.3021 1177.3021 1177.3021 1177.3021  938.8344 
##       405       406       407       408       409       410       411 
##  938.8344 1746.9749 1746.9749 1746.9749 1746.9749 3164.5329 3164.5329 
##       412       413       414       415       416       417       418 
## 3164.5329 3164.5329 1581.3723 1581.3723 1581.3723 1581.3723 3016.5946 
##       419       420       421       422       423       424       425 
## 3016.5946 3016.5946 3016.5946 1656.4455 1656.4455 1656.4455 1656.4455 
##       426       427       428       429       430       431       432 
## 3091.6678 3091.6678 1877.2489 1877.2489 2574.9878 2574.9878 2574.9878 
##       433       434       435       436       437       438       439 
## 2078.1801 2098.0524 2098.0524 2098.0524 2760.4626 2760.4626 3091.6678 
##       440       441       442       443       444       445       446 
## 1470.9706  918.9621  918.9621 1470.9706 1470.9706 1470.9706 1470.9706 
##       447       448       449       450       451       452       453 
## 1470.9706  918.9621  790.8961  790.8961  790.8961  918.9621  790.8961 
##       454       455       456       457       458 
##  790.8961  790.8961  790.8961  938.8344  790.8961
cor(INTL$PricePremium,INTL$FlightDuration)
## [1] 0.5979467
fit<-lm(PricePremium~SeatsEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsEconomy, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2009.9 -1144.9   203.9  1047.0  5437.3 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1734.5948   182.8845   9.485   <2e-16 ***
## SeatsEconomy    1.1924     0.8202   1.454    0.147    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1260 on 416 degrees of freedom
## Multiple R-squared:  0.005055,   Adjusted R-squared:  0.002663 
## F-statistic: 2.114 on 1 and 416 DF,  p-value: 0.1468
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##        9       10       11       12       13       14       15       16 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##       17       18       19       20       21       22       23       24 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##       25       26       27       28       29       30       31       32 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##       33       34       35       36       37       38       39       40 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##       41       42       43       44       45       46       47       48 
## 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 1880.073 
##       49       50       51       52       53       54       55       56 
## 1880.073 1880.073 1880.073 1886.036 1886.036 1886.036 1886.036 1886.036 
##       57       58       59       60       61       62       63       64 
## 1886.036 1886.036 1886.036 1886.036 1886.036 1955.198 1955.198 1955.198 
##       65       66       67       68       69       70       71       72 
## 1955.198 1955.198 1955.198 1955.198 1955.198 1955.198 1955.198 1955.198 
##       73       82       83       84       85       86       87       88 
## 1955.198 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##       89       90       91       92       93       94       95       96 
## 2024.360 1899.153 1899.153 1899.153 1899.153 1899.153 1899.153 1899.153 
##       97       99      100      101      102      103      104      105 
## 1899.153 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      106      107      108      109      110      111      112      113 
## 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      114      115      116      117      118      119      120      121 
## 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      122      123      124      125      126      127      128      129 
## 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      130      131      132      133      134      135      136      137 
## 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      138      139      140      141      142      143      144      145 
## 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 2095.907 
##      146      147      148      149      150      151      156      157 
## 2095.907 2095.907 2095.907 2095.907 2106.639 2095.907 1970.700 1970.700 
##      158      159      160      161      162      163      164      165 
## 1970.700 1970.700 1970.700 1970.700 1970.700 1970.700 2181.763 2181.763 
##      166      167      168      169      170      171      172      173 
## 2181.763 2181.763 1970.700 1970.700 1970.700 1970.700 1970.700 1970.700 
##      174      175      176      177      178      179      180      181 
## 2181.763 2181.763 2181.763 2181.763 1970.700 1970.700 1970.700 1970.700 
##      182      183      184      185      186      187      188      189 
## 1970.700 1970.700 1970.700 2012.435 2012.435 2012.435 2012.435 2012.435 
##      190      191      192      193      194      195      196      197 
## 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 
##      198      199      200      201      202      203      204      205 
## 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 
##      206      207      208      209      210      211      212      213 
## 2012.435 2012.435 2012.435 2012.435 2012.435 2012.435 1909.885 1909.885 
##      214      215      216      217      218      219      220      221 
## 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 
##      222      223      224      225      226      227      228      229 
## 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 
##      230      231      232      233      234      235      236      237 
## 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 1909.885 
##      238      239      240      241      242      243      244      245 
## 1909.885 1909.885 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##      246      247      248      249      250      251      252      253 
## 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##      254      255      256      257      258      259      260      261 
## 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##      262      263      264      265      266      267      268      269 
## 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##      270      271      272      273      274      275      276      277 
## 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 2024.360 
##      278      279      280      308      309      310      311      312 
## 2024.360 2024.360 2024.360 1909.885 1909.885 1909.885 1909.885 1909.885 
##      313      314      315      316      317      318      319      320 
## 1909.885 1909.885 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 
##      321      322      323      324      325      326      327      328 
## 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 
##      329      330      331      332      333      334      335      336 
## 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 1954.005 
##      337      338      339      340      341      342      343      344 
## 1954.005 1954.005 1973.084 1973.084 1973.084 1973.084 1973.084 1973.084 
##      345      346      347      348      349      350      351      352 
## 1973.084 1973.084 1973.084 1973.084 1973.084 1973.084 1973.084 1973.084 
##      353      354      355      356      357      358      359      360 
## 1973.084 1942.081 1942.081 1942.081 1942.081 1973.084 1973.084 1973.084 
##      361      362      363      364      365      366      367      368 
## 1942.081 1942.081 1973.084 1973.084 1973.084 1973.084 1976.662 1976.662 
##      369      370      371      372      373      374      375      376 
## 1976.662 1976.662 1976.662 1976.662 1976.662 1976.662 1976.662 1976.662 
##      377      378      379      380      381      382      383      384 
## 1976.662 1976.662 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 
##      385      386      387      388      389      390      391      392 
## 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 
##      393      394      395      396      397      398      399      400 
## 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 1882.458 
##      401      402      403      404      405      406      407      408 
## 1882.458 1882.458 1882.458 1882.458 1882.458 1992.164 1992.164 1992.164 
##      409      410      411      412      413      414      415      416 
## 1992.164 2131.680 2131.680 2131.680 2131.680 2131.680 2131.680 2131.680 
##      417      418      419      420      421      422      423      424 
## 2131.680 2131.680 2131.680 2131.680 2131.680 2131.680 2131.680 2131.680 
##      425      426      427      428      429      430      431      432 
## 2131.680 2198.457 2198.457 2198.457 2198.457 2198.457 2198.457 2198.457 
##      433      434      435      436      437      438      439      440 
## 2198.457 2198.457 2198.457 2198.457 2198.457 2198.457 2198.457 1927.771 
##      441      442      443      444      445      446      447      448 
## 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 
##      449      450      451      452      453      454      455      456 
## 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 1927.771 
##      457      458 
## 1927.771 1927.771
cor(INTL$PricePremium,INTL$SeatsEconomy)
## [1] 0.07109765
fit<-lm(PricePremium~SeatsPremium,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsPremium, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2131.6 -1081.3    47.1  1031.9  5555.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1579.838    174.366   9.060   <2e-16 ***
## SeatsPremium   11.596      4.673   2.482   0.0135 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1254 on 416 degrees of freedom
## Multiple R-squared:  0.01459,    Adjusted R-squared:  0.01222 
## F-statistic: 6.159 on 1 and 416 DF,  p-value: 0.01347
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##        9       10       11       12       13       14       15       16 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##       17       18       19       20       21       22       23       24 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##       25       26       27       28       29       30       31       32 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##       33       34       35       36       37       38       39       40 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##       41       42       43       44       45       46       47       48 
## 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 2043.696 
##       49       50       51       52       53       54       55       56 
## 2043.696 2043.696 2043.696 2032.099 2032.099 2032.099 2032.099 2032.099 
##       57       58       59       60       61       62       63       64 
## 2032.099 2032.099 2032.099 2032.099 2032.099 2136.467 2136.467 2136.467 
##       65       66       67       68       69       70       71       72 
## 2136.467 2136.467 2136.467 2136.467 2136.467 2136.467 2136.467 2136.467 
##       73       82       83       84       85       86       87       88 
## 2136.467 2229.239 2229.239 2229.239 2229.239 2229.239 2229.239 2229.239 
##       89       90       91       92       93       94       95       96 
## 2229.239 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##       97       99      100      101      102      103      104      105 
## 1904.539 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      106      107      108      109      110      111      112      113 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      114      115      116      117      118      119      120      121 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      122      123      124      125      126      127      128      129 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      130      131      132      133      134      135      136      137 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      138      139      140      141      142      143      144      145 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 
##      146      147      148      149      150      151      156      157 
## 2217.642 2217.642 2217.642 2217.642 2217.642 2217.642 1985.714 1985.714 
##      158      159      160      161      162      163      164      165 
## 1985.714 1985.714 1985.714 1985.714 1985.714 1985.714 2345.203 2345.203 
##      166      167      168      169      170      171      172      173 
## 2345.203 2345.203 1985.714 1985.714 1985.714 1985.714 1985.714 1985.714 
##      174      175      176      177      178      179      180      181 
## 2345.203 2345.203 2345.203 2345.203 1985.714 1985.714 1985.714 1985.714 
##      182      183      184      185      186      187      188      189 
## 1985.714 1985.714 1985.714 2020.503 2020.503 2020.503 2020.503 2020.503 
##      190      191      192      193      194      195      196      197 
## 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 
##      198      199      200      201      202      203      204      205 
## 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 
##      206      207      208      209      210      211      212      213 
## 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 1823.364 1823.364 
##      214      215      216      217      218      219      220      221 
## 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 
##      222      223      224      225      226      227      228      229 
## 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 
##      230      231      232      233      234      235      236      237 
## 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 1823.364 
##      238      239      240      241      242      243      244      245 
## 1823.364 1823.364 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      246      247      248      249      250      251      252      253 
## 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      254      255      256      257      258      259      260      261 
## 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      262      263      264      265      266      267      268      269 
## 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      270      271      272      273      274      275      276      277 
## 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      278      279      280      308      309      310      311      312 
## 1997.310 1997.310 1997.310 1823.364 1823.364 1823.364 1823.364 1823.364 
##      313      314      315      316      317      318      319      320 
## 1823.364 1823.364 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##      321      322      323      324      325      326      327      328 
## 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##      329      330      331      332      333      334      335      336 
## 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##      337      338      339      340      341      342      343      344 
## 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##      345      346      347      348      349      350      351      352 
## 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 1904.539 
##      353      354      355      356      357      358      359      360 
## 1904.539 1858.153 1858.153 1858.153 1858.153 1904.539 1904.539 1904.539 
##      361      362      363      364      365      366      367      368 
## 1858.153 1858.153 1904.539 1904.539 1904.539 1904.539 1858.153 1858.153 
##      369      370      371      372      373      374      375      376 
## 1858.153 1858.153 1858.153 1858.153 1858.153 1858.153 1858.153 1858.153 
##      377      378      379      380      381      382      383      384 
## 1858.153 1858.153 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 
##      385      386      387      388      389      390      391      392 
## 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 
##      393      394      395      396      397      398      399      400 
## 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 1765.381 
##      401      402      403      404      405      406      407      408 
## 1765.381 1765.381 1765.381 1765.381 1765.381 1858.153 1858.153 1858.153 
##      409      410      411      412      413      414      415      416 
## 1858.153 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      417      418      419      420      421      422      423      424 
## 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 1997.310 
##      425      426      427      428      429      430      431      432 
## 1997.310 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 
##      433      434      435      436      437      438      439      440 
## 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 2020.503 1672.610 
##      441      442      443      444      445      446      447      448 
## 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 
##      449      450      451      452      453      454      455      456 
## 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 1672.610 
##      457      458 
## 1672.610 1672.610
cor(INTL$PricePremium,INTL$SeatsPremium)
## [1] 0.1207902
fit<-lm(PricePremium~PriceRelative,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PriceRelative, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1938.4 -1213.1    91.5  1108.4  5603.4 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    2090.94      94.47  22.132   <2e-16 ***
## PriceRelative  -201.69     136.18  -1.481    0.139    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1260 on 416 degrees of freedom
## Multiple R-squared:  0.005245,   Adjusted R-squared:  0.002854 
## F-statistic: 2.194 on 1 and 416 DF,  p-value: 0.1393
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 2014.299 2014.299 2014.299 2014.299 1955.809 1955.809 1955.809 1883.200 
##        9       10       11       12       13       14       15       16 
## 1883.200 1939.673 1939.673 1977.995 2038.502 1986.062 1986.062 1986.062 
##       17       18       19       20       21       22       23       24 
## 2014.299 2014.299 2014.299 2022.367 2022.367 2022.367 2024.384 2024.384 
##       25       26       27       28       29       30       31       32 
## 2024.384 2020.350 2024.384 2024.384 2022.367 2022.367 2022.367 2006.231 
##       33       34       35       36       37       38       39       40 
## 2006.231 2006.231 2006.231 1959.842 1959.842 1959.842 2042.536 2042.536 
##       41       42       43       44       45       46       47       48 
## 2042.536 2042.536 2056.654 2056.654 2056.654 2074.806 2074.806 2074.806 
##       49       50       51       52       53       54       55       56 
## 1986.062 1986.062 1986.062 1883.200 2018.333 2018.333 2018.333 2022.367 
##       57       58       59       60       61       62       63       64 
## 2022.367 2022.367 2048.587 2048.587 1967.910 1943.707 1943.707 1943.707 
##       65       66       67       68       69       70       71       72 
## 1943.707 2012.282 2012.282 2012.282 2012.282 2038.502 2038.502 2038.502 
##       73       82       83       84       85       86       87       88 
## 2070.773 1875.132 1875.132 1875.132 1875.132 2010.265 2010.265 2010.265 
##       89       90       91       92       93       94       95       96 
## 2010.265 1994.130 1994.130 1994.130 1994.130 2024.384 2024.384 2024.384 
##       97       99      100      101      102      103      104      105 
## 2038.502 1992.113 1992.113 1992.113 1992.113 1907.403 1907.403 1907.403 
##      106      107      108      109      110      111      112      113 
## 1907.403 1996.147 1996.147 1996.147 1834.794 1834.794 2018.333 2078.840 
##      114      115      116      117      118      119      120      121 
## 2070.773 2070.773 2082.874 2068.756 2068.756 2074.806 2072.789 2080.857 
##      122      123      124      125      126      127      128      129 
## 2080.857 2068.756 2062.705 2056.654 2058.671 2060.688 2076.823 2056.654 
##      130      131      132      133      134      135      136      137 
## 2054.637 2062.705 2064.722 2058.671 2054.637 2054.637 2040.519 2050.603 
##      138      139      140      141      142      143      144      145 
## 2038.502 2052.620 2044.553 2044.553 2030.434 2030.434 2030.434 2040.519 
##      146      147      148      149      150      151      156      157 
## 2032.451 2032.451 2032.451 2010.265 2028.417 2024.384 1723.864 1723.864 
##      158      159      160      161      162      163      164      165 
## 1723.864 1723.864 1742.016 1742.016 1742.016 1812.608 1895.301 1895.301 
##      166      167      168      169      170      171      172      173 
## 1895.301 1895.301 1907.403 1907.403 1907.403 1907.403 1921.521 1977.995 
##      174      175      176      177      178      179      180      181 
## 1988.079 1988.079 1988.079 1988.079 1990.096 1992.113 2010.265 2010.265 
##      182      183      184      185      186      187      188      189 
## 2010.265 2010.265 2038.502 1998.164 1998.164 2014.299 2014.299 2014.299 
##      190      191      192      193      194      195      196      197 
## 2030.434 1873.115 1873.115 1873.115 1873.115 1883.200 1883.200 1883.200 
##      198      199      200      201      202      203      204      205 
## 1883.200 1921.521 1921.521 1921.521 1992.113 1992.113 2008.248 2008.248 
##      206      207      208      209      210      211      212      213 
## 2008.248 2008.248 2038.502 2070.773 2070.773 2070.773 1776.304 1854.963 
##      214      215      216      217      218      219      220      221 
## 1963.876 2074.806 2074.806 2074.806 2074.806 2074.806 2074.806 2074.806 
##      222      223      224      225      226      227      228      229 
## 2074.806 2074.806 2074.806 2074.806 2076.823 2076.823 2076.823 2076.823 
##      230      231      232      233      234      235      236      237 
## 2076.823 2082.874 2084.891 2084.891 2084.891 2084.891 2084.891 2084.891 
##      238      239      240      241      242      243      244      245 
## 2084.891 2084.891 1863.031 1863.031 2038.502 2000.181 2000.181 2000.181 
##      246      247      248      249      250      251      252      253 
## 2018.333 2018.333 2018.333 2018.333 1893.284 1893.284 1893.284 2024.384 
##      254      255      256      257      258      259      260      261 
## 2024.384 2024.384 2024.384 2018.333 2018.333 2018.333 1863.031 2006.231 
##      262      263      264      265      266      267      268      269 
## 2006.231 2006.231 2010.265 2010.265 2010.265 1929.589 2076.823 2076.823 
##      270      271      272      273      274      275      276      277 
## 2076.823 1867.065 1867.065 1907.403 2050.603 1929.589 2056.654 2056.654 
##      278      279      280      308      309      310      311      312 
## 2056.654 2048.587 1975.978 1788.405 1897.318 1925.555 2006.231 2006.231 
##      313      314      315      316      317      318      319      320 
## 2010.265 2014.299 1867.065 1923.538 1923.538 1935.640 1969.927 1969.927 
##      321      322      323      324      325      326      327      328 
## 1969.927 1980.012 1994.130 1994.130 2064.722 2064.722 2064.722 2064.722 
##      329      330      331      332      333      334      335      336 
## 2064.722 2064.722 2070.773 2070.773 2070.773 2070.773 2072.789 2072.789 
##      337      338      339      340      341      342      343      344 
## 2072.789 2072.789 2018.333 2018.333 2018.333 2074.806 2076.823 2076.823 
##      345      346      347      348      349      350      351      352 
## 2076.823 2076.823 2082.874 2082.874 2082.874 2084.891 2084.891 2084.891 
##      353      354      355      356      357      358      359      360 
## 2084.891 2084.891 2084.891 2084.891 2084.891 2084.891 2084.891 2084.891 
##      361      362      363      364      365      366      367      368 
## 2084.891 2084.891 2084.891 2084.891 2084.891 2084.891 1810.591 1810.591 
##      369      370      371      372      373      374      375      376 
## 1810.591 2062.705 2062.705 2062.705 1935.640 1994.130 1994.130 2082.874 
##      377      378      379      380      381      382      383      384 
## 1986.062 2016.316 1709.745 1709.745 1709.745 1713.779 1754.118 1760.168 
##      385      386      387      388      389      390      391      392 
## 1782.354 1830.760 1836.811 1836.811 1836.811 1867.065 1867.065 1867.065 
##      393      394      395      396      397      398      399      400 
## 1871.098 1877.149 1881.183 1881.183 1907.403 1927.572 1931.606 1941.690 
##      401      402      403      404      405      406      407      408 
## 1941.690 1941.690 1941.690 1990.096 2056.654 1760.168 1760.168 1800.506 
##      409      410      411      412      413      414      415      416 
## 1977.995 1891.267 1891.267 1891.267 1891.267 1891.267 1891.267 1891.267 
##      417      418      419      420      421      422      423      424 
## 1891.267 1967.910 1967.910 1967.910 1967.910 1967.910 1967.910 1967.910 
##      425      426      427      428      429      430      431      432 
## 1967.910 1856.980 1856.980 2074.806 2074.806 2076.823 2076.823 2076.823 
##      433      434      435      436      437      438      439      440 
## 2082.874 2082.874 2082.874 2082.874 2084.891 2084.891 2086.908 1746.050 
##      441      442      443      444      445      446      447      448 
## 1752.101 1752.101 1828.743 1828.743 1828.743 1828.743 1844.879 1875.132 
##      449      450      451      452      453      454      455      456 
## 1935.640 1935.640 1935.640 1959.842 1969.927 1973.961 2000.181 2000.181 
##      457      458 
## 2014.299 2066.739
cor(INTL$PricePremium,INTL$PriceRelative)
## [1] -0.07242428
fit<-lm(PricePremium~PercentPremiumSeats,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PercentPremiumSeats, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1921.4 -1113.7   -90.2  1017.3  5559.1 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1518.56     190.72   7.962 1.63e-14 ***
## PercentPremiumSeats    31.82      12.32   2.582   0.0102 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1254 on 416 degrees of freedom
## Multiple R-squared:  0.01578,    Adjusted R-squared:  0.01341 
## F-statistic: 6.669 on 1 and 416 DF,  p-value: 0.01015
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##        9       10       11       12       13       14       15       16 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##       17       18       19       20       21       22       23       24 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##       25       26       27       28       29       30       31       32 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##       33       34       35       36       37       38       39       40 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##       41       42       43       44       45       46       47       48 
## 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 2304.275 
##       49       50       51       52       53       54       55       56 
## 2304.275 2304.275 2304.275 2266.087 2266.087 2266.087 2266.087 2266.087 
##       57       58       59       60       61       62       63       64 
## 2266.087 2266.087 2266.087 2266.087 2266.087 2174.118 2174.118 2174.118 
##       65       66       67       68       69       70       71       72 
## 2174.118 2174.118 2174.118 2174.118 2174.118 2174.118 2174.118 2174.118 
##       73       82       83       84       85       86       87       88 
## 2174.118 2114.608 2114.608 2114.608 2114.608 2114.608 2114.608 2114.608 
##       89       90       91       92       93       94       95       96 
## 2114.608 2055.417 2055.417 2055.417 2055.417 2055.417 2055.417 2055.417 
##       97       99      100      101      102      103      104      105 
## 2055.417 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      106      107      108      109      110      111      112      113 
## 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      114      115      116      117      118      119      120      121 
## 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      122      123      124      125      126      127      128      129 
## 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      130      131      132      133      134      135      136      137 
## 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      138      139      140      141      142      143      144      145 
## 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 2007.364 
##      146      147      148      149      150      151      156      157 
## 2007.364 2007.364 2007.364 2007.364 1995.589 2007.364 1996.544 1996.544 
##      158      159      160      161      162      163      164      165 
## 1996.544 1996.544 1996.544 1996.544 1996.544 1996.544 1994.952 1994.952 
##      166      167      168      169      170      171      172      173 
## 1994.952 1994.952 1996.544 1996.544 1996.544 1996.544 1996.544 1996.544 
##      174      175      176      177      178      179      180      181 
## 1994.952 1994.952 1994.952 1994.952 1996.544 1996.544 1996.544 1996.544 
##      182      183      184      185      186      187      188      189 
## 1996.544 1996.544 1996.544 1964.720 1964.720 1964.720 1964.720 1964.720 
##      190      191      192      193      194      195      196      197 
## 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 
##      198      199      200      201      202      203      204      205 
## 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 
##      206      207      208      209      210      211      212      213 
## 1964.720 1964.720 1964.720 1964.720 1964.720 1964.720 1916.349 1916.349 
##      214      215      216      217      218      219      220      221 
## 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 
##      222      223      224      225      226      227      228      229 
## 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 
##      230      231      232      233      234      235      236      237 
## 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 1916.349 
##      238      239      240      241      242      243      244      245 
## 1916.349 1916.349 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 
##      246      247      248      249      250      251      252      253 
## 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 
##      254      255      256      257      258      259      260      261 
## 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 
##      262      263      264      265      266      267      268      269 
## 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 
##      270      271      272      273      274      275      276      277 
## 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 1929.078 
##      278      279      280      308      309      310      311      312 
## 1929.078 1929.078 1929.078 1916.349 1916.349 1916.349 1916.349 1916.349 
##      313      314      315      316      317      318      319      320 
## 1916.349 1916.349 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 
##      321      322      323      324      325      326      327      328 
## 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 
##      329      330      331      332      333      334      335      336 
## 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 1938.943 
##      337      338      339      340      341      342      343      344 
## 1938.943 1938.943 1909.348 1909.348 1909.348 1909.348 1909.348 1909.348 
##      345      346      347      348      349      350      351      352 
## 1909.348 1909.348 1909.348 1909.348 1909.348 1909.348 1909.348 1909.348 
##      353      354      355      356      357      358      359      360 
## 1909.348 1904.256 1904.256 1904.256 1904.256 1909.348 1909.348 1909.348 
##      361      362      363      364      365      366      367      368 
## 1904.256 1904.256 1909.348 1909.348 1909.348 1909.348 1854.930 1854.930 
##      369      370      371      372      373      374      375      376 
## 1854.930 1854.930 1854.930 1854.930 1854.930 1854.930 1854.930 1854.930 
##      377      378      379      380      381      382      383      384 
## 1854.930 1854.930 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 
##      385      386      387      388      389      390      391      392 
## 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 
##      393      394      395      396      397      398      399      400 
## 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 1882.298 
##      401      402      403      404      405      406      407      408 
## 1882.298 1882.298 1882.298 1882.298 1882.298 1836.791 1836.791 1836.791 
##      409      410      411      412      413      414      415      416 
## 1836.791 1829.153 1829.153 1829.153 1829.153 1829.153 1829.153 1829.153 
##      417      418      419      420      421      422      423      424 
## 1829.153 1829.153 1829.153 1829.153 1829.153 1829.153 1829.153 1829.153 
##      425      426      427      428      429      430      431      432 
## 1829.153 1801.785 1801.785 1801.785 1801.785 1801.785 1801.785 1801.785 
##      433      434      435      436      437      438      439      440 
## 1801.785 1801.785 1801.785 1801.785 1801.785 1801.785 1801.785 1668.445 
##      441      442      443      444      445      446      447      448 
## 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 
##      449      450      451      452      453      454      455      456 
## 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 1668.445 
##      457      458 
## 1668.445 1668.445
cor(INTL$PricePremium,INTL$PercentPremiumSeats)
## [1] 0.1256081
fit<-lm(PricePremium~PitchEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchEconomy, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2009.4  -905.7   155.6   870.2  5551.9 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -21892.47    2841.02  -7.706 9.63e-14 ***
## PitchEconomy    766.28      91.16   8.406 6.81e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1168 on 416 degrees of freedom
## Multiple R-squared:  0.1452, Adjusted R-squared:  0.1431 
## F-statistic: 70.66 on 1 and 416 DF,  p-value: 6.806e-16
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##        9       10       11       12       13       14       15       16 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       17       18       19       20       21       22       23       24 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       25       26       27       28       29       30       31       32 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       33       34       35       36       37       38       39       40 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       41       42       43       44       45       46       47       48 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       49       50       51       52       53       54       55       56 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       57       58       59       60       61       62       63       64 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       65       66       67       68       69       70       71       72 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       73       82       83       84       85       86       87       88 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##       89       90       91       92       93       94       95       96 
## 1862.085 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##       97       99      100      101      102      103      104      105 
## 1095.809 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      106      107      108      109      110      111      112      113 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      114      115      116      117      118      119      120      121 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      122      123      124      125      126      127      128      129 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      130      131      132      133      134      135      136      137 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      138      139      140      141      142      143      144      145 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      146      147      148      149      150      151      156      157 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      158      159      160      161      162      163      164      165 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      166      167      168      169      170      171      172      173 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      174      175      176      177      178      179      180      181 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      182      183      184      185      186      187      188      189 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      190      191      192      193      194      195      196      197 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      198      199      200      201      202      203      204      205 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      206      207      208      209      210      211      212      213 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 2628.361 2628.361 
##      214      215      216      217      218      219      220      221 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      222      223      224      225      226      227      228      229 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      230      231      232      233      234      235      236      237 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      238      239      240      241      242      243      244      245 
## 2628.361 2628.361 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      246      247      248      249      250      251      252      253 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      254      255      256      257      258      259      260      261 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      262      263      264      265      266      267      268      269 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      270      271      272      273      274      275      276      277 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      278      279      280      308      309      310      311      312 
## 1862.085 1862.085 1862.085 2628.361 2628.361 2628.361 2628.361 2628.361 
##      313      314      315      316      317      318      319      320 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      321      322      323      324      325      326      327      328 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      329      330      331      332      333      334      335      336 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      337      338      339      340      341      342      343      344 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      345      346      347      348      349      350      351      352 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      353      354      355      356      357      358      359      360 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      361      362      363      364      365      366      367      368 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 1862.085 1862.085 
##      369      370      371      372      373      374      375      376 
## 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 1862.085 
##      377      378      379      380      381      382      383      384 
## 1862.085 1862.085 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##      385      386      387      388      389      390      391      392 
## 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##      393      394      395      396      397      398      399      400 
## 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##      401      402      403      404      405      406      407      408 
## 1095.809 1095.809 1095.809 1095.809 1095.809 2628.361 2628.361 2628.361 
##      409      410      411      412      413      414      415      416 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      417      418      419      420      421      422      423      424 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      425      426      427      428      429      430      431      432 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 
##      433      434      435      436      437      438      439      440 
## 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 2628.361 1095.809 
##      441      442      443      444      445      446      447      448 
## 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##      449      450      451      452      453      454      455      456 
## 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 1095.809 
##      457      458 
## 1095.809 1095.809
cor(INTL$PricePremium,INTL$PitchEconomy)
## [1] 0.3810529
fit<-lm(PriceEconomy~PitchEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchEconomy, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1772.78  -702.78    96.71   559.55  1813.55 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -24141.74    2043.97  -11.81   <2e-16 ***
## PitchEconomy    820.33      65.58   12.51   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 840.5 on 416 degrees of freedom
## Multiple R-squared:  0.2733, Adjusted R-squared:  0.2716 
## F-statistic: 156.5 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##         8         9        10        11        12        13        14 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        15        16        17        18        19        20        21 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        22        23        24        25        26        27        28 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        29        30        31        32        33        34        35 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        36        37        38        39        40        41        42 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        43        44        45        46        47        48        49 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        50        51        52        53        54        55        56 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        57        58        59        60        61        62        63 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        64        65        66        67        68        69        70 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        71        72        73        82        83        84        85 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##        86        87        88        89        90        91        92 
## 1288.4545 1288.4545 1288.4545 1288.4545  468.1256  468.1256  468.1256 
##        93        94        95        96        97        99       100 
##  468.1256  468.1256  468.1256  468.1256  468.1256 1288.4545 1288.4545 
##       101       102       103       104       105       106       107 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       108       109       110       111       112       113       114 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       115       116       117       118       119       120       121 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       122       123       124       125       126       127       128 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       129       130       131       132       133       134       135 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       136       137       138       139       140       141       142 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       143       144       145       146       147       148       149 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       150       151       156       157       158       159       160 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       161       162       163       164       165       166       167 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       168       169       170       171       172       173       174 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       175       176       177       178       179       180       181 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       182       183       184       185       186       187       188 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       189       190       191       192       193       194       195 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       196       197       198       199       200       201       202 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       203       204       205       206       207       208       209 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       210       211       212       213       214       215       216 
## 1288.4545 1288.4545 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       217       218       219       220       221       222       223 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       224       225       226       227       228       229       230 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       231       232       233       234       235       236       237 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       238       239       240       241       242       243       244 
## 2108.7833 2108.7833 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       245       246       247       248       249       250       251 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       252       253       254       255       256       257       258 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       259       260       261       262       263       264       265 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       266       267       268       269       270       271       272 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       273       274       275       276       277       278       279 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       280       308       309       310       311       312       313 
## 1288.4545 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       314       315       316       317       318       319       320 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       321       322       323       324       325       326       327 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       328       329       330       331       332       333       334 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       335       336       337       338       339       340       341 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       342       343       344       345       346       347       348 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       349       350       351       352       353       354       355 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       356       357       358       359       360       361       362 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       363       364       365       366       367       368       369 
## 2108.7833 2108.7833 2108.7833 2108.7833 1288.4545 1288.4545 1288.4545 
##       370       371       372       373       374       375       376 
## 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 1288.4545 
##       377       378       379       380       381       382       383 
## 1288.4545 1288.4545  468.1256  468.1256  468.1256  468.1256  468.1256 
##       384       385       386       387       388       389       390 
##  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256 
##       391       392       393       394       395       396       397 
##  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256 
##       398       399       400       401       402       403       404 
##  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256 
##       405       406       407       408       409       410       411 
##  468.1256 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       412       413       414       415       416       417       418 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       419       420       421       422       423       424       425 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       426       427       428       429       430       431       432 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       433       434       435       436       437       438       439 
## 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 2108.7833 
##       440       441       442       443       444       445       446 
##  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256 
##       447       448       449       450       451       452       453 
##  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256  468.1256 
##       454       455       456       457       458 
##  468.1256  468.1256  468.1256  468.1256  468.1256
cor(INTL$PriceEconomy,INTL$PitchEconomy)
## [1] 0.5227929
fit<-lm(PricePremium~PitchPremium,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchPremium, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2128.7  -702.7    88.4   784.3  5199.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  36017.58    3105.53   11.60   <2e-16 ***
## PitchPremium  -889.55      81.16  -10.96   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1113 on 416 degrees of freedom
## Multiple R-squared:  0.2241, Adjusted R-squared:  0.2222 
## F-statistic: 120.1 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##         8         9        10        11        12        13        14 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        15        16        17        18        19        20        21 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        22        23        24        25        26        27        28 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        29        30        31        32        33        34        35 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        36        37        38        39        40        41        42 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        43        44        45        46        47        48        49 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        50        51        52        53        54        55        56 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        57        58        59        60        61        62        63 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        64        65        66        67        68        69        70 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        71        72        73        82        83        84        85 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##        86        87        88        89        90        91        92 
## 2214.7445 2214.7445 2214.7445 2214.7445  435.6481  435.6481  435.6481 
##        93        94        95        96        97        99       100 
##  435.6481  435.6481  435.6481  435.6481  435.6481 2214.7445 2214.7445 
##       101       102       103       104       105       106       107 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       108       109       110       111       112       113       114 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       115       116       117       118       119       120       121 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       122       123       124       125       126       127       128 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       129       130       131       132       133       134       135 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       136       137       138       139       140       141       142 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       143       144       145       146       147       148       149 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       150       151       156       157       158       159       160 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       161       162       163       164       165       166       167 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       168       169       170       171       172       173       174 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       175       176       177       178       179       180       181 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       182       183       184       185       186       187       188 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       189       190       191       192       193       194       195 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       196       197       198       199       200       201       202 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       203       204       205       206       207       208       209 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       210       211       212       213       214       215       216 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       217       218       219       220       221       222       223 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       224       225       226       227       228       229       230 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       231       232       233       234       235       236       237 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       238       239       240       241       242       243       244 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       245       246       247       248       249       250       251 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       252       253       254       255       256       257       258 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       259       260       261       262       263       264       265 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       266       267       268       269       270       271       272 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       273       274       275       276       277       278       279 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       280       308       309       310       311       312       313 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       314       315       316       317       318       319       320 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       321       322       323       324       325       326       327 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       328       329       330       331       332       333       334 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       335       336       337       338       339       340       341 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       342       343       344       345       346       347       348 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       349       350       351       352       353       354       355 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       356       357       358       359       360       361       362 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       363       364       365       366       367       368       369 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       370       371       372       373       374       375       376 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       377       378       379       380       381       382       383 
## 2214.7445 2214.7445  435.6481  435.6481  435.6481  435.6481  435.6481 
##       384       385       386       387       388       389       390 
##  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481 
##       391       392       393       394       395       396       397 
##  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481 
##       398       399       400       401       402       403       404 
##  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481 
##       405       406       407       408       409       410       411 
##  435.6481 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       412       413       414       415       416       417       418 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       419       420       421       422       423       424       425 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       426       427       428       429       430       431       432 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       433       434       435       436       437       438       439 
## 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 2214.7445 
##       440       441       442       443       444       445       446 
##  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481 
##       447       448       449       450       451       452       453 
##  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481  435.6481 
##       454       455       456       457       458 
##  435.6481  435.6481  435.6481  435.6481  435.6481
cor(INTL$PricePremium,INTL$PitchPremium)
## [1] -0.4733605
fit<-lm(PriceEconomy~PitchPremium,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchPremium, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1529.42  -654.42   -28.42   457.58  1998.58 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  27255.17    2441.88   11.16   <2e-16 ***
## PitchPremium  -675.28      63.82  -10.58   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 875.2 on 416 degrees of freedom
## Multiple R-squared:  0.2121, Adjusted R-squared:  0.2102 
## F-statistic:   112 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##         8         9        10        11        12        13        14 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        15        16        17        18        19        20        21 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        22        23        24        25        26        27        28 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        29        30        31        32        33        34        35 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        36        37        38        39        40        41        42 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        43        44        45        46        47        48        49 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        50        51        52        53        54        55        56 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        57        58        59        60        61        62        63 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        64        65        66        67        68        69        70 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        71        72        73        82        83        84        85 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##        86        87        88        89        90        91        92 
## 1594.4176 1594.4176 1594.4176 1594.4176  243.8519  243.8519  243.8519 
##        93        94        95        96        97        99       100 
##  243.8519  243.8519  243.8519  243.8519  243.8519 1594.4176 1594.4176 
##       101       102       103       104       105       106       107 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       108       109       110       111       112       113       114 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       115       116       117       118       119       120       121 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       122       123       124       125       126       127       128 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       129       130       131       132       133       134       135 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       136       137       138       139       140       141       142 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       143       144       145       146       147       148       149 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       150       151       156       157       158       159       160 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       161       162       163       164       165       166       167 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       168       169       170       171       172       173       174 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       175       176       177       178       179       180       181 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       182       183       184       185       186       187       188 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       189       190       191       192       193       194       195 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       196       197       198       199       200       201       202 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       203       204       205       206       207       208       209 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       210       211       212       213       214       215       216 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       217       218       219       220       221       222       223 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       224       225       226       227       228       229       230 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       231       232       233       234       235       236       237 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       238       239       240       241       242       243       244 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       245       246       247       248       249       250       251 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       252       253       254       255       256       257       258 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       259       260       261       262       263       264       265 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       266       267       268       269       270       271       272 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       273       274       275       276       277       278       279 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       280       308       309       310       311       312       313 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       314       315       316       317       318       319       320 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       321       322       323       324       325       326       327 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       328       329       330       331       332       333       334 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       335       336       337       338       339       340       341 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       342       343       344       345       346       347       348 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       349       350       351       352       353       354       355 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       356       357       358       359       360       361       362 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       363       364       365       366       367       368       369 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       370       371       372       373       374       375       376 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       377       378       379       380       381       382       383 
## 1594.4176 1594.4176  243.8519  243.8519  243.8519  243.8519  243.8519 
##       384       385       386       387       388       389       390 
##  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519 
##       391       392       393       394       395       396       397 
##  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519 
##       398       399       400       401       402       403       404 
##  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519 
##       405       406       407       408       409       410       411 
##  243.8519 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       412       413       414       415       416       417       418 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       419       420       421       422       423       424       425 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       426       427       428       429       430       431       432 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       433       434       435       436       437       438       439 
## 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 1594.4176 
##       440       441       442       443       444       445       446 
##  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519 
##       447       448       449       450       451       452       453 
##  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519  243.8519 
##       454       455       456       457       458 
##  243.8519  243.8519  243.8519  243.8519  243.8519
cor(INTL$PriceEconomy,INTL$PitchPremium)
## [1] -0.4605215
fit<-lm(PriceEconomy~WidthPremium,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthPremium, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1599.51  -755.08   -57.55   836.42  1928.49 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   8503.84    1002.61   8.482 3.92e-16 ***
## WidthPremium  -359.96      50.89  -7.073 6.47e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 931.6 on 416 degrees of freedom
## Multiple R-squared:  0.1073, Adjusted R-squared:  0.1052 
## F-statistic: 50.02 on 1 and 416 DF,  p-value: 6.471e-12
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##         8         9        10        11        12        13        14 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        15        16        17        18        19        20        21 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        22        23        24        25        26        27        28 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        29        30        31        32        33        34        35 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        36        37        38        39        40        41        42 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        43        44        45        46        47        48        49 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        50        51        52        53        54        55        56 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##        57        58        59        60        61        62        63 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119  944.5824  944.5824 
##        64        65        66        67        68        69        70 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##        71        72        73        82        83        84        85 
##  944.5824  944.5824  944.5824 1664.5119 1664.5119 1664.5119 1664.5119 
##        86        87        88        89        90        91        92 
## 1664.5119 1664.5119 1664.5119 1664.5119  944.5824  944.5824  944.5824 
##        93        94        95        96        97        99       100 
##  944.5824  944.5824  944.5824  944.5824  944.5824 1664.5119 1664.5119 
##       101       102       103       104       105       106       107 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       108       109       110       111       112       113       114 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       115       116       117       118       119       120       121 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       122       123       124       125       126       127       128 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       129       130       131       132       133       134       135 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       136       137       138       139       140       141       142 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       143       144       145       146       147       148       149 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       150       151       156       157       158       159       160 
## 1664.5119 1664.5119  944.5824  944.5824  944.5824  944.5824  944.5824 
##       161       162       163       164       165       166       167 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       168       169       170       171       172       173       174 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       175       176       177       178       179       180       181 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       182       183       184       185       186       187       188 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       189       190       191       192       193       194       195 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       196       197       198       199       200       201       202 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       203       204       205       206       207       208       209 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       210       211       212       213       214       215       216 
##  944.5824  944.5824 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       217       218       219       220       221       222       223 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       224       225       226       227       228       229       230 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       231       232       233       234       235       236       237 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       238       239       240       241       242       243       244 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       245       246       247       248       249       250       251 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       252       253       254       255       256       257       258 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       259       260       261       262       263       264       265 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       266       267       268       269       270       271       272 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       273       274       275       276       277       278       279 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       280       308       309       310       311       312       313 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       314       315       316       317       318       319       320 
## 1664.5119 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 
##       321       322       323       324       325       326       327 
## 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 
##       328       329       330       331       332       333       334 
## 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 
##       335       336       337       338       339       340       341 
## 1304.5472 1304.5472 1304.5472 1304.5472 1664.5119 1664.5119 1664.5119 
##       342       343       344       345       346       347       348 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       349       350       351       352       353       354       355 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       356       357       358       359       360       361       362 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       363       364       365       366       367       368       369 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       370       371       372       373       374       375       376 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       377       378       379       380       381       382       383 
## 1664.5119 1664.5119  944.5824  944.5824  944.5824  944.5824  944.5824 
##       384       385       386       387       388       389       390 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       391       392       393       394       395       396       397 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       398       399       400       401       402       403       404 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       405       406       407       408       409       410       411 
##  944.5824 1664.5119 1664.5119 1664.5119 1664.5119 1304.5472 1304.5472 
##       412       413       414       415       416       417       418 
## 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 
##       419       420       421       422       423       424       425 
## 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 1304.5472 
##       426       427       428       429       430       431       432 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       433       434       435       436       437       438       439 
## 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 1664.5119 
##       440       441       442       443       444       445       446 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       447       448       449       450       451       452       453 
##  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824  944.5824 
##       454       455       456       457       458 
##  944.5824  944.5824  944.5824  944.5824  944.5824
cor(INTL$PriceEconomy,INTL$WidthPremium)
## [1] -0.327631
fit<-lm(PricePremium~WidthPremium,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthPremium, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2096.5 -1050.8    12.5  1013.5  5231.5 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   7709.37    1330.64   5.794 1.36e-08 ***
## WidthPremium  -290.89      67.55  -4.306 2.07e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1236 on 416 degrees of freedom
## Multiple R-squared:  0.04268,    Adjusted R-squared:  0.04038 
## F-statistic: 18.55 on 1 and 416 DF,  p-value: 2.071e-05
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##        9       10       11       12       13       14       15       16 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       17       18       19       20       21       22       23       24 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       25       26       27       28       29       30       31       32 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       33       34       35       36       37       38       39       40 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       41       42       43       44       45       46       47       48 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       49       50       51       52       53       54       55       56 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       57       58       59       60       61       62       63       64 
## 2182.544 2182.544 2182.544 2182.544 2182.544 1600.773 1600.773 1600.773 
##       65       66       67       68       69       70       71       72 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##       73       82       83       84       85       86       87       88 
## 1600.773 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##       89       90       91       92       93       94       95       96 
## 2182.544 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##       97       99      100      101      102      103      104      105 
## 1600.773 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      106      107      108      109      110      111      112      113 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      114      115      116      117      118      119      120      121 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      122      123      124      125      126      127      128      129 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      130      131      132      133      134      135      136      137 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      138      139      140      141      142      143      144      145 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      146      147      148      149      150      151      156      157 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 1600.773 1600.773 
##      158      159      160      161      162      163      164      165 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      166      167      168      169      170      171      172      173 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      174      175      176      177      178      179      180      181 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      182      183      184      185      186      187      188      189 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      190      191      192      193      194      195      196      197 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      198      199      200      201      202      203      204      205 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      206      207      208      209      210      211      212      213 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 2182.544 2182.544 
##      214      215      216      217      218      219      220      221 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      222      223      224      225      226      227      228      229 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      230      231      232      233      234      235      236      237 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      238      239      240      241      242      243      244      245 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      246      247      248      249      250      251      252      253 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      254      255      256      257      258      259      260      261 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      262      263      264      265      266      267      268      269 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      270      271      272      273      274      275      276      277 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      278      279      280      308      309      310      311      312 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      313      314      315      316      317      318      319      320 
## 2182.544 2182.544 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 
##      321      322      323      324      325      326      327      328 
## 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 
##      329      330      331      332      333      334      335      336 
## 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 
##      337      338      339      340      341      342      343      344 
## 1891.659 1891.659 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      345      346      347      348      349      350      351      352 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      353      354      355      356      357      358      359      360 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      361      362      363      364      365      366      367      368 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      369      370      371      372      373      374      375      376 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      377      378      379      380      381      382      383      384 
## 2182.544 2182.544 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      385      386      387      388      389      390      391      392 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      393      394      395      396      397      398      399      400 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      401      402      403      404      405      406      407      408 
## 1600.773 1600.773 1600.773 1600.773 1600.773 2182.544 2182.544 2182.544 
##      409      410      411      412      413      414      415      416 
## 2182.544 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 
##      417      418      419      420      421      422      423      424 
## 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 1891.659 
##      425      426      427      428      429      430      431      432 
## 1891.659 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 
##      433      434      435      436      437      438      439      440 
## 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 2182.544 1600.773 
##      441      442      443      444      445      446      447      448 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      449      450      451      452      453      454      455      456 
## 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 1600.773 
##      457      458 
## 1600.773 1600.773
cor(INTL$PricePremium,INTL$WidthPremium)
## [1] -0.2065882
fit<-lm(PriceEconomy~WidthEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1354.27  -873.10    34.08   637.29  2178.29 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   2270.91    1604.19   1.416    0.158
## WidthEconomy   -47.57      89.63  -0.531    0.596
## 
## Residual standard error: 985.7 on 416 degrees of freedom
## Multiple R-squared:  0.0006766,  Adjusted R-squared:  -0.001726 
## F-statistic: 0.2816 on 1 and 416 DF,  p-value: 0.5959
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##        9       10       11       12       13       14       15       16 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       17       18       19       20       21       22       23       24 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       25       26       27       28       29       30       31       32 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       33       34       35       36       37       38       39       40 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       41       42       43       44       45       46       47       48 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       49       50       51       52       53       54       55       56 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       57       58       59       60       61       62       63       64 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       65       66       67       68       69       70       71       72 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       73       82       83       84       85       86       87       88 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       89       90       91       92       93       94       95       96 
## 1414.708 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##       97       99      100      101      102      103      104      105 
## 1462.275 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      106      107      108      109      110      111      112      113 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      114      115      116      117      118      119      120      121 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      122      123      124      125      126      127      128      129 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      130      131      132      133      134      135      136      137 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      138      139      140      141      142      143      144      145 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      146      147      148      149      150      151      156      157 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      158      159      160      161      162      163      164      165 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      166      167      168      169      170      171      172      173 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      174      175      176      177      178      179      180      181 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      182      183      184      185      186      187      188      189 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      190      191      192      193      194      195      196      197 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      198      199      200      201      202      203      204      205 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      206      207      208      209      210      211      212      213 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      214      215      216      217      218      219      220      221 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      222      223      224      225      226      227      228      229 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      230      231      232      233      234      235      236      237 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      238      239      240      241      242      243      244      245 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      246      247      248      249      250      251      252      253 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      254      255      256      257      258      259      260      261 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      262      263      264      265      266      267      268      269 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      270      271      272      273      274      275      276      277 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      278      279      280      308      309      310      311      312 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      313      314      315      316      317      318      319      320 
## 1414.708 1414.708 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      321      322      323      324      325      326      327      328 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      329      330      331      332      333      334      335      336 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      337      338      339      340      341      342      343      344 
## 1367.141 1367.141 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      345      346      347      348      349      350      351      352 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      353      354      355      356      357      358      359      360 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      361      362      363      364      365      366      367      368 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1414.708 1414.708 
##      369      370      371      372      373      374      375      376 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      377      378      379      380      381      382      383      384 
## 1414.708 1414.708 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      385      386      387      388      389      390      391      392 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      393      394      395      396      397      398      399      400 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      401      402      403      404      405      406      407      408 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      409      410      411      412      413      414      415      416 
## 1462.275 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      417      418      419      420      421      422      423      424 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      425      426      427      428      429      430      431      432 
## 1367.141 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      433      434      435      436      437      438      439      440 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1462.275 
##      441      442      443      444      445      446      447      448 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      449      450      451      452      453      454      455      456 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      457      458 
## 1462.275 1462.275
cor(INTL$PriceEconomy,INTL$WidthEconomy)
## [1] -0.02601124
fit<-lm(PricePremium~WidthEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1912.6 -1209.6    85.4  1000.4  5415.4 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    -242.8     2053.7  -0.118    0.906
## WidthEconomy    124.5      114.7   1.085    0.278
## 
## Residual standard error: 1262 on 416 degrees of freedom
## Multiple R-squared:  0.002823,   Adjusted R-squared:  0.0004262 
## F-statistic: 1.178 on 1 and 416 DF,  p-value: 0.2784
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##        9       10       11       12       13       14       15       16 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       17       18       19       20       21       22       23       24 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       25       26       27       28       29       30       31       32 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       33       34       35       36       37       38       39       40 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       41       42       43       44       45       46       47       48 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       49       50       51       52       53       54       55       56 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       57       58       59       60       61       62       63       64 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       65       66       67       68       69       70       71       72 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       73       82       83       84       85       86       87       88 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       89       90       91       92       93       94       95       96 
## 1998.613 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##       97       99      100      101      102      103      104      105 
## 1874.088 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      106      107      108      109      110      111      112      113 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      114      115      116      117      118      119      120      121 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      122      123      124      125      126      127      128      129 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      130      131      132      133      134      135      136      137 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      138      139      140      141      142      143      144      145 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      146      147      148      149      150      151      156      157 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      158      159      160      161      162      163      164      165 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      166      167      168      169      170      171      172      173 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      174      175      176      177      178      179      180      181 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      182      183      184      185      186      187      188      189 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      190      191      192      193      194      195      196      197 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      198      199      200      201      202      203      204      205 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      206      207      208      209      210      211      212      213 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      214      215      216      217      218      219      220      221 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      222      223      224      225      226      227      228      229 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      230      231      232      233      234      235      236      237 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      238      239      240      241      242      243      244      245 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      246      247      248      249      250      251      252      253 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      254      255      256      257      258      259      260      261 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      262      263      264      265      266      267      268      269 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      270      271      272      273      274      275      276      277 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      278      279      280      308      309      310      311      312 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      313      314      315      316      317      318      319      320 
## 1998.613 1998.613 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      321      322      323      324      325      326      327      328 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      329      330      331      332      333      334      335      336 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      337      338      339      340      341      342      343      344 
## 2123.138 2123.138 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      345      346      347      348      349      350      351      352 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      353      354      355      356      357      358      359      360 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      361      362      363      364      365      366      367      368 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1998.613 1998.613 
##      369      370      371      372      373      374      375      376 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      377      378      379      380      381      382      383      384 
## 1998.613 1998.613 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      385      386      387      388      389      390      391      392 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      393      394      395      396      397      398      399      400 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      401      402      403      404      405      406      407      408 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      409      410      411      412      413      414      415      416 
## 1874.088 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      417      418      419      420      421      422      423      424 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      425      426      427      428      429      430      431      432 
## 2123.138 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      433      434      435      436      437      438      439      440 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1874.088 
##      441      442      443      444      445      446      447      448 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      449      450      451      452      453      454      455      456 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      457      458 
## 1874.088 1874.088
cor(INTL$PricePremium,INTL$WidthEconomy)
## [1] 0.05313392
fit<-lm(PriceEconomy~WidthEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1354.27  -873.10    34.08   637.29  2178.29 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   2270.91    1604.19   1.416    0.158
## WidthEconomy   -47.57      89.63  -0.531    0.596
## 
## Residual standard error: 985.7 on 416 degrees of freedom
## Multiple R-squared:  0.0006766,  Adjusted R-squared:  -0.001726 
## F-statistic: 0.2816 on 1 and 416 DF,  p-value: 0.5959
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##        9       10       11       12       13       14       15       16 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       17       18       19       20       21       22       23       24 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       25       26       27       28       29       30       31       32 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       33       34       35       36       37       38       39       40 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       41       42       43       44       45       46       47       48 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       49       50       51       52       53       54       55       56 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       57       58       59       60       61       62       63       64 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       65       66       67       68       69       70       71       72 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       73       82       83       84       85       86       87       88 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##       89       90       91       92       93       94       95       96 
## 1414.708 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##       97       99      100      101      102      103      104      105 
## 1462.275 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      106      107      108      109      110      111      112      113 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      114      115      116      117      118      119      120      121 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      122      123      124      125      126      127      128      129 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      130      131      132      133      134      135      136      137 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      138      139      140      141      142      143      144      145 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      146      147      148      149      150      151      156      157 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      158      159      160      161      162      163      164      165 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      166      167      168      169      170      171      172      173 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      174      175      176      177      178      179      180      181 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      182      183      184      185      186      187      188      189 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      190      191      192      193      194      195      196      197 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      198      199      200      201      202      203      204      205 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      206      207      208      209      210      211      212      213 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      214      215      216      217      218      219      220      221 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      222      223      224      225      226      227      228      229 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      230      231      232      233      234      235      236      237 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      238      239      240      241      242      243      244      245 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      246      247      248      249      250      251      252      253 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      254      255      256      257      258      259      260      261 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      262      263      264      265      266      267      268      269 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      270      271      272      273      274      275      276      277 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      278      279      280      308      309      310      311      312 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      313      314      315      316      317      318      319      320 
## 1414.708 1414.708 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      321      322      323      324      325      326      327      328 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      329      330      331      332      333      334      335      336 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      337      338      339      340      341      342      343      344 
## 1367.141 1367.141 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      345      346      347      348      349      350      351      352 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      353      354      355      356      357      358      359      360 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      361      362      363      364      365      366      367      368 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1414.708 1414.708 
##      369      370      371      372      373      374      375      376 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      377      378      379      380      381      382      383      384 
## 1414.708 1414.708 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      385      386      387      388      389      390      391      392 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      393      394      395      396      397      398      399      400 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      401      402      403      404      405      406      407      408 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      409      410      411      412      413      414      415      416 
## 1462.275 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      417      418      419      420      421      422      423      424 
## 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 1367.141 
##      425      426      427      428      429      430      431      432 
## 1367.141 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 
##      433      434      435      436      437      438      439      440 
## 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1414.708 1462.275 
##      441      442      443      444      445      446      447      448 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      449      450      451      452      453      454      455      456 
## 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 1462.275 
##      457      458 
## 1462.275 1462.275
cor(INTL$PriceEconomy,INTL$WidthEconomy)
## [1] -0.02601124
fit<-lm(PricePremium~WidthEconomy,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1912.6 -1209.6    85.4  1000.4  5415.4 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    -242.8     2053.7  -0.118    0.906
## WidthEconomy    124.5      114.7   1.085    0.278
## 
## Residual standard error: 1262 on 416 degrees of freedom
## Multiple R-squared:  0.002823,   Adjusted R-squared:  0.0004262 
## F-statistic: 1.178 on 1 and 416 DF,  p-value: 0.2784
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##        9       10       11       12       13       14       15       16 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       17       18       19       20       21       22       23       24 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       25       26       27       28       29       30       31       32 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       33       34       35       36       37       38       39       40 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       41       42       43       44       45       46       47       48 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       49       50       51       52       53       54       55       56 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       57       58       59       60       61       62       63       64 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       65       66       67       68       69       70       71       72 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       73       82       83       84       85       86       87       88 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##       89       90       91       92       93       94       95       96 
## 1998.613 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##       97       99      100      101      102      103      104      105 
## 1874.088 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      106      107      108      109      110      111      112      113 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      114      115      116      117      118      119      120      121 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      122      123      124      125      126      127      128      129 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      130      131      132      133      134      135      136      137 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      138      139      140      141      142      143      144      145 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      146      147      148      149      150      151      156      157 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      158      159      160      161      162      163      164      165 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      166      167      168      169      170      171      172      173 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      174      175      176      177      178      179      180      181 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      182      183      184      185      186      187      188      189 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      190      191      192      193      194      195      196      197 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      198      199      200      201      202      203      204      205 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      206      207      208      209      210      211      212      213 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      214      215      216      217      218      219      220      221 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      222      223      224      225      226      227      228      229 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      230      231      232      233      234      235      236      237 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      238      239      240      241      242      243      244      245 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      246      247      248      249      250      251      252      253 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      254      255      256      257      258      259      260      261 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      262      263      264      265      266      267      268      269 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      270      271      272      273      274      275      276      277 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      278      279      280      308      309      310      311      312 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      313      314      315      316      317      318      319      320 
## 1998.613 1998.613 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      321      322      323      324      325      326      327      328 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      329      330      331      332      333      334      335      336 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      337      338      339      340      341      342      343      344 
## 2123.138 2123.138 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      345      346      347      348      349      350      351      352 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      353      354      355      356      357      358      359      360 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      361      362      363      364      365      366      367      368 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1998.613 1998.613 
##      369      370      371      372      373      374      375      376 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      377      378      379      380      381      382      383      384 
## 1998.613 1998.613 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      385      386      387      388      389      390      391      392 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      393      394      395      396      397      398      399      400 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      401      402      403      404      405      406      407      408 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      409      410      411      412      413      414      415      416 
## 1874.088 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      417      418      419      420      421      422      423      424 
## 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 2123.138 
##      425      426      427      428      429      430      431      432 
## 2123.138 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 
##      433      434      435      436      437      438      439      440 
## 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1998.613 1874.088 
##      441      442      443      444      445      446      447      448 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      449      450      451      452      453      454      455      456 
## 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 1874.088 
##      457      458 
## 1874.088 1874.088
cor(INTL$PricePremium,INTL$WidthEconomy)
## [1] 0.05313392
fit<-lm(PriceEconomy~SeatsTotal,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsTotal, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1397.46  -889.64     4.23   636.51  2190.66 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1327.9383   149.3201   8.893   <2e-16 ***
## SeatsTotal     0.3758     0.5772   0.651    0.515    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 985.5 on 416 degrees of freedom
## Multiple R-squared:  0.001018,   Adjusted R-squared:  -0.001384 
## F-statistic: 0.4238 on 1 and 416 DF,  p-value: 0.5154
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##        9       10       11       12       13       14       15       16 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##       17       18       19       20       21       22       23       24 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##       25       26       27       28       29       30       31       32 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##       33       34       35       36       37       38       39       40 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##       41       42       43       44       45       46       47       48 
## 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 1388.812 
##       49       50       51       52       53       54       55       56 
## 1388.812 1388.812 1388.812 1390.315 1390.315 1390.315 1390.315 1390.315 
##       57       58       59       60       61       62       63       64 
## 1390.315 1390.315 1390.315 1390.315 1390.315 1415.491 1415.491 1415.491 
##       65       66       67       68       69       70       71       72 
## 1415.491 1415.491 1415.491 1415.491 1415.491 1415.491 1415.491 1415.491 
##       73       82       83       84       85       86       87       88 
## 1415.491 1440.291 1440.291 1440.291 1440.291 1440.291 1440.291 1440.291 
##       89       90       91       92       93       94       95       96 
## 1440.291 1390.315 1390.315 1390.315 1390.315 1390.315 1390.315 1390.315 
##       97       99      100      101      102      103      104      105 
## 1390.315 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      106      107      108      109      110      111      112      113 
## 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      114      115      116      117      118      119      120      121 
## 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      122      123      124      125      126      127      128      129 
## 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      130      131      132      133      134      135      136      137 
## 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      138      139      140      141      142      143      144      145 
## 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 1462.461 
##      146      147      148      149      150      151      156      157 
## 1462.461 1462.461 1462.461 1462.461 1465.843 1462.461 1415.491 1415.491 
##      158      159      160      161      162      163      164      165 
## 1415.491 1415.491 1415.491 1415.491 1415.491 1415.491 1493.650 1493.650 
##      166      167      168      169      170      171      172      173 
## 1493.650 1493.650 1415.491 1415.491 1415.491 1415.491 1415.491 1415.491 
##      174      175      176      177      178      179      180      181 
## 1493.650 1493.650 1493.650 1493.650 1415.491 1415.491 1415.491 1415.491 
##      182      183      184      185      186      187      188      189 
## 1415.491 1415.491 1415.491 1429.770 1429.770 1429.770 1429.770 1429.770 
##      190      191      192      193      194      195      196      197 
## 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 
##      198      199      200      201      202      203      204      205 
## 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 
##      206      207      208      209      210      211      212      213 
## 1429.770 1429.770 1429.770 1429.770 1429.770 1429.770 1391.066 1391.066 
##      214      215      216      217      218      219      220      221 
## 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 
##      222      223      224      225      226      227      228      229 
## 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 
##      230      231      232      233      234      235      236      237 
## 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 1391.066 
##      238      239      240      241      242      243      244      245 
## 1391.066 1391.066 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 
##      246      247      248      249      250      251      252      253 
## 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 
##      254      255      256      257      258      259      260      261 
## 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 
##      262      263      264      265      266      267      268      269 
## 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 
##      270      271      272      273      274      275      276      277 
## 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 1432.776 
##      278      279      280      308      309      310      311      312 
## 1432.776 1432.776 1432.776 1391.066 1391.066 1391.066 1391.066 1391.066 
##      313      314      315      316      317      318      319      320 
## 1391.066 1391.066 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 
##      321      322      323      324      325      326      327      328 
## 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 
##      329      330      331      332      333      334      335      336 
## 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 1407.600 
##      337      338      339      340      341      342      343      344 
## 1407.600 1407.600 1413.612 1413.612 1413.612 1413.612 1413.612 1413.612 
##      345      346      347      348      349      350      351      352 
## 1413.612 1413.612 1413.612 1413.612 1413.612 1413.612 1413.612 1413.612 
##      353      354      355      356      357      358      359      360 
## 1413.612 1402.339 1402.339 1402.339 1402.339 1413.612 1413.612 1413.612 
##      361      362      363      364      365      366      367      368 
## 1402.339 1402.339 1413.612 1413.612 1413.612 1413.612 1413.236 1413.236 
##      369      370      371      372      373      374      375      376 
## 1413.236 1413.236 1413.236 1413.236 1413.236 1413.236 1413.236 1413.236 
##      377      378      379      380      381      382      383      384 
## 1413.236 1413.236 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 
##      385      386      387      388      389      390      391      392 
## 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 
##      393      394      395      396      397      398      399      400 
## 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 1380.545 
##      401      402      403      404      405      406      407      408 
## 1380.545 1380.545 1380.545 1380.545 1380.545 1418.121 1418.121 1418.121 
##      409      410      411      412      413      414      415      416 
## 1418.121 1466.595 1466.595 1466.595 1466.595 1466.595 1466.595 1466.595 
##      417      418      419      420      421      422      423      424 
## 1466.595 1466.595 1466.595 1466.595 1466.595 1466.595 1466.595 1466.595 
##      425      426      427      428      429      430      431      432 
## 1466.595 1488.389 1488.389 1488.389 1488.389 1488.389 1488.389 1488.389 
##      433      434      435      436      437      438      439      440 
## 1488.389 1488.389 1488.389 1488.389 1488.389 1488.389 1488.389 1391.818 
##      441      442      443      444      445      446      447      448 
## 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 
##      449      450      451      452      453      454      455      456 
## 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 1391.818 
##      457      458 
## 1391.818 1391.818
cor(INTL$PriceEconomy,INTL$SeatsTotal)
## [1] 0.03190204
fit<-lm(PricePremium~SeatsTotal,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsTotal, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2040.9 -1136.5   202.9  1046.9  5451.4 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1678.2099   190.8009   8.796   <2e-16 ***
## SeatsTotal     1.2526     0.7375   1.698   0.0902 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1259 on 416 degrees of freedom
## Multiple R-squared:  0.006886,   Adjusted R-squared:  0.004499 
## F-statistic: 2.884 on 1 and 416 DF,  p-value: 0.09019
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##        9       10       11       12       13       14       15       16 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##       17       18       19       20       21       22       23       24 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##       25       26       27       28       29       30       31       32 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##       33       34       35       36       37       38       39       40 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##       41       42       43       44       45       46       47       48 
## 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 1881.134 
##       49       50       51       52       53       54       55       56 
## 1881.134 1881.134 1881.134 1886.144 1886.144 1886.144 1886.144 1886.144 
##       57       58       59       60       61       62       63       64 
## 1886.144 1886.144 1886.144 1886.144 1886.144 1970.069 1970.069 1970.069 
##       65       66       67       68       69       70       71       72 
## 1970.069 1970.069 1970.069 1970.069 1970.069 1970.069 1970.069 1970.069 
##       73       82       83       84       85       86       87       88 
## 1970.069 2052.742 2052.742 2052.742 2052.742 2052.742 2052.742 2052.742 
##       89       90       91       92       93       94       95       96 
## 2052.742 1886.144 1886.144 1886.144 1886.144 1886.144 1886.144 1886.144 
##       97       99      100      101      102      103      104      105 
## 1886.144 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      106      107      108      109      110      111      112      113 
## 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      114      115      116      117      118      119      120      121 
## 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      122      123      124      125      126      127      128      129 
## 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      130      131      132      133      134      135      136      137 
## 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      138      139      140      141      142      143      144      145 
## 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 2126.647 
##      146      147      148      149      150      151      156      157 
## 2126.647 2126.647 2126.647 2126.647 2137.920 2126.647 1970.069 1970.069 
##      158      159      160      161      162      163      164      165 
## 1970.069 1970.069 1970.069 1970.069 1970.069 1970.069 2230.614 2230.614 
##      166      167      168      169      170      171      172      173 
## 2230.614 2230.614 1970.069 1970.069 1970.069 1970.069 1970.069 1970.069 
##      174      175      176      177      178      179      180      181 
## 2230.614 2230.614 2230.614 2230.614 1970.069 1970.069 1970.069 1970.069 
##      182      183      184      185      186      187      188      189 
## 1970.069 1970.069 1970.069 2017.669 2017.669 2017.669 2017.669 2017.669 
##      190      191      192      193      194      195      196      197 
## 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 
##      198      199      200      201      202      203      204      205 
## 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 
##      206      207      208      209      210      211      212      213 
## 2017.669 2017.669 2017.669 2017.669 2017.669 2017.669 1888.649 1888.649 
##      214      215      216      217      218      219      220      221 
## 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 
##      222      223      224      225      226      227      228      229 
## 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 
##      230      231      232      233      234      235      236      237 
## 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 1888.649 
##      238      239      240      241      242      243      244      245 
## 1888.649 1888.649 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 
##      246      247      248      249      250      251      252      253 
## 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 
##      254      255      256      257      258      259      260      261 
## 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 
##      262      263      264      265      266      267      268      269 
## 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 
##      270      271      272      273      274      275      276      277 
## 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 2027.690 
##      278      279      280      308      309      310      311      312 
## 2027.690 2027.690 2027.690 1888.649 1888.649 1888.649 1888.649 1888.649 
##      313      314      315      316      317      318      319      320 
## 1888.649 1888.649 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 
##      321      322      323      324      325      326      327      328 
## 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 
##      329      330      331      332      333      334      335      336 
## 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 1943.765 
##      337      338      339      340      341      342      343      344 
## 1943.765 1943.765 1963.806 1963.806 1963.806 1963.806 1963.806 1963.806 
##      345      346      347      348      349      350      351      352 
## 1963.806 1963.806 1963.806 1963.806 1963.806 1963.806 1963.806 1963.806 
##      353      354      355      356      357      358      359      360 
## 1963.806 1926.228 1926.228 1926.228 1926.228 1963.806 1963.806 1963.806 
##      361      362      363      364      365      366      367      368 
## 1926.228 1926.228 1963.806 1963.806 1963.806 1963.806 1962.554 1962.554 
##      369      370      371      372      373      374      375      376 
## 1962.554 1962.554 1962.554 1962.554 1962.554 1962.554 1962.554 1962.554 
##      377      378      379      380      381      382      383      384 
## 1962.554 1962.554 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 
##      385      386      387      388      389      390      391      392 
## 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 
##      393      394      395      396      397      398      399      400 
## 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 1853.576 
##      401      402      403      404      405      406      407      408 
## 1853.576 1853.576 1853.576 1853.576 1853.576 1978.838 1978.838 1978.838 
##      409      410      411      412      413      414      415      416 
## 1978.838 2140.425 2140.425 2140.425 2140.425 2140.425 2140.425 2140.425 
##      417      418      419      420      421      422      423      424 
## 2140.425 2140.425 2140.425 2140.425 2140.425 2140.425 2140.425 2140.425 
##      425      426      427      428      429      430      431      432 
## 2140.425 2213.077 2213.077 2213.077 2213.077 2213.077 2213.077 2213.077 
##      433      434      435      436      437      438      439      440 
## 2213.077 2213.077 2213.077 2213.077 2213.077 2213.077 2213.077 1891.155 
##      441      442      443      444      445      446      447      448 
## 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 
##      449      450      451      452      453      454      455      456 
## 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 1891.155 
##      457      458 
## 1891.155 1891.155
cor(INTL$PricePremium,INTL$SeatsTotal)
## [1] 0.08298154
fit<-lm(PriceEconomy~PitchDifference,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchDifference, data = INTL)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1560.64  -661.55    99.48   589.48  1696.36 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      4501.37     245.11   18.36   <2e-16 ***
## PitchDifference  -434.12      34.05  -12.75   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 836.1 on 416 degrees of freedom
## Multiple R-squared:  0.281,  Adjusted R-squared:  0.2793 
## F-statistic: 162.6 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##         8         9        10        11        12        13        14 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        15        16        17        18        19        20        21 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        22        23        24        25        26        27        28 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        29        30        31        32        33        34        35 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        36        37        38        39        40        41        42 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        43        44        45        46        47        48        49 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        50        51        52        53        54        55        56 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        57        58        59        60        61        62        63 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        64        65        66        67        68        69        70 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        71        72        73        82        83        84        85 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##        86        87        88        89        90        91        92 
## 1462.5238 1462.5238 1462.5238 1462.5238  160.1607  160.1607  160.1607 
##        93        94        95        96        97        99       100 
##  160.1607  160.1607  160.1607  160.1607  160.1607 1462.5238 1462.5238 
##       101       102       103       104       105       106       107 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       108       109       110       111       112       113       114 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       115       116       117       118       119       120       121 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       122       123       124       125       126       127       128 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       129       130       131       132       133       134       135 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       136       137       138       139       140       141       142 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       143       144       145       146       147       148       149 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       150       151       156       157       158       159       160 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       161       162       163       164       165       166       167 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       168       169       170       171       172       173       174 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       175       176       177       178       179       180       181 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       182       183       184       185       186       187       188 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       189       190       191       192       193       194       195 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       196       197       198       199       200       201       202 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       203       204       205       206       207       208       209 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       210       211       212       213       214       215       216 
## 1462.5238 1462.5238 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       217       218       219       220       221       222       223 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       224       225       226       227       228       229       230 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       231       232       233       234       235       236       237 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       238       239       240       241       242       243       244 
## 1896.6449 1896.6449 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       245       246       247       248       249       250       251 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       252       253       254       255       256       257       258 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       259       260       261       262       263       264       265 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       266       267       268       269       270       271       272 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       273       274       275       276       277       278       279 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       280       308       309       310       311       312       313 
## 1462.5238 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       314       315       316       317       318       319       320 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       321       322       323       324       325       326       327 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       328       329       330       331       332       333       334 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       335       336       337       338       339       340       341 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       342       343       344       345       346       347       348 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       349       350       351       352       353       354       355 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       356       357       358       359       360       361       362 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       363       364       365       366       367       368       369 
## 1896.6449 1896.6449 1896.6449 1896.6449 1462.5238 1462.5238 1462.5238 
##       370       371       372       373       374       375       376 
## 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 1462.5238 
##       377       378       379       380       381       382       383 
## 1462.5238 1462.5238  160.1607  160.1607  160.1607  160.1607  160.1607 
##       384       385       386       387       388       389       390 
##  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607 
##       391       392       393       394       395       396       397 
##  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607 
##       398       399       400       401       402       403       404 
##  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607 
##       405       406       407       408       409       410       411 
##  160.1607 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       412       413       414       415       416       417       418 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       419       420       421       422       423       424       425 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       426       427       428       429       430       431       432 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       433       434       435       436       437       438       439 
## 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 1896.6449 
##       440       441       442       443       444       445       446 
##  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607 
##       447       448       449       450       451       452       453 
##  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607  160.1607 
##       454       455       456       457       458 
##  160.1607  160.1607  160.1607  160.1607  160.1607
cor(INTL$PriceEconomy,INTL$PitchDifference)
## [1] -0.530074
fit<-lm(PricePremium~PitchDifference,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchDifference, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1946.6  -819.6   122.1   806.2  5381.4 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       5436.2      328.3   16.56   <2e-16 ***
## PitchDifference   -486.2       45.6  -10.66   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1120 on 416 degrees of freedom
## Multiple R-squared:  0.2146, Adjusted R-squared:  0.2127 
## F-statistic: 113.7 on 1 and 416 DF,  p-value: < 2.2e-16
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##         8         9        10        11        12        13        14 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        15        16        17        18        19        20        21 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        22        23        24        25        26        27        28 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        29        30        31        32        33        34        35 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        36        37        38        39        40        41        42 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        43        44        45        46        47        48        49 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        50        51        52        53        54        55        56 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        57        58        59        60        61        62        63 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        64        65        66        67        68        69        70 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        71        72        73        82        83        84        85 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##        86        87        88        89        90        91        92 
## 2032.6020 2032.6020 2032.6020 2032.6020  573.8968  573.8968  573.8968 
##        93        94        95        96        97        99       100 
##  573.8968  573.8968  573.8968  573.8968  573.8968 2032.6020 2032.6020 
##       101       102       103       104       105       106       107 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       108       109       110       111       112       113       114 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       115       116       117       118       119       120       121 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       122       123       124       125       126       127       128 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       129       130       131       132       133       134       135 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       136       137       138       139       140       141       142 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       143       144       145       146       147       148       149 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       150       151       156       157       158       159       160 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       161       162       163       164       165       166       167 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       168       169       170       171       172       173       174 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       175       176       177       178       179       180       181 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       182       183       184       185       186       187       188 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       189       190       191       192       193       194       195 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       196       197       198       199       200       201       202 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       203       204       205       206       207       208       209 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       210       211       212       213       214       215       216 
## 2032.6020 2032.6020 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       217       218       219       220       221       222       223 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       224       225       226       227       228       229       230 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       231       232       233       234       235       236       237 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       238       239       240       241       242       243       244 
## 2518.8371 2518.8371 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       245       246       247       248       249       250       251 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       252       253       254       255       256       257       258 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       259       260       261       262       263       264       265 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       266       267       268       269       270       271       272 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       273       274       275       276       277       278       279 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       280       308       309       310       311       312       313 
## 2032.6020 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       314       315       316       317       318       319       320 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       321       322       323       324       325       326       327 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       328       329       330       331       332       333       334 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       335       336       337       338       339       340       341 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       342       343       344       345       346       347       348 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       349       350       351       352       353       354       355 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       356       357       358       359       360       361       362 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       363       364       365       366       367       368       369 
## 2518.8371 2518.8371 2518.8371 2518.8371 2032.6020 2032.6020 2032.6020 
##       370       371       372       373       374       375       376 
## 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 2032.6020 
##       377       378       379       380       381       382       383 
## 2032.6020 2032.6020  573.8968  573.8968  573.8968  573.8968  573.8968 
##       384       385       386       387       388       389       390 
##  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968 
##       391       392       393       394       395       396       397 
##  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968 
##       398       399       400       401       402       403       404 
##  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968 
##       405       406       407       408       409       410       411 
##  573.8968 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       412       413       414       415       416       417       418 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       419       420       421       422       423       424       425 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       426       427       428       429       430       431       432 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       433       434       435       436       437       438       439 
## 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 2518.8371 
##       440       441       442       443       444       445       446 
##  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968 
##       447       448       449       450       451       452       453 
##  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968  573.8968 
##       454       455       456       457       458 
##  573.8968  573.8968  573.8968  573.8968  573.8968
cor(INTL$PricePremium,INTL$PitchDifference)
## [1] -0.4632659
fit<-lm(PriceEconomy~WidthDifference,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthDifference, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1526.2  -786.0  -110.7   731.7  2218.7 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1808.11      87.75  20.605  < 2e-16 ***
## WidthDifference  -216.92      41.51  -5.226 2.75e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 955.2 on 416 degrees of freedom
## Multiple R-squared:  0.0616, Adjusted R-squared:  0.05934 
## F-statistic: 27.31 on 1 and 416 DF,  p-value: 2.751e-07
INTL$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509 1813 1813 1813 1813 2052 2052 2052 2052 1919
##  [71] 1919 1919  540 1444 1444 1444 1444 1824 1824 1824 1823  354  354  354
##  [85]  354  464  464  464  489 2384 2384 2384 2384 1848 1848 1848 1848 1758
##  [99] 1758 1758  719  719 1198  457  402  402  392  356  356  322  297  303
## [113]  303  276  249  238  238  228  231  203  201  207  207  182  171  168
## [127]  140  147  137  138  126  126  109  109  109  104   97   77   77   69
## [141]   74   65  574  574  574  574 1086 1086 1086 1247 1781 1781 1781 1781
## [155] 1580 1580 1580 1580 1903 1096 2445 2445 2445 2445  975 2369 1811 1811
## [169] 1811 1811 1356 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
## [183] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
## [197]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
## [211] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [225] 3165 3165 1651 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562
## [239] 1562 2281 2281 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632
## [253] 1632 1140 1736 1736 1736  846  846  937 1485  891 1323 1023 1023  757
## [267]  533  336  429  462  557  557  661  676  794  794  794  794 1215 1215
## [281] 1215  876  609  609 1406 1406 1406 1247 1247 1247  563  563  563  563
## [295] 1431 1431 1431 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057
## [309] 3057 3414 3414 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593
## [323] 3159 3159 3159 3159 3102 3102 3102 2166 2166 2166  649  575  575  797
## [337]  524  582  167  167  167  139  149  197  211  139  118  118  118  108
## [351]  108  108  297  234  156  156  324  147  127  154  154  154  154  322
## [365]  594  648  648  700 1094  505  505  505  505  505  505  505  505  690
## [379]  690  690  690  690  690  690  690 1522 1522 2581 2581 2996 2996 2996
## [393] 2979 2979 2979 2979 3593 3593 3220  201  148  148  187  187  187  187
## [407]  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##         8         9        10        11        12        13        14 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        15        16        17        18        19        20        21 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        22        23        24        25        26        27        28 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        29        30        31        32        33        34        35 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        36        37        38        39        40        41        42 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        43        44        45        46        47        48        49 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        50        51        52        53        54        55        56 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##        57        58        59        60        61        62        63 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1157.3607 1157.3607 
##        64        65        66        67        68        69        70 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##        71        72        73        82        83        84        85 
## 1157.3607 1157.3607 1157.3607 1591.1917 1591.1917 1591.1917 1591.1917 
##        86        87        88        89        90        91        92 
## 1591.1917 1591.1917 1591.1917 1591.1917  940.4451  940.4451  940.4451 
##        93        94        95        96        97        99       100 
##  940.4451  940.4451  940.4451  940.4451  940.4451 1591.1917 1591.1917 
##       101       102       103       104       105       106       107 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       108       109       110       111       112       113       114 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       115       116       117       118       119       120       121 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       122       123       124       125       126       127       128 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       129       130       131       132       133       134       135 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       136       137       138       139       140       141       142 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       143       144       145       146       147       148       149 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       150       151       156       157       158       159       160 
## 1591.1917 1591.1917 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       161       162       163       164       165       166       167 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       168       169       170       171       172       173       174 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       175       176       177       178       179       180       181 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       182       183       184       185       186       187       188 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       189       190       191       192       193       194       195 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       196       197       198       199       200       201       202 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       203       204       205       206       207       208       209 
## 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 1157.3607 
##       210       211       212       213       214       215       216 
## 1157.3607 1157.3607 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       217       218       219       220       221       222       223 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       224       225       226       227       228       229       230 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       231       232       233       234       235       236       237 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       238       239       240       241       242       243       244 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       245       246       247       248       249       250       251 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       252       253       254       255       256       257       258 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       259       260       261       262       263       264       265 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       266       267       268       269       270       271       272 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       273       274       275       276       277       278       279 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       280       308       309       310       311       312       313 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       314       315       316       317       318       319       320 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       321       322       323       324       325       326       327 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       328       329       330       331       332       333       334 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       335       336       337       338       339       340       341 
## 1591.1917 1591.1917 1591.1917 1591.1917 1374.2762 1374.2762 1374.2762 
##       342       343       344       345       346       347       348 
## 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 
##       349       350       351       352       353       354       355 
## 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 
##       356       357       358       359       360       361       362 
## 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 1374.2762 
##       363       364       365       366       367       368       369 
## 1374.2762 1374.2762 1374.2762 1374.2762 1591.1917 1591.1917 1591.1917 
##       370       371       372       373       374       375       376 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       377       378       379       380       381       382       383 
## 1591.1917 1591.1917  940.4451  940.4451  940.4451  940.4451  940.4451 
##       384       385       386       387       388       389       390 
##  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451 
##       391       392       393       394       395       396       397 
##  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451 
##       398       399       400       401       402       403       404 
##  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451 
##       405       406       407       408       409       410       411 
##  940.4451 1374.2762 1374.2762 1374.2762 1374.2762 1591.1917 1591.1917 
##       412       413       414       415       416       417       418 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       419       420       421       422       423       424       425 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       426       427       428       429       430       431       432 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       433       434       435       436       437       438       439 
## 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 1591.1917 
##       440       441       442       443       444       445       446 
##  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451 
##       447       448       449       450       451       452       453 
##  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451  940.4451 
##       454       455       456       457       458 
##  940.4451  940.4451  940.4451  940.4451  940.4451
cor(INTL$PriceEconomy,INTL$WidthDifference)
## [1] -0.2481919
fit<-lm(PricePremium~WidthDifference,data = INTL)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthDifference, data = INTL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2066.7 -1042.7   -17.7  1043.3  5261.3 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      2365.19     113.98  20.751  < 2e-16 ***
## WidthDifference  -212.51      53.92  -3.941  9.5e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1241 on 416 degrees of freedom
## Multiple R-squared:  0.036,  Adjusted R-squared:  0.03368 
## F-statistic: 15.53 on 1 and 416 DF,  p-value: 9.503e-05
INTL$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818 3128 3128 3128 3128 2856 2856 2856 2856 2409
##  [71] 2409 2409  594 2982 2982 2982 2982 2549 2549 2549 2548  524  524  524
##  [85]  524  616  616  616  616 3563 3563 3563 3563 3536 3536 3536 3536 2592
##  [99] 2592 2592 1634 1634 1634  486  442  442  407  396  396  348  323  319
## [113]  319  306  285  278  276  263  247  238  237  237  234  211  201  198
## [127]  175  175  172  165  156  156  141  141  141  131  125   99   99   97
## [141]   97   86 1619 1619 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509
## [155] 3019 3019 3019 3019 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531
## [169] 2531 2531 1710 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
## [183] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
## [197]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
## [211] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [225] 3275 3275 3509 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099
## [239] 3099 3025 3025 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278
## [253] 2278 2049 1866 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912
## [267]  837  841  841  841  789  789  928  931 1671 1452 1452 1408 1947 1947
## [281] 1947 1356  900  900 1584 1584 1584 1407 1407 1407  619  619  619  619
## [295] 1564 1564 1564 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167
## [309] 3167 3524 3524 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702
## [323] 3243 3243 3243 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826
## [337]  797  797  483  483  483  398  398  520  534  318  267  267  267  228
## [351]  228  228  620  483  318  318  620  267  228  267  267  267  267  483
## [365]  696 1710 1710 1710 1710 1004 1004 1004 1004 1004 1004 1004 1004 1110
## [379] 1110 1110 1110 1110 1110 1110 1110 3289 3289 2781 2781 3196 3196 3196
## [393] 3088 3088 3088 3088 3702 3702 3289  545  397  397  430  430  430  430
## [407]  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##        9       10       11       12       13       14       15       16 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       17       18       19       20       21       22       23       24 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       25       26       27       28       29       30       31       32 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       33       34       35       36       37       38       39       40 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       41       42       43       44       45       46       47       48 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       49       50       51       52       53       54       55       56 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       57       58       59       60       61       62       63       64 
## 2152.681 2152.681 2152.681 2152.681 2152.681 1727.659 1727.659 1727.659 
##       65       66       67       68       69       70       71       72 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##       73       82       83       84       85       86       87       88 
## 1727.659 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##       89       90       91       92       93       94       95       96 
## 2152.681 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##       97       99      100      101      102      103      104      105 
## 1515.148 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      106      107      108      109      110      111      112      113 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      114      115      116      117      118      119      120      121 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      122      123      124      125      126      127      128      129 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      130      131      132      133      134      135      136      137 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      138      139      140      141      142      143      144      145 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      146      147      148      149      150      151      156      157 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 1727.659 1727.659 
##      158      159      160      161      162      163      164      165 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      166      167      168      169      170      171      172      173 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      174      175      176      177      178      179      180      181 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      182      183      184      185      186      187      188      189 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      190      191      192      193      194      195      196      197 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      198      199      200      201      202      203      204      205 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 
##      206      207      208      209      210      211      212      213 
## 1727.659 1727.659 1727.659 1727.659 1727.659 1727.659 2152.681 2152.681 
##      214      215      216      217      218      219      220      221 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      222      223      224      225      226      227      228      229 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      230      231      232      233      234      235      236      237 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      238      239      240      241      242      243      244      245 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      246      247      248      249      250      251      252      253 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      254      255      256      257      258      259      260      261 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      262      263      264      265      266      267      268      269 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      270      271      272      273      274      275      276      277 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      278      279      280      308      309      310      311      312 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      313      314      315      316      317      318      319      320 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      321      322      323      324      325      326      327      328 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      329      330      331      332      333      334      335      336 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      337      338      339      340      341      342      343      344 
## 2152.681 2152.681 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 
##      345      346      347      348      349      350      351      352 
## 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 
##      353      354      355      356      357      358      359      360 
## 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 
##      361      362      363      364      365      366      367      368 
## 1940.170 1940.170 1940.170 1940.170 1940.170 1940.170 2152.681 2152.681 
##      369      370      371      372      373      374      375      376 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      377      378      379      380      381      382      383      384 
## 2152.681 2152.681 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##      385      386      387      388      389      390      391      392 
## 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##      393      394      395      396      397      398      399      400 
## 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##      401      402      403      404      405      406      407      408 
## 1515.148 1515.148 1515.148 1515.148 1515.148 1940.170 1940.170 1940.170 
##      409      410      411      412      413      414      415      416 
## 1940.170 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      417      418      419      420      421      422      423      424 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      425      426      427      428      429      430      431      432 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 
##      433      434      435      436      437      438      439      440 
## 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 2152.681 1515.148 
##      441      442      443      444      445      446      447      448 
## 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##      449      450      451      452      453      454      455      456 
## 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 1515.148 
##      457      458 
## 1515.148 1515.148
cor(INTL$PricePremium,INTL$WidthDifference)
## [1] -0.1897303

Boeing VS AirBus

Boeing Analyse all about Boeing Aircrafts:-

Boeing <- airline[ which(airline$Aircraft=='Boeing'),]
View(Boeing)
summary(Boeing)
##       Airline      Aircraft   FlightDuration   TravelMonth
##  AirFrance: 38   AirBus:  0   Min.   : 1.250   Aug:88     
##  British  :128   Boeing:307   1st Qu.: 4.250   Jul:50     
##  Delta    : 34                Median : 7.750   Oct:86     
##  Jet      : 54                Mean   : 7.648   Sep:83     
##  Singapore: 24                3rd Qu.:11.000              
##  Virgin   : 29                Max.   :14.660              
##       IsInternational  SeatsEconomy  SeatsPremium    PitchEconomy  
##  Domestic     : 34    Min.   : 78   Min.   : 8.00   Min.   :30.00  
##  International:273    1st Qu.:124   1st Qu.:24.00   1st Qu.:31.00  
##                       Median :174   Median :29.00   Median :31.00  
##                       Mean   :181   Mean   :30.94   Mean   :31.11  
##                       3rd Qu.:203   3rd Qu.:39.00   3rd Qu.:32.00  
##                       Max.   :389   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.:17.00   1st Qu.:19.00   1st Qu.: 413  
##  Median :38.00   Median :18.00   Median :19.00   Median :1224  
##  Mean   :37.93   Mean   :17.73   Mean   :19.44   Mean   :1306  
##  3rd Qu.:38.00   3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:1812  
##  Max.   :40.00   Max.   :19.00   Max.   :21.00   Max.   :3593  
##   PricePremium    PriceRelative      SeatsTotal  PitchDifference 
##  Min.   :  86.0   Min.   :0.0300   Min.   : 98   Min.   : 2.000  
##  1st Qu.: 539.5   1st Qu.:0.1200   1st Qu.:162   1st Qu.: 6.000  
##  Median :1710.0   Median :0.3800   Median :200   Median : 7.000  
##  Mean   :1833.3   Mean   :0.5228   Mean   :212   Mean   : 6.824  
##  3rd Qu.:2993.0   3rd Qu.:0.7700   3rd Qu.:233   3rd Qu.: 7.000  
##  Max.   :7414.0   Max.   :1.8900   Max.   :441   Max.   :10.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :0.00    Min.   : 4.71      
##  1st Qu.:1.00    1st Qu.:12.28      
##  Median :1.00    Median :12.90      
##  Mean   :1.71    Mean   :15.04      
##  3rd Qu.:3.00    3rd Qu.:17.80      
##  Max.   :4.00    Max.   :24.69

Check the all the means now all Boeing aircrafts

mean(Boeing$PriceEconomy)
## [1] 1305.987
mean(Boeing$PricePremium)
## [1] 1833.332
mean(Boeing$FlightDuration)
## [1] 7.64759
mean(Boeing$PitchEconomy)
## [1] 31.11075
mean(Boeing$PitchPremium)
## [1] 37.93485
mean(Boeing$WidthEconomy)
## [1] 17.72638
mean(Boeing$WidthPremium)
## [1] 19.43648
mean(Boeing$PriceRelative)
## [1] 0.5228339
mean(Boeing$PitchDifference)
## [1] 6.824104
mean(Boeing$WidthDifference)
## [1] 1.710098
mean(Boeing$PriceEconomy)
## [1] 1305.987
mean(Boeing$PricePremium)
## [1] 1833.332
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Boeing$PriceEconomy,Boeing$TravelMonth,mean))
y2<-c(by(Boeing$PricePremium,Boeing$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
mean(Boeing$PriceEconomy)
## [1] 1305.987
mean(Boeing$PricePremium)
## [1] 1833.332
library(plotly)
x<-c('British','Virgin','Delta','Jet','AirFrance','Singapore')
y1<-c(by(Boeing$PriceEconomy,Boeing$Airline,mean))
y2<-c(by(Boeing$PricePremium,Boeing$Airline,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Aircrafts", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1599.9  -466.0  -142.3   480.8  1896.7 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      102.60     104.75    0.98    0.328    
## FlightDuration   157.35      12.36   12.73   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 791.2 on 305 degrees of freedom
## Multiple R-squared:  0.347,  Adjusted R-squared:  0.3449 
## F-statistic: 162.1 on 1 and 305 DF,  p-value: < 2.2e-16
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 2030.1986 2030.1986 2030.1986 2030.1986 1386.6172 1386.6172 1386.6172 
##         8         9        10        11        12        13        14 
## 1125.4082 1125.4082 1912.1825 1912.1825 1912.1825 1912.1825 1924.7708 
##        15        16        17        18        19        20        21 
## 1924.7708 1924.7708 1543.9721 1543.9721 1543.9721 1164.7469 1164.7469 
##        22        23        24        25        26        27        28 
## 1164.7469 1150.5850 1150.5850 1150.5850 1479.4566 1479.4566 1479.4566 
##        29        30        31        32        33        34        35 
##  875.2140  875.2140  875.2140  705.2707  705.2707  705.2707  705.2707 
##        36        37        38        39        40        41        42 
## 2226.8922 2226.8922 2226.8922  705.2707  705.2707  705.2707  705.2707 
##        43        44        45        46        47        48        49 
##  953.8914  953.8914  953.8914 1400.7792 1400.7792 1400.7792 2108.8760 
##        50        51        52        53        54        55        56 
## 2108.8760 2108.8760 1125.4082 1846.0934 1846.0934 1846.0934 1059.3191 
##        57        58        59        60        61        74        75 
## 1059.3191 1059.3191 2069.5373 1998.7276 2069.5373  426.7526  469.2384 
##        76        77        78        79        80        81        82 
##  426.7526  418.8849  469.2384  377.9726  464.5178  464.5178 1177.3353 
##        83        84        85        86        87        88        89 
## 1177.3353 1177.3353 1177.3353 1295.3514 1295.3514 1295.3514 1295.3514 
##        90        91        92        93        94        95        96 
##  587.2546  587.2546  587.2546  587.2546  587.2546  587.2546  587.2546 
##        97        98       138       144       147       148       149 
##  587.2546  772.9333  299.2952  299.2952  311.8836  311.8836  299.2952 
##       151       152       153       154       155       156       157 
##  311.8836  783.9481  812.2720  783.9481  812.2720 1872.8437 1872.8437 
##       158       159       160       161       162       163       164 
## 1872.8437 1872.8437 2003.4483 2003.4483 2003.4483 2003.4483 1661.9882 
##       165       166       167       168       169       170       171 
## 1661.9882 1661.9882 1661.9882 1806.7547 1806.7547 1806.7547 1806.7547 
##       172       173       174       175       176       177       178 
## 1740.6657 2082.1257 1794.1663 1794.1663 1794.1663 1794.1663 2082.1257 
##       179       180       181       182       183       184       240 
## 1885.4321 1307.9398 1307.9398 1307.9398 1307.9398 2082.1257 1740.6657 
##       241       242       243       244       245       246       247 
## 1740.6657 1740.6657 1833.5050 1833.5050 1833.5050 1661.9882 1661.9882 
##       248       249       250       251       252       253       254 
## 1661.9882 1661.9882 1452.7063 1452.7063 1452.7063 1898.0205 1898.0205 
##       255       256       257       258       259       260       261 
## 1898.0205 1898.0205 1570.7224 1570.7224 1570.7224 1504.6334 1465.2947 
##       262       263       264       265       266       267       268 
## 1465.2947 1465.2947 1243.4243 1243.4243 1243.4243 1504.6334 1216.6740 
##       269       270       271       272       273       274       275 
## 1216.6740 1216.6740 1898.0205 1898.0205 1898.0205 1898.0205 1504.6334 
##       276       277       278       279       280       281       282 
## 1846.0934 1846.0934 1846.0934 1216.6740 1846.0934  776.0804  771.3598 
##       283       284       285       286       287       288       289 
##  831.1546  834.3017  835.8752  842.1694  842.1694  842.1694  788.6688 
##       290       291       292       293       294       295       299 
##  771.3598  799.6836  842.1694  772.9333  794.9630  403.1494  503.8565 
##       300       301       304       305       307       315       316 
##  831.1546  552.6365  349.6487  495.9888  349.6487 2291.4077 2291.4077 
##       317       318       319       320       321       322       323 
## 2291.4077 2291.4077 2055.3754 2055.3754 2055.3754 1806.7547 1806.7547 
##       324       325       326       327       328       329       330 
## 1806.7547 2409.4238 2409.4238 2409.4238 1622.6495 1622.6495 1622.6495 
##       331       332       333       334       335       336       337 
##  705.2707  705.2707  705.2707  705.2707 2108.8760 2108.8760 2108.8760 
##       338       339       340       341       342       343       344 
## 2108.8760 1413.3676 1413.3676 1413.3676 1282.7630 1177.3353 1479.4566 
##       345       346       347       348       349       350       351 
## 1479.4566 1479.4566 1307.9398 1177.3353 1177.3353 1597.4727 1597.4727 
##       352       353       354       355       356       357       358 
## 1597.4727 1597.4727 1322.1017 1322.1017 1322.1017 1334.6901 1583.3108 
##       359       360       361       362       363       364       365 
## 1583.3108 1583.3108 1951.5212 1951.5212 1976.6979 1976.6979 1976.6979 
##       366       367       368       369       370       371       372 
## 1976.6979 2278.8193 2278.8193 2278.8193 2200.1418 2200.1418 2200.1418 
##       373       374       375       376       377       378       379 
## 1504.6334 1504.6334 1504.6334 1610.0611 1610.0611 1610.0611  614.0049 
##       380       381       382       383       384       385       386 
##  614.0049  614.0049  614.0049  614.0049  757.1978  757.1978  744.6094 
##       387       388       389       390       391       392       393 
##  495.9888  495.9888  495.9888  521.1655  521.1655  521.1655  757.1978 
##       394       395       396       397       398       399       400 
##  614.0049  744.6094  757.1978  757.1978  495.9888  521.1655  783.9481 
##       401       402       403       404       405       406       407 
##  783.9481  783.9481  783.9481  614.0049  614.0049 1189.9237 1189.9237 
##       408       409       430       431       432       436       437 
## 1189.9237 1189.9237 1780.0044 1780.0044 1780.0044 1440.1179 1912.1825 
##       438       440       441       442       443       444       445 
## 1912.1825  993.2301  599.8430  599.8430  993.2301  993.2301  993.2301 
##       446       447       448       449       450       451       452 
##  993.2301  993.2301  599.8430  508.5771  508.5771  508.5771  599.8430 
##       453       454       455       456       457       458 
##  508.5771  508.5771  508.5771  508.5771  614.0049  508.5771
cor(Boeing$PriceEconomy,Boeing$FlightDuration)
## [1] 0.589106
fit<-lm(PriceEconomy~SeatsEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1983.5  -705.8  -109.0   596.6  2329.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   203.919    149.622   1.363    0.174    
## SeatsEconomy    6.088      0.777   7.835 7.88e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 893.3 on 305 degrees of freedom
## Multiple R-squared:  0.1675, Adjusted R-squared:  0.1648 
## F-statistic: 61.38 on 1 and 305 DF,  p-value: 7.881e-14
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##         8         9        10        11        12        13        14 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        15        16        17        18        19        20        21 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        22        23        24        25        26        27        28 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        29        30        31        32        33        34        35 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        36        37        38        39        40        41        42 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        43        44        45        46        47        48        49 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        50        51        52        53        54        55        56 
##  946.6157  946.6157  977.0541  977.0541  977.0541  977.0541  977.0541 
##        57        58        59        60        61        74        75 
##  977.0541  977.0541  977.0541  977.0541  977.0541  678.7578  678.7578 
##        76        77        78        79        80        81        82 
##  678.7578  678.7578  678.7578  678.7578  678.7578  678.7578 1683.2247 
##        83        84        85        86        87        88        89 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##        90        91        92        93        94        95        96 
## 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 
##        97        98       138       144       147       148       149 
## 1044.0185 1007.4924 2048.4854 2048.4854 2048.4854 2048.4854 2048.4854 
##       151       152       153       154       155       156       157 
## 2048.4854 1244.9119 1244.9119 1244.9119 1244.9119 1409.2792 1409.2792 
##       158       159       160       161       162       163       164 
## 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 2486.7982 
##       165       166       167       168       169       170       171 
## 2486.7982 2486.7982 2486.7982 1409.2792 1409.2792 1409.2792 1409.2792 
##       172       173       174       175       176       177       178 
## 1409.2792 1409.2792 2486.7982 2486.7982 2486.7982 2486.7982 1409.2792 
##       179       180       181       182       183       184       240 
## 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1683.2247 
##       241       242       243       244       245       246       247 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       248       249       250       251       252       253       254 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       255       256       257       258       259       260       261 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       262       263       264       265       266       267       268 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       269       270       271       272       273       274       275 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       276       277       278       279       280       281       282 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247  970.9664  970.9664 
##       283       284       285       286       287       288       289 
##  970.9664  970.9664  970.9664 1050.1062 1050.1062 1050.1062  970.9664 
##       290       291       292       293       294       295       299 
##  970.9664  970.9664 1050.1062  970.9664  970.9664 1031.8432 1031.8432 
##       300       301       304       305       307       315       316 
##  970.9664 1031.8432  970.9664 1031.8432  970.9664 1324.0517 1324.0517 
##       317       318       319       320       321       322       323 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       324       325       326       327       328       329       330 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       331       332       333       334       335       336       337 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       338       339       340       341       342       343       344 
## 1324.0517 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 
##       345       346       347       348       349       350       351 
## 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 
##       352       353       354       355       356       357       358 
## 1421.4546 1421.4546 1263.1749 1263.1749 1263.1749 1263.1749 1421.4546 
##       359       360       361       362       363       364       365 
## 1421.4546 1421.4546 1263.1749 1263.1749 1421.4546 1421.4546 1421.4546 
##       366       367       368       369       370       371       372 
## 1421.4546 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 
##       373       374       375       376       377       378       379 
## 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176  958.7910 
##       380       381       382       383       384       385       386 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       387       388       389       390       391       392       393 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       394       395       396       397       398       399       400 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       401       402       403       404       405       406       407 
##  958.7910  958.7910  958.7910  958.7910  958.7910 1518.8574 1518.8574 
##       408       409       430       431       432       436       437 
## 1518.8574 1518.8574 2572.0257 2572.0257 2572.0257 2572.0257 2572.0257 
##       438       440       441       442       443       444       445 
## 2572.0257 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 
##       446       447       448       449       450       451       452 
## 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 
##       453       454       455       456       457       458 
## 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228
cor(Boeing$PriceEconomy,Boeing$SeatsEconomy)
## [1] 0.4093083
fit<-lm(PriceEconomy~PriceRelative,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1443.5  -797.1  -111.1   587.5  2388.1 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1662.97      78.21  21.263  < 2e-16 ***
## PriceRelative  -682.79     110.55  -6.176  2.1e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 923.1 on 305 degrees of freedom
## Multiple R-squared:  0.1112, Adjusted R-squared:  0.1082 
## F-statistic: 38.14 on 1 and 305 DF,  p-value: 2.096e-09
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1403.5124 1403.5124 1403.5124 1403.5124 1205.5035 1205.5035 1205.5035 
##         8         9        10        11        12        13        14 
##  959.6994  959.6994 1150.8804 1150.8804 1280.6103 1485.4471 1307.9219 
##        15        16        17        18        19        20        21 
## 1307.9219 1307.9219 1403.5124 1403.5124 1403.5124 1430.8240 1430.8240 
##        22        23        24        25        26        27        28 
## 1430.8240 1437.6519 1437.6519 1437.6519 1423.9961 1437.6519 1437.6519 
##        29        30        31        32        33        34        35 
## 1430.8240 1430.8240 1430.8240 1376.2008 1376.2008 1376.2008 1376.2008 
##        36        37        38        39        40        41        42 
## 1219.1593 1219.1593 1219.1593 1499.1029 1499.1029 1499.1029 1499.1029 
##        43        44        45        46        47        48        49 
## 1546.8981 1546.8981 1546.8981 1608.3492 1608.3492 1608.3492 1307.9219 
##        50        51        52        53        54        55        56 
## 1307.9219 1307.9219  959.6994 1417.1682 1417.1682 1417.1682 1430.8240 
##        57        58        59        60        61        74        75 
## 1430.8240 1430.8240 1519.5866 1519.5866 1246.4709 1601.5213 1608.3492 
##        76        77        78        79        80        81        82 
## 1615.1771 1615.1771 1615.1771 1635.6607 1635.6607 1642.4886  932.3878 
##        83        84        85        86        87        88        89 
##  932.3878  932.3878  932.3878 1389.8566 1389.8566 1389.8566 1389.8566 
##        90        91        92        93        94        95        96 
## 1335.2335 1335.2335 1335.2335 1335.2335 1437.6519 1437.6519 1437.6519 
##        97        98       138       144       147       148       149 
## 1485.4471 1601.5213 1485.4471 1458.1355 1464.9634 1464.9634 1389.8566 
##       151       152       153       154       155       156       157 
## 1437.6519 1574.2097 1594.6934 1601.5213 1622.0049  420.2959  420.2959 
##       158       159       160       161       162       163       164 
##  420.2959  420.2959  481.7470  481.7470  481.7470  720.7232 1000.6668 
##       165       166       167       168       169       170       171 
## 1000.6668 1000.6668 1000.6668 1041.6341 1041.6341 1041.6341 1041.6341 
##       172       173       174       175       176       177       178 
## 1089.4294 1280.6103 1314.7498 1314.7498 1314.7498 1314.7498 1321.5777 
##       179       180       181       182       183       184       240 
## 1328.4056 1389.8566 1389.8566 1389.8566 1389.8566 1485.4471  891.4205 
##       241       242       243       244       245       246       247 
##  891.4205 1485.4471 1355.7172 1355.7172 1355.7172 1417.1682 1417.1682 
##       248       249       250       251       252       253       254 
## 1417.1682 1417.1682  993.8389  993.8389  993.8389 1437.6519 1437.6519 
##       255       256       257       258       259       260       261 
## 1437.6519 1437.6519 1417.1682 1417.1682 1417.1682  891.4205 1376.2008 
##       262       263       264       265       266       267       268 
## 1376.2008 1376.2008 1389.8566 1389.8566 1389.8566 1116.7409 1615.1771 
##       269       270       271       272       273       274       275 
## 1615.1771 1615.1771  905.0763  905.0763 1041.6341 1526.4145 1116.7409 
##       276       277       278       279       280       281       282 
## 1546.8981 1546.8981 1546.8981 1519.5866 1273.7825 1567.3818 1567.3818 
##       283       284       285       286       287       288       289 
## 1581.0376 1581.0376 1581.0376 1587.8655 1587.8655 1587.8655 1587.8655 
##       290       291       292       293       294       295       299 
## 1587.8655 1587.8655 1594.6934 1594.6934 1594.6934 1601.5213 1608.3492 
##       300       301       304       305       307       315       316 
## 1615.1771 1615.1771 1628.8328 1635.6607 1635.6607  905.0763 1096.2573 
##       317       318       319       320       321       322       323 
## 1096.2573 1137.2246 1253.2988 1253.2988 1253.2988 1287.4382 1335.2335 
##       324       325       326       327       328       329       330 
## 1335.2335 1574.2097 1574.2097 1574.2097 1574.2097 1574.2097 1574.2097 
##       331       332       333       334       335       336       337 
## 1594.6934 1594.6934 1594.6934 1594.6934 1601.5213 1601.5213 1601.5213 
##       338       339       340       341       342       343       344 
## 1601.5213 1417.1682 1417.1682 1417.1682 1608.3492 1615.1771 1615.1771 
##       345       346       347       348       349       350       351 
## 1615.1771 1615.1771 1635.6607 1635.6607 1635.6607 1642.4886 1642.4886 
##       352       353       354       355       356       357       358 
## 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 
##       359       360       361       362       363       364       365 
## 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 
##       366       367       368       369       370       371       372 
## 1642.4886  713.8953  713.8953  713.8953 1567.3818 1567.3818 1567.3818 
##       373       374       375       376       377       378       379 
## 1137.2246 1335.2335 1335.2335 1635.6607 1307.9219 1410.3403  372.5007 
##       380       381       382       383       384       385       386 
##  372.5007  372.5007  386.1565  522.7143  543.1980  618.3048  782.1742 
##       387       388       389       390       391       392       393 
##  802.6579  802.6579  802.6579  905.0763  905.0763  905.0763  918.7321 
##       394       395       396       397       398       399       400 
##  939.2157  952.8715  952.8715 1041.6341 1109.9130 1123.5688 1157.7083 
##       401       402       403       404       405       406       407 
## 1157.7083 1157.7083 1157.7083 1321.5777 1546.8981  543.1980  543.1980 
##       408       409       430       431       432       436       437 
##  679.7558 1280.6103 1615.1771 1615.1771 1615.1771 1635.6607 1642.4886 
##       438       440       441       442       443       444       445 
## 1642.4886  495.4028  515.8864  515.8864  775.3463  775.3463  775.3463 
##       446       447       448       449       450       451       452 
##  775.3463  829.9695  932.3878 1137.2246 1137.2246 1137.2246 1219.1593 
##       453       454       455       456       457       458 
## 1253.2988 1266.9546 1355.7172 1355.7172 1403.5124 1581.0376
cor(Boeing$PriceEconomy,Boeing$PriceRelative)
## [1] -0.3334061
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1257.1  -858.1  -209.6   475.0  2411.8 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.24     160.88   6.217 1.66e-09 ***
## PercentPremiumSeats    20.33      10.04   2.025   0.0437 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 972.6 on 305 degrees of freedom
## Multiple R-squared:  0.01326,    Adjusted R-squared:  0.01003 
## F-statistic:   4.1 on 1 and 305 DF,  p-value: 0.04375
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##        9       10       11       12       13       14       15       16 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       17       18       19       20       21       22       23       24 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       25       26       27       28       29       30       31       32 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       33       34       35       36       37       38       39       40 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       41       42       43       44       45       46       47       48 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       49       50       51       52       53       54       55       56 
## 1502.147 1502.147 1502.147 1477.752 1477.752 1477.752 1477.752 1477.752 
##       57       58       59       60       61       74       75       76 
## 1477.752 1477.752 1477.752 1477.752 1477.752 1415.141 1415.141 1415.141 
##       77       78       79       80       81       82       83       84 
## 1415.141 1415.141 1415.141 1415.141 1415.141 1380.989 1380.989 1380.989 
##       85       86       87       88       89       90       91       92 
## 1380.989 1380.989 1380.989 1380.989 1380.989 1343.178 1343.178 1343.178 
##       93       94       95       96       97       98      138      144 
## 1343.178 1343.178 1343.178 1343.178 1343.178 1334.843 1312.482 1312.482 
##      147      148      149      151      152      153      154      155 
## 1312.482 1312.482 1312.482 1312.482 1295.000 1295.000 1295.000 1295.000 
##      156      157      158      159      160      161      162      163 
## 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 
##      164      165      166      167      168      169      170      171 
## 1304.554 1304.554 1304.554 1304.554 1305.570 1305.570 1305.570 1305.570 
##      172      173      174      175      176      177      178      179 
## 1305.570 1305.570 1304.554 1304.554 1304.554 1304.554 1305.570 1305.570 
##      180      181      182      183      184      240      241      242 
## 1305.570 1305.570 1305.570 1305.570 1305.570 1262.474 1262.474 1262.474 
##      243      244      245      246      247      248      249      250 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      251      252      253      254      255      256      257      258 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      259      260      261      262      263      264      265      266 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      267      268      269      270      271      272      273      274 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      275      276      277      278      279      280      281      282 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1254.343 1254.343 
##      283      284      285      286      287      288      289      290 
## 1254.343 1254.343 1254.343 1267.150 1267.150 1267.150 1254.343 1254.343 
##      291      292      293      294      295      299      300      301 
## 1254.343 1267.150 1254.343 1254.343 1260.848 1260.848 1254.343 1260.848 
##      304      305      307      315      316      317      318      319 
## 1254.343 1260.848 1254.343 1268.776 1268.776 1268.776 1268.776 1268.776 
##      320      321      322      323      324      325      326      327 
## 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 
##      328      329      330      331      332      333      334      335 
## 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 
##      336      337      338      339      340      341      342      343 
## 1268.776 1268.776 1268.776 1249.871 1249.871 1249.871 1249.871 1249.871 
##      344      345      346      347      348      349      350      351 
## 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 
##      352      353      354      355      356      357      358      359 
## 1249.871 1249.871 1246.618 1246.618 1246.618 1246.618 1249.871 1249.871 
##      360      361      362      363      364      365      366      367 
## 1249.871 1246.618 1246.618 1249.871 1249.871 1249.871 1249.871 1215.109 
##      368      369      370      371      372      373      374      375 
## 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 
##      376      377      378      379      380      381      382      383 
## 1215.109 1215.109 1215.109 1232.591 1232.591 1232.591 1232.591 1232.591 
##      384      385      386      387      388      389      390      391 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 
##      392      393      394      395      396      397      398      399 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 
##      400      401      402      403      404      405      406      407 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1203.522 1203.522 
##      408      409      430      431      432      436      437      438 
## 1203.522 1203.522 1181.160 1181.160 1181.160 1181.160 1181.160 1181.160 
##      440      441      442      443      444      445      446      447 
## 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 
##      448      449      450      451      452      453      454      455 
## 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 
##      456      457      458 
## 1095.984 1095.984 1095.984
cor(Boeing$PriceEconomy,Boeing$PercentPremiumSeats)
## [1] 0.1151734
fit<-lm(PricePremium~FlightDuration,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2251.2  -688.4   -95.2   694.8  4137.7 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       48.39     131.28   0.369    0.713    
## FlightDuration   233.40      15.49  15.068   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 991.6 on 305 degrees of freedom
## Multiple R-squared:  0.4268, Adjusted R-squared:  0.4249 
## F-statistic: 227.1 on 1 and 305 DF,  p-value: < 2.2e-16
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 2907.5299 2907.5299 2907.5299 2907.5299 1952.9283 1952.9283 1952.9283 
##         8         9        10        11        12        13        14 
## 1565.4861 1565.4861 2732.4807 2732.4807 2732.4807 2732.4807 2751.1526 
##        15        16        17        18        19        20        21 
## 2751.1526 2751.1526 2186.3272 2186.3272 2186.3272 1623.8358 1623.8358 
##        22        23        24        25        26        27        28 
## 1623.8358 1602.8299 1602.8299 1602.8299 2090.6337 2090.6337 2090.6337 
##        29        30        31        32        33        34        35 
## 1194.3818 1194.3818 1194.3818  942.3109  942.3109  942.3109  942.3109 
##        36        37        38        39        40        41        42 
## 3199.2786 3199.2786 3199.2786  942.3109  942.3109  942.3109  942.3109 
##        43        44        45        46        47        48        49 
## 1311.0812 1311.0812 1311.0812 1973.9342 1973.9342 1973.9342 3024.2294 
##        50        51        52        53        54        55        56 
## 3024.2294 3024.2294 1565.4861 2634.4532 2634.4532 2634.4532 1467.4585 
##        57        58        59        60        61        74        75 
## 1467.4585 1467.4585 2965.8796 2860.8501 2965.8796  529.1948  592.2125 
##        76        77        78        79        80        81        82 
##  529.1948  517.5249  592.2125  456.8412  585.2106  585.2106 1642.5077 
##        83        84        85        86        87        88        89 
## 1642.5077 1642.5077 1642.5077 1817.5569 1817.5569 1817.5569 1817.5569 
##        90        91        92        93        94        95        96 
##  767.2617  767.2617  767.2617  767.2617  767.2617  767.2617  767.2617 
##        97        98       138       144       147       148       149 
##  767.2617 1042.6725  340.1417  340.1417  358.8136  358.8136  340.1417 
##       151       152       153       154       155       156       157 
##  358.8136 1059.0104 1101.0222 1059.0104 1101.0222 2674.1310 2674.1310 
##       158       159       160       161       162       163       164 
## 2674.1310 2674.1310 2867.8521 2867.8521 2867.8521 2867.8521 2361.3764 
##       165       166       167       168       169       170       171 
## 2361.3764 2361.3764 2361.3764 2576.1034 2576.1034 2576.1034 2576.1034 
##       172       173       174       175       176       177       178 
## 2478.0759 2984.5516 2557.4315 2557.4315 2557.4315 2557.4315 2984.5516 
##       179       180       181       182       183       184       240 
## 2692.8029 1836.2288 1836.2288 1836.2288 1836.2288 2984.5516 2478.0759 
##       241       242       243       244       245       246       247 
## 2478.0759 2478.0759 2615.7812 2615.7812 2615.7812 2361.3764 2361.3764 
##       248       249       250       251       252       253       254 
## 2361.3764 2361.3764 2050.9558 2050.9558 2050.9558 2711.4748 2711.4748 
##       255       256       257       258       259       260       261 
## 2711.4748 2711.4748 2226.0050 2226.0050 2226.0050 2127.9775 2069.6278 
##       262       263       264       265       266       267       268 
## 2069.6278 2069.6278 1740.5353 1740.5353 1740.5353 2127.9775 1700.8574 
##       269       270       271       272       273       274       275 
## 1700.8574 1700.8574 2711.4748 2711.4748 2711.4748 2711.4748 2127.9775 
##       276       277       278       279       280       281       282 
## 2634.4532 2634.4532 2634.4532 1700.8574 2634.4532 1047.3405 1040.3385 
##       283       284       285       286       287       288       289 
## 1129.0301 1133.6981 1136.0320 1145.3680 1145.3680 1145.3680 1066.0124 
##       290       291       292       293       294       295       299 
## 1040.3385 1082.3503 1145.3680 1042.6725 1075.3483  494.1850  643.5603 
##       300       301       304       305       307       315       316 
## 1129.0301  715.9140  414.8294  631.8904  414.8294 3294.9721 3294.9721 
##       317       318       319       320       321       322       323 
## 3294.9721 3294.9721 2944.8737 2944.8737 2944.8737 2576.1034 2576.1034 
##       324       325       326       327       328       329       330 
## 2576.1034 3470.0213 3470.0213 3470.0213 2303.0267 2303.0267 2303.0267 
##       331       332       333       334       335       336       337 
##  942.3109  942.3109  942.3109  942.3109 3024.2294 3024.2294 3024.2294 
##       338       339       340       341       342       343       344 
## 3024.2294 1992.6061 1992.6061 1992.6061 1798.8850 1642.5077 2090.6337 
##       345       346       347       348       349       350       351 
## 2090.6337 2090.6337 1836.2288 1642.5077 1642.5077 2265.6829 2265.6829 
##       352       353       354       355       356       357       358 
## 2265.6829 2265.6829 1857.2347 1857.2347 1857.2347 1875.9066 2244.6770 
##       359       360       361       362       363       364       365 
## 2244.6770 2244.6770 2790.8304 2790.8304 2828.1743 2828.1743 2828.1743 
##       366       367       368       369       370       371       372 
## 2828.1743 3276.3002 3276.3002 3276.3002 3159.6007 3159.6007 3159.6007 
##       373       374       375       376       377       378       379 
## 2127.9775 2127.9775 2127.9775 2284.3548 2284.3548 2284.3548  806.9396 
##       380       381       382       383       384       385       386 
##  806.9396  806.9396  806.9396  806.9396 1019.3326 1019.3326 1000.6607 
##       387       388       389       390       391       392       393 
##  631.8904  631.8904  631.8904  669.2342  669.2342  669.2342 1019.3326 
##       394       395       396       397       398       399       400 
##  806.9396 1000.6607 1019.3326 1019.3326  631.8904  669.2342 1059.0104 
##       401       402       403       404       405       406       407 
## 1059.0104 1059.0104 1059.0104  806.9396  806.9396 1661.1796 1661.1796 
##       408       409       430       431       432       436       437 
## 1661.1796 1661.1796 2536.4256 2536.4256 2536.4256 2032.2839 2732.4807 
##       438       440       441       442       443       444       445 
## 2732.4807 1369.4310  785.9337  785.9337 1369.4310 1369.4310 1369.4310 
##       446       447       448       449       450       451       452 
## 1369.4310 1369.4310  785.9337  650.5623  650.5623  650.5623  785.9337 
##       453       454       455       456       457       458 
##  650.5623  650.5623  650.5623  650.5623  806.9396  650.5623
cor(Boeing$PricePremium,Boeing$FlightDuration)
## [1] 0.6532631
fit<-lm(PriceEconomy~SeatsEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1983.5  -705.8  -109.0   596.6  2329.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   203.919    149.622   1.363    0.174    
## SeatsEconomy    6.088      0.777   7.835 7.88e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 893.3 on 305 degrees of freedom
## Multiple R-squared:  0.1675, Adjusted R-squared:  0.1648 
## F-statistic: 61.38 on 1 and 305 DF,  p-value: 7.881e-14
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##         8         9        10        11        12        13        14 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        15        16        17        18        19        20        21 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        22        23        24        25        26        27        28 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        29        30        31        32        33        34        35 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        36        37        38        39        40        41        42 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        43        44        45        46        47        48        49 
##  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157  946.6157 
##        50        51        52        53        54        55        56 
##  946.6157  946.6157  977.0541  977.0541  977.0541  977.0541  977.0541 
##        57        58        59        60        61        74        75 
##  977.0541  977.0541  977.0541  977.0541  977.0541  678.7578  678.7578 
##        76        77        78        79        80        81        82 
##  678.7578  678.7578  678.7578  678.7578  678.7578  678.7578 1683.2247 
##        83        84        85        86        87        88        89 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##        90        91        92        93        94        95        96 
## 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 1044.0185 
##        97        98       138       144       147       148       149 
## 1044.0185 1007.4924 2048.4854 2048.4854 2048.4854 2048.4854 2048.4854 
##       151       152       153       154       155       156       157 
## 2048.4854 1244.9119 1244.9119 1244.9119 1244.9119 1409.2792 1409.2792 
##       158       159       160       161       162       163       164 
## 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 2486.7982 
##       165       166       167       168       169       170       171 
## 2486.7982 2486.7982 2486.7982 1409.2792 1409.2792 1409.2792 1409.2792 
##       172       173       174       175       176       177       178 
## 1409.2792 1409.2792 2486.7982 2486.7982 2486.7982 2486.7982 1409.2792 
##       179       180       181       182       183       184       240 
## 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1409.2792 1683.2247 
##       241       242       243       244       245       246       247 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       248       249       250       251       252       253       254 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       255       256       257       258       259       260       261 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       262       263       264       265       266       267       268 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       269       270       271       272       273       274       275 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247 
##       276       277       278       279       280       281       282 
## 1683.2247 1683.2247 1683.2247 1683.2247 1683.2247  970.9664  970.9664 
##       283       284       285       286       287       288       289 
##  970.9664  970.9664  970.9664 1050.1062 1050.1062 1050.1062  970.9664 
##       290       291       292       293       294       295       299 
##  970.9664  970.9664 1050.1062  970.9664  970.9664 1031.8432 1031.8432 
##       300       301       304       305       307       315       316 
##  970.9664 1031.8432  970.9664 1031.8432  970.9664 1324.0517 1324.0517 
##       317       318       319       320       321       322       323 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       324       325       326       327       328       329       330 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       331       332       333       334       335       336       337 
## 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 1324.0517 
##       338       339       340       341       342       343       344 
## 1324.0517 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 
##       345       346       347       348       349       350       351 
## 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 1421.4546 
##       352       353       354       355       356       357       358 
## 1421.4546 1421.4546 1263.1749 1263.1749 1263.1749 1263.1749 1421.4546 
##       359       360       361       362       363       364       365 
## 1421.4546 1421.4546 1263.1749 1263.1749 1421.4546 1421.4546 1421.4546 
##       366       367       368       369       370       371       372 
## 1421.4546 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 
##       373       374       375       376       377       378       379 
## 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176 1439.7176  958.7910 
##       380       381       382       383       384       385       386 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       387       388       389       390       391       392       393 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       394       395       396       397       398       399       400 
##  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910  958.7910 
##       401       402       403       404       405       406       407 
##  958.7910  958.7910  958.7910  958.7910  958.7910 1518.8574 1518.8574 
##       408       409       430       431       432       436       437 
## 1518.8574 1518.8574 2572.0257 2572.0257 2572.0257 2572.0257 2572.0257 
##       438       440       441       442       443       444       445 
## 2572.0257 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 
##       446       447       448       449       450       451       452 
## 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 
##       453       454       455       456       457       458 
## 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228 1190.1228
cor(Boeing$PricePremium,Boeing$SeatsEconomy)
## [1] 0.4317098
fit<-lm(PriceEconomy~SeatsPremium,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1995.4  -610.6  -324.6   217.2  2504.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   335.801    138.934   2.417   0.0162 *  
## SeatsPremium   31.356      4.173   7.515 6.38e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 899.4 on 305 degrees of freedom
## Multiple R-squared:  0.1562, Adjusted R-squared:  0.1535 
## F-statistic: 56.47 on 1 and 305 DF,  p-value: 6.377e-13
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##         8         9        10        11        12        13        14 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        15        16        17        18        19        20        21 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        22        23        24        25        26        27        28 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        29        30        31        32        33        34        35 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        36        37        38        39        40        41        42 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        43        44        45        46        47        48        49 
## 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 1590.0260 
##        50        51        52        53        54        55        56 
## 1590.0260 1590.0260 1558.6704 1558.6704 1558.6704 1558.6704 1558.6704 
##        57        58        59        60        61        74        75 
## 1558.6704 1558.6704 1558.6704 1558.6704 1558.6704  962.9136  962.9136 
##        76        77        78        79        80        81        82 
##  962.9136  962.9136  962.9136  962.9136  962.9136  962.9136 2091.7159 
##        83        84        85        86        87        88        89 
## 2091.7159 2091.7159 2091.7159 2091.7159 2091.7159 2091.7159 2091.7159 
##        90        91        92        93        94        95        96 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##        97        98       138       144       147       148       149 
## 1213.7585 1151.0473 2060.3603 2060.3603 2060.3603 2060.3603 2060.3603 
##       151       152       153       154       155       156       157 
## 2060.3603 1245.1142 1245.1142 1245.1142 1245.1142 1433.2479 1433.2479 
##       158       159       160       161       162       163       164 
## 1433.2479 1433.2479 1433.2479 1433.2479 1433.2479 1433.2479 2405.2721 
##       165       166       167       168       169       170       171 
## 2405.2721 2405.2721 2405.2721 1433.2479 1433.2479 1433.2479 1433.2479 
##       172       173       174       175       176       177       178 
## 1433.2479 1433.2479 2405.2721 2405.2721 2405.2721 2405.2721 1433.2479 
##       179       180       181       182       183       184       240 
## 1433.2479 1433.2479 1433.2479 1433.2479 1433.2479 1433.2479 1464.6035 
##       241       242       243       244       245       246       247 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 
##       248       249       250       251       252       253       254 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 
##       255       256       257       258       259       260       261 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 
##       262       263       264       265       266       267       268 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 
##       269       270       271       272       273       274       275 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035 
##       276       277       278       279       280       281       282 
## 1464.6035 1464.6035 1464.6035 1464.6035 1464.6035  900.2023  900.2023 
##       283       284       285       286       287       288       289 
##  900.2023  900.2023  900.2023  994.2692  994.2692  994.2692  900.2023 
##       290       291       292       293       294       295       299 
##  900.2023  900.2023  994.2692  900.2023  900.2023  962.9136  962.9136 
##       300       301       304       305       307       315       316 
##  900.2023  962.9136  900.2023  962.9136  900.2023 1213.7585 1213.7585 
##       317       318       319       320       321       322       323 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##       324       325       326       327       328       329       330 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##       331       332       333       334       335       336       337 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##       338       339       340       341       342       343       344 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##       345       346       347       348       349       350       351 
## 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 1213.7585 
##       352       353       354       355       356       357       358 
## 1213.7585 1213.7585 1088.3361 1088.3361 1088.3361 1088.3361 1213.7585 
##       359       360       361       362       363       364       365 
## 1213.7585 1213.7585 1088.3361 1088.3361 1213.7585 1213.7585 1213.7585 
##       366       367       368       369       370       371       372 
## 1213.7585 1088.3361 1088.3361 1088.3361 1088.3361 1088.3361 1088.3361 
##       373       374       375       376       377       378       379 
## 1088.3361 1088.3361 1088.3361 1088.3361 1088.3361 1088.3361  837.4911 
##       380       381       382       383       384       385       386 
##  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911 
##       387       388       389       390       391       392       393 
##  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911 
##       394       395       396       397       398       399       400 
##  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911  837.4911 
##       401       402       403       404       405       406       407 
##  837.4911  837.4911  837.4911  837.4911  837.4911 1088.3361 1088.3361 
##       408       409       430       431       432       436       437 
## 1088.3361 1088.3361 1527.3148 1527.3148 1527.3148 1527.3148 1527.3148 
##       438       440       441       442       443       444       445 
## 1527.3148  586.6461  586.6461  586.6461  586.6461  586.6461  586.6461 
##       446       447       448       449       450       451       452 
##  586.6461  586.6461  586.6461  586.6461  586.6461  586.6461  586.6461 
##       453       454       455       456       457       458 
##  586.6461  586.6461  586.6461  586.6461  586.6461  586.6461
cor(Boeing$PricePremium,Boeing$SeatsPremium)
## [1] 0.478673
fit<-lm(PriceEconomy~PriceRelative,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1443.5  -797.1  -111.1   587.5  2388.1 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    1662.97      78.21  21.263  < 2e-16 ***
## PriceRelative  -682.79     110.55  -6.176  2.1e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 923.1 on 305 degrees of freedom
## Multiple R-squared:  0.1112, Adjusted R-squared:  0.1082 
## F-statistic: 38.14 on 1 and 305 DF,  p-value: 2.096e-09
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 1403.5124 1403.5124 1403.5124 1403.5124 1205.5035 1205.5035 1205.5035 
##         8         9        10        11        12        13        14 
##  959.6994  959.6994 1150.8804 1150.8804 1280.6103 1485.4471 1307.9219 
##        15        16        17        18        19        20        21 
## 1307.9219 1307.9219 1403.5124 1403.5124 1403.5124 1430.8240 1430.8240 
##        22        23        24        25        26        27        28 
## 1430.8240 1437.6519 1437.6519 1437.6519 1423.9961 1437.6519 1437.6519 
##        29        30        31        32        33        34        35 
## 1430.8240 1430.8240 1430.8240 1376.2008 1376.2008 1376.2008 1376.2008 
##        36        37        38        39        40        41        42 
## 1219.1593 1219.1593 1219.1593 1499.1029 1499.1029 1499.1029 1499.1029 
##        43        44        45        46        47        48        49 
## 1546.8981 1546.8981 1546.8981 1608.3492 1608.3492 1608.3492 1307.9219 
##        50        51        52        53        54        55        56 
## 1307.9219 1307.9219  959.6994 1417.1682 1417.1682 1417.1682 1430.8240 
##        57        58        59        60        61        74        75 
## 1430.8240 1430.8240 1519.5866 1519.5866 1246.4709 1601.5213 1608.3492 
##        76        77        78        79        80        81        82 
## 1615.1771 1615.1771 1615.1771 1635.6607 1635.6607 1642.4886  932.3878 
##        83        84        85        86        87        88        89 
##  932.3878  932.3878  932.3878 1389.8566 1389.8566 1389.8566 1389.8566 
##        90        91        92        93        94        95        96 
## 1335.2335 1335.2335 1335.2335 1335.2335 1437.6519 1437.6519 1437.6519 
##        97        98       138       144       147       148       149 
## 1485.4471 1601.5213 1485.4471 1458.1355 1464.9634 1464.9634 1389.8566 
##       151       152       153       154       155       156       157 
## 1437.6519 1574.2097 1594.6934 1601.5213 1622.0049  420.2959  420.2959 
##       158       159       160       161       162       163       164 
##  420.2959  420.2959  481.7470  481.7470  481.7470  720.7232 1000.6668 
##       165       166       167       168       169       170       171 
## 1000.6668 1000.6668 1000.6668 1041.6341 1041.6341 1041.6341 1041.6341 
##       172       173       174       175       176       177       178 
## 1089.4294 1280.6103 1314.7498 1314.7498 1314.7498 1314.7498 1321.5777 
##       179       180       181       182       183       184       240 
## 1328.4056 1389.8566 1389.8566 1389.8566 1389.8566 1485.4471  891.4205 
##       241       242       243       244       245       246       247 
##  891.4205 1485.4471 1355.7172 1355.7172 1355.7172 1417.1682 1417.1682 
##       248       249       250       251       252       253       254 
## 1417.1682 1417.1682  993.8389  993.8389  993.8389 1437.6519 1437.6519 
##       255       256       257       258       259       260       261 
## 1437.6519 1437.6519 1417.1682 1417.1682 1417.1682  891.4205 1376.2008 
##       262       263       264       265       266       267       268 
## 1376.2008 1376.2008 1389.8566 1389.8566 1389.8566 1116.7409 1615.1771 
##       269       270       271       272       273       274       275 
## 1615.1771 1615.1771  905.0763  905.0763 1041.6341 1526.4145 1116.7409 
##       276       277       278       279       280       281       282 
## 1546.8981 1546.8981 1546.8981 1519.5866 1273.7825 1567.3818 1567.3818 
##       283       284       285       286       287       288       289 
## 1581.0376 1581.0376 1581.0376 1587.8655 1587.8655 1587.8655 1587.8655 
##       290       291       292       293       294       295       299 
## 1587.8655 1587.8655 1594.6934 1594.6934 1594.6934 1601.5213 1608.3492 
##       300       301       304       305       307       315       316 
## 1615.1771 1615.1771 1628.8328 1635.6607 1635.6607  905.0763 1096.2573 
##       317       318       319       320       321       322       323 
## 1096.2573 1137.2246 1253.2988 1253.2988 1253.2988 1287.4382 1335.2335 
##       324       325       326       327       328       329       330 
## 1335.2335 1574.2097 1574.2097 1574.2097 1574.2097 1574.2097 1574.2097 
##       331       332       333       334       335       336       337 
## 1594.6934 1594.6934 1594.6934 1594.6934 1601.5213 1601.5213 1601.5213 
##       338       339       340       341       342       343       344 
## 1601.5213 1417.1682 1417.1682 1417.1682 1608.3492 1615.1771 1615.1771 
##       345       346       347       348       349       350       351 
## 1615.1771 1615.1771 1635.6607 1635.6607 1635.6607 1642.4886 1642.4886 
##       352       353       354       355       356       357       358 
## 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 
##       359       360       361       362       363       364       365 
## 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 1642.4886 
##       366       367       368       369       370       371       372 
## 1642.4886  713.8953  713.8953  713.8953 1567.3818 1567.3818 1567.3818 
##       373       374       375       376       377       378       379 
## 1137.2246 1335.2335 1335.2335 1635.6607 1307.9219 1410.3403  372.5007 
##       380       381       382       383       384       385       386 
##  372.5007  372.5007  386.1565  522.7143  543.1980  618.3048  782.1742 
##       387       388       389       390       391       392       393 
##  802.6579  802.6579  802.6579  905.0763  905.0763  905.0763  918.7321 
##       394       395       396       397       398       399       400 
##  939.2157  952.8715  952.8715 1041.6341 1109.9130 1123.5688 1157.7083 
##       401       402       403       404       405       406       407 
## 1157.7083 1157.7083 1157.7083 1321.5777 1546.8981  543.1980  543.1980 
##       408       409       430       431       432       436       437 
##  679.7558 1280.6103 1615.1771 1615.1771 1615.1771 1635.6607 1642.4886 
##       438       440       441       442       443       444       445 
## 1642.4886  495.4028  515.8864  515.8864  775.3463  775.3463  775.3463 
##       446       447       448       449       450       451       452 
##  775.3463  829.9695  932.3878 1137.2246 1137.2246 1137.2246 1219.1593 
##       453       454       455       456       457       458 
## 1253.2988 1266.9546 1355.7172 1355.7172 1403.5124 1581.0376
cor(Boeing$PricePremium,Boeing$PriceRelative)
## [1] -0.01949137
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1257.1  -858.1  -209.6   475.0  2411.8 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1000.24     160.88   6.217 1.66e-09 ***
## PercentPremiumSeats    20.33      10.04   2.025   0.0437 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 972.6 on 305 degrees of freedom
## Multiple R-squared:  0.01326,    Adjusted R-squared:  0.01003 
## F-statistic:   4.1 on 1 and 305 DF,  p-value: 0.04375
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##        9       10       11       12       13       14       15       16 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       17       18       19       20       21       22       23       24 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       25       26       27       28       29       30       31       32 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       33       34       35       36       37       38       39       40 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       41       42       43       44       45       46       47       48 
## 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 1502.147 
##       49       50       51       52       53       54       55       56 
## 1502.147 1502.147 1502.147 1477.752 1477.752 1477.752 1477.752 1477.752 
##       57       58       59       60       61       74       75       76 
## 1477.752 1477.752 1477.752 1477.752 1477.752 1415.141 1415.141 1415.141 
##       77       78       79       80       81       82       83       84 
## 1415.141 1415.141 1415.141 1415.141 1415.141 1380.989 1380.989 1380.989 
##       85       86       87       88       89       90       91       92 
## 1380.989 1380.989 1380.989 1380.989 1380.989 1343.178 1343.178 1343.178 
##       93       94       95       96       97       98      138      144 
## 1343.178 1343.178 1343.178 1343.178 1343.178 1334.843 1312.482 1312.482 
##      147      148      149      151      152      153      154      155 
## 1312.482 1312.482 1312.482 1312.482 1295.000 1295.000 1295.000 1295.000 
##      156      157      158      159      160      161      162      163 
## 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 1305.570 
##      164      165      166      167      168      169      170      171 
## 1304.554 1304.554 1304.554 1304.554 1305.570 1305.570 1305.570 1305.570 
##      172      173      174      175      176      177      178      179 
## 1305.570 1305.570 1304.554 1304.554 1304.554 1304.554 1305.570 1305.570 
##      180      181      182      183      184      240      241      242 
## 1305.570 1305.570 1305.570 1305.570 1305.570 1262.474 1262.474 1262.474 
##      243      244      245      246      247      248      249      250 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      251      252      253      254      255      256      257      258 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      259      260      261      262      263      264      265      266 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      267      268      269      270      271      272      273      274 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 
##      275      276      277      278      279      280      281      282 
## 1262.474 1262.474 1262.474 1262.474 1262.474 1262.474 1254.343 1254.343 
##      283      284      285      286      287      288      289      290 
## 1254.343 1254.343 1254.343 1267.150 1267.150 1267.150 1254.343 1254.343 
##      291      292      293      294      295      299      300      301 
## 1254.343 1267.150 1254.343 1254.343 1260.848 1260.848 1254.343 1260.848 
##      304      305      307      315      316      317      318      319 
## 1254.343 1260.848 1254.343 1268.776 1268.776 1268.776 1268.776 1268.776 
##      320      321      322      323      324      325      326      327 
## 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 
##      328      329      330      331      332      333      334      335 
## 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 1268.776 
##      336      337      338      339      340      341      342      343 
## 1268.776 1268.776 1268.776 1249.871 1249.871 1249.871 1249.871 1249.871 
##      344      345      346      347      348      349      350      351 
## 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 1249.871 
##      352      353      354      355      356      357      358      359 
## 1249.871 1249.871 1246.618 1246.618 1246.618 1246.618 1249.871 1249.871 
##      360      361      362      363      364      365      366      367 
## 1249.871 1246.618 1246.618 1249.871 1249.871 1249.871 1249.871 1215.109 
##      368      369      370      371      372      373      374      375 
## 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 1215.109 
##      376      377      378      379      380      381      382      383 
## 1215.109 1215.109 1215.109 1232.591 1232.591 1232.591 1232.591 1232.591 
##      384      385      386      387      388      389      390      391 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 
##      392      393      394      395      396      397      398      399 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 
##      400      401      402      403      404      405      406      407 
## 1232.591 1232.591 1232.591 1232.591 1232.591 1232.591 1203.522 1203.522 
##      408      409      430      431      432      436      437      438 
## 1203.522 1203.522 1181.160 1181.160 1181.160 1181.160 1181.160 1181.160 
##      440      441      442      443      444      445      446      447 
## 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 
##      448      449      450      451      452      453      454      455 
## 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 1095.984 
##      456      457      458 
## 1095.984 1095.984 1095.984
cor(Boeing$PricePremium,Boeing$PercentPremiumSeats)
## [1] 0.1539623
fit<-lm(PricePremium~PitchEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2686.0  -907.6  -169.7   964.2  5641.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -15187.5     3226.1  -4.708 3.81e-06 ***
## PitchEconomy    547.1      103.7   5.277 2.49e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1254 on 305 degrees of freedom
## Multiple R-squared:  0.08367,    Adjusted R-squared:  0.08067 
## F-statistic: 27.85 on 1 and 305 DF,  p-value: 2.492e-07
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##        9       10       11       12       13       14       15       16 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       17       18       19       20       21       22       23       24 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       25       26       27       28       29       30       31       32 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       33       34       35       36       37       38       39       40 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       41       42       43       44       45       46       47       48 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       49       50       51       52       53       54       55       56 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       57       58       59       60       61       74       75       76 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       77       78       79       80       81       82       83       84 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##       85       86       87       88       89       90       91       92 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1225.635 1225.635 1225.635 
##       93       94       95       96       97       98      138      144 
## 1225.635 1225.635 1225.635 1225.635 1225.635 2319.846 1772.741 1772.741 
##      147      148      149      151      152      153      154      155 
## 1772.741 1772.741 1772.741 1772.741 2319.846 2319.846 2319.846 2319.846 
##      156      157      158      159      160      161      162      163 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      164      165      166      167      168      169      170      171 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      172      173      174      175      176      177      178      179 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      180      181      182      183      184      240      241      242 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      243      244      245      246      247      248      249      250 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      251      252      253      254      255      256      257      258 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      259      260      261      262      263      264      265      266 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      267      268      269      270      271      272      273      274 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      275      276      277      278      279      280      281      282 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 2319.846 2319.846 
##      283      284      285      286      287      288      289      290 
## 2319.846 2319.846 2319.846 1772.741 1772.741 1772.741 2319.846 2319.846 
##      291      292      293      294      295      299      300      301 
## 2319.846 1772.741 2319.846 2319.846 2866.952 2866.952 2319.846 2866.952 
##      304      305      307      315      316      317      318      319 
## 2319.846 2866.952 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      320      321      322      323      324      325      326      327 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      328      329      330      331      332      333      334      335 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      336      337      338      339      340      341      342      343 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      344      345      346      347      348      349      350      351 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      352      353      354      355      356      357      358      359 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      360      361      362      363      364      365      366      367 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 1772.741 
##      368      369      370      371      372      373      374      375 
## 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 1772.741 
##      376      377      378      379      380      381      382      383 
## 1772.741 1772.741 1772.741 1225.635 1225.635 1225.635 1225.635 1225.635 
##      384      385      386      387      388      389      390      391 
## 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 
##      392      393      394      395      396      397      398      399 
## 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 
##      400      401      402      403      404      405      406      407 
## 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 2319.846 2319.846 
##      408      409      430      431      432      436      437      438 
## 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 2319.846 
##      440      441      442      443      444      445      446      447 
## 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 
##      448      449      450      451      452      453      454      455 
## 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 1225.635 
##      456      457      458 
## 1225.635 1225.635 1225.635
cor(Boeing$PricePremium,Boeing$PitchEconomy)
## [1] 0.2892619
fit<-lm(PriceEconomy~PitchEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2285.6  -524.5  -115.8   573.2  1863.2 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -17558.47    2276.13  -7.714 1.74e-13 ***
## PitchEconomy    606.36      73.14   8.290 3.65e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 884.5 on 305 degrees of freedom
## Multiple R-squared:  0.1839, Adjusted R-squared:  0.1812 
## F-statistic: 68.72 on 1 and 305 DF,  p-value: 3.655e-15
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##        9       10       11       12       13       14       15       16 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       17       18       19       20       21       22       23       24 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       25       26       27       28       29       30       31       32 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       33       34       35       36       37       38       39       40 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       41       42       43       44       45       46       47       48 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       49       50       51       52       53       54       55       56 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       57       58       59       60       61       74       75       76 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       77       78       79       80       81       82       83       84 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##       85       86       87       88       89       90       91       92 
## 1238.833 1238.833 1238.833 1238.833 1238.833  632.468  632.468  632.468 
##       93       94       95       96       97       98      138      144 
##  632.468  632.468  632.468  632.468  632.468 1845.197 1238.833 1238.833 
##      147      148      149      151      152      153      154      155 
## 1238.833 1238.833 1238.833 1238.833 1845.197 1845.197 1845.197 1845.197 
##      156      157      158      159      160      161      162      163 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      164      165      166      167      168      169      170      171 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      172      173      174      175      176      177      178      179 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      180      181      182      183      184      240      241      242 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      243      244      245      246      247      248      249      250 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      251      252      253      254      255      256      257      258 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      259      260      261      262      263      264      265      266 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      267      268      269      270      271      272      273      274 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      275      276      277      278      279      280      281      282 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1845.197 1845.197 
##      283      284      285      286      287      288      289      290 
## 1845.197 1845.197 1845.197 1238.833 1238.833 1238.833 1845.197 1845.197 
##      291      292      293      294      295      299      300      301 
## 1845.197 1238.833 1845.197 1845.197 2451.562 2451.562 1845.197 2451.562 
##      304      305      307      315      316      317      318      319 
## 1845.197 2451.562 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      320      321      322      323      324      325      326      327 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      328      329      330      331      332      333      334      335 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      336      337      338      339      340      341      342      343 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      344      345      346      347      348      349      350      351 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      352      353      354      355      356      357      358      359 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      360      361      362      363      364      365      366      367 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1238.833 
##      368      369      370      371      372      373      374      375 
## 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 1238.833 
##      376      377      378      379      380      381      382      383 
## 1238.833 1238.833 1238.833  632.468  632.468  632.468  632.468  632.468 
##      384      385      386      387      388      389      390      391 
##  632.468  632.468  632.468  632.468  632.468  632.468  632.468  632.468 
##      392      393      394      395      396      397      398      399 
##  632.468  632.468  632.468  632.468  632.468  632.468  632.468  632.468 
##      400      401      402      403      404      405      406      407 
##  632.468  632.468  632.468  632.468  632.468  632.468 1845.197 1845.197 
##      408      409      430      431      432      436      437      438 
## 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 1845.197 
##      440      441      442      443      444      445      446      447 
##  632.468  632.468  632.468  632.468  632.468  632.468  632.468  632.468 
##      448      449      450      451      452      453      454      455 
##  632.468  632.468  632.468  632.468  632.468  632.468  632.468  632.468 
##      456      457      458 
##  632.468  632.468  632.468
cor(Boeing$PriceEconomy,Boeing$PitchEconomy)
## [1] 0.428823
fit<-lm(PricePremium~PitchPremium,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchPremium, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1750.4 -1242.0  -126.4  1156.6  5577.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)     56.28    1872.89    0.03    0.976
## PitchPremium    46.84      49.33    0.95    0.343
## 
## Residual standard error: 1308 on 305 degrees of freedom
## Multiple R-squared:  0.002948,   Adjusted R-squared:  -0.0003213 
## F-statistic: 0.9017 on 1 and 305 DF,  p-value: 0.3431
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##        9       10       11       12       13       14       15       16 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       17       18       19       20       21       22       23       24 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       25       26       27       28       29       30       31       32 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       33       34       35       36       37       38       39       40 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       41       42       43       44       45       46       47       48 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       49       50       51       52       53       54       55       56 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##       57       58       59       60       61       74       75       76 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1649.005 1649.005 1649.005 
##       77       78       79       80       81       82       83       84 
## 1649.005 1649.005 1649.005 1649.005 1649.005 1836.384 1836.384 1836.384 
##       85       86       87       88       89       90       91       92 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1930.073 1930.073 1930.073 
##       93       94       95       96       97       98      138      144 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1649.005 1836.384 1836.384 
##      147      148      149      151      152      153      154      155 
## 1836.384 1836.384 1836.384 1836.384 1695.850 1695.850 1695.850 1695.850 
##      156      157      158      159      160      161      162      163 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      164      165      166      167      168      169      170      171 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      172      173      174      175      176      177      178      179 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      180      181      182      183      184      240      241      242 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      243      244      245      246      247      248      249      250 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      251      252      253      254      255      256      257      258 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      259      260      261      262      263      264      265      266 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      267      268      269      270      271      272      273      274 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      275      276      277      278      279      280      281      282 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1649.005 1649.005 
##      283      284      285      286      287      288      289      290 
## 1649.005 1649.005 1649.005 1649.005 1649.005 1649.005 1649.005 1649.005 
##      291      292      293      294      295      299      300      301 
## 1649.005 1649.005 1649.005 1649.005 1695.850 1695.850 1649.005 1695.850 
##      304      305      307      315      316      317      318      319 
## 1649.005 1695.850 1649.005 1836.384 1836.384 1836.384 1836.384 1836.384 
##      320      321      322      323      324      325      326      327 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      328      329      330      331      332      333      334      335 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      336      337      338      339      340      341      342      343 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      344      345      346      347      348      349      350      351 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      352      353      354      355      356      357      358      359 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      360      361      362      363      364      365      366      367 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      368      369      370      371      372      373      374      375 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      376      377      378      379      380      381      382      383 
## 1836.384 1836.384 1836.384 1930.073 1930.073 1930.073 1930.073 1930.073 
##      384      385      386      387      388      389      390      391 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 
##      392      393      394      395      396      397      398      399 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 
##      400      401      402      403      404      405      406      407 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1836.384 1836.384 
##      408      409      430      431      432      436      437      438 
## 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 1836.384 
##      440      441      442      443      444      445      446      447 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 
##      448      449      450      451      452      453      454      455 
## 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 1930.073 
##      456      457      458 
## 1930.073 1930.073 1930.073
cor(Boeing$PricePremium,Boeing$PitchPremium)
## [1] 0.05429251
fit<-lm(PriceEconomy~PitchPremium,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchPremium, data = Boeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1241.51  -861.23   -82.51   505.49  2286.49 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   999.800   1402.156   0.713    0.476
## PitchPremium    8.071     36.933   0.219    0.827
## 
## Residual standard error: 979 on 305 degrees of freedom
## Multiple R-squared:  0.0001566,  Adjusted R-squared:  -0.003122 
## F-statistic: 0.04776 on 1 and 305 DF,  p-value: 0.8272
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##        9       10       11       12       13       14       15       16 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       17       18       19       20       21       22       23       24 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       25       26       27       28       29       30       31       32 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       33       34       35       36       37       38       39       40 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       41       42       43       44       45       46       47       48 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       49       50       51       52       53       54       55       56 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##       57       58       59       60       61       74       75       76 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1274.227 1274.227 1274.227 
##       77       78       79       80       81       82       83       84 
## 1274.227 1274.227 1274.227 1274.227 1274.227 1306.513 1306.513 1306.513 
##       85       86       87       88       89       90       91       92 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1322.656 1322.656 1322.656 
##       93       94       95       96       97       98      138      144 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1274.227 1306.513 1306.513 
##      147      148      149      151      152      153      154      155 
## 1306.513 1306.513 1306.513 1306.513 1282.299 1282.299 1282.299 1282.299 
##      156      157      158      159      160      161      162      163 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      164      165      166      167      168      169      170      171 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      172      173      174      175      176      177      178      179 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      180      181      182      183      184      240      241      242 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      243      244      245      246      247      248      249      250 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      251      252      253      254      255      256      257      258 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      259      260      261      262      263      264      265      266 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      267      268      269      270      271      272      273      274 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      275      276      277      278      279      280      281      282 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1274.227 1274.227 
##      283      284      285      286      287      288      289      290 
## 1274.227 1274.227 1274.227 1274.227 1274.227 1274.227 1274.227 1274.227 
##      291      292      293      294      295      299      300      301 
## 1274.227 1274.227 1274.227 1274.227 1282.299 1282.299 1274.227 1282.299 
##      304      305      307      315      316      317      318      319 
## 1274.227 1282.299 1274.227 1306.513 1306.513 1306.513 1306.513 1306.513 
##      320      321      322      323      324      325      326      327 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      328      329      330      331      332      333      334      335 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      336      337      338      339      340      341      342      343 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      344      345      346      347      348      349      350      351 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      352      353      354      355      356      357      358      359 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      360      361      362      363      364      365      366      367 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      368      369      370      371      372      373      374      375 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      376      377      378      379      380      381      382      383 
## 1306.513 1306.513 1306.513 1322.656 1322.656 1322.656 1322.656 1322.656 
##      384      385      386      387      388      389      390      391 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 
##      392      393      394      395      396      397      398      399 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 
##      400      401      402      403      404      405      406      407 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1306.513 1306.513 
##      408      409      430      431      432      436      437      438 
## 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 1306.513 
##      440      441      442      443      444      445      446      447 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 
##      448      449      450      451      452      453      454      455 
## 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 1322.656 
##      456      457      458 
## 1322.656 1322.656 1322.656
cor(Boeing$PriceEconomy,Boeing$PitchPremium)
## [1] 0.01251271
fit<-lm(PriceEconomy~WidthPremium,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthPremium, data = Boeing)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1475.13  -851.42   -43.03   489.08  2226.97 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3979.55     943.75   4.217 3.27e-05 ***
## WidthPremium  -137.55      48.47  -2.838  0.00485 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 966.4 on 305 degrees of freedom
## Multiple R-squared:  0.02572,    Adjusted R-squared:  0.02253 
## F-statistic: 8.053 on 1 and 305 DF,  p-value: 0.004848
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##        9       10       11       12       13       14       15       16 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       17       18       19       20       21       22       23       24 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       25       26       27       28       29       30       31       32 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       33       34       35       36       37       38       39       40 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       41       42       43       44       45       46       47       48 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       49       50       51       52       53       54       55       56 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##       57       58       59       60       61       74       75       76 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1503.581 1503.581 1503.581 
##       77       78       79       80       81       82       83       84 
## 1503.581 1503.581 1503.581 1503.581 1503.581 1366.027 1366.027 1366.027 
##       85       86       87       88       89       90       91       92 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1090.919 1090.919 1090.919 
##       93       94       95       96       97       98      138      144 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1641.135 1366.027 1366.027 
##      147      148      149      151      152      153      154      155 
## 1366.027 1366.027 1366.027 1366.027 1503.581 1503.581 1503.581 1503.581 
##      156      157      158      159      160      161      162      163 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      164      165      166      167      168      169      170      171 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      172      173      174      175      176      177      178      179 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      180      181      182      183      184      240      241      242 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1366.027 1366.027 1366.027 
##      243      244      245      246      247      248      249      250 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      251      252      253      254      255      256      257      258 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      259      260      261      262      263      264      265      266 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      267      268      269      270      271      272      273      274 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      275      276      277      278      279      280      281      282 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1641.135 1641.135 
##      283      284      285      286      287      288      289      290 
## 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 
##      291      292      293      294      295      299      300      301 
## 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 1641.135 
##      304      305      307      315      316      317      318      319 
## 1641.135 1641.135 1641.135 1228.473 1228.473 1228.473 1228.473 1228.473 
##      320      321      322      323      324      325      326      327 
## 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 
##      328      329      330      331      332      333      334      335 
## 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 1228.473 
##      336      337      338      339      340      341      342      343 
## 1228.473 1228.473 1228.473 1366.027 1366.027 1366.027 1366.027 1366.027 
##      344      345      346      347      348      349      350      351 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      352      353      354      355      356      357      358      359 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      360      361      362      363      364      365      366      367 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      368      369      370      371      372      373      374      375 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      376      377      378      379      380      381      382      383 
## 1366.027 1366.027 1366.027 1090.919 1090.919 1090.919 1090.919 1090.919 
##      384      385      386      387      388      389      390      391 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      392      393      394      395      396      397      398      399 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      400      401      402      403      404      405      406      407 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1366.027 1366.027 
##      408      409      430      431      432      436      437      438 
## 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 1366.027 
##      440      441      442      443      444      445      446      447 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      448      449      450      451      452      453      454      455 
## 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 1090.919 
##      456      457      458 
## 1090.919 1090.919 1090.919
cor(Boeing$PriceEconomy,Boeing$WidthPremium)
## [1] -0.1603862
fit<-lm(PricePremium~WidthPremium,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthPremium, data = Boeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -1812  -1207   -112   1137   5552 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   3105.47    1276.83   2.432   0.0156 *
## WidthPremium   -65.45      65.58  -0.998   0.3191  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1308 on 305 degrees of freedom
## Multiple R-squared:  0.003255,   Adjusted R-squared:  -1.285e-05 
## F-statistic: 0.9961 on 1 and 305 DF,  p-value: 0.3191
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##        9       10       11       12       13       14       15       16 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       17       18       19       20       21       22       23       24 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       25       26       27       28       29       30       31       32 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       33       34       35       36       37       38       39       40 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       41       42       43       44       45       46       47       48 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       49       50       51       52       53       54       55       56 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##       57       58       59       60       61       74       75       76 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1927.351 1927.351 1927.351 
##       77       78       79       80       81       82       83       84 
## 1927.351 1927.351 1927.351 1927.351 1927.351 1861.900 1861.900 1861.900 
##       85       86       87       88       89       90       91       92 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1730.998 1730.998 1730.998 
##       93       94       95       96       97       98      138      144 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1992.802 1861.900 1861.900 
##      147      148      149      151      152      153      154      155 
## 1861.900 1861.900 1861.900 1861.900 1927.351 1927.351 1927.351 1927.351 
##      156      157      158      159      160      161      162      163 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      164      165      166      167      168      169      170      171 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      172      173      174      175      176      177      178      179 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      180      181      182      183      184      240      241      242 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1861.900 1861.900 1861.900 
##      243      244      245      246      247      248      249      250 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      251      252      253      254      255      256      257      258 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      259      260      261      262      263      264      265      266 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      267      268      269      270      271      272      273      274 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      275      276      277      278      279      280      281      282 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1992.802 1992.802 
##      283      284      285      286      287      288      289      290 
## 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 
##      291      292      293      294      295      299      300      301 
## 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 1992.802 
##      304      305      307      315      316      317      318      319 
## 1992.802 1992.802 1992.802 1796.449 1796.449 1796.449 1796.449 1796.449 
##      320      321      322      323      324      325      326      327 
## 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 
##      328      329      330      331      332      333      334      335 
## 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 1796.449 
##      336      337      338      339      340      341      342      343 
## 1796.449 1796.449 1796.449 1861.900 1861.900 1861.900 1861.900 1861.900 
##      344      345      346      347      348      349      350      351 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      352      353      354      355      356      357      358      359 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      360      361      362      363      364      365      366      367 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      368      369      370      371      372      373      374      375 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      376      377      378      379      380      381      382      383 
## 1861.900 1861.900 1861.900 1730.998 1730.998 1730.998 1730.998 1730.998 
##      384      385      386      387      388      389      390      391 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      392      393      394      395      396      397      398      399 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      400      401      402      403      404      405      406      407 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1861.900 1861.900 
##      408      409      430      431      432      436      437      438 
## 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 1861.900 
##      440      441      442      443      444      445      446      447 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      448      449      450      451      452      453      454      455 
## 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 1730.998 
##      456      457      458 
## 1730.998 1730.998 1730.998
cor(Boeing$PricePremium,Boeing$WidthPremium)
## [1] -0.05705404
fit<-lm(PriceEconomy~WidthEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1293.2  -821.8  -218.2   453.8  2425.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  -2075.98    1651.90  -1.257   0.2098  
## WidthEconomy   190.79      93.14   2.048   0.0414 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 972.4 on 305 degrees of freedom
## Multiple R-squared:  0.01357,    Adjusted R-squared:  0.01034 
## F-statistic: 4.196 on 1 and 305 DF,  p-value: 0.04137
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##        9       10       11       12       13       14       15       16 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       17       18       19       20       21       22       23       24 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       25       26       27       28       29       30       31       32 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       33       34       35       36       37       38       39       40 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       41       42       43       44       45       46       47       48 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       49       50       51       52       53       54       55       56 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       57       58       59       60       61       74       75       76 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       77       78       79       80       81       82       83       84 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       85       86       87       88       89       90       91       92 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1167.402 1167.402 1167.402 
##       93       94       95       96       97       98      138      144 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1358.189 1358.189 
##      147      148      149      151      152      153      154      155 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      156      157      158      159      160      161      162      163 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      164      165      166      167      168      169      170      171 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      172      173      174      175      176      177      178      179 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      180      181      182      183      184      240      241      242 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      243      244      245      246      247      248      249      250 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      251      252      253      254      255      256      257      258 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      259      260      261      262      263      264      265      266 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      267      268      269      270      271      272      273      274 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      275      276      277      278      279      280      281      282 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1167.402 1167.402 
##      283      284      285      286      287      288      289      290 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      291      292      293      294      295      299      300      301 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      304      305      307      315      316      317      318      319 
## 1167.402 1167.402 1167.402 1548.976 1548.976 1548.976 1548.976 1548.976 
##      320      321      322      323      324      325      326      327 
## 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 
##      328      329      330      331      332      333      334      335 
## 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 
##      336      337      338      339      340      341      342      343 
## 1548.976 1548.976 1548.976 1167.402 1167.402 1167.402 1167.402 1167.402 
##      344      345      346      347      348      349      350      351 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      352      353      354      355      356      357      358      359 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      360      361      362      363      364      365      366      367 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1358.189 
##      368      369      370      371      372      373      374      375 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      376      377      378      379      380      381      382      383 
## 1358.189 1358.189 1358.189 1167.402 1167.402 1167.402 1167.402 1167.402 
##      384      385      386      387      388      389      390      391 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      392      393      394      395      396      397      398      399 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      400      401      402      403      404      405      406      407 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      408      409      430      431      432      436      437      438 
## 1167.402 1167.402 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      440      441      442      443      444      445      446      447 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      448      449      450      451      452      453      454      455 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      456      457      458 
## 1167.402 1167.402 1167.402
cor(Boeing$PriceEconomy,Boeing$WidthEconomy)
## [1] 0.1164968
fit<-lm(PricePremium~WidthEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1877.3 -1031.4  -344.3  1033.7  5450.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -6588.2     2171.8  -3.034 0.002625 ** 
## WidthEconomy    475.1      122.4   3.880 0.000128 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1278 on 305 degrees of freedom
## Multiple R-squared:  0.04704,    Adjusted R-squared:  0.04391 
## F-statistic: 15.05 on 1 and 305 DF,  p-value: 0.0001281
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##        9       10       11       12       13       14       15       16 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       17       18       19       20       21       22       23       24 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       25       26       27       28       29       30       31       32 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       33       34       35       36       37       38       39       40 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       41       42       43       44       45       46       47       48 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       49       50       51       52       53       54       55       56 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       57       58       59       60       61       74       75       76 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       77       78       79       80       81       82       83       84 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       85       86       87       88       89       90       91       92 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1488.239 1488.239 1488.239 
##       93       94       95       96       97       98      138      144 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1963.323 1963.323 
##      147      148      149      151      152      153      154      155 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      156      157      158      159      160      161      162      163 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      164      165      166      167      168      169      170      171 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      172      173      174      175      176      177      178      179 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      180      181      182      183      184      240      241      242 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      243      244      245      246      247      248      249      250 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      251      252      253      254      255      256      257      258 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      259      260      261      262      263      264      265      266 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      267      268      269      270      271      272      273      274 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      275      276      277      278      279      280      281      282 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1488.239 1488.239 
##      283      284      285      286      287      288      289      290 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      291      292      293      294      295      299      300      301 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      304      305      307      315      316      317      318      319 
## 1488.239 1488.239 1488.239 2438.407 2438.407 2438.407 2438.407 2438.407 
##      320      321      322      323      324      325      326      327 
## 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 
##      328      329      330      331      332      333      334      335 
## 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 
##      336      337      338      339      340      341      342      343 
## 2438.407 2438.407 2438.407 1488.239 1488.239 1488.239 1488.239 1488.239 
##      344      345      346      347      348      349      350      351 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      352      353      354      355      356      357      358      359 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      360      361      362      363      364      365      366      367 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1963.323 
##      368      369      370      371      372      373      374      375 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      376      377      378      379      380      381      382      383 
## 1963.323 1963.323 1963.323 1488.239 1488.239 1488.239 1488.239 1488.239 
##      384      385      386      387      388      389      390      391 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      392      393      394      395      396      397      398      399 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      400      401      402      403      404      405      406      407 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      408      409      430      431      432      436      437      438 
## 1488.239 1488.239 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      440      441      442      443      444      445      446      447 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      448      449      450      451      452      453      454      455 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      456      457      458 
## 1488.239 1488.239 1488.239
cor(Boeing$PricePremium,Boeing$WidthEconomy)
## [1] 0.216876
fit<-lm(PriceEconomy~WidthEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1293.2  -821.8  -218.2   453.8  2425.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  -2075.98    1651.90  -1.257   0.2098  
## WidthEconomy   190.79      93.14   2.048   0.0414 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 972.4 on 305 degrees of freedom
## Multiple R-squared:  0.01357,    Adjusted R-squared:  0.01034 
## F-statistic: 4.196 on 1 and 305 DF,  p-value: 0.04137
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##        9       10       11       12       13       14       15       16 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       17       18       19       20       21       22       23       24 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       25       26       27       28       29       30       31       32 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       33       34       35       36       37       38       39       40 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       41       42       43       44       45       46       47       48 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       49       50       51       52       53       54       55       56 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       57       58       59       60       61       74       75       76 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       77       78       79       80       81       82       83       84 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##       85       86       87       88       89       90       91       92 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1167.402 1167.402 1167.402 
##       93       94       95       96       97       98      138      144 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1358.189 1358.189 
##      147      148      149      151      152      153      154      155 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      156      157      158      159      160      161      162      163 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      164      165      166      167      168      169      170      171 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      172      173      174      175      176      177      178      179 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      180      181      182      183      184      240      241      242 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      243      244      245      246      247      248      249      250 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      251      252      253      254      255      256      257      258 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      259      260      261      262      263      264      265      266 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      267      268      269      270      271      272      273      274 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      275      276      277      278      279      280      281      282 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1167.402 1167.402 
##      283      284      285      286      287      288      289      290 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      291      292      293      294      295      299      300      301 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      304      305      307      315      316      317      318      319 
## 1167.402 1167.402 1167.402 1548.976 1548.976 1548.976 1548.976 1548.976 
##      320      321      322      323      324      325      326      327 
## 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 
##      328      329      330      331      332      333      334      335 
## 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 1548.976 
##      336      337      338      339      340      341      342      343 
## 1548.976 1548.976 1548.976 1167.402 1167.402 1167.402 1167.402 1167.402 
##      344      345      346      347      348      349      350      351 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      352      353      354      355      356      357      358      359 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      360      361      362      363      364      365      366      367 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1358.189 
##      368      369      370      371      372      373      374      375 
## 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      376      377      378      379      380      381      382      383 
## 1358.189 1358.189 1358.189 1167.402 1167.402 1167.402 1167.402 1167.402 
##      384      385      386      387      388      389      390      391 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      392      393      394      395      396      397      398      399 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      400      401      402      403      404      405      406      407 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      408      409      430      431      432      436      437      438 
## 1167.402 1167.402 1358.189 1358.189 1358.189 1358.189 1358.189 1358.189 
##      440      441      442      443      444      445      446      447 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      448      449      450      451      452      453      454      455 
## 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 1167.402 
##      456      457      458 
## 1167.402 1167.402 1167.402
cor(Boeing$PriceEconomy,Boeing$WidthEconomy)
## [1] 0.1164968
fit<-lm(PricePremium~WidthEconomy,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1877.3 -1031.4  -344.3  1033.7  5450.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -6588.2     2171.8  -3.034 0.002625 ** 
## WidthEconomy    475.1      122.4   3.880 0.000128 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1278 on 305 degrees of freedom
## Multiple R-squared:  0.04704,    Adjusted R-squared:  0.04391 
## F-statistic: 15.05 on 1 and 305 DF,  p-value: 0.0001281
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##        9       10       11       12       13       14       15       16 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       17       18       19       20       21       22       23       24 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       25       26       27       28       29       30       31       32 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       33       34       35       36       37       38       39       40 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       41       42       43       44       45       46       47       48 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       49       50       51       52       53       54       55       56 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       57       58       59       60       61       74       75       76 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       77       78       79       80       81       82       83       84 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##       85       86       87       88       89       90       91       92 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1488.239 1488.239 1488.239 
##       93       94       95       96       97       98      138      144 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1963.323 1963.323 
##      147      148      149      151      152      153      154      155 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      156      157      158      159      160      161      162      163 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      164      165      166      167      168      169      170      171 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      172      173      174      175      176      177      178      179 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      180      181      182      183      184      240      241      242 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      243      244      245      246      247      248      249      250 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      251      252      253      254      255      256      257      258 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      259      260      261      262      263      264      265      266 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      267      268      269      270      271      272      273      274 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      275      276      277      278      279      280      281      282 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1488.239 1488.239 
##      283      284      285      286      287      288      289      290 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      291      292      293      294      295      299      300      301 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      304      305      307      315      316      317      318      319 
## 1488.239 1488.239 1488.239 2438.407 2438.407 2438.407 2438.407 2438.407 
##      320      321      322      323      324      325      326      327 
## 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 
##      328      329      330      331      332      333      334      335 
## 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 2438.407 
##      336      337      338      339      340      341      342      343 
## 2438.407 2438.407 2438.407 1488.239 1488.239 1488.239 1488.239 1488.239 
##      344      345      346      347      348      349      350      351 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      352      353      354      355      356      357      358      359 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      360      361      362      363      364      365      366      367 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1963.323 
##      368      369      370      371      372      373      374      375 
## 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      376      377      378      379      380      381      382      383 
## 1963.323 1963.323 1963.323 1488.239 1488.239 1488.239 1488.239 1488.239 
##      384      385      386      387      388      389      390      391 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      392      393      394      395      396      397      398      399 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      400      401      402      403      404      405      406      407 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      408      409      430      431      432      436      437      438 
## 1488.239 1488.239 1963.323 1963.323 1963.323 1963.323 1963.323 1963.323 
##      440      441      442      443      444      445      446      447 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      448      449      450      451      452      453      454      455 
## 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 1488.239 
##      456      457      458 
## 1488.239 1488.239 1488.239
cor(Boeing$PricePremium,Boeing$WidthEconomy)
## [1] 0.216876
fit<-lm(PriceEconomy~SeatsTotal,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsTotal, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2096.9  -682.5  -136.9   542.0  2368.9 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  63.4722   155.0306   0.409    0.683    
## SeatsTotal    5.8616     0.6918   8.473 1.04e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 880.9 on 305 degrees of freedom
## Multiple R-squared:  0.1905, Adjusted R-squared:  0.1879 
## F-statistic: 71.78 on 1 and 305 DF,  p-value: 1.036e-15
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##         1         2         3         4         5         6         7 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##         8         9        10        11        12        13        14 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        15        16        17        18        19        20        21 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        22        23        24        25        26        27        28 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        29        30        31        32        33        34        35 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        36        37        38        39        40        41        42 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        43        44        45        46        47        48        49 
## 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 1013.0577 
##        50        51        52        53        54        55        56 
## 1013.0577 1013.0577 1036.5043 1036.5043 1036.5043 1036.5043 1036.5043 
##        57        58        59        60        61        74        75 
## 1036.5043 1036.5043 1036.5043 1036.5043 1036.5043  637.9128  637.9128 
##        76        77        78        79        80        81        82 
##  637.9128  637.9128  637.9128  637.9128  637.9128  637.9128 1816.1023 
##        83        84        85        86        87        88        89 
## 1816.1023 1816.1023 1816.1023 1816.1023 1816.1023 1816.1023 1816.1023 
##        90        91        92        93        94        95        96 
## 1036.5043 1036.5043 1036.5043 1036.5043 1036.5043 1036.5043 1036.5043 
##        97        98       138       144       147       148       149 
## 1036.5043  989.6112 2161.9391 2161.9391 2161.9391 2161.9391 2161.9391 
##       151       152       153       154       155       156       157 
## 2161.9391 1235.8000 1235.8000 1235.8000 1235.8000 1429.2341 1429.2341 
##       158       159       160       161       162       163       164 
## 1429.2341 1429.2341 1429.2341 1429.2341 1429.2341 1429.2341 2648.4551 
##       165       166       167       168       169       170       171 
## 2648.4551 2648.4551 2648.4551 1429.2341 1429.2341 1429.2341 1429.2341 
##       172       173       174       175       176       177       178 
## 1429.2341 1429.2341 2648.4551 2648.4551 2648.4551 2648.4551 1429.2341 
##       179       180       181       182       183       184       240 
## 1429.2341 1429.2341 1429.2341 1429.2341 1429.2341 1429.2341 1698.8696 
##       241       242       243       244       245       246       247 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 
##       248       249       250       251       252       253       254 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 
##       255       256       257       258       259       260       261 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 
##       262       263       264       265       266       267       268 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 
##       269       270       271       272       273       274       275 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696 
##       276       277       278       279       280       281       282 
## 1698.8696 1698.8696 1698.8696 1698.8696 1698.8696  907.5482  907.5482 
##       283       284       285       286       287       288       289 
##  907.5482  907.5482  907.5482 1001.3345 1001.3345 1001.3345  907.5482 
##       290       291       292       293       294       295       299 
##  907.5482  907.5482 1001.3345  907.5482  907.5482  977.8879  977.8879 
##       300       301       304       305       307       315       316 
##  907.5482  977.8879  907.5482  977.8879  907.5482 1306.1397 1306.1397 
##       317       318       319       320       321       322       323 
## 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 
##       324       325       326       327       328       329       330 
## 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 
##       331       332       333       334       335       336       337 
## 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 1306.1397 
##       338       339       340       341       342       343       344 
## 1306.1397 1399.9259 1399.9259 1399.9259 1399.9259 1399.9259 1399.9259 
##       345       346       347       348       349       350       351 
## 1399.9259 1399.9259 1399.9259 1399.9259 1399.9259 1399.9259 1399.9259 
##       352       353       354       355       356       357       358 
## 1399.9259 1399.9259 1224.0768 1224.0768 1224.0768 1224.0768 1399.9259 
##       359       360       361       362       363       364       365 
## 1399.9259 1399.9259 1224.0768 1224.0768 1399.9259 1399.9259 1399.9259 
##       366       367       368       369       370       371       372 
## 1399.9259 1394.0643 1394.0643 1394.0643 1394.0643 1394.0643 1394.0643 
##       373       374       375       376       377       378       379 
## 1394.0643 1394.0643 1394.0643 1394.0643 1394.0643 1394.0643  884.1017 
##       380       381       382       383       384       385       386 
##  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017 
##       387       388       389       390       391       392       393 
##  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017 
##       394       395       396       397       398       399       400 
##  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017  884.1017 
##       401       402       403       404       405       406       407 
##  884.1017  884.1017  884.1017  884.1017  884.1017 1470.2656 1470.2656 
##       408       409       430       431       432       436       437 
## 1470.2656 1470.2656 2566.3922 2566.3922 2566.3922 2566.3922 2566.3922 
##       438       440       441       442       443       444       445 
## 2566.3922 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 
##       446       447       448       449       450       451       452 
## 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 
##       453       454       455       456       457       458 
## 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509 1059.9509
cor(Boeing$PriceEconomy,Boeing$SeatsTotal)
## [1] 0.4364836
fit<-lm(PricePremium~SeatsTotal,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsTotal, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2982.3  -865.4  -261.3   782.3  5453.6 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  40.5680   203.3369    0.20    0.842    
## SeatsTotal    8.4575     0.9074    9.32   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1155 on 305 degrees of freedom
## Multiple R-squared:  0.2217, Adjusted R-squared:  0.2191 
## F-statistic: 86.87 on 1 and 305 DF,  p-value: < 2.2e-16
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##         1         2         3         4         5         6         7 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##         8         9        10        11        12        13        14 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        15        16        17        18        19        20        21 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        22        23        24        25        26        27        28 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        29        30        31        32        33        34        35 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        36        37        38        39        40        41        42 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        43        44        45        46        47        48        49 
## 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 1410.6789 
##        50        51        52        53        54        55        56 
## 1410.6789 1410.6789 1444.5088 1444.5088 1444.5088 1444.5088 1444.5088 
##        57        58        59        60        61        74        75 
## 1444.5088 1444.5088 1444.5088 1444.5088 1444.5088  869.4005  869.4005 
##        76        77        78        79        80        81        82 
##  869.4005  869.4005  869.4005  869.4005  869.4005  869.4005 2569.3529 
##        83        84        85        86        87        88        89 
## 2569.3529 2569.3529 2569.3529 2569.3529 2569.3529 2569.3529 2569.3529 
##        90        91        92        93        94        95        96 
## 1444.5088 1444.5088 1444.5088 1444.5088 1444.5088 1444.5088 1444.5088 
##        97        98       138       144       147       148       149 
## 1444.5088 1376.8490 3068.3439 3068.3439 3068.3439 3068.3439 3068.3439 
##       151       152       153       154       155       156       157 
## 3068.3439 1732.0629 1732.0629 1732.0629 1732.0629 2011.1596 2011.1596 
##       158       159       160       161       162       163       164 
## 2011.1596 2011.1596 2011.1596 2011.1596 2011.1596 2011.1596 3770.3143 
##       165       166       167       168       169       170       171 
## 3770.3143 3770.3143 3770.3143 2011.1596 2011.1596 2011.1596 2011.1596 
##       172       173       174       175       176       177       178 
## 2011.1596 2011.1596 3770.3143 3770.3143 3770.3143 3770.3143 2011.1596 
##       179       180       181       182       183       184       240 
## 2011.1596 2011.1596 2011.1596 2011.1596 2011.1596 2011.1596 2400.2034 
##       241       242       243       244       245       246       247 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 
##       248       249       250       251       252       253       254 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 
##       255       256       257       258       259       260       261 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 
##       262       263       264       265       266       267       268 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 
##       269       270       271       272       273       274       275 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 
##       276       277       278       279       280       281       282 
## 2400.2034 2400.2034 2400.2034 2400.2034 2400.2034 1258.4444 1258.4444 
##       283       284       285       286       287       288       289 
## 1258.4444 1258.4444 1258.4444 1393.7640 1393.7640 1393.7640 1258.4444 
##       290       291       292       293       294       295       299 
## 1258.4444 1258.4444 1393.7640 1258.4444 1258.4444 1359.9341 1359.9341 
##       300       301       304       305       307       315       316 
## 1258.4444 1359.9341 1258.4444 1359.9341 1258.4444 1833.5526 1833.5526 
##       317       318       319       320       321       322       323 
## 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 
##       324       325       326       327       328       329       330 
## 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 
##       331       332       333       334       335       336       337 
## 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 1833.5526 
##       338       339       340       341       342       343       344 
## 1833.5526 1968.8722 1968.8722 1968.8722 1968.8722 1968.8722 1968.8722 
##       345       346       347       348       349       350       351 
## 1968.8722 1968.8722 1968.8722 1968.8722 1968.8722 1968.8722 1968.8722 
##       352       353       354       355       356       357       358 
## 1968.8722 1968.8722 1715.1480 1715.1480 1715.1480 1715.1480 1968.8722 
##       359       360       361       362       363       364       365 
## 1968.8722 1968.8722 1715.1480 1715.1480 1968.8722 1968.8722 1968.8722 
##       366       367       368       369       370       371       372 
## 1968.8722 1960.4148 1960.4148 1960.4148 1960.4148 1960.4148 1960.4148 
##       373       374       375       376       377       378       379 
## 1960.4148 1960.4148 1960.4148 1960.4148 1960.4148 1960.4148 1224.6145 
##       380       381       382       383       384       385       386 
## 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 
##       387       388       389       390       391       392       393 
## 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 
##       394       395       396       397       398       399       400 
## 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 
##       401       402       403       404       405       406       407 
## 1224.6145 1224.6145 1224.6145 1224.6145 1224.6145 2070.3619 2070.3619 
##       408       409       430       431       432       436       437 
## 2070.3619 2070.3619 3651.9097 3651.9097 3651.9097 3651.9097 3651.9097 
##       438       440       441       442       443       444       445 
## 3651.9097 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 
##       446       447       448       449       450       451       452 
## 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 
##       453       454       455       456       457       458 
## 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387 1478.3387
cor(Boeing$PricePremium,Boeing$SeatsTotal)
## [1] 0.4708315
fit<-lm(PriceEconomy~PitchDifference,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchDifference, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1461.7  -800.2  -114.0   517.7  2232.1 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1761.11     195.59   9.004   <2e-16 ***
## PitchDifference   -66.69      27.49  -2.426   0.0158 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 969.8 on 305 degrees of freedom
## Multiple R-squared:  0.01893,    Adjusted R-squared:  0.01572 
## F-statistic: 5.886 on 1 and 305 DF,  p-value: 0.01584
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##        9       10       11       12       13       14       15       16 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       17       18       19       20       21       22       23       24 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       25       26       27       28       29       30       31       32 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       33       34       35       36       37       38       39       40 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       41       42       43       44       45       46       47       48 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       49       50       51       52       53       54       55       56 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##       57       58       59       60       61       74       75       76 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1561.028 1561.028 1561.028 
##       77       78       79       80       81       82       83       84 
## 1561.028 1561.028 1561.028 1561.028 1561.028 1294.256 1294.256 1294.256 
##       85       86       87       88       89       90       91       92 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1094.177 1094.177 1094.177 
##       93       94       95       96       97       98      138      144 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1627.722 1294.256 1294.256 
##      147      148      149      151      152      153      154      155 
## 1294.256 1294.256 1294.256 1294.256 1561.028 1561.028 1561.028 1561.028 
##      156      157      158      159      160      161      162      163 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      164      165      166      167      168      169      170      171 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      172      173      174      175      176      177      178      179 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      180      181      182      183      184      240      241      242 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      243      244      245      246      247      248      249      250 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      251      252      253      254      255      256      257      258 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      259      260      261      262      263      264      265      266 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      267      268      269      270      271      272      273      274 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      275      276      277      278      279      280      281      282 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1627.722 1627.722 
##      283      284      285      286      287      288      289      290 
## 1627.722 1627.722 1627.722 1561.028 1561.028 1561.028 1627.722 1627.722 
##      291      292      293      294      295      299      300      301 
## 1627.722 1561.028 1627.722 1627.722 1627.722 1627.722 1627.722 1627.722 
##      304      305      307      315      316      317      318      319 
## 1627.722 1627.722 1627.722 1360.949 1360.949 1360.949 1360.949 1360.949 
##      320      321      322      323      324      325      326      327 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      328      329      330      331      332      333      334      335 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      336      337      338      339      340      341      342      343 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      344      345      346      347      348      349      350      351 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      352      353      354      355      356      357      358      359 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      360      361      362      363      364      365      366      367 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1294.256 
##      368      369      370      371      372      373      374      375 
## 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 1294.256 
##      376      377      378      379      380      381      382      383 
## 1294.256 1294.256 1294.256 1094.177 1094.177 1094.177 1094.177 1094.177 
##      384      385      386      387      388      389      390      391 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 
##      392      393      394      395      396      397      398      399 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 
##      400      401      402      403      404      405      406      407 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1360.949 1360.949 
##      408      409      430      431      432      436      437      438 
## 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 1360.949 
##      440      441      442      443      444      445      446      447 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 
##      448      449      450      451      452      453      454      455 
## 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 1094.177 
##      456      457      458 
## 1094.177 1094.177 1094.177
cor(Boeing$PriceEconomy,Boeing$PitchDifference)
## [1] -0.1375936
fit<-lm(PricePremium~PitchDifference,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchDifference, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1834.9 -1230.2  -154.5  1166.3  5587.3 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      2091.54     263.69   7.932 4.13e-14 ***
## PitchDifference   -37.84      37.06  -1.021    0.308    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1307 on 305 degrees of freedom
## Multiple R-squared:  0.003406,   Adjusted R-squared:  0.0001383 
## F-statistic: 1.042 on 1 and 305 DF,  p-value: 0.3081
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##        9       10       11       12       13       14       15       16 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       17       18       19       20       21       22       23       24 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       25       26       27       28       29       30       31       32 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       33       34       35       36       37       38       39       40 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       41       42       43       44       45       46       47       48 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       49       50       51       52       53       54       55       56 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##       57       58       59       60       61       74       75       76 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1978.024 1978.024 1978.024 
##       77       78       79       80       81       82       83       84 
## 1978.024 1978.024 1978.024 1978.024 1978.024 1826.677 1826.677 1826.677 
##       85       86       87       88       89       90       91       92 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1713.166 1713.166 1713.166 
##       93       94       95       96       97       98      138      144 
## 1713.166 1713.166 1713.166 1713.166 1713.166 2015.861 1826.677 1826.677 
##      147      148      149      151      152      153      154      155 
## 1826.677 1826.677 1826.677 1826.677 1978.024 1978.024 1978.024 1978.024 
##      156      157      158      159      160      161      162      163 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      164      165      166      167      168      169      170      171 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      172      173      174      175      176      177      178      179 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      180      181      182      183      184      240      241      242 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      243      244      245      246      247      248      249      250 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      251      252      253      254      255      256      257      258 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      259      260      261      262      263      264      265      266 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      267      268      269      270      271      272      273      274 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      275      276      277      278      279      280      281      282 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 2015.861 2015.861 
##      283      284      285      286      287      288      289      290 
## 2015.861 2015.861 2015.861 1978.024 1978.024 1978.024 2015.861 2015.861 
##      291      292      293      294      295      299      300      301 
## 2015.861 1978.024 2015.861 2015.861 2015.861 2015.861 2015.861 2015.861 
##      304      305      307      315      316      317      318      319 
## 2015.861 2015.861 2015.861 1864.514 1864.514 1864.514 1864.514 1864.514 
##      320      321      322      323      324      325      326      327 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      328      329      330      331      332      333      334      335 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      336      337      338      339      340      341      342      343 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      344      345      346      347      348      349      350      351 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      352      353      354      355      356      357      358      359 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      360      361      362      363      364      365      366      367 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1826.677 
##      368      369      370      371      372      373      374      375 
## 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 1826.677 
##      376      377      378      379      380      381      382      383 
## 1826.677 1826.677 1826.677 1713.166 1713.166 1713.166 1713.166 1713.166 
##      384      385      386      387      388      389      390      391 
## 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 
##      392      393      394      395      396      397      398      399 
## 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 
##      400      401      402      403      404      405      406      407 
## 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1864.514 1864.514 
##      408      409      430      431      432      436      437      438 
## 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 1864.514 
##      440      441      442      443      444      445      446      447 
## 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 
##      448      449      450      451      452      453      454      455 
## 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 1713.166 
##      456      457      458 
## 1713.166 1713.166 1713.166
cor(Boeing$PricePremium,Boeing$PitchDifference)
## [1] -0.05835906
fit<-lm(PriceEconomy~WidthDifference,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthDifference, data = Boeing)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1399.5  -799.3  -168.4   463.7  2329.7 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1557.50      90.88  17.138  < 2e-16 ***
## WidthDifference  -147.07      42.39  -3.469 0.000597 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 960.3 on 305 degrees of freedom
## Multiple R-squared:  0.03797,    Adjusted R-squared:  0.03481 
## F-statistic: 12.04 on 1 and 305 DF,  p-value: 0.0005968
Boeing$PriceEconomy
##   [1] 2707 2707 2707 2707 1793 1793 1793 1476 1476 1705 1705 1911 2378 1750
##  [15] 1750 1750 1813 1813 1813 1634 1634 1634 1651 1651 1651 1542 1566 1566
##  [29] 1356 1356 1356 1242 1242 1242 1242  940  940  940 1224 1224 1224 1224
##  [43] 1127 1127 1127 1123 1123 1123  509  509  509 1476 2156 2156 2156 1634
##  [57] 1634 1634 1038 1038  509  158  189  228  222  216  391  349  581 1444
##  [71] 1444 1444 1444 1824 1824 1824 1823  354  354  354  354  464  464  464
##  [85]  489  458  137  109   77   77   69   65  298  423  483  713  574  574
##  [99]  574  574 1086 1086 1086 1247 1781 1781 1781 1781 1580 1580 1580 1580
## [113] 1903 1096 2445 2445 2445 2445  975 2369 1811 1811 1811 1811 1356 1651
## [127] 1651 2775 2230 2230 2230 2356 2356 2356 2356 1562 1562 1562 2281 2281
## [141] 2281 2281 1813 1813 1813 1140 1609 1609 1609 1632 1632 1632 1140 1736
## [155] 1736 1736  846  846  937 1485  891 1323 1023 1023  757  533  288  288
## [169]  363  363  363  413  413  413  413  413  340  423  328  328  166  243
## [183]  626  354  293  636  349  794  794  794  794 1215 1215 1215  876  609
## [197]  609 1406 1406 1406 1247 1247 1247  563  563  563  563 1431 1431 1431
## [211] 1431 2918 2918 2918 2581 2860 3026 3026 3026 3057 3057 3057 3414 3414
## [225] 3414 3414 3215 3215 3215 3215 3480 3480 3480 3593 3593 3159 3159 3159
## [239] 3159 3102 3102 3102 2166 2166 2166  649  575  575  797  524  582  167
## [253]  167  167  139  149  197  211  139  118  118  118  108  108  108  297
## [267]  234  156  156  324  147  127  154  154  154  154  322  594  648  648
## [281]  700 1094 2996 2996 2996 2979 3593 3593  201  148  148  187  187  187
## [295]  187  245  234  172  172  172  293  281  295  380  380  505  510
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##        9       10       11       12       13       14       15       16 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       17       18       19       20       21       22       23       24 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       25       26       27       28       29       30       31       32 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       33       34       35       36       37       38       39       40 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       41       42       43       44       45       46       47       48 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       49       50       51       52       53       54       55       56 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##       57       58       59       60       61       74       75       76 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1557.498 1557.498 1557.498 
##       77       78       79       80       81       82       83       84 
## 1557.498 1557.498 1557.498 1557.498 1557.498 1410.424 1410.424 1410.424 
##       85       86       87       88       89       90       91       92 
## 1410.424 1410.424 1410.424 1410.424 1410.424  969.202  969.202  969.202 
##       93       94       95       96       97       98      138      144 
##  969.202  969.202  969.202  969.202  969.202 1557.498 1410.424 1410.424 
##      147      148      149      151      152      153      154      155 
## 1410.424 1410.424 1410.424 1410.424 1557.498 1557.498 1557.498 1557.498 
##      156      157      158      159      160      161      162      163 
## 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 
##      164      165      166      167      168      169      170      171 
## 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 
##      172      173      174      175      176      177      178      179 
## 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 1116.276 
##      180      181      182      183      184      240      241      242 
## 1116.276 1116.276 1116.276 1116.276 1116.276 1410.424 1410.424 1410.424 
##      243      244      245      246      247      248      249      250 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      251      252      253      254      255      256      257      258 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      259      260      261      262      263      264      265      266 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      267      268      269      270      271      272      273      274 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      275      276      277      278      279      280      281      282 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1557.498 1557.498 
##      283      284      285      286      287      288      289      290 
## 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 
##      291      292      293      294      295      299      300      301 
## 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 1557.498 
##      304      305      307      315      316      317      318      319 
## 1557.498 1557.498 1557.498 1410.424 1410.424 1410.424 1410.424 1410.424 
##      320      321      322      323      324      325      326      327 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      328      329      330      331      332      333      334      335 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      336      337      338      339      340      341      342      343 
## 1410.424 1410.424 1410.424 1263.350 1263.350 1263.350 1263.350 1263.350 
##      344      345      346      347      348      349      350      351 
## 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 
##      352      353      354      355      356      357      358      359 
## 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 
##      360      361      362      363      364      365      366      367 
## 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1263.350 1410.424 
##      368      369      370      371      372      373      374      375 
## 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      376      377      378      379      380      381      382      383 
## 1410.424 1410.424 1410.424  969.202  969.202  969.202  969.202  969.202 
##      384      385      386      387      388      389      390      391 
##  969.202  969.202  969.202  969.202  969.202  969.202  969.202  969.202 
##      392      393      394      395      396      397      398      399 
##  969.202  969.202  969.202  969.202  969.202  969.202  969.202  969.202 
##      400      401      402      403      404      405      406      407 
##  969.202  969.202  969.202  969.202  969.202  969.202 1263.350 1263.350 
##      408      409      430      431      432      436      437      438 
## 1263.350 1263.350 1410.424 1410.424 1410.424 1410.424 1410.424 1410.424 
##      440      441      442      443      444      445      446      447 
##  969.202  969.202  969.202  969.202  969.202  969.202  969.202  969.202 
##      448      449      450      451      452      453      454      455 
##  969.202  969.202  969.202  969.202  969.202  969.202  969.202  969.202 
##      456      457      458 
##  969.202  969.202  969.202
cor(Boeing$PriceEconomy,Boeing$WidthDifference)
## [1] -0.1948488
fit<-lm(PricePremium~WidthDifference,data = Boeing)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthDifference, data = Boeing)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -1920  -1056   -157   1058   5473 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      2092.61     122.53  17.078   <2e-16 ***
## WidthDifference  -151.62      57.16  -2.653   0.0084 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1295 on 305 degrees of freedom
## Multiple R-squared:  0.02255,    Adjusted R-squared:  0.01935 
## F-statistic: 7.037 on 1 and 305 DF,  p-value: 0.008403
Boeing$PricePremium
##   [1] 3725 3725 3725 3725 2999 2999 2999 2997 2997 2989 2989 2989 2989 2656
##  [15] 2656 2656 2504 2504 2504 2195 2195 2195 2191 2191 2191 2084 2084 2084
##  [29] 1820 1820 1820 1764 1764 1764 1764 1548 1548 1548 1512 1512 1512 1512
##  [43] 1317 1317 1317 1213 1213 1213  773  773  773 2997 2933 2933 2933 2195
##  [57] 2195 2195 1259 1259  818  173  204  243  237  231  406  364  596 2982
##  [71] 2982 2982 2982 2549 2549 2549 2548  524  524  524  524  616  616  616
##  [85]  616  497  172  141   99   99   97   86  337  467  527  757 1619 1619
##  [99] 1619 1619 2964 2964 2964 2964 3509 3509 3509 3509 3019 3019 3019 3019
## [113] 3509 1710 3694 3694 3694 3694 1465 3540 2531 2531 2531 2531 1710 3509
## [127] 3509 3509 3227 3227 3227 3200 3200 3200 3200 3099 3099 3099 3025 3025
## [141] 3025 3025 2472 2472 2472 2423 2292 2292 2292 2278 2278 2278 2049 1866
## [155] 1866 1866 1784 1784 1784 1784 1603 1550 1199 1199  912  837  327  327
## [169]  407  407  407  457  457  457  457  457  379  467  362  362  181  262
## [183]  670  378  308  660  364 1671 1452 1452 1408 1947 1947 1947 1356  900
## [197]  900 1584 1584 1584 1407 1407 1407  619  619  619  619 1564 1564 1564
## [211] 1564 3972 3972 3972 2781 3063 3226 3226 3226 3167 3167 3167 3524 3524
## [225] 3524 3524 3325 3325 3325 3325 3589 3589 3589 3702 3702 3243 3243 3243
## [239] 3243 7414 7414 7414 2470 2470 2470 1152  853  853  826  797  797  483
## [253]  483  483  398  398  520  534  318  267  267  267  228  228  228  620
## [267]  483  318  318  620  267  228  267  267  267  267  483  696 1710 1710
## [281] 1710 1710 3196 3196 3196 3088 3702 3702  545  397  397  430  430  430
## [295]  430  545  483  304  304  304  483  451  464  550  550  696  569
fitted(fit)
##        1        2        3        4        5        6        7        8 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##        9       10       11       12       13       14       15       16 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       17       18       19       20       21       22       23       24 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       25       26       27       28       29       30       31       32 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       33       34       35       36       37       38       39       40 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       41       42       43       44       45       46       47       48 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       49       50       51       52       53       54       55       56 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##       57       58       59       60       61       74       75       76 
## 1940.995 1940.995 1940.995 1940.995 1940.995 2092.611 2092.611 2092.611 
##       77       78       79       80       81       82       83       84 
## 2092.611 2092.611 2092.611 2092.611 2092.611 1940.995 1940.995 1940.995 
##       85       86       87       88       89       90       91       92 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1486.145 1486.145 1486.145 
##       93       94       95       96       97       98      138      144 
## 1486.145 1486.145 1486.145 1486.145 1486.145 2092.611 1940.995 1940.995 
##      147      148      149      151      152      153      154      155 
## 1940.995 1940.995 1940.995 1940.995 2092.611 2092.611 2092.611 2092.611 
##      156      157      158      159      160      161      162      163 
## 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 
##      164      165      166      167      168      169      170      171 
## 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 
##      172      173      174      175      176      177      178      179 
## 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 1637.762 
##      180      181      182      183      184      240      241      242 
## 1637.762 1637.762 1637.762 1637.762 1637.762 1940.995 1940.995 1940.995 
##      243      244      245      246      247      248      249      250 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      251      252      253      254      255      256      257      258 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      259      260      261      262      263      264      265      266 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      267      268      269      270      271      272      273      274 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      275      276      277      278      279      280      281      282 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 2092.611 2092.611 
##      283      284      285      286      287      288      289      290 
## 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 
##      291      292      293      294      295      299      300      301 
## 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 2092.611 
##      304      305      307      315      316      317      318      319 
## 2092.611 2092.611 2092.611 1940.995 1940.995 1940.995 1940.995 1940.995 
##      320      321      322      323      324      325      326      327 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      328      329      330      331      332      333      334      335 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      336      337      338      339      340      341      342      343 
## 1940.995 1940.995 1940.995 1789.378 1789.378 1789.378 1789.378 1789.378 
##      344      345      346      347      348      349      350      351 
## 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 
##      352      353      354      355      356      357      358      359 
## 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 
##      360      361      362      363      364      365      366      367 
## 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1789.378 1940.995 
##      368      369      370      371      372      373      374      375 
## 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      376      377      378      379      380      381      382      383 
## 1940.995 1940.995 1940.995 1486.145 1486.145 1486.145 1486.145 1486.145 
##      384      385      386      387      388      389      390      391 
## 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 
##      392      393      394      395      396      397      398      399 
## 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 
##      400      401      402      403      404      405      406      407 
## 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1789.378 1789.378 
##      408      409      430      431      432      436      437      438 
## 1789.378 1789.378 1940.995 1940.995 1940.995 1940.995 1940.995 1940.995 
##      440      441      442      443      444      445      446      447 
## 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 
##      448      449      450      451      452      453      454      455 
## 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 1486.145 
##      456      457      458 
## 1486.145 1486.145 1486.145
cor(Boeing$PricePremium,Boeing$WidthDifference)
## [1] -0.1501705

AirBus

Analyse all about AirBus Aircrafts:-

Airbus <- airline[ which(airline$Aircraft=='AirBus'),]
View(Airbus)
summary(Airbus)
##       Airline     Aircraft   FlightDuration   TravelMonth
##  AirFrance:36   AirBus:151   Min.   : 1.250   Aug:39     
##  British  :47   Boeing:  0   1st Qu.: 4.500   Jul:25     
##  Delta    :12                Median : 8.000   Oct:41     
##  Jet      : 7                Mean   : 7.436   Sep:46     
##  Singapore:16                3rd Qu.: 9.500              
##  Virgin   :33                Max.   :13.330              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :  6    Min.   :120.0   Min.   :18.00   Min.   :31.00  
##  International:145    1st Qu.:147.0   1st Qu.:21.00   1st Qu.:31.00  
##                       Median :233.0   Median :38.00   Median :31.00  
##                       Mean   :245.6   Mean   :39.15   Mean   :31.44  
##                       3rd Qu.:303.0   3rd Qu.:55.00   3rd Qu.:32.00  
##                       Max.   :389.0   Max.   :55.00   Max.   :33.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy 
##  Min.   :34.00   Min.   :17.00   Min.   :17.00   Min.   :  74  
##  1st Qu.:38.00   1st Qu.:18.00   1st Qu.:19.00   1st Qu.: 409  
##  Median :38.00   Median :18.00   Median :19.00   Median :1434  
##  Mean   :37.85   Mean   :18.07   Mean   :19.54   Mean   :1370  
##  3rd Qu.:38.00   3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:2052  
##  Max.   :38.00   Max.   :19.00   Max.   :21.00   Max.   :3220  
##   PricePremium  PriceRelative      SeatsTotal    PitchDifference
##  Min.   :  97   Min.   :0.0200   Min.   :138.0   Min.   :2.000  
##  1st Qu.: 464   1st Qu.:0.0800   1st Qu.:168.0   1st Qu.:6.000  
##  Median :2409   Median :0.3000   Median :271.0   Median :7.000  
##  Mean   :1870   Mean   :0.4148   Mean   :284.7   Mean   :6.411  
##  3rd Qu.:2982   3rd Qu.:0.6100   3rd Qu.:358.0   3rd Qu.:7.000  
##  Max.   :3563   Max.   :1.5600   Max.   :427.0   Max.   :7.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :0.000   Min.   : 8.90      
##  1st Qu.:1.000   1st Qu.:12.50      
##  Median :1.000   Median :14.02      
##  Mean   :1.477   Mean   :13.84      
##  3rd Qu.:3.000   3rd Qu.:15.36      
##  Max.   :3.000   Max.   :20.60

Check the all the means now all Airbus aircrafts

mean(Airbus$PriceEconomy)
## [1] 1369.954
mean(Airbus$PricePremium)
## [1] 1869.503
mean(Airbus$FlightDuration)
## [1] 7.436026
mean(Airbus$PitchEconomy)
## [1] 31.43709
mean(Airbus$PitchPremium)
## [1] 37.84768
mean(Airbus$WidthEconomy)
## [1] 18.06623
mean(Airbus$WidthPremium)
## [1] 19.54305
mean(Airbus$PriceRelative)
## [1] 0.4147682
mean(Airbus$PitchDifference)
## [1] 6.410596
mean(Airbus$WidthDifference)
## [1] 1.476821
View(Airbus)
summary(Airbus)
##       Airline     Aircraft   FlightDuration   TravelMonth
##  AirFrance:36   AirBus:151   Min.   : 1.250   Aug:39     
##  British  :47   Boeing:  0   1st Qu.: 4.500   Jul:25     
##  Delta    :12                Median : 8.000   Oct:41     
##  Jet      : 7                Mean   : 7.436   Sep:46     
##  Singapore:16                3rd Qu.: 9.500              
##  Virgin   :33                Max.   :13.330              
##       IsInternational  SeatsEconomy    SeatsPremium    PitchEconomy  
##  Domestic     :  6    Min.   :120.0   Min.   :18.00   Min.   :31.00  
##  International:145    1st Qu.:147.0   1st Qu.:21.00   1st Qu.:31.00  
##                       Median :233.0   Median :38.00   Median :31.00  
##                       Mean   :245.6   Mean   :39.15   Mean   :31.44  
##                       3rd Qu.:303.0   3rd Qu.:55.00   3rd Qu.:32.00  
##                       Max.   :389.0   Max.   :55.00   Max.   :33.00  
##   PitchPremium    WidthEconomy    WidthPremium    PriceEconomy 
##  Min.   :34.00   Min.   :17.00   Min.   :17.00   Min.   :  74  
##  1st Qu.:38.00   1st Qu.:18.00   1st Qu.:19.00   1st Qu.: 409  
##  Median :38.00   Median :18.00   Median :19.00   Median :1434  
##  Mean   :37.85   Mean   :18.07   Mean   :19.54   Mean   :1370  
##  3rd Qu.:38.00   3rd Qu.:18.00   3rd Qu.:21.00   3rd Qu.:2052  
##  Max.   :38.00   Max.   :19.00   Max.   :21.00   Max.   :3220  
##   PricePremium  PriceRelative      SeatsTotal    PitchDifference
##  Min.   :  97   Min.   :0.0200   Min.   :138.0   Min.   :2.000  
##  1st Qu.: 464   1st Qu.:0.0800   1st Qu.:168.0   1st Qu.:6.000  
##  Median :2409   Median :0.3000   Median :271.0   Median :7.000  
##  Mean   :1870   Mean   :0.4148   Mean   :284.7   Mean   :6.411  
##  3rd Qu.:2982   3rd Qu.:0.6100   3rd Qu.:358.0   3rd Qu.:7.000  
##  Max.   :3563   Max.   :1.5600   Max.   :427.0   Max.   :7.000  
##  WidthDifference PercentPremiumSeats
##  Min.   :0.000   Min.   : 8.90      
##  1st Qu.:1.000   1st Qu.:12.50      
##  Median :1.000   Median :14.02      
##  Mean   :1.477   Mean   :13.84      
##  3rd Qu.:3.000   3rd Qu.:15.36      
##  Max.   :3.000   Max.   :20.60
mean(Airbus$PriceEconomy)
## [1] 1369.954
mean(Airbus$PricePremium)
## [1] 1869.503
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(Airbus$PriceEconomy,Airbus$TravelMonth,mean))
y2<-c(by(Airbus$PricePremium,Airbus$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
mean(Airbus$PriceEconomy)
## [1] 1369.954
mean(Airbus$PricePremium)
## [1] 1869.503
library(plotly)
x<-c('British','Virgin','Delta','Jet','AirFrance','Singapore')
y1<-c(by(Airbus$PriceEconomy,Airbus$Airline,mean))
y2<-c(by(Airbus$PricePremium,Airbus$Airline,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Airlines", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
fit<-lm(PriceEconomy~FlightDuration,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ FlightDuration, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1815.3  -535.7  -167.5   457.3  1587.8 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      170.92     173.86   0.983    0.327    
## FlightDuration   161.25      21.39   7.540 4.26e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 863.6 on 149 degrees of freedom
## Multiple R-squared:  0.2762, Adjusted R-squared:  0.2713 
## F-statistic: 56.85 on 1 and 149 DF,  p-value: 4.258e-12
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1460.8925 1460.8925 1460.8925 1460.8925 1594.7272 1594.7272 1594.7272 
##        69        70        71        72        73        99       100 
## 1594.7272 1312.5456 1312.5456 1312.5456 1420.5808 1970.4318 1970.4318 
##       101       102       103       104       105       106       107 
## 1970.4318 1970.4318 1864.0091 1864.0091 1864.0091 1864.0091 2280.0254 
##       108       109       110       111       112       113       114 
## 2280.0254 2280.0254 1970.4318 1970.4318 1970.4318  828.8057  748.1823 
##       115       116       117       118       119       120       121 
##  748.1823  559.5238  694.9709  694.9709  748.1823  599.8354  559.5238 
##       122       123       124       125       126       127       128 
##  559.5238  559.5238  694.9709  466.0007  748.1823  896.5292  559.5238 
##       129       130       131       132       133       134       135 
##  896.5292  466.0007  559.5238  748.1823  828.8057  627.2474  896.5292 
##       136       137       139       140       141       142       143 
##  372.4777  828.8057  559.5238  466.0007  466.0007  372.4777  372.4777 
##       145       146       150       185       186       187       188 
##  748.1823  627.2474  559.5238 1514.1039 1514.1039 1702.7624 1702.7624 
##       189       190       191       192       193       194       195 
## 1702.7624 1514.1039 1285.1336 1285.1336 1285.1336 1285.1336 1231.9222 
##       196       197       198       199       200       201       202 
## 1231.9222 1231.9222 1231.9222 1849.4969 1849.4969 1849.4969 1997.8438 
##       203       204       205       206       207       208       209 
## 1997.8438 1365.7570 1365.7570 1365.7570 1365.7570 1312.5456 1420.5808 
##       210       211       212       213       214       215       216 
## 1420.5808 1420.5808 1702.7624 1702.7624 1702.7624 1514.1039 1514.1039 
##       217       218       219       220       221       222       223 
## 1514.1039 1514.1039 1514.1039 1514.1039 1514.1039 1514.1039 1352.8572 
##       224       225       226       227       228       229       230 
## 1352.8572 1352.8572 1272.2339 1272.2339 1607.6269 1607.6269 1607.6269 
##       231       232       233       234       235       236       237 
## 1473.7922 1651.1635 1651.1635 1662.4508 1662.4508 1647.9386 1647.9386 
##       238       239       296       297       298       302       303 
## 1662.4508 1662.4508  485.3503  535.3368  582.0983  462.7758  466.0007 
##       306       308       309       310       311       312       313 
##  461.1633 1702.7624 1702.7624 1702.7624 1607.6269 1607.6269 1702.7624 
##       314       410       411       412       413       414       415 
## 1607.6269 2320.3370 2320.3370 2320.3370 2320.3370 1164.1987 1164.1987 
##       416       417       418       419       420       421       422 
## 1164.1987 1164.1987 2212.3018 2212.3018 2212.3018 2212.3018 1219.0225 
##       423       424       425       426       427       428       429 
## 1219.0225 1219.0225 1219.0225 2267.1257 2267.1257 1380.2692 1380.2692 
##       433       434       435       439 
## 1527.0036 1541.5158 1541.5158 2267.1257
cor(Airbus$PriceEconomy,Airbus$FlightDuration)
## [1] 0.5255296
fit<-lm(PriceEconomy~SeatsEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1754.6  -882.6    50.9   780.9  2478.9 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2446.7103   256.2089    9.55  < 2e-16 ***
## SeatsEconomy   -4.3846     0.9942   -4.41 1.97e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 954.7 on 149 degrees of freedom
## Multiple R-squared:  0.1155, Adjusted R-squared:  0.1095 
## F-statistic: 19.45 on 1 and 149 DF,  p-value: 1.967e-05
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 
##        69        70        71        72        73        99       100 
## 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1118.1723 1118.1723 
##       101       102       103       104       105       106       107 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       108       109       110       111       112       113       114 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       115       116       117       118       119       120       121 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       122       123       124       125       126       127       128 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       129       130       131       132       133       134       135 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       136       137       139       140       141       142       143 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       145       146       150       185       186       187       188 
## 1118.1723 1118.1723 1078.7107 1425.0952 1425.0952 1425.0952 1425.0952 
##       189       190       191       192       193       194       195 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       196       197       198       199       200       201       202 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       203       204       205       206       207       208       209 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       210       211       212       213       214       215       216 
## 1425.0952 1425.0952 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       217       218       219       220       221       222       223 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       224       225       226       227       228       229       230 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       231       232       233       234       235       236       237 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       238       239       296       297       298       302       303 
## 1802.1721 1802.1721 1920.5566 1920.5566 1850.4028 1920.5566 1920.5566 
##       306       308       309       310       311       312       313 
## 1920.5566 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       314       410       411       412       413       414       415 
## 1802.1721  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338 
##       416       417       418       419       420       421       422 
##  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338 
##       423       424       425       426       427       428       429 
##  986.6338  986.6338  986.6338  741.0955  741.0955  741.0955  741.0955 
##       433       434       435       439 
##  741.0955  741.0955  741.0955  741.0955
cor(Airbus$PriceEconomy,Airbus$SeatsEconomy)
## [1] -0.3398079
fit<-lm(PriceEconomy~PriceRelative,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1358.6 -1099.9   380.9   735.6  1662.0 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1567.5      120.2  13.043   <2e-16 ***
## PriceRelative   -476.3      213.5  -2.231   0.0272 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 998.6 on 149 degrees of freedom
## Multiple R-squared:  0.03233,    Adjusted R-squared:  0.02584 
## F-statistic: 4.978 on 1 and 149 DF,  p-value: 0.02716
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1219.8235 1219.8235 1219.8235 1219.8235 1381.7496 1381.7496 1381.7496 
##        69        70        71        72        73        99       100 
## 1381.7496 1443.6625 1443.6625 1443.6625 1519.8630 1334.1243 1334.1243 
##       101       102       103       104       105       106       107 
## 1334.1243 1334.1243 1134.0979 1134.0979 1134.0979 1134.0979 1343.6493 
##       108       109       110       111       112       113       114 
## 1343.6493 1343.6493  962.6468  962.6468 1396.0372 1538.9131 1519.8630 
##       115       116       117       118       119       120       121 
## 1519.8630 1548.4382 1515.1005 1515.1005 1529.3881 1524.6255 1543.6757 
##       122       123       124       125       126       127       128 
## 1543.6757 1515.1005 1500.8129 1486.5253 1491.2878 1496.0504 1534.1506 
##       129       130       131       132       133       134       135 
## 1486.5253 1481.7628 1500.8129 1505.5754 1491.2878 1481.7628 1481.7628 
##       136       137       139       140       141       142       143 
## 1448.4250 1472.2377 1477.0002 1457.9501 1457.9501 1424.6124 1424.6124 
##       145       146       150       185       186       187       188 
## 1448.4250 1429.3749 1419.8498 1348.4119 1348.4119 1386.5121 1386.5121 
##       189       190       191       192       193       194       195 
## 1386.5121 1424.6124 1053.1349 1053.1349 1053.1349 1053.1349 1076.9475 
##       196       197       198       199       200       201       202 
## 1076.9475 1076.9475 1076.9475 1167.4356 1167.4356 1167.4356 1334.1243 
##       203       204       205       206       207       208       209 
## 1334.1243 1372.2245 1372.2245 1372.2245 1372.2245 1443.6625 1519.8630 
##       210       211       212       213       214       215       216 
## 1519.8630 1519.8630  824.5333 1010.2721 1267.4488 1529.3881 1529.3881 
##       217       218       219       220       221       222       223 
## 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 
##       224       225       226       227       228       229       230 
## 1529.3881 1529.3881 1534.1506 1534.1506 1534.1506 1534.1506 1534.1506 
##       231       232       233       234       235       236       237 
## 1548.4382 1553.2007 1553.2007 1553.2007 1553.2007 1553.2007 1553.2007 
##       238       239       296       297       298       302       303 
## 1553.2007 1553.2007 1524.6255 1529.3881 1529.3881 1543.6757 1543.6757 
##       306       308       309       310       311       312       313 
## 1548.4382  853.1085 1110.2853 1176.9607 1367.4620 1367.4620 1376.9871 
##       314       410       411       412       413       414       415 
## 1386.5121 1095.9977 1095.9977 1095.9977 1095.9977 1095.9977 1095.9977 
##       416       417       418       419       420       421       422 
## 1095.9977 1095.9977 1276.9739 1276.9739 1276.9739 1276.9739 1276.9739 
##       423       424       425       426       427       428       429 
## 1276.9739 1276.9739 1276.9739 1015.0346 1015.0346 1529.3881 1529.3881 
##       433       434       435       439 
## 1548.4382 1548.4382 1548.4382 1557.9633
cor(Airbus$PriceEconomy,Airbus$PriceRelative)
## [1] -0.1798069
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1257.06 -1003.28    70.07   911.04  1749.57 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1839.00     414.53   4.436 1.77e-05 ***
## PercentPremiumSeats   -33.89      29.35  -1.154     0.25    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1011 on 149 degrees of freedom
## Multiple R-squared:  0.008865,   Adjusted R-squared:  0.002214 
## F-statistic: 1.333 on 1 and 149 DF,  p-value: 0.2502
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 
##       70       71       72       73       99      100      101      102 
## 1140.963 1140.963 1140.963 1140.963 1318.522 1318.522 1318.522 1318.522 
##      103      104      105      106      107      108      109      110 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      111      112      113      114      115      116      117      118 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      119      120      121      122      123      124      125      126 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      127      128      129      130      131      132      133      134 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      135      136      137      139      140      141      142      143 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      145      146      150      185      186      187      188      189 
## 1318.522 1318.522 1331.060 1363.928 1363.928 1363.928 1363.928 1363.928 
##      190      191      192      193      194      195      196      197 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 
##      198      199      200      201      202      203      204      205 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 
##      206      207      208      209      210      211      212      213 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1415.434 1415.434 
##      214      215      216      217      218      219      220      221 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      222      223      224      225      226      227      228      229 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      230      231      232      233      234      235      236      237 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      238      239      296      297      298      302      303      306 
## 1415.434 1415.434 1397.136 1397.136 1404.591 1397.136 1397.136 1397.136 
##      308      309      310      311      312      313      314      410 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1508.280 
##      411      412      413      414      415      416      417      418 
## 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 
##      419      420      421      422      423      424      425      426 
## 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1537.421 
##      427      428      429      433      434      435      439 
## 1537.421 1537.421 1537.421 1537.421 1537.421 1537.421 1537.421
cor(Airbus$PriceEconomy,Airbus$PercentPremiumSeats)
## [1] -0.09415658
fit<-lm(PricePremium~FlightDuration,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ FlightDuration, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2300.13  -574.78    65.19   841.40  1341.01 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       59.53     194.02   0.307    0.759    
## FlightDuration   243.41      23.87  10.199   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 963.8 on 149 degrees of freedom
## Multiple R-squared:  0.4111, Adjusted R-squared:  0.4072 
## F-statistic:   104 on 1 and 149 DF,  p-value: < 2.2e-16
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 2006.7778 2006.7778 2006.7778 2006.7778 2208.8047 2208.8047 2208.8047 
##        69        70        71        72        73        99       100 
## 2208.8047 1782.8443 1782.8443 1782.8443 1945.9263 2775.9406 2775.9406 
##       101       102       103       104       105       106       107 
## 2775.9406 2775.9406 2615.2927 2615.2927 2615.2927 2615.2927 3243.2800 
##       108       109       110       111       112       113       114 
## 3243.2800 3243.2800 2775.9406 2775.9406 2775.9406 1052.6265  930.9235 
##       115       116       117       118       119       120       121 
##  930.9235  646.1386  850.5996  850.5996  930.9235  706.9901  646.1386 
##       122       123       124       125       126       127       128 
##  646.1386  646.1386  850.5996  504.9631  930.9235 1154.8570  646.1386 
##       129       130       131       132       133       134       135 
## 1154.8570  504.9631  646.1386  930.9235 1052.6265  748.3691 1154.8570 
##       136       137       139       140       141       142       143 
##  363.7877 1052.6265  646.1386  504.9631  504.9631  363.7877  363.7877 
##       145       146       150       185       186       187       188 
##  930.9235  748.3691  646.1386 2087.1018 2087.1018 2371.8867 2371.8867 
##       189       190       191       192       193       194       195 
## 2371.8867 2087.1018 1741.4653 1741.4653 1741.4653 1741.4653 1661.1414 
##       196       197       198       199       200       201       202 
## 1661.1414 1661.1414 1661.1414 2593.3861 2593.3861 2593.3861 2817.3196 
##       203       204       205       206       207       208       209 
## 2817.3196 1863.1683 1863.1683 1863.1683 1863.1683 1782.8443 1945.9263 
##       210       211       212       213       214       215       216 
## 1945.9263 1945.9263 2371.8867 2371.8867 2371.8867 2087.1018 2087.1018 
##       217       218       219       220       221       222       223 
## 2087.1018 2087.1018 2087.1018 2087.1018 2087.1018 2087.1018 1843.6958 
##       224       225       226       227       228       229       230 
## 1843.6958 1843.6958 1721.9929 1721.9929 2228.2772 2228.2772 2228.2772 
##       231       232       233       234       235       236       237 
## 2026.2503 2293.9968 2293.9968 2311.0352 2311.0352 2289.1287 2289.1287 
##       238       239       296       297       298       302       303 
## 2311.0352 2311.0352  534.1719  609.6277  680.2154  500.0950  504.9631 
##       306       308       309       310       311       312       313 
##  497.6610 2371.8867 2371.8867 2371.8867 2228.2772 2228.2772 2371.8867 
##       314       410       411       412       413       414       415 
## 2228.2772 3304.1315 3304.1315 3304.1315 3304.1315 1558.9109 1558.9109 
##       416       417       418       419       420       421       422 
## 1558.9109 1558.9109 3141.0495 3141.0495 3141.0495 3141.0495 1641.6689 
##       423       424       425       426       427       428       429 
## 1641.6689 1641.6689 1641.6689 3223.8075 3223.8075 1885.0748 1885.0748 
##       433       434       435       439 
## 2106.5743 2128.4808 2128.4808 3223.8075
cor(Airbus$PricePremium,Airbus$FlightDuration)
## [1] 0.6411862
fit<-lm(PriceEconomy~SeatsEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1754.6  -882.6    50.9   780.9  2478.9 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2446.7103   256.2089    9.55  < 2e-16 ***
## SeatsEconomy   -4.3846     0.9942   -4.41 1.97e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 954.7 on 149 degrees of freedom
## Multiple R-squared:  0.1155, Adjusted R-squared:  0.1095 
## F-statistic: 19.45 on 1 and 149 DF,  p-value: 1.967e-05
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 
##        69        70        71        72        73        99       100 
## 1635.5567 1635.5567 1635.5567 1635.5567 1635.5567 1118.1723 1118.1723 
##       101       102       103       104       105       106       107 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       108       109       110       111       112       113       114 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       115       116       117       118       119       120       121 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       122       123       124       125       126       127       128 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       129       130       131       132       133       134       135 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       136       137       139       140       141       142       143 
## 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 1118.1723 
##       145       146       150       185       186       187       188 
## 1118.1723 1118.1723 1078.7107 1425.0952 1425.0952 1425.0952 1425.0952 
##       189       190       191       192       193       194       195 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       196       197       198       199       200       201       202 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       203       204       205       206       207       208       209 
## 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 1425.0952 
##       210       211       212       213       214       215       216 
## 1425.0952 1425.0952 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       217       218       219       220       221       222       223 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       224       225       226       227       228       229       230 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       231       232       233       234       235       236       237 
## 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       238       239       296       297       298       302       303 
## 1802.1721 1802.1721 1920.5566 1920.5566 1850.4028 1920.5566 1920.5566 
##       306       308       309       310       311       312       313 
## 1920.5566 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 1802.1721 
##       314       410       411       412       413       414       415 
## 1802.1721  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338 
##       416       417       418       419       420       421       422 
##  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338  986.6338 
##       423       424       425       426       427       428       429 
##  986.6338  986.6338  986.6338  741.0955  741.0955  741.0955  741.0955 
##       433       434       435       439 
##  741.0955  741.0955  741.0955  741.0955
cor(Airbus$PricePremium,Airbus$SeatsEconomy)
## [1] -0.2465987
fit<-lm(PriceEconomy~SeatsPremium,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsPremium, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1851.61  -776.10    70.76   733.24  1814.76 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2568.750    233.175  11.016  < 2e-16 ***
## SeatsPremium  -30.619      5.635  -5.434  2.2e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 927.4 on 149 degrees of freedom
## Multiple R-squared:  0.1654, Adjusted R-squared:  0.1598 
## F-statistic: 29.52 on 1 and 149 DF,  p-value: 2.202e-07
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 1099.0484 1099.0484 1099.0484 1099.0484 1099.0484 1099.0484 1099.0484 
##        69        70        71        72        73        99       100 
## 1099.0484 1099.0484 1099.0484 1099.0484 1099.0484  884.7169  884.7169 
##       101       102       103       104       105       106       107 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       108       109       110       111       112       113       114 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       115       116       117       118       119       120       121 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       122       123       124       125       126       127       128 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       129       130       131       132       133       134       135 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       136       137       139       140       141       142       143 
##  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169  884.7169 
##       145       146       150       185       186       187       188 
##  884.7169  884.7169  884.7169 1405.2362 1405.2362 1405.2362 1405.2362 
##       189       190       191       192       193       194       195 
## 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 
##       196       197       198       199       200       201       202 
## 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 
##       203       204       205       206       207       208       209 
## 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 1405.2362 
##       210       211       212       213       214       215       216 
## 1405.2362 1405.2362 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 
##       217       218       219       220       221       222       223 
## 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 
##       224       225       226       227       228       229       230 
## 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 
##       231       232       233       234       235       236       237 
## 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 
##       238       239       296       297       298       302       303 
## 1925.7555 1925.7555 2017.6119 2017.6119 1956.3743 2017.6119 2017.6119 
##       306       308       309       310       311       312       313 
## 2017.6119 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 1925.7555 
##       314       410       411       412       413       414       415 
## 1925.7555 1466.4738 1466.4738 1466.4738 1466.4738 1466.4738 1466.4738 
##       416       417       418       419       420       421       422 
## 1466.4738 1466.4738 1466.4738 1466.4738 1466.4738 1466.4738 1466.4738 
##       423       424       425       426       427       428       429 
## 1466.4738 1466.4738 1466.4738 1405.2362 1405.2362 1405.2362 1405.2362 
##       433       434       435       439 
## 1405.2362 1405.2362 1405.2362 1405.2362
cor(Airbus$PricePremium,Airbus$SeatsPremium)
## [1] -0.2739066
fit<-lm(PriceEconomy~PriceRelative,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PriceRelative, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1358.6 -1099.9   380.9   735.6  1662.0 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     1567.5      120.2  13.043   <2e-16 ***
## PriceRelative   -476.3      213.5  -2.231   0.0272 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 998.6 on 149 degrees of freedom
## Multiple R-squared:  0.03233,    Adjusted R-squared:  0.02584 
## F-statistic: 4.978 on 1 and 149 DF,  p-value: 0.02716
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 1219.8235 1219.8235 1219.8235 1219.8235 1381.7496 1381.7496 1381.7496 
##        69        70        71        72        73        99       100 
## 1381.7496 1443.6625 1443.6625 1443.6625 1519.8630 1334.1243 1334.1243 
##       101       102       103       104       105       106       107 
## 1334.1243 1334.1243 1134.0979 1134.0979 1134.0979 1134.0979 1343.6493 
##       108       109       110       111       112       113       114 
## 1343.6493 1343.6493  962.6468  962.6468 1396.0372 1538.9131 1519.8630 
##       115       116       117       118       119       120       121 
## 1519.8630 1548.4382 1515.1005 1515.1005 1529.3881 1524.6255 1543.6757 
##       122       123       124       125       126       127       128 
## 1543.6757 1515.1005 1500.8129 1486.5253 1491.2878 1496.0504 1534.1506 
##       129       130       131       132       133       134       135 
## 1486.5253 1481.7628 1500.8129 1505.5754 1491.2878 1481.7628 1481.7628 
##       136       137       139       140       141       142       143 
## 1448.4250 1472.2377 1477.0002 1457.9501 1457.9501 1424.6124 1424.6124 
##       145       146       150       185       186       187       188 
## 1448.4250 1429.3749 1419.8498 1348.4119 1348.4119 1386.5121 1386.5121 
##       189       190       191       192       193       194       195 
## 1386.5121 1424.6124 1053.1349 1053.1349 1053.1349 1053.1349 1076.9475 
##       196       197       198       199       200       201       202 
## 1076.9475 1076.9475 1076.9475 1167.4356 1167.4356 1167.4356 1334.1243 
##       203       204       205       206       207       208       209 
## 1334.1243 1372.2245 1372.2245 1372.2245 1372.2245 1443.6625 1519.8630 
##       210       211       212       213       214       215       216 
## 1519.8630 1519.8630  824.5333 1010.2721 1267.4488 1529.3881 1529.3881 
##       217       218       219       220       221       222       223 
## 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 1529.3881 
##       224       225       226       227       228       229       230 
## 1529.3881 1529.3881 1534.1506 1534.1506 1534.1506 1534.1506 1534.1506 
##       231       232       233       234       235       236       237 
## 1548.4382 1553.2007 1553.2007 1553.2007 1553.2007 1553.2007 1553.2007 
##       238       239       296       297       298       302       303 
## 1553.2007 1553.2007 1524.6255 1529.3881 1529.3881 1543.6757 1543.6757 
##       306       308       309       310       311       312       313 
## 1548.4382  853.1085 1110.2853 1176.9607 1367.4620 1367.4620 1376.9871 
##       314       410       411       412       413       414       415 
## 1386.5121 1095.9977 1095.9977 1095.9977 1095.9977 1095.9977 1095.9977 
##       416       417       418       419       420       421       422 
## 1095.9977 1095.9977 1276.9739 1276.9739 1276.9739 1276.9739 1276.9739 
##       423       424       425       426       427       428       429 
## 1276.9739 1276.9739 1276.9739 1015.0346 1015.0346 1529.3881 1529.3881 
##       433       434       435       439 
## 1548.4382 1548.4382 1548.4382 1557.9633
cor(Airbus$PricePremium,Airbus$PriceRelative)
## [1] 0.1751965
fit<-lm(PriceEconomy~PercentPremiumSeats,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PercentPremiumSeats, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1257.06 -1003.28    70.07   911.04  1749.57 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          1839.00     414.53   4.436 1.77e-05 ***
## PercentPremiumSeats   -33.89      29.35  -1.154     0.25    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1011 on 149 degrees of freedom
## Multiple R-squared:  0.008865,   Adjusted R-squared:  0.002214 
## F-statistic: 1.333 on 1 and 149 DF,  p-value: 0.2502
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 1140.963 
##       70       71       72       73       99      100      101      102 
## 1140.963 1140.963 1140.963 1140.963 1318.522 1318.522 1318.522 1318.522 
##      103      104      105      106      107      108      109      110 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      111      112      113      114      115      116      117      118 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      119      120      121      122      123      124      125      126 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      127      128      129      130      131      132      133      134 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      135      136      137      139      140      141      142      143 
## 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 1318.522 
##      145      146      150      185      186      187      188      189 
## 1318.522 1318.522 1331.060 1363.928 1363.928 1363.928 1363.928 1363.928 
##      190      191      192      193      194      195      196      197 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 
##      198      199      200      201      202      203      204      205 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 
##      206      207      208      209      210      211      212      213 
## 1363.928 1363.928 1363.928 1363.928 1363.928 1363.928 1415.434 1415.434 
##      214      215      216      217      218      219      220      221 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      222      223      224      225      226      227      228      229 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      230      231      232      233      234      235      236      237 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 
##      238      239      296      297      298      302      303      306 
## 1415.434 1415.434 1397.136 1397.136 1404.591 1397.136 1397.136 1397.136 
##      308      309      310      311      312      313      314      410 
## 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1415.434 1508.280 
##      411      412      413      414      415      416      417      418 
## 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 
##      419      420      421      422      423      424      425      426 
## 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1508.280 1537.421 
##      427      428      429      433      434      435      439 
## 1537.421 1537.421 1537.421 1537.421 1537.421 1537.421 1537.421
cor(Airbus$PricePremium,Airbus$PercentPremiumSeats)
## [1] -0.009426023
fit<-lm(PricePremium~PitchEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1847.8 -1338.3   606.7  1132.0  1760.7 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   -2963.2     6298.5  -0.470    0.639
## PitchEconomy    153.7      200.3   0.767    0.444
## 
## Residual standard error: 1253 on 149 degrees of freedom
## Multiple R-squared:  0.003937,   Adjusted R-squared:  -0.002748 
## F-statistic: 0.5889 on 1 and 149 DF,  p-value: 0.4441
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##       70       71       72       73       99      100      101      102 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      103      104      105      106      107      108      109      110 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      111      112      113      114      115      116      117      118 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      119      120      121      122      123      124      125      126 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      127      128      129      130      131      132      133      134 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      135      136      137      139      140      141      142      143 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      145      146      150      185      186      187      188      189 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      190      191      192      193      194      195      196      197 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      198      199      200      201      202      203      204      205 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 
##      206      207      208      209      210      211      212      213 
## 1802.311 1802.311 1802.311 1802.311 1802.311 1802.311 1956.039 1956.039 
##      214      215      216      217      218      219      220      221 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      222      223      224      225      226      227      228      229 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      230      231      232      233      234      235      236      237 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      238      239      296      297      298      302      303      306 
## 1956.039 1956.039 1956.039 1956.039 2109.766 1956.039 1956.039 1956.039 
##      308      309      310      311      312      313      314      410 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      411      412      413      414      415      416      417      418 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      419      420      421      422      423      424      425      426 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 
##      427      428      429      433      434      435      439 
## 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039 1956.039
cor(Airbus$PricePremium,Airbus$PitchEconomy)
## [1] 0.06274279
fit<-lm(PriceEconomy~PitchEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1857.6  -957.9   268.4   886.4  1586.9 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  -13326.4     4956.7  -2.689  0.00799 **
## PitchEconomy    467.5      157.6   2.965  0.00352 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 986.4 on 149 degrees of freedom
## Multiple R-squared:  0.05573,    Adjusted R-squared:  0.04939 
## F-statistic: 8.793 on 1 and 149 DF,  p-value: 0.003522
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##       70       71       72       73       99      100      101      102 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      103      104      105      106      107      108      109      110 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      111      112      113      114      115      116      117      118 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      119      120      121      122      123      124      125      126 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      127      128      129      130      131      132      133      134 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      135      136      137      139      140      141      142      143 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      145      146      150      185      186      187      188      189 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      190      191      192      193      194      195      196      197 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      198      199      200      201      202      203      204      205 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 
##      206      207      208      209      210      211      212      213 
## 1165.623 1165.623 1165.623 1165.623 1165.623 1165.623 1633.107 1633.107 
##      214      215      216      217      218      219      220      221 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      222      223      224      225      226      227      228      229 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      230      231      232      233      234      235      236      237 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      238      239      296      297      298      302      303      306 
## 1633.107 1633.107 1633.107 1633.107 2100.590 1633.107 1633.107 1633.107 
##      308      309      310      311      312      313      314      410 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      411      412      413      414      415      416      417      418 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      419      420      421      422      423      424      425      426 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 
##      427      428      429      433      434      435      439 
## 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107 1633.107
cor(Airbus$PriceEconomy,Airbus$PitchEconomy)
## [1] 0.2360655
fit<-lm(PricePremium~PitchPremium,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchPremium, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1836.4 -1144.4   475.6  1048.6  1629.6 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  -14015.9     4974.4  -2.818  0.00550 **
## PitchPremium    419.7      131.4   3.194  0.00171 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1215 on 149 degrees of freedom
## Multiple R-squared:  0.06408,    Adjusted R-squared:  0.0578 
## F-statistic:  10.2 on 1 and 149 DF,  p-value: 0.001712
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##        69        70        71        72        73        99       100 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       101       102       103       104       105       106       107 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       108       109       110       111       112       113       114 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       115       116       117       118       119       120       121 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       122       123       124       125       126       127       128 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       129       130       131       132       133       134       135 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       136       137       139       140       141       142       143 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       145       146       150       185       186       187       188 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       189       190       191       192       193       194       195 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       196       197       198       199       200       201       202 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       203       204       205       206       207       208       209 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       210       211       212       213       214       215       216 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       217       218       219       220       221       222       223 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       224       225       226       227       228       229       230 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       231       232       233       234       235       236       237 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       238       239       296       297       298       302       303 
## 1933.4340 1933.4340  254.5584  254.5584  674.2773  254.5584  254.5584 
##       306       308       309       310       311       312       313 
##  254.5584 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       314       410       411       412       413       414       415 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       416       417       418       419       420       421       422 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       423       424       425       426       427       428       429 
## 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 1933.4340 
##       433       434       435       439 
## 1933.4340 1933.4340 1933.4340 1933.4340
cor(Airbus$PricePremium,Airbus$PitchPremium)
## [1] 0.2531437
fit<-lm(PriceEconomy~PitchPremium,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchPremium, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1340.12  -909.12    61.88   637.88  1805.88 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   -9604.9     4057.5  -2.367  0.01921 * 
## PitchPremium    290.0      107.2   2.705  0.00762 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 991.1 on 149 degrees of freedom
## Multiple R-squared:  0.04682,    Adjusted R-squared:  0.04042 
## F-statistic: 7.319 on 1 and 149 DF,  p-value: 0.007618
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##        69        70        71        72        73        99       100 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       101       102       103       104       105       106       107 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       108       109       110       111       112       113       114 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       115       116       117       118       119       120       121 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       122       123       124       125       126       127       128 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       129       130       131       132       133       134       135 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       136       137       139       140       141       142       143 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       145       146       150       185       186       187       188 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       189       190       191       192       193       194       195 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       196       197       198       199       200       201       202 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       203       204       205       206       207       208       209 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       210       211       212       213       214       215       216 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       217       218       219       220       221       222       223 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       224       225       226       227       228       229       230 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       231       232       233       234       235       236       237 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       238       239       296       297       298       302       303 
## 1414.1221 1414.1221  254.2206  254.2206  544.1960  254.2206  254.2206 
##       306       308       309       310       311       312       313 
##  254.2206 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       314       410       411       412       413       414       415 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       416       417       418       419       420       421       422 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       423       424       425       426       427       428       429 
## 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 1414.1221 
##       433       434       435       439 
## 1414.1221 1414.1221 1414.1221 1414.1221
cor(Airbus$PriceEconomy,Airbus$PitchPremium)
## [1] 0.2163831
fit<-lm(PriceEconomy~WidthPremium,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthPremium, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1203.7  -942.5  -141.4   570.3  1942.3 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -1948.7     1590.9  -1.225   0.2225  
## WidthPremium    169.8       81.3   2.089   0.0384 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1001 on 149 degrees of freedom
## Multiple R-squared:  0.02845,    Adjusted R-squared:  0.02193 
## F-statistic: 4.363 on 1 and 149 DF,  p-value: 0.03843
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 
##        69        70        71        72        73        99       100 
## 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1277.7366 1277.7366 
##       101       102       103       104       105       106       107 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       108       109       110       111       112       113       114 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       115       116       117       118       119       120       121 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       122       123       124       125       126       127       128 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       129       130       131       132       133       134       135 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       136       137       139       140       141       142       143 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       145       146       150       185       186       187       188 
## 1277.7366 1277.7366 1277.7366 1617.3652 1617.3652 1617.3652 1617.3652 
##       189       190       191       192       193       194       195 
## 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 
##       196       197       198       199       200       201       202 
## 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 
##       203       204       205       206       207       208       209 
## 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 1617.3652 
##       210       211       212       213       214       215       216 
## 1617.3652 1617.3652 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       217       218       219       220       221       222       223 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       224       225       226       227       228       229       230 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       231       232       233       234       235       236       237 
## 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       238       239       296       297       298       302       303 
## 1277.7366 1277.7366  938.1081  938.1081  938.1081  938.1081  938.1081 
##       306       308       309       310       311       312       313 
##  938.1081 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 1277.7366 
##       314       410       411       412       413       414       415 
## 1277.7366 1447.5509 1447.5509 1447.5509 1447.5509 1447.5509 1447.5509 
##       416       417       418       419       420       421       422 
## 1447.5509 1447.5509 1447.5509 1447.5509 1447.5509 1447.5509 1447.5509 
##       423       424       425       426       427       428       429 
## 1447.5509 1447.5509 1447.5509 1277.7366 1277.7366 1277.7366 1277.7366 
##       433       434       435       439 
## 1277.7366 1277.7366 1277.7366 1277.7366
cor(Airbus$PriceEconomy,Airbus$WidthPremium)
## [1] 0.1686651
fit<-lm(PricePremium~WidthPremium,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthPremium, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1919.74 -1067.56   -14.74  1157.62  1933.62 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -6772.0     1866.9  -3.627 0.000393 ***
## WidthPremium    442.2       95.4   4.635 7.74e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1174 on 149 degrees of freedom
## Multiple R-squared:  0.126,  Adjusted R-squared:  0.1201 
## F-statistic: 21.48 on 1 and 149 DF,  p-value: 7.74e-06
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##        62        63        64        65        66        67        68 
## 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 
##        69        70        71        72        73        99       100 
## 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 1629.3804 1629.3804 
##       101       102       103       104       105       106       107 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       108       109       110       111       112       113       114 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       115       116       117       118       119       120       121 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       122       123       124       125       126       127       128 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       129       130       131       132       133       134       135 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       136       137       139       140       141       142       143 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       145       146       150       185       186       187       188 
## 1629.3804 1629.3804 1629.3804 2513.7356 2513.7356 2513.7356 2513.7356 
##       189       190       191       192       193       194       195 
## 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 
##       196       197       198       199       200       201       202 
## 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 
##       203       204       205       206       207       208       209 
## 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 2513.7356 
##       210       211       212       213       214       215       216 
## 2513.7356 2513.7356 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       217       218       219       220       221       222       223 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       224       225       226       227       228       229       230 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       231       232       233       234       235       236       237 
## 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       238       239       296       297       298       302       303 
## 1629.3804 1629.3804  745.0252  745.0252  745.0252  745.0252  745.0252 
##       306       308       309       310       311       312       313 
##  745.0252 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 1629.3804 
##       314       410       411       412       413       414       415 
## 1629.3804 2071.5580 2071.5580 2071.5580 2071.5580 2071.5580 2071.5580 
##       416       417       418       419       420       421       422 
## 2071.5580 2071.5580 2071.5580 2071.5580 2071.5580 2071.5580 2071.5580 
##       423       424       425       426       427       428       429 
## 2071.5580 2071.5580 2071.5580 1629.3804 1629.3804 1629.3804 1629.3804 
##       433       434       435       439 
## 1629.3804 1629.3804 1629.3804 1629.3804
cor(Airbus$PricePremium,Airbus$WidthPremium)
## [1] 0.3549722
fit<-lm(PriceEconomy~WidthEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1497.8  -986.2    45.8   663.8  1831.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    6348.0     3950.1   1.607    0.110
## WidthEconomy   -275.5      218.6  -1.261    0.209
## 
## Residual standard error: 1010 on 149 degrees of freedom
## Multiple R-squared:  0.01055,    Adjusted R-squared:  0.003911 
## F-statistic: 1.589 on 1 and 149 DF,  p-value: 0.2094
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##       70       71       72       73       99      100      101      102 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      103      104      105      106      107      108      109      110 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      111      112      113      114      115      116      117      118 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      119      120      121      122      123      124      125      126 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      127      128      129      130      131      132      133      134 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      135      136      137      139      140      141      142      143 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      145      146      150      185      186      187      188      189 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      190      191      192      193      194      195      196      197 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      198      199      200      201      202      203      204      205 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      206      207      208      209      210      211      212      213 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      214      215      216      217      218      219      220      221 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      222      223      224      225      226      227      228      229 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      230      231      232      233      234      235      236      237 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      238      239      296      297      298      302      303      306 
## 1388.202 1388.202 1663.748 1663.748 1663.748 1663.748 1663.748 1663.748 
##      308      309      310      311      312      313      314      410 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1112.655 
##      411      412      413      414      415      416      417      418 
## 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 
##      419      420      421      422      423      424      425      426 
## 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1388.202 
##      427      428      429      433      434      435      439 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202
cor(Airbus$PriceEconomy,Airbus$WidthEconomy)
## [1] -0.1027203
fit<-lm(PricePremium~WidthEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1869.7 -1416.8   528.2  1101.2  1682.2 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    4940.4     4906.7   1.007    0.316
## WidthEconomy   -170.0      271.5  -0.626    0.532
## 
## Residual standard error: 1254 on 149 degrees of freedom
## Multiple R-squared:  0.002623,   Adjusted R-squared:  -0.004071 
## F-statistic: 0.3919 on 1 and 149 DF,  p-value: 0.5323
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##       70       71       72       73       99      100      101      102 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      103      104      105      106      107      108      109      110 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      111      112      113      114      115      116      117      118 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      119      120      121      122      123      124      125      126 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      127      128      129      130      131      132      133      134 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      135      136      137      139      140      141      142      143 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      145      146      150      185      186      187      188      189 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      190      191      192      193      194      195      196      197 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      198      199      200      201      202      203      204      205 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      206      207      208      209      210      211      212      213 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      214      215      216      217      218      219      220      221 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      222      223      224      225      226      227      228      229 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      230      231      232      233      234      235      236      237 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      238      239      296      297      298      302      303      306 
## 1880.760 1880.760 2050.742 2050.742 2050.742 2050.742 2050.742 2050.742 
##      308      309      310      311      312      313      314      410 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1710.778 
##      411      412      413      414      415      416      417      418 
## 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 
##      419      420      421      422      423      424      425      426 
## 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1880.760 
##      427      428      429      433      434      435      439 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760
cor(Airbus$PricePremium,Airbus$WidthEconomy)
## [1] -0.05121666
fit<-lm(PriceEconomy~WidthEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1497.8  -986.2    45.8   663.8  1831.8 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    6348.0     3950.1   1.607    0.110
## WidthEconomy   -275.5      218.6  -1.261    0.209
## 
## Residual standard error: 1010 on 149 degrees of freedom
## Multiple R-squared:  0.01055,    Adjusted R-squared:  0.003911 
## F-statistic: 1.589 on 1 and 149 DF,  p-value: 0.2094
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##       70       71       72       73       99      100      101      102 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      103      104      105      106      107      108      109      110 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      111      112      113      114      115      116      117      118 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      119      120      121      122      123      124      125      126 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      127      128      129      130      131      132      133      134 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      135      136      137      139      140      141      142      143 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      145      146      150      185      186      187      188      189 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      190      191      192      193      194      195      196      197 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      198      199      200      201      202      203      204      205 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      206      207      208      209      210      211      212      213 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      214      215      216      217      218      219      220      221 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      222      223      224      225      226      227      228      229 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      230      231      232      233      234      235      236      237 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 
##      238      239      296      297      298      302      303      306 
## 1388.202 1388.202 1663.748 1663.748 1663.748 1663.748 1663.748 1663.748 
##      308      309      310      311      312      313      314      410 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1112.655 
##      411      412      413      414      415      416      417      418 
## 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 
##      419      420      421      422      423      424      425      426 
## 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1112.655 1388.202 
##      427      428      429      433      434      435      439 
## 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202 1388.202
cor(Airbus$PriceEconomy,Airbus$WidthEconomy)
## [1] -0.1027203
fit<-lm(PricePremium~WidthEconomy,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthEconomy, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1869.7 -1416.8   528.2  1101.2  1682.2 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)    4940.4     4906.7   1.007    0.316
## WidthEconomy   -170.0      271.5  -0.626    0.532
## 
## Residual standard error: 1254 on 149 degrees of freedom
## Multiple R-squared:  0.002623,   Adjusted R-squared:  -0.004071 
## F-statistic: 0.3919 on 1 and 149 DF,  p-value: 0.5323
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##       70       71       72       73       99      100      101      102 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      103      104      105      106      107      108      109      110 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      111      112      113      114      115      116      117      118 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      119      120      121      122      123      124      125      126 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      127      128      129      130      131      132      133      134 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      135      136      137      139      140      141      142      143 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      145      146      150      185      186      187      188      189 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      190      191      192      193      194      195      196      197 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      198      199      200      201      202      203      204      205 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      206      207      208      209      210      211      212      213 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      214      215      216      217      218      219      220      221 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      222      223      224      225      226      227      228      229 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      230      231      232      233      234      235      236      237 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 
##      238      239      296      297      298      302      303      306 
## 1880.760 1880.760 2050.742 2050.742 2050.742 2050.742 2050.742 2050.742 
##      308      309      310      311      312      313      314      410 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1710.778 
##      411      412      413      414      415      416      417      418 
## 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 
##      419      420      421      422      423      424      425      426 
## 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1710.778 1880.760 
##      427      428      429      433      434      435      439 
## 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760 1880.760
cor(Airbus$PricePremium,Airbus$WidthEconomy)
## [1] -0.05121666
fit<-lm(PriceEconomy~SeatsTotal,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ SeatsTotal, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1816.31  -834.66    48.75   750.89  2443.80 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2558.242    260.756   9.811  < 2e-16 ***
## SeatsTotal    -4.173      0.875  -4.769 4.36e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 945.5 on 149 degrees of freedom
## Multiple R-squared:  0.1324, Adjusted R-squared:  0.1266 
## F-statistic: 22.75 on 1 and 149 DF,  p-value: 4.359e-06
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##        62        63        64        65        66        67        68 
## 1585.8377 1585.8377 1585.8377 1585.8377 1585.8377 1585.8377 1585.8377 
##        69        70        71        72        73        99       100 
## 1585.8377 1585.8377 1585.8377 1585.8377 1585.8377 1064.1616 1064.1616 
##       101       102       103       104       105       106       107 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       108       109       110       111       112       113       114 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       115       116       117       118       119       120       121 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       122       123       124       125       126       127       128 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       129       130       131       132       133       134       135 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       136       137       139       140       141       142       143 
## 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 1064.1616 
##       145       146       150       185       186       187       188 
## 1064.1616 1064.1616 1026.6009 1427.2482 1427.2482 1427.2482 1427.2482 
##       189       190       191       192       193       194       195 
## 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 
##       196       197       198       199       200       201       202 
## 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 
##       203       204       205       206       207       208       209 
## 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 1427.2482 
##       210       211       212       213       214       215       216 
## 1427.2482 1427.2482 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 
##       217       218       219       220       221       222       223 
## 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 
##       224       225       226       227       228       229       230 
## 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 
##       231       232       233       234       235       236       237 
## 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 
##       238       239       296       297       298       302       303 
## 1857.1093 1857.1093 1982.3116 1982.3116 1907.1902 1982.3116 1982.3116 
##       306       308       309       310       311       312       313 
## 1982.3116 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 1857.1093 
##       314       410       411       412       413       414       415 
## 1857.1093 1018.2541 1018.2541 1018.2541 1018.2541 1018.2541 1018.2541 
##       416       417       418       419       420       421       422 
## 1018.2541 1018.2541 1018.2541 1018.2541 1018.2541 1018.2541 1018.2541 
##       423       424       425       426       427       428       429 
## 1018.2541 1018.2541 1018.2541  776.1964  776.1964  776.1964  776.1964 
##       433       434       435       439 
##  776.1964  776.1964  776.1964  776.1964
cor(Airbus$PriceEconomy,Airbus$SeatsTotal)
## [1] -0.3639357
fit<-lm(PricePremium~SeatsTotal,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ SeatsTotal, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2231.6 -1316.8   485.4   973.5  1964.7 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2923.372    334.376   8.743 4.43e-15 ***
## SeatsTotal    -3.701      1.122  -3.299  0.00122 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1212 on 149 degrees of freedom
## Multiple R-squared:  0.06806,    Adjusted R-squared:  0.0618 
## F-statistic: 10.88 on 1 and 149 DF,  p-value: 0.001215
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2060.966 2060.966 2060.966 2060.966 2060.966 2060.966 2060.966 2060.966 
##       70       71       72       73       99      100      101      102 
## 2060.966 2060.966 2060.966 2060.966 1598.303 1598.303 1598.303 1598.303 
##      103      104      105      106      107      108      109      110 
## 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 
##      111      112      113      114      115      116      117      118 
## 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 
##      119      120      121      122      123      124      125      126 
## 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 
##      127      128      129      130      131      132      133      134 
## 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 
##      135      136      137      139      140      141      142      143 
## 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 1598.303 
##      145      146      150      185      186      187      188      189 
## 1598.303 1598.303 1564.991 1920.317 1920.317 1920.317 1920.317 1920.317 
##      190      191      192      193      194      195      196      197 
## 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 
##      198      199      200      201      202      203      204      205 
## 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 
##      206      207      208      209      210      211      212      213 
## 1920.317 1920.317 1920.317 1920.317 1920.317 1920.317 2301.552 2301.552 
##      214      215      216      217      218      219      220      221 
## 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 
##      222      223      224      225      226      227      228      229 
## 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 
##      230      231      232      233      234      235      236      237 
## 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 
##      238      239      296      297      298      302      303      306 
## 2301.552 2301.552 2412.591 2412.591 2345.967 2412.591 2412.591 2412.591 
##      308      309      310      311      312      313      314      410 
## 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 2301.552 1557.588 
##      411      412      413      414      415      416      417      418 
## 1557.588 1557.588 1557.588 1557.588 1557.588 1557.588 1557.588 1557.588 
##      419      420      421      422      423      424      425      426 
## 1557.588 1557.588 1557.588 1557.588 1557.588 1557.588 1557.588 1342.912 
##      427      428      429      433      434      435      439 
## 1342.912 1342.912 1342.912 1342.912 1342.912 1342.912 1342.912
cor(Airbus$PricePremium,Airbus$SeatsTotal)
## [1] -0.260877
fit<-lm(PriceEconomy~PitchDifference,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchDifference, data = Airbus)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1320.39  -894.13    39.61   657.61  1867.07 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      1104.23     526.17   2.099   0.0375 *
## PitchDifference    41.45      81.06   0.511   0.6099  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1014 on 149 degrees of freedom
## Multiple R-squared:  0.001752,   Adjusted R-squared:  -0.004948 
## F-statistic: 0.2615 on 1 and 149 DF,  p-value: 0.6099
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##       70       71       72       73       99      100      101      102 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      103      104      105      106      107      108      109      110 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      111      112      113      114      115      116      117      118 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      119      120      121      122      123      124      125      126 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      127      128      129      130      131      132      133      134 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      135      136      137      139      140      141      142      143 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      145      146      150      185      186      187      188      189 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      190      191      192      193      194      195      196      197 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      198      199      200      201      202      203      204      205 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 
##      206      207      208      209      210      211      212      213 
## 1394.385 1394.385 1394.385 1394.385 1394.385 1394.385 1352.934 1352.934 
##      214      215      216      217      218      219      220      221 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      222      223      224      225      226      227      228      229 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      230      231      232      233      234      235      236      237 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      238      239      296      297      298      302      303      306 
## 1352.934 1352.934 1187.130 1187.130 1187.130 1187.130 1187.130 1187.130 
##      308      309      310      311      312      313      314      410 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      411      412      413      414      415      416      417      418 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      419      420      421      422      423      424      425      426 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 
##      427      428      429      433      434      435      439 
## 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934 1352.934
cor(Airbus$PriceEconomy,Airbus$PitchDifference)
## [1] 0.04185429
fit<-lm(PricePremium~PitchDifference,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ PitchDifference, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1885.0 -1002.2   427.1  1067.8  1581.0 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)       646.47     643.63   1.004   0.3168  
## PitchDifference   190.78      99.16   1.924   0.0563 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1241 on 149 degrees of freedom
## Multiple R-squared:  0.02424,    Adjusted R-squared:  0.01769 
## F-statistic: 3.702 on 1 and 149 DF,  p-value: 0.05626
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##       70       71       72       73       99      100      101      102 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      103      104      105      106      107      108      109      110 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      111      112      113      114      115      116      117      118 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      119      120      121      122      123      124      125      126 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      127      128      129      130      131      132      133      134 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      135      136      137      139      140      141      142      143 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      145      146      150      185      186      187      188      189 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      190      191      192      193      194      195      196      197 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      198      199      200      201      202      203      204      205 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 
##      206      207      208      209      210      211      212      213 
## 1981.952 1981.952 1981.952 1981.952 1981.952 1981.952 1791.168 1791.168 
##      214      215      216      217      218      219      220      221 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      222      223      224      225      226      227      228      229 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      230      231      232      233      234      235      236      237 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      238      239      296      297      298      302      303      306 
## 1791.168 1791.168 1028.035 1028.035 1028.035 1028.035 1028.035 1028.035 
##      308      309      310      311      312      313      314      410 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      411      412      413      414      415      416      417      418 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      419      420      421      422      423      424      425      426 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 
##      427      428      429      433      434      435      439 
## 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168 1791.168
cor(Airbus$PricePremium,Airbus$PitchDifference)
## [1] 0.1557009
fit<-lm(PriceEconomy~WidthDifference,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PriceEconomy ~ WidthDifference, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1207.0  -830.7  -271.0   596.1  1968.1 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      1004.40     152.26   6.597 6.89e-10 ***
## WidthDifference   247.53      87.52   2.828  0.00533 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 988.9 on 149 degrees of freedom
## Multiple R-squared:  0.05094,    Adjusted R-squared:  0.04458 
## F-statistic: 7.998 on 1 and 149 DF,  p-value: 0.005327
Airbus$PriceEconomy
##   [1] 1813 1813 1813 1813 2052 2052 2052 2052 1919 1919 1919  540 2384 2384
##  [15] 2384 2384 1848 1848 1848 1848 1758 1758 1758  719  719 1198  457  402
##  [29]  402  392  356  356  322  297  303  303  276  249  238  238  228  231
##  [43]  203  201  207  207  182  171  168  140  147  138  126  126  109  109
##  [57]  104   97   74 1778 1778 1999 1999 1999 1985 1434 1434 1434 1434 1476
##  [71] 1476 1476 1476 1903 1903 1903 2369 2369 1767 1767 1767 1767 1919  540
##  [85]  540  540  630  743  990 2659 2659 2659 2659 2659 2659 2659 2659 2607
##  [99] 2607 2607 2860 2860 2609 2609 2609 2813 3165 3165 3165 3165 3165 3165
## [113] 3165 3165  166  329  243  293  293  416  336  429  462  557  557  661
## [127]  676  505  505  505  505  505  505  505  505  690  690  690  690  690
## [141]  690  690  690 1522 1522 2581 2581 2979 2979 2979 3220
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 
##       70       71       72       73       99      100      101      102 
## 1746.980 1746.980 1746.980 1746.980 1251.928 1251.928 1251.928 1251.928 
##      103      104      105      106      107      108      109      110 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      111      112      113      114      115      116      117      118 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      119      120      121      122      123      124      125      126 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      127      128      129      130      131      132      133      134 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      135      136      137      139      140      141      142      143 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      145      146      150      185      186      187      188      189 
## 1251.928 1251.928 1251.928 1746.980 1746.980 1746.980 1746.980 1746.980 
##      190      191      192      193      194      195      196      197 
## 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 
##      198      199      200      201      202      203      204      205 
## 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 
##      206      207      208      209      210      211      212      213 
## 1746.980 1746.980 1746.980 1746.980 1746.980 1746.980 1251.928 1251.928 
##      214      215      216      217      218      219      220      221 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      222      223      224      225      226      227      228      229 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      230      231      232      233      234      235      236      237 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      238      239      296      297      298      302      303      306 
## 1251.928 1251.928 1004.402 1004.402 1004.402 1004.402 1004.402 1004.402 
##      308      309      310      311      312      313      314      410 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      411      412      413      414      415      416      417      418 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      419      420      421      422      423      424      425      426 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 
##      427      428      429      433      434      435      439 
## 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928 1251.928
cor(Airbus$PriceEconomy,Airbus$WidthDifference)
## [1] 0.2257098
fit<-lm(PricePremium~WidthDifference,data = Airbus)
summary(fit)
## 
## Call:
## lm(formula = PricePremium ~ WidthDifference, data = Airbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2117.9  -844.3  -123.9  1181.2  1957.2 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       1052.8      176.6   5.962 1.73e-08 ***
## WidthDifference    553.0      101.5   5.448 2.06e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1147 on 149 degrees of freedom
## Multiple R-squared:  0.1661, Adjusted R-squared:  0.1605 
## F-statistic: 29.68 on 1 and 149 DF,  p-value: 2.056e-07
Airbus$PricePremium
##   [1] 3128 3128 3128 3128 2856 2856 2856 2856 2409 2409 2409  594 3563 3563
##  [15] 3563 3563 3536 3536 3536 3536 2592 2592 2592 1634 1634 1634  486  442
##  [29]  442  407  396  396  348  323  319  319  306  285  278  276  263  247
##  [43]  238  237  237  234  211  201  198  175  175  165  156  156  141  141
##  [57]  131  125   97 2588 2588 2765 2765 2765 2588 2982 2982 2982 2982 2997
##  [71] 2997 2997 2997 3509 3509 3509 3540 3540 2499 2499 2499 2499 2409  594
##  [85]  594  594 1611 1611 1611 2859 2859 2859 2859 2859 2859 2859 2859 2807
##  [99] 2807 2807 3063 3063 2787 2787 2787 2922 3275 3275 3275 3275 3275 3275
## [113] 3275 3275  181  354  262  308  308  431  841  841  841  789  789  928
## [127]  931 1004 1004 1004 1004 1004 1004 1004 1004 1110 1110 1110 1110 1110
## [141] 1110 1110 1110 3289 3289 2781 2781 3088 3088 3088 3289
fitted(fit)
##       62       63       64       65       66       67       68       69 
## 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 
##       70       71       72       73       99      100      101      102 
## 2711.855 2711.855 2711.855 2711.855 1605.810 1605.810 1605.810 1605.810 
##      103      104      105      106      107      108      109      110 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      111      112      113      114      115      116      117      118 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      119      120      121      122      123      124      125      126 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      127      128      129      130      131      132      133      134 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      135      136      137      139      140      141      142      143 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      145      146      150      185      186      187      188      189 
## 1605.810 1605.810 1605.810 2711.855 2711.855 2711.855 2711.855 2711.855 
##      190      191      192      193      194      195      196      197 
## 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 
##      198      199      200      201      202      203      204      205 
## 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 
##      206      207      208      209      210      211      212      213 
## 2711.855 2711.855 2711.855 2711.855 2711.855 2711.855 1605.810 1605.810 
##      214      215      216      217      218      219      220      221 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      222      223      224      225      226      227      228      229 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      230      231      232      233      234      235      236      237 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      238      239      296      297      298      302      303      306 
## 1605.810 1605.810 1052.788 1052.788 1052.788 1052.788 1052.788 1052.788 
##      308      309      310      311      312      313      314      410 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      411      412      413      414      415      416      417      418 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      419      420      421      422      423      424      425      426 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 
##      427      428      429      433      434      435      439 
## 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810 1605.810
cor(Airbus$PricePremium,Airbus$WidthDifference)
## [1] 0.4075861

Now It’s time for all overall Analysis

mean(airline$PriceEconomy)
## [1] 1327.076
mean(airline$PricePremium)
## [1] 1845.258
library(plotly)
x<-c('Jul','Aug','Sept','Oct')
y1<-c(by(airline$PriceEconomy,airline$TravelMonth,mean))
y2<-c(by(airline$PricePremium,airline$TravelMonth,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Months", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
mean(airline$PriceEconomy)
## [1] 1327.076
mean(airline$PricePremium)
## [1] 1845.258
library(plotly)
x<-c('British','Virgin','Delta','Jet','AirFrance','Singapore')
y1<-c(by(airline$PriceEconomy,airline$Airline,mean))
y2<-c(by(airline$PricePremium,airline$Airline,mean))
data<-data.frame(x,y1,y2)
data$x <- factor(data$x, levels = data[["x"]])
plot_ly(data, x = ~x, y = ~y1, type = 'bar', name = 'Economy Ticket Price', marker = list(color = 'rgb(49,130,189)')) %>%
    add_trace(y = ~y2, name = 'Premium Ticket Price', marker = list(color = 'rgb(204,204,204)')) %>%
     layout(xaxis = list(title = "Airlines", tickangle = -45),
            yaxis = list(title = "Price"),
            margin = list(b = 100),
            barmode = 'group')
by(airline$PriceEconomy,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 2769.784
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 1293.48
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 560.9348
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 276.1639
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 860.25
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 1603.532
by(airline$PricePremium,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 3065.216
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 1937.029
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 684.6739
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 483.3607
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 1239.925
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 2721.694
by(airline$SeatsEconomy,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 214.4595
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 216.5886
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 137.2174
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 140.3115
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 243.6
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 230.1774
by(airline$SeatsPremium,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 26.7027
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 43.18286
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 22.56522
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 15.65574
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 31.2
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 42.53226
by(airline$WidthEconomy,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 17.56757
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 18
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 17.3913
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 17.11475
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 19
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 18
by(airline$WidthPremium,airline$Airline,mean)
## airline$Airline: AirFrance
## [1] 19
## -------------------------------------------------------- 
## airline$Airline: British
## [1] 19
## -------------------------------------------------------- 
## airline$Airline: Delta
## [1] 17.78261
## -------------------------------------------------------- 
## airline$Airline: Jet
## [1] 20.77049
## -------------------------------------------------------- 
## airline$Airline: Singapore
## [1] 20
## -------------------------------------------------------- 
## airline$Airline: Virgin
## [1] 21

Drawing boxplots among comparable variables

Reading variables except Airline,Aircraft,IsInternational,TravelMonth because they are strings

airline1=airline[,6:18]
View(airline1)
##Taking Logarithm
airline2=log(airline1+1)
boxplot(airline2,xlab="Value",ylab="Parameters",main="Boxplot Presentation of different Parameters")

individual boxplots for comparable variables

par(mfrow=c(1,2))
with(airline,boxplot(airline$PriceEconomy,main="Price of Economy Seats",ylab="Price of tickets"))
with(airline,boxplot(airline$PricePremium,main="Price of Premium Seats",ylab="Price of tickets"))

par(mfrow=c(1,1))

par(mfrow=c(1,2))
with(airline,boxplot(airline$WidthEconomy,main="Width of Economy Seats",ylab="Width of seats"))
with(airline,boxplot(airline$WidthPremium,main="Width of Premium Seats",ylab="Width of seats"))

par(mfrow=c(1,1))

par(mfrow=c(1,2))
with(airline,boxplot(airline$PitchEconomy,main="Pitch of Economy Seats",ylab="Pitch of seats"))
with(airline,boxplot(airline$PitchPremium,main="Pitch of Premium Seats",ylab="Pitch of seats"))

par(mfrow=c(1,1))

par(mfrow=c(1,2))
with(airline,boxplot(airline$SeatsEconomy,main="No of Economy Seats",ylab="Count"))
with(airline,boxplot(airline$SeatsPremium,main="No of Premium Seats",ylab="Count"))

par(mfrow=c(1,1))
boxplot(airline$FlightDuration,main="Duration of Flights",ylab="Hours")

Price of seats with different Aircrafts

boxplot(airline$PriceEconomy~airline$Aircraft,yaxt="n",horizontal=TRUE,main="Price of Economy Seats with Aircraft",xlab="Price of tickets",ylab="Name Of Aircraft")
axis(side=2,at=c(1,2),labels=c("Boeing","AirBus"))

boxplot(airline$PricePremium~airline$Aircraft,yaxt="n",horizontal=TRUE,main="Price of Premium Seats with Aircraft",xlab="Price of tickets",ylab="Name Of Aircraft")
axis(side=2,at=c(1,2),labels=c("Boeing","AirBus"))

price of seat varies with flightduration

plot(airline$FlightDuration~airline$PriceEconomy,main="Price of Economy seat with FlightDuration",xlab="FlightDuration(hours)",ylab="Price of seats",cex=1.1)

plot(airline$FlightDuration~airline$PricePremium,main="Price of Premium seat with FlightDuration",xlab="FlightDuration(hours)",ylab="Price of seats",cex=1.1)

plot(airline$FlightDuration~airline$PriceRelative,main="PriceRelative with FlightDuration",xlab="ratio",ylab="PriceRelative ",cex=1.1)

plot(airline$PitchEconomy~airline$PriceRelative,main="PriceRelative with FlightDuration",xlab="ratio",ylab="PriceRelative ",cex=1.1)

scatterplots

library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplot(airline$PriceEconomy,airline$FlightDuration,main="Price of economy seats with FlightDuration",ylab="FlightDuration(hours)",xlab="Price of seats",cex=1.1,pch=19)

library(car)
scatterplot(airline$PricePremium,airline$FlightDuration,main="Price of premium seats with FlightDuration",ylab="FlightDuration(hours)",xlab="Price of seats",cex=1.1,pch=19)

library(car)
scatterplot(airline$PriceRelative,airline$FlightDuration,main="PriceRelative with FlightDuration",ylab="FlightDuration(hours)",xlab="ratio",cex=1.1,pch=19)

library(car)
scatterplot(airline$PriceRelative,airline$PitchEconomy,main="PriceRelative with FlightDuration",ylab="FlightDuration(hours)",xlab="ratio",cex=1.1,pch=19)

scatterplotmatrix

library(car)
scatterplotMatrix(airline[,c("FlightDuration","PriceEconomy","PricePremium")],spread=FALSE,smoother.args=list(lty=2),main="Scatter Plot Matrix",diagonal="histogram")

ggvis Data Visualization

library(ggvis)
## 
## Attaching package: 'ggvis'
## The following objects are masked from 'package:plotly':
## 
##     add_data, hide_legend
## The following object is masked from 'package:ggplot2':
## 
##     resolution
airline %>% ggvis(~PriceEconomy, ~PricePremium, fill = ~PriceRelative) %>% layer_points()
library(ggvis)
airline %>% ggvis(~PriceEconomy, ~WidthEconomy, fill = ~PriceRelative) %>% layer_points()
library(ggvis)
airline %>% ggvis(~PricePremium, ~WidthPremium, fill = ~PriceRelative) %>% layer_points()
library(ggvis)
airline %>% ggvis(~PriceEconomy, ~PriceRelative, fill = ~PricePremium) %>% layer_points()

correlation test among comparable variables

correlationmatrix,cov-matrix,corrplot,corrgram

x<-airline[,c("FlightDuration","WidthEconomy","WidthPremium","SeatsEconomy","SeatsPremium","PitchEconomy","PitchPremium","PitchDifference","WidthDifference","SeatsTotal","PercentPremiumSeats")]
y<-airline[,c("PriceEconomy","PricePremium","PriceRelative")]
cor(x,y)
##                     PriceEconomy PricePremium PriceRelative
## FlightDuration        0.56664039   0.64873981   0.121075014
## WidthEconomy          0.06799061   0.15054837  -0.043961160
## WidthPremium         -0.05704522   0.06402004   0.504247591
## SeatsEconomy          0.12816722   0.17700093   0.003956939
## SeatsPremium          0.11364218   0.21761238  -0.097196009
## PitchEconomy          0.36866123   0.22614179  -0.423022038
## PitchPremium          0.05038455   0.08853915   0.417539056
## PitchDifference      -0.09952511  -0.01806629   0.468730249
## WidthDifference      -0.08449975  -0.01151218   0.485802437
## SeatsTotal            0.13243313   0.19232533  -0.011568942
## PercentPremiumSeats   0.06532232   0.11639097  -0.161565556
cov(x,y)
##                     PriceEconomy PricePremium PriceRelative
## FlightDuration        1983.54017   2959.97830    0.19323683
## WidthEconomy            37.46095    108.11612   -0.01104335
## WidthPremium           -61.85450     90.47998    0.24928593
## SeatsEconomy          9673.79447  17413.25417    0.13616991
## SeatsPremium          1489.38360   3717.36429   -0.58078765
## PitchEconomy           238.70319    190.85172   -0.12488080
## PitchPremium            65.42513    149.85356    0.24719874
## PitchDifference       -173.27806    -40.99816    0.37207954
## WidthDifference        -99.31545    -17.63614    0.26032928
## SeatsTotal           11163.17806  21130.61846   -0.44461774
## PercentPremiumSeats    312.61077    726.01582   -0.35252750
var(x,y)
##                     PriceEconomy PricePremium PriceRelative
## FlightDuration        1983.54017   2959.97830    0.19323683
## WidthEconomy            37.46095    108.11612   -0.01104335
## WidthPremium           -61.85450     90.47998    0.24928593
## SeatsEconomy          9673.79447  17413.25417    0.13616991
## SeatsPremium          1489.38360   3717.36429   -0.58078765
## PitchEconomy           238.70319    190.85172   -0.12488080
## PitchPremium            65.42513    149.85356    0.24719874
## PitchDifference       -173.27806    -40.99816    0.37207954
## WidthDifference        -99.31545    -17.63614    0.26032928
## SeatsTotal           11163.17806  21130.61846   -0.44461774
## PercentPremiumSeats    312.61077    726.01582   -0.35252750
library(corrplot)
## corrplot 0.84 loaded
corrplot(corr=cor(airline[,c(3,6:18)],use="complete.obs"),method="ellipse")

library(gplots)
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
corrplot.mixed(corr=cor(airline[,c(3,6:18)],use ="complete.obs"), lower = "number", upper = "circle", tl.pos = c("d",
"lt", "n"), diag = c("n", "l", "u"), bg = "white", addgrid.col = "grey",
lower.col = NULL, upper.col = NULL)

library(corrgram)
corrgram(airline,order=FALSE,lower.panel=panel.shade,upper.panel=panel.pie,text.panel=panel.txt,main="Corrgram of Airline Ticket Pricing")

from the above cor(),corrplot,corrgram command we can consider that (i)FlightDuration as a factor for pricing in Economy and Premium seats and for (ii) PriceRelative factors such as PitchEconomy,PitchPremium,WidthPremium are correlated

Hypothesis(A) Average cost of Premiumm seats in Boeing Aircraft is less than that of AirBus

t.test(PricePremium~Aircraft,alternative="less",data=airline)
## 
##  Welch Two Sample t-test
## 
## data:  PricePremium by Aircraft
## t = 0.28645, df = 310.38, p-value = 0.6126
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##      -Inf 244.4973
## sample estimates:
## mean in group AirBus mean in group Boeing 
##             1869.503             1833.332

Hypothesis(B) Average cost of Economy seats in Boeing Aircraft is less than that of AirBus

t.test(PriceEconomy~Aircraft,alternative="less",data=airline)
## 
##  Welch Two Sample t-test
## 
## data:  PriceEconomy by Aircraft
## t = 0.64317, df = 289.45, p-value = 0.7397
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##      -Inf 228.0809
## sample estimates:
## mean in group AirBus mean in group Boeing 
##             1369.954             1305.987

Hypothesis(C) Average cost of Economy seats in Domestic Aircraft is less than that of International

t.test(PriceEconomy~IsInternational,alternative="less",data=airline)
## 
##  Welch Two Sample t-test
## 
## data:  PriceEconomy by IsInternational
## t = -20.368, df = 433.89, p-value < 2.2e-16
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##       -Inf -977.2634
## sample estimates:
##      mean in group Domestic mean in group International 
##                     356.625                    1419.943

Hypothesis(D) Average cost of Premium seats in Domestic Aircraft is less than that of International

t.test(PricePremium~IsInternational,alternative="less",data=airline)
## 
##  Welch Two Sample t-test
## 
## data:  PricePremium by IsInternational
## t = -24.495, df = 453.64, p-value < 2.2e-16
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##       -Inf -1491.417
## sample estimates:
##      mean in group Domestic mean in group International 
##                     385.900                    1984.909

Linear Regression Model fo Price of Economy Flights as Dependent variable

fit1<-lm(PriceEconomy~PitchEconomy+WidthEconomy+FlightDuration+PriceRelative+IsInternational,data=airline)
summary(fit1)
## 
## Call:
## lm(formula = PriceEconomy ~ PitchEconomy + WidthEconomy + FlightDuration + 
##     PriceRelative + IsInternational, data = airline)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1520.33  -470.75    53.75   499.90  1599.59 
## 
## Coefficients:
##                              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  -1094.27    1876.87  -0.583     0.56    
## PitchEconomy                   424.30      58.30   7.278 1.52e-12 ***
## WidthEconomy                  -722.84      60.98 -11.854  < 2e-16 ***
## FlightDuration                 157.98      10.33  15.286  < 2e-16 ***
## PriceRelative                 -801.77      73.05 -10.976  < 2e-16 ***
## IsInternationalInternational  1384.18     126.83  10.914  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 610.4 on 452 degrees of freedom
## Multiple R-squared:  0.6227, Adjusted R-squared:  0.6185 
## F-statistic: 149.2 on 5 and 452 DF,  p-value: < 2.2e-16

Linear Regression Model fo Price of Premium Flights as Dependent variable

fit2<-lm(PricePremium~PitchPremium+WidthPremium+FlightDuration+PriceRelative+IsInternational,data=airline)
summary(fit2)
## 
## Call:
## lm(formula = PricePremium ~ PitchPremium + WidthPremium + FlightDuration + 
##     PriceRelative + IsInternational, data = airline)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2162.7  -747.4   134.3   709.8  4286.6 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  13960.2975  3016.7663   4.628 4.84e-06 ***
## PitchPremium                  -417.2839    96.5620  -4.321 1.91e-05 ***
## WidthPremium                     6.9662    64.5802   0.108    0.914    
## FlightDuration                 177.9965    16.0656  11.079  < 2e-16 ***
## PriceRelative                   -0.5811   118.3982  -0.005    0.996    
## IsInternationalInternational  2430.6658   409.4689   5.936 5.82e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 945.3 on 452 degrees of freedom
## Multiple R-squared:  0.4673, Adjusted R-squared:  0.4614 
## F-statistic: 79.31 on 5 and 452 DF,  p-value: < 2.2e-16

Linear Regression Model fo PriceRelative as Dependent variable

fit<-lm(PriceRelative~Aircraft-SeatsEconomy-SeatsPremium-WidthEconomy,data=airline)
summary(fit)
## 
## Call:
## lm(formula = PriceRelative ~ Aircraft - SeatsEconomy - SeatsPremium - 
##     WidthEconomy, data = airline)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4928 -0.3528 -0.1428  0.2422  1.3672 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     0.41477    0.03647  11.372   <2e-16 ***
## AircraftBoeing  0.10807    0.04455   2.426   0.0157 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4482 on 456 degrees of freedom
## Multiple R-squared:  0.01274,    Adjusted R-squared:  0.01057 
## F-statistic: 5.884 on 1 and 456 DF,  p-value: 0.01566

** Note:-Here no decriptive conclusion is written here,I’m trying to show the calculations,charts,plots,matrices which are very much needed for analysing the whole dataset and the answers or solutions about the RESEARCH QUESTION:-What factors explain the difference in price between an economy ticket and a premium-economy airline ticket?**

** So,here is the end of Airline Pricing Project. Thank You!**