library(readxl)
## Warning: package 'readxl' was built under R version 4.3.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(car)
## Warning: package 'car' was built under R version 4.3.3
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.3.3
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
library(lmtest)
## Warning: package 'lmtest' was built under R version 4.3.3
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(sandwich)
## Warning: package 'sandwich' was built under R version 4.3.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
library(readxl)
thy_data <- read_excel("D:/MBA/MRP/data/thy_data.xlsx")
View(thy_data)
data <- read_excel("D:/MBA/MRP/data/thy_data.xlsx")
colnames(data) <- make.names(colnames(data))
data <- read_excel("D:/MBA/MRP/data/thy_data.xlsx")
colnames(data) <- make.names(colnames(data))
str(data)
## tibble [7 × 16] (S3: tbl_df/tbl/data.frame)
##  $ Year                : num [1:7] 2018 2019 2020 2021 2022 ...
##  $ Total_Revenue       : num [1:7] 12.86 13.23 6.73 10.69 18.43 ...
##  $ Net_Profit          : num [1:7] 753 788 -836 959 2725 ...
##  $ Total_Passengers    : num [1:7] 75.2 74.3 28 44.8 71.8 83.4 85.2
##  $ Load_Factor         : num [1:7] 82 81.6 71 67.9 80.6 82.6 82.2
##  $ Cargo_Revenue       : num [1:7] 1667 1688 2722 4015 3735 ...
##  $ Current_Ratio       : num [1:7] 0.87 0.8 0.65 0.73 0.88 0.94 1.01
##  $ Debt_to_Equity_Ratio: num [1:7] 2.07 1.95 3.1 1.95 1.76 0.75 0.62
##  $ Operating_Cash_Flow : num [1:7] 9613 13029 5603 49362 117012 ...
##  $ Total_Assets        : num [1:7] 109076 146871 187402 353708 578571 ...
##  $ Leased_Fleet_Percent: num [1:7] 85.8 87.4 82.4 80.5 77.7 73 70.5
##  $ Government_Support  : num [1:7] 414 488 1032 416 966 ...
##  $ GDP_Growth          : num [1:7] 20.8 15.6 16.8 44.6 106.2 ...
##  $ Inflation           : num [1:7] 20.3 11.8 14.6 36.1 64.3 ...
##  $ USD_TRY             : num [1:7] 5.26 5.94 7.34 12.98 18.7 ...
##  $ Stock_Return        : num [1:7] 1.91 -10.57 -9.65 55.88 599.6 ...
summary(data)
##       Year      Total_Revenue     Net_Profit     Total_Passengers
##  Min.   :2018   Min.   : 6.73   Min.   :-836.0   Min.   :28.0    
##  1st Qu.:2020   1st Qu.:11.78   1st Qu.: 770.5   1st Qu.:58.3    
##  Median :2021   Median :13.23   Median : 959.0   Median :74.3    
##  Mean   :2021   Mean   :15.08   Mean   :1976.4   Mean   :66.1    
##  3rd Qu.:2022   3rd Qu.:19.68   3rd Qu.:3075.0   3rd Qu.:79.3    
##  Max.   :2024   Max.   :22.67   Max.   :6021.0   Max.   :85.2    
##   Load_Factor    Cargo_Revenue  Current_Ratio   Debt_to_Equity_Ratio
##  Min.   :67.90   Min.   :1667   Min.   :0.650   Min.   :0.620       
##  1st Qu.:75.80   1st Qu.:2142   1st Qu.:0.765   1st Qu.:1.255       
##  Median :81.60   Median :2722   Median :0.870   Median :1.950       
##  Mean   :78.27   Mean   :2845   Mean   :0.840   Mean   :1.743       
##  3rd Qu.:82.10   3rd Qu.:3615   3rd Qu.:0.910   3rd Qu.:2.010       
##  Max.   :82.60   Max.   :4015   Max.   :1.010   Max.   :3.100       
##  Operating_Cash_Flow  Total_Assets     Leased_Fleet_Percent Government_Support
##  Min.   :  5603      Min.   : 109076   Min.   :70.50        Min.   : 414      
##  1st Qu.: 11321      1st Qu.: 167137   1st Qu.:75.35        1st Qu.: 452      
##  Median : 49362      Median : 353708   Median :80.50        Median : 966      
##  Mean   : 67890      Mean   : 546311   Mean   :79.61        Mean   :1927      
##  3rd Qu.:126296      3rd Qu.: 813757   3rd Qu.:84.10        3rd Qu.:1327      
##  Max.   :145032      Max.   :1399606   Max.   :87.40        Max.   :8551      
##    GDP_Growth       Inflation        USD_TRY       Stock_Return   
##  Min.   : 15.60   Min.   :11.84   Min.   : 5.26   Min.   :-10.57  
##  1st Qu.: 18.80   1st Qu.:17.45   1st Qu.: 6.64   1st Qu.: -3.87  
##  Median : 44.60   Median :36.08   Median :12.98   Median : 23.47  
##  Mean   : 49.34   Mean   :36.61   Mean   :16.41   Mean   :103.27  
##  3rd Qu.: 70.70   3rd Qu.:54.33   3rd Qu.:24.05   3rd Qu.: 59.06  
##  Max.   :106.20   Max.   :64.77   Max.   :35.22   Max.   :599.60
rev_2019 <- data$Total_Revenue[data$Year == 2019]
data$Revenue_Recovery <- data$Total_Revenue / rev_2019
pax_2019 <- data$Total_Passengers[data$Year == 2019]
data$Passenger_Recovery <- data$Total_Passengers / pax_2019
data <- data %>%
  mutate(
    z_revenue   = as.numeric(scale(Revenue_Recovery)),
    z_passenger = as.numeric(scale(Passenger_Recovery)),
    z_profit    = as.numeric(scale(Net_Profit)),
    z_cashflow  = as.numeric(scale(Operating_Cash_Flow))
  )
data$SRI <- rowMeans(
  cbind(
    data$z_revenue,
    data$z_passenger,
    data$z_profit,
    data$z_cashflow
  ),
  na.rm = TRUE
)
summary(data$SRI)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -1.3642 -0.4907 -0.3340  0.0000  0.7354  1.2089
model_H1 <- lm(
  SRI ~ Current_Ratio + GDP_Growth + Inflation + USD_TRY,
  data = data
)
summary(model_H1)
## 
## Call:
## lm(formula = SRI ~ Current_Ratio + GDP_Growth + Inflation + USD_TRY, 
##     data = data)
## 
## Residuals:
##         1         2         3         4         5         6         7 
## -0.211927  0.311734 -0.060252 -0.081475 -0.001843  0.127844 -0.084080 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -4.753794   1.117493  -4.254   0.0511 .
## Current_Ratio  4.850891   1.536302   3.158   0.0874 .
## GDP_Growth    -0.006698   0.013354  -0.502   0.6657  
## Inflation      0.023834   0.022778   1.046   0.4052  
## USD_TRY        0.008356   0.019791   0.422   0.7139  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2965 on 2 degrees of freedom
## Multiple R-squared:  0.9659, Adjusted R-squared:  0.8977 
## F-statistic: 14.16 on 4 and 2 DF,  p-value: 0.06705
model_H2 <- lm(
  SRI ~ Leased_Fleet_Percent + GDP_Growth + Inflation + USD_TRY,
  data = data
)
summary(model_H2)
## 
## Call:
## lm(formula = SRI ~ Leased_Fleet_Percent + GDP_Growth + Inflation + 
##     USD_TRY, data = data)
## 
## Residuals:
##        1        2        3        4        5        6        7 
##  0.24162 -0.10993  0.03294 -0.25340  0.03481  0.02093  0.03303 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)  
## (Intercept)          -28.146450   7.392580  -3.807   0.0626 .
## Leased_Fleet_Percent   0.303293   0.083506   3.632   0.0681 .
## GDP_Growth            -0.004424   0.011818  -0.374   0.7441  
## Inflation              0.030929   0.020423   1.514   0.2691  
## USD_TRY                0.188112   0.041707   4.510   0.0458 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2632 on 2 degrees of freedom
## Multiple R-squared:  0.9731, Adjusted R-squared:  0.9194 
## F-statistic:  18.1 on 4 and 2 DF,  p-value: 0.05303
model_H3 <- lm(
  SRI ~ Government_Support + GDP_Growth + Inflation + USD_TRY,
  data = data
)
summary(model_H3)
## 
## Call:
## lm(formula = SRI ~ Government_Support + GDP_Growth + Inflation + 
##     USD_TRY, data = data)
## 
## Residuals:
##        1        2        3        4        5        6        7 
##  0.37403  0.52515 -0.62244 -0.47342  0.02433  0.15428  0.01806 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)
## (Intercept)        -1.312e+00  6.940e-01  -1.890    0.199
## Government_Support  5.317e-06  5.071e-04   0.010    0.993
## GDP_Growth         -3.682e-03  5.699e-02  -0.065    0.954
## Inflation           2.096e-02  1.409e-01   0.149    0.895
## USD_TRY             4.363e-02  1.892e-01   0.231    0.839
## 
## Residual standard error: 0.7252 on 2 degrees of freedom
## Multiple R-squared:  0.7959, Adjusted R-squared:  0.3876 
## F-statistic: 1.949 on 4 and 2 DF,  p-value: 0.3666
full_model <- lm(
  SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support +
        Debt_to_Equity_Ratio + GDP_Growth + Inflation + USD_TRY,
  data = data
)
summary(full_model)
## 
## Call:
## lm(formula = SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support + 
##     Debt_to_Equity_Ratio + GDP_Growth + Inflation + USD_TRY, 
##     data = data)
## 
## Residuals:
## ALL 7 residuals are 0: no residual degrees of freedom!
## 
## Coefficients: (1 not defined because of singularities)
##                        Estimate Std. Error t value Pr(>|t|)
## (Intercept)          31.6105840        NaN     NaN      NaN
## Current_Ratio         8.5612880        NaN     NaN      NaN
## Leased_Fleet_Percent -0.4079986        NaN     NaN      NaN
## Government_Support   -0.0007125        NaN     NaN      NaN
## Debt_to_Equity_Ratio -0.8385289        NaN     NaN      NaN
## GDP_Growth            0.0679735        NaN     NaN      NaN
## Inflation            -0.1868351        NaN     NaN      NaN
## USD_TRY                      NA         NA      NA       NA
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 6 and 0 DF,  p-value: NA
alias(full_model)
## Model :
## SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support + 
##     Debt_to_Equity_Ratio + GDP_Growth + Inflation + USD_TRY
## 
## Complete :
##         (Intercept)          Current_Ratio        Leased_Fleet_Percent
## USD_TRY      46765677/146263 3448214474/136459775       -447647/125644
##         Government_Support   Debt_to_Equity_Ratio GDP_Growth          
## USD_TRY         -3445/989007  -569499402/81241069       884408/2206125
##         Inflation           
## USD_TRY         -31022/27195
full_model_final <- lm(
  SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support +
        Debt_to_Equity_Ratio + GDP_Growth + Inflation,
  data = data
)

summary(full_model_final)
## 
## Call:
## lm(formula = SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support + 
##     Debt_to_Equity_Ratio + GDP_Growth + Inflation, data = data)
## 
## Residuals:
## ALL 7 residuals are 0: no residual degrees of freedom!
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)
## (Intercept)          31.6105840        NaN     NaN      NaN
## Current_Ratio         8.5612880        NaN     NaN      NaN
## Leased_Fleet_Percent -0.4079986        NaN     NaN      NaN
## Government_Support   -0.0007125        NaN     NaN      NaN
## Debt_to_Equity_Ratio -0.8385289        NaN     NaN      NaN
## GDP_Growth            0.0679735        NaN     NaN      NaN
## Inflation            -0.1868351        NaN     NaN      NaN
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 6 and 0 DF,  p-value: NA
vif(full_model_final)
## Warning in cov2cor(v): diag(.) had 0 or NA entries; non-finite result is
## doubtful
##        Current_Ratio Leased_Fleet_Percent   Government_Support 
##                  NaN                  NaN                  NaN 
## Debt_to_Equity_Ratio           GDP_Growth            Inflation 
##                  NaN                  NaN                  NaN
bptest(full_model_final)
## 
##  studentized Breusch-Pagan test
## 
## data:  full_model_final
## BP = NaN, df = 6, p-value = NA
coeftest(full_model_final, vcov = vcovHC(full_model_final, type = "HC3"))
## Warning in meatHC(x, type = type, omega = omega): HC3 covariances are
## numerically unstable for hat values close to 1 (and undefined if exactly 1) as
## for observation(s) 1, 2, 3, 4, 5, 6, 7
## 
## z test of coefficients:
## 
##                         Estimate Std. Error z value Pr(>|z|)
## (Intercept)          31.61058396        NaN     NaN      NaN
## Current_Ratio         8.56128798        NaN     NaN      NaN
## Leased_Fleet_Percent -0.40799857        NaN     NaN      NaN
## Government_Support   -0.00071245        NaN     NaN      NaN
## Debt_to_Equity_Ratio -0.83852893        NaN     NaN      NaN
## GDP_Growth            0.06797355        NaN     NaN      NaN
## Inflation            -0.18683507        NaN     NaN      NaN
qqnorm(residuals(full_model_final))
qqline(residuals(full_model_final))

plot(full_model_final, which = 1)

summary(full_model_final)
## 
## Call:
## lm(formula = SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support + 
##     Debt_to_Equity_Ratio + GDP_Growth + Inflation, data = data)
## 
## Residuals:
## ALL 7 residuals are 0: no residual degrees of freedom!
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)
## (Intercept)          31.6105840        NaN     NaN      NaN
## Current_Ratio         8.5612880        NaN     NaN      NaN
## Leased_Fleet_Percent -0.4079986        NaN     NaN      NaN
## Government_Support   -0.0007125        NaN     NaN      NaN
## Debt_to_Equity_Ratio -0.8385289        NaN     NaN      NaN
## GDP_Growth            0.0679735        NaN     NaN      NaN
## Inflation            -0.1868351        NaN     NaN      NaN
## 
## Residual standard error: NaN on 0 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:    NaN 
## F-statistic:   NaN on 6 and 0 DF,  p-value: NA
final_model <- lm(
  SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support,
  data = data
)
summary(final_model)
## 
## Call:
## lm(formula = SRI ~ Current_Ratio + Leased_Fleet_Percent + Government_Support, 
##     data = data)
## 
## Residuals:
##         1         2         3         4         5         6         7 
## -0.282914  0.304671 -0.059900 -0.028548 -0.002824  0.079314 -0.009798 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)  
## (Intercept)           4.078e-01  2.523e+00   0.162   0.8818  
## Current_Ratio         6.360e+00  1.144e+00   5.560   0.0115 *
## Leased_Fleet_Percent -6.958e-02  2.490e-02  -2.795   0.0682 .
## Government_Support   -1.094e-04  5.253e-05  -2.082   0.1287  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2474 on 3 degrees of freedom
## Multiple R-squared:  0.9644, Adjusted R-squared:  0.9287 
## F-statistic: 27.06 on 3 and 3 DF,  p-value: 0.0113
vif(final_model)
##        Current_Ratio Leased_Fleet_Percent   Government_Support 
##             1.949191             2.408910             2.359442
bptest(final_model)
## 
##  studentized Breusch-Pagan test
## 
## data:  final_model
## BP = 6.5518, df = 3, p-value = 0.08764
coeftest(final_model, vcov = vcovHC(final_model, type = "HC1"))
## 
## t test of coefficients:
## 
##                         Estimate  Std. Error t value Pr(>|t|)   
## (Intercept)           0.40783498  3.47194552  0.1175 0.913914   
## Current_Ratio         6.35986526  1.06911483  5.9487 0.009499 **
## Leased_Fleet_Percent -0.06957689  0.03470000 -2.0051 0.138640   
## Government_Support   -0.00010940  0.00002291 -4.7750 0.017455 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dwtest(final_model)
## 
##  Durbin-Watson test
## 
## data:  final_model
## DW = 2.6924, p-value = 0.3593
## alternative hypothesis: true autocorrelation is greater than 0
qqnorm(residuals(final_model))
qqline(residuals(final_model))

plot(final_model)

## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced

## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced