Загружаем библиотеки и данные:

library(dplyr)
library(plm)
library(dynlm)
library(pglm)
library(readr)
library(dplyr)
library(tidyr)
library(ggplot2)
library(GGally)
library(sandwich)
library(lmtest)
library(car)
library(broom)
library(xtable)
library(ggpubr)
library(stargazer)
library(modelsummary)
library(haven)
library(readr)
library(margins)
library(ivreg)
library(readxl)

panel_data6 <- read_excel("panel_data6.xlsx")

Расчет корреляция между переменными

correlation_matrix <- cor(panel_data6)
print(correlation_matrix)
##                  Year            Id          FS          VOL           DL
## Year      1.000000000  0.000000e+00  0.05287655  0.012307931 -0.002389351
## Id        0.000000000  1.000000e+00 -0.02335167 -0.037888465  0.044661988
## FS        0.052876553 -2.335167e-02  1.00000000  0.597827535 -0.688492288
## VOL       0.012307931 -3.788846e-02  0.59782753  1.000000000 -0.404295468
## DL       -0.002389351  4.466199e-02 -0.68849229 -0.404295468  1.000000000
## Bin       0.049993012 -2.040071e-02  0.72944285  0.435067395 -0.573992470
## FS_L      0.053991540 -1.926151e-02  0.82945173  0.495024766 -0.629482233
## Age      -0.032119960 -1.303681e-02  0.07044426  0.038590550 -0.071024301
## Size      0.066822316 -9.521384e-03  0.80670959  0.467552078 -0.421261053
## VOL_ebit  0.014262081 -2.250004e-03  0.01809547  0.010281789 -0.032549661
## EPU       0.773087102  1.426114e-17  0.03833615  0.023572879 -0.009226967
## R        -0.948754294 -2.303481e-18 -0.04973552 -0.006200962  0.003233230
##                  Bin        FS_L         Age         Size     VOL_ebit
## Year      0.04999301  0.05399154 -0.03211996  0.066822316  0.014262081
## Id       -0.02040071 -0.01926151 -0.01303681 -0.009521384 -0.002250004
## FS        0.72944285  0.82945173  0.07044426  0.806709592  0.018095465
## VOL       0.43506740  0.49502477  0.03859055  0.467552078  0.010281789
## DL       -0.57399247 -0.62948223 -0.07102430 -0.421261053 -0.032549661
## Bin       1.00000000  0.98637119  0.07891028  0.632838418  0.053329389
## FS_L      0.98637119  1.00000000  0.07931454  0.705869182  0.047461179
## Age       0.07891028  0.07931454  1.00000000  0.015695064  0.015931936
## Size      0.63283842  0.70586918  0.01569506  1.000000000 -0.010124330
## VOL_ebit  0.05332939  0.04746118  0.01593194 -0.010124330  1.000000000
## EPU       0.05215859  0.05286706 -0.04540272  0.048248752  0.026489917
## R        -0.04233416 -0.04731749  0.03121915 -0.063350099 -0.002576494
##                    EPU             R
## Year      7.730871e-01 -9.487543e-01
## Id        1.426114e-17 -2.303481e-18
## FS        3.833615e-02 -4.973552e-02
## VOL       2.357288e-02 -6.200962e-03
## DL       -9.226967e-03  3.233230e-03
## Bin       5.215859e-02 -4.233416e-02
## FS_L      5.286706e-02 -4.731749e-02
## Age      -4.540272e-02  3.121915e-02
## Size      4.824875e-02 -6.335010e-02
## VOL_ebit  2.648992e-02 -2.576494e-03
## EPU       1.000000e+00 -8.273969e-01
## R        -8.273969e-01  1.000000e+00

Проверка 1 гипотезы Для VOL_Net_income

Модель Logit

#BIN
logit_model <- pglm(Bin ~ VOL + DL + Age + Size + EPU + R, data = panel_data6,
                       index = c("Id", "Year"), family = binomial(link = "logit"))
summary(logit_model)
## --------------------------------------------
## Maximum Likelihood estimation
## Newton-Raphson maximisation, 5 iterations
## Return code 8: successive function values within relative tolerance limit (reltol)
## Log-Likelihood: -255.5948 
## 8  free parameters
## Estimates:
##              Estimate Std. error t value  Pr(> t)    
## (Intercept) -45.28041    6.51179  -6.954 3.56e-12 ***
## VOL           0.19940    0.02888   6.905 5.01e-12 ***
## DL          -15.37166    1.83099  -8.395  < 2e-16 ***
## Age           0.09044    0.03831   2.361   0.0182 *  
## Size          9.04597    0.93286   9.697  < 2e-16 ***
## EPU           1.00058    0.63899   1.566   0.1174    
## R            10.63817   15.47305   0.688   0.4917    
## sigma        -0.49426    0.41195  -1.200   0.2302    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------

Модель Probit

#BIN
probit_model <- pglm(Bin ~ VOL + DL + Age + Size + EPU + R, data = panel_data6,
                        index = c("Id", "Year"), family = binomial(link = "probit"))
summary(probit_model)
## --------------------------------------------
## Maximum Likelihood estimation
## Newton-Raphson maximisation, 8 iterations
## Return code 8: successive function values within relative tolerance limit (reltol)
## Log-Likelihood: -252.9634 
## 8  free parameters
## Estimates:
##              Estimate Std. error t value  Pr(> t)    
## (Intercept) -24.59644    3.47577  -7.077 1.48e-12 ***
## VOL           0.10659    0.01545   6.897 5.30e-12 ***
## DL           -8.46827    0.95977  -8.823  < 2e-16 ***
## Age           0.04542    0.02057   2.207   0.0273 *  
## Size          4.94645    0.48376  10.225  < 2e-16 ***
## EPU           0.53978    0.34724   1.555   0.1201    
## R             5.94202    8.47603   0.701   0.4833    
## sigma         0.08594    0.68036   0.126   0.8995    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------

##Модель Probit оказалась лучше, так как Log-Likelihood: -252.9634 > -255.5948

Посмотрим на показатели AIC

aic_log <- AIC(logit_model)
aic_prob <- AIC(probit_model)
print(aic_log)
## [1] 527.1897
## attr(,"df")
## [1] 8
print(aic_prob)
## [1] 521.9269
## attr(,"df")
## [1] 8

##Модель probit лучше, так как у нее меньше AIC

Проверка 1 гипотезы Для VOL_ebitda

Модель Logit для VOL_ebitda

#BIN
logit_model1 <- pglm(Bin ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6,
                       index = c("Id", "Year"), family = binomial(link = "logit"))
summary(logit_model1)
## --------------------------------------------
## Maximum Likelihood estimation
## Newton-Raphson maximisation, 5 iterations
## Return code 1: gradient close to zero (gradtol)
## Log-Likelihood: -292.7823 
## 8  free parameters
## Estimates:
##              Estimate Std. error t value  Pr(> t)    
## (Intercept) -46.39065    6.10752  -7.596 3.06e-14 ***
## VOL_ebit      1.64396    0.76686   2.144  0.03205 *  
## DL          -17.13349    1.71082 -10.015  < 2e-16 ***
## Age           0.09874    0.03640   2.712  0.00668 ** 
## Size          9.78227    0.89981  10.871  < 2e-16 ***
## EPU           0.93693    0.60654   1.545  0.12241    
## R             7.54486   14.60559   0.517  0.60545    
## sigma        -0.56648    0.33227  -1.705  0.08822 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------

Модель Probit для VOL_ebitda

#BIN
probit_model1 <- pglm(Bin ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6,
                        index = c("Id", "Year"), family = binomial(link = "probit"))
summary(probit_model1)
## --------------------------------------------
## Maximum Likelihood estimation
## Newton-Raphson maximisation, 6 iterations
## Return code 8: successive function values within relative tolerance limit (reltol)
## Log-Likelihood: -288.3954 
## 8  free parameters
## Estimates:
##              Estimate Std. error t value  Pr(> t)    
## (Intercept) -25.27786    3.29877  -7.663 1.82e-14 ***
## VOL_ebit      0.87943    0.41191   2.135  0.03276 *  
## DL           -9.37589    0.90124 -10.403  < 2e-16 ***
## Age           0.05303    0.01944   2.728  0.00638 ** 
## Size          5.35293    0.46909  11.411  < 2e-16 ***
## EPU           0.49640    0.33201   1.495  0.13488    
## R             4.36320    8.01703   0.544  0.58628    
## sigma         0.15551    0.34392   0.452  0.65114    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------

##Модель Probit оказалась лучше, так как Log-Likelihood: -288.3954 > -292.7823

Посмотрим на показатели AIC

aic_log1 <- AIC(logit_model1)
aic_prob1 <- AIC(probit_model1)
print(aic_log1)
## [1] 601.5646
## attr(,"df")
## [1] 8
print(aic_prob1)
## [1] 592.7907
## attr(,"df")
## [1] 8

##Модель probit лучше, так как у нее меньше AIC

Сравним Probit модель для VOL_Net_income и Probit модель для VOL_ebitda

##Посмотрим на их Log-Likelihood: у VOL_Net_income = -252.9634 и VOL_ebitda = -288.3954

##Посмотрим на AIC: у VOL_Net_income = 521.9269 и VOL_ebitda = 592.7907

##В обоих случаях лучше модель Probit для VOL_Net_income

Проверка 2 гипотезы Для VOL_Net_income

Модель c фиксированными эффектами

fixed_model <- plm(FS_L ~ VOL + DL + Age + Size + EPU + R, data = panel_data6,
                           index = c("Id", "Year"))
summary(fixed_model)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = FS_L ~ VOL + DL + Age + Size + EPU + R, data = panel_data6, 
##     index = c("Id", "Year"))
## 
## Balanced Panel: n = 277, T = 5, N = 1385
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -2.770648 -0.565818  0.063558  0.650847  2.501138 
## 
## Coefficients:
##        Estimate Std. Error  t-value  Pr(>|t|)    
## VOL   0.0166384  0.0035097   4.7408 2.408e-06 ***
## DL   -5.9334948  0.3416567 -17.3668 < 2.2e-16 ***
## Age   0.0206435  0.0108567   1.9015    0.0575 .  
## Size  3.5565094  0.1522705  23.3565 < 2.2e-16 ***
## EPU   0.2079169  0.1558772   1.3339    0.1825    
## R     2.3576221  3.8977017   0.6049    0.5454    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    3350.5
## Residual Sum of Squares: 1239.5
## R-Squared:      0.63005
## Adj. R-Squared: 0.53538
## F-statistic: 312.801 on 6 and 1102 DF, p-value: < 2.22e-16

Модель c рандомными эффектами

random_model <- plm(FS_L ~ VOL + DL + Age + Size + EPU + R, data = panel_data6,
                            index = c("Id", "Year"), model = "random")
summary(random_model)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = FS_L ~ VOL + DL + Age + Size + EPU + R, data = panel_data6, 
##     model = "random", index = c("Id", "Year"))
## 
## Balanced Panel: n = 277, T = 5, N = 1385
## 
## Effects:
##                 var std.dev share
## idiosyncratic 1.125   1.061     1
## individual    0.000   0.000     0
## theta: 0
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -3.004432 -0.572643  0.085973  0.691253  2.428730 
## 
## Coefficients:
##                Estimate  Std. Error  z-value  Pr(>|z|)    
## (Intercept) -13.5907036   1.3419616 -10.1275 < 2.2e-16 ***
## VOL           0.0178069   0.0030513   5.8358 5.353e-09 ***
## DL           -6.0537615   0.2986816 -20.2683 < 2.2e-16 ***
## Age           0.0249392   0.0095760   2.6044  0.009205 ** 
## Size          3.4792210   0.1336340  26.0354 < 2.2e-16 ***
## EPU           0.2064565   0.1538730   1.3417  0.179683    
## R             2.2127793   3.8468403   0.5752  0.565143    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    4243.2
## Residual Sum of Squares: 1511.6
## R-Squared:      0.64377
## Adj. R-Squared: 0.64222
## Chisq: 2490.3 on 6 DF, p-value: < 2.22e-16

Посчитаем AIC aic2 <- AIC(fixed_model) aic22 <- AIC(random_model) print(aic2) print(aic22) У модели с фиксированными эффектами AIC лучше

Проверка 2 гипотезы Для VOL_ebitda

Модель c фиксированными эффектами

fixed_model2 <- plm(FS_L ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6,
                           index = c("Id", "Year"))
summary(fixed_model2)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = FS_L ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6, 
##     index = c("Id", "Year"))
## 
## Balanced Panel: n = 277, T = 5, N = 1385
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -2.879216 -0.557168  0.077876  0.623760  2.694895 
## 
## Coefficients:
##           Estimate Std. Error  t-value  Pr(>|t|)    
## VOL_ebit  0.604961   0.213579   2.8325  0.004703 ** 
## DL       -6.324018   0.331457 -19.0795 < 2.2e-16 ***
## Age       0.021334   0.010926   1.9527  0.051112 .  
## Size      3.822555   0.143194  26.6948 < 2.2e-16 ***
## EPU       0.219095   0.156918   1.3962  0.162924    
## R         2.848724   3.921000   0.7265  0.467668    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    3350.5
## Residual Sum of Squares: 1255.6
## R-Squared:      0.62524
## Adj. R-Squared: 0.52934
## F-statistic: 306.42 on 6 and 1102 DF, p-value: < 2.22e-16

Модель c рандомными эффектами

random_model2 <- plm(FS_L ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6,
                            index = c("Id", "Year"), model = "random")
summary(random_model2)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = FS_L ~ VOL_ebit + DL + Age + Size + EPU + R, data = panel_data6, 
##     model = "random", index = c("Id", "Year"))
## 
## Balanced Panel: n = 277, T = 5, N = 1385
## 
## Effects:
##                 var std.dev share
## idiosyncratic 1.139   1.067     1
## individual    0.000   0.000     0
## theta: 0
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -3.105963 -0.514824  0.084386  0.669658  2.620826 
## 
## Coefficients:
##                Estimate  Std. Error  z-value  Pr(>|z|)    
## (Intercept) -14.8483516   1.3386657 -11.0919 < 2.2e-16 ***
## VOL_ebit      0.4457952   0.1900436   2.3458  0.018989 *  
## DL           -6.4732643   0.2919179 -22.1749 < 2.2e-16 ***
## Age           0.0256291   0.0096737   2.6494  0.008065 ** 
## Size          3.7673214   0.1260135  29.8962 < 2.2e-16 ***
## EPU           0.2255714   0.1554807   1.4508  0.146835    
## R             2.8847121   3.8848064   0.7426  0.457747    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    4243.2
## Residual Sum of Squares: 1542.8
## R-Squared:      0.63642
## Adj. R-Squared: 0.63484
## Chisq: 2412.08 on 6 DF, p-value: < 2.22e-16

Посчитаем AIC aic3 <- AIC(fixed_model2) aic33 <- AIC(random_model2) print(aic3) print(aic33) У модели с фиксированными эффектами AIC лучше

Сравним модели с фиксированными эффектами для VOL_Net_income и VOL_ebitda aic2 <- AIC(fixed_model) aic3 <- AIC(fixed_model2) print(aic2) print(aic3) У модели VOL_Net_income с фиксированными эффектами AIC лучше