Load in data

bankruptcy <- read.csv("https://raw.githubusercontent.com/cmm6/data608/main/bankruptcy.csv", header=TRUE, sep = ",")
#bankruptcy <- read.csv("bankruptcy.csv", header=TRUE, sep = ",")

Data Exploration

Then we’ll take a look at the dataset.

head(bankruptcy)
##   Bankrupt. ROA.C..before.interest.and.depreciation.before.interest
## 1         1                                               0.3705943
## 2         1                                               0.4642909
## 3         1                                               0.4260713
## 4         1                                               0.3998440
## 5         1                                               0.4650222
## 6         1                                               0.3886803
##   ROA.A..before.interest.and...after.tax
## 1                              0.4243894
## 2                              0.5382141
## 3                              0.4990188
## 4                              0.4512647
## 5                              0.5384322
## 6                              0.4151766
##   ROA.B..before.interest.and.depreciation.after.tax Operating.Gross.Margin
## 1                                         0.4057498              0.6014572
## 2                                         0.5167300              0.6102351
## 3                                         0.4722951              0.6014500
## 4                                         0.4577333              0.5835411
## 5                                         0.5222978              0.5987835
## 6                                         0.4191338              0.5901714
##   Realized.Sales.Gross.Margin Operating.Profit.Rate Pre.tax.net.Interest.Rate
## 1                   0.6014572             0.9989692                 0.7968871
## 2                   0.6102351             0.9989460                 0.7973802
## 3                   0.6013635             0.9988574                 0.7964034
## 4                   0.5835411             0.9986997                 0.7969670
## 5                   0.5987835             0.9989731                 0.7973661
## 6                   0.5902507             0.9987581                 0.7969032
##   After.tax.net.Interest.Rate Non.industry.income.and.expenditure.revenue
## 1                   0.8088094                                   0.3026464
## 2                   0.8093007                                   0.3035564
## 3                   0.8083875                                   0.3020352
## 4                   0.8089656                                   0.3033495
## 5                   0.8093037                                   0.3034750
## 6                   0.8087706                                   0.3031158
##   Continuous.interest.rate..after.tax. Operating.Expense.Rate
## 1                            0.7809849           1.256969e-04
## 2                            0.7815060           2.897851e-04
## 3                            0.7802839           2.361297e-04
## 4                            0.7812410           1.078888e-04
## 5                            0.7815500           7.890000e+09
## 6                            0.7810691           1.571500e-04
##   Research.and.development.expense.rate Cash.flow.rate
## 1                                     0      0.4581431
## 2                                     0      0.4618673
## 3                              25500000      0.4585206
## 4                                     0      0.4657054
## 5                                     0      0.4627463
## 6                                     0      0.4658615
##   Interest.bearing.debt.interest.rate Tax.rate..A. Net.Value.Per.Share..B.
## 1                        0.0007250725            0               0.1479499
## 2                        0.0006470647            0               0.1822511
## 3                        0.0007900790            0               0.1779107
## 4                        0.0004490449            0               0.1541865
## 5                        0.0006860686            0               0.1675024
## 6                        0.0007160716            0               0.1555771
##   Net.Value.Per.Share..A. Net.Value.Per.Share..C.
## 1               0.1479499               0.1479499
## 2               0.1822511               0.1822511
## 3               0.1779107               0.1937129
## 4               0.1541865               0.1541865
## 5               0.1675024               0.1675024
## 6               0.1555771               0.1555771
##   Persistent.EPS.in.the.Last.Four.Seasons Cash.Flow.Per.Share
## 1                               0.1691406           0.3116644
## 2                               0.2089439           0.3181368
## 3                               0.1805805           0.3071019
## 4                               0.1937222           0.3216736
## 5                               0.2125366           0.3191625
## 6                               0.1744351           0.3253873
##   Revenue.Per.Share..Yuan.Â.. Operating.Profit.Per.Share..Yuan.Â..
## 1                 0.017559780                           0.09592053
## 2                 0.021144335                           0.09372201
## 3                 0.005944008                           0.09233776
## 4                 0.014368468                           0.07776240
## 5                 0.029689792                           0.09689765
## 6                 0.018104270                           0.07808810
##   Per.Share.Net.profit.before.tax..Yuan.Â..
## 1                                 0.1387362
## 2                                 0.1699179
## 3                                 0.1428033
## 4                                 0.1486028
## 5                                 0.1684115
## 6                                 0.1388115
##   Realized.Sales.Gross.Profit.Growth.Rate Operating.Profit.Growth.Rate
## 1                              0.02210228                    0.8481950
## 2                              0.02208017                    0.8480879
## 3                              0.02276010                    0.8480940
## 4                              0.02204607                    0.8480055
## 5                              0.02209591                    0.8482582
## 6                              0.02156494                    0.8479828
##   After.tax.Net.Profit.Growth.Rate Regular.Net.Profit.Growth.Rate
## 1                        0.6889795                      0.6889795
## 2                        0.6896929                      0.6897017
## 3                        0.6894627                      0.6894697
## 4                        0.6891095                      0.6891095
## 5                        0.6896969                      0.6896969
## 6                        0.6891051                      0.6891775
##   Continuous.Net.Profit.Growth.Rate Total.Asset.Growth.Rate
## 1                         0.2175354                4.98e+09
## 2                         0.2176196                6.11e+09
## 3                         0.2176013                7.28e+09
## 4                         0.2175682                4.88e+09
## 5                         0.2176256                5.51e+09
## 6                         0.2175664                6.08e+08
##   Net.Value.Growth.Rate Total.Asset.Return.Growth.Rate.Ratio
## 1          0.0003269773                            0.2631000
## 2          0.0004430401                            0.2645158
## 3          0.0003964253                            0.2641840
## 4          0.0003824259                            0.2633712
## 5          0.0004389476                            0.2652182
## 6          0.0003517819                            0.2632500
##   Cash.Reinvestment.. Current.Ratio  Quick.Ratio Interest.Expense.Ratio
## 1           0.3637253   0.002258963 0.0012077551              0.6299513
## 2           0.3767091   0.006016206 0.0040393668              0.6351725
## 3           0.3689132   0.011542554 0.0053475602              0.6296314
## 4           0.3840766   0.004194059 0.0028964911              0.6302284
## 5           0.3796897   0.006022446 0.0037274466              0.6360550
## 6           0.3880258   0.002740085 0.0008546614              0.6301838
##   Total.debt.Total.net.worth Debt.ratio.. Net.worth.Assets
## 1                0.021265924    0.2075763        0.7924237
## 2                0.012502394    0.1711763        0.8288237
## 3                0.021247686    0.2075158        0.7924842
## 4                0.009572402    0.1514648        0.8485352
## 5                0.005149600    0.1065091        0.8934909
## 6                0.014213152    0.1804275        0.8195725
##   Long.term.fund.suitability.ratio..A. Borrowing.dependency
## 1                          0.005024455            0.3902844
## 2                          0.005058882            0.3767600
## 3                          0.005099899            0.3790929
## 4                          0.005046924            0.3797427
## 5                          0.005303319            0.3750254
## 6                          0.004913193            0.3814482
##   Contingent.liabilities.Net.worth Operating.profit.Paid.in.capital
## 1                      0.006478502                       0.09588483
## 2                      0.005835039                       0.09374338
## 3                      0.006561982                       0.09231847
## 4                      0.005365848                       0.07772729
## 5                      0.006623525                       0.09692706
## 6                      0.005749123                       0.07810185
##   Net.profit.before.tax.Paid.in.capital
## 1                             0.1377573
## 2                             0.1689616
## 3                             0.1480356
## 4                             0.1475605
## 5                             0.1674610
## 6                             0.1378252
##   Inventory.and.accounts.receivable.Net.value Total.Asset.Turnover
## 1                                   0.3980357           0.08695652
## 2                                   0.3977249           0.06446777
## 3                                   0.4065805           0.01499250
## 4                                   0.3979245           0.08995502
## 5                                   0.4000788           0.17541229
## 6                                   0.4004191           0.09595202
##   Accounts.Receivable.Turnover Average.Collection.Days
## 1                  0.001813884             0.003487364
## 2                  0.001286356             0.004916808
## 3                  0.001495338             0.004226849
## 4                  0.001966056             0.003214967
## 5                  0.001448673             0.004366891
## 6                  0.001527802             0.004137189
##   Inventory.Turnover.Rate..times. Fixed.Assets.Turnover.Frequency
## 1                    1.820926e-04                    1.165007e-04
## 2                    9.360000e+09                    7.190000e+08
## 3                    6.500000e+07                    2.650000e+09
## 4                    7.130000e+09                    9.150000e+09
## 5                    1.633674e-04                    2.935211e-04
## 6                    6.500000e+08                    9.300000e+09
##   Net.Worth.Turnover.Rate..times. Revenue.per.person
## 1                      0.03290323        0.034164182
## 2                      0.02548387        0.006888651
## 3                      0.01338710        0.028996960
## 4                      0.02806452        0.015463478
## 5                      0.04016129        0.058111423
## 6                      0.02967742        0.021300471
##   Operating.profit.per.person Allocation.rate.per.person
## 1                   0.3929129                 0.03713530
## 2                   0.3915900                 0.01233497
## 3                   0.3819678                 0.14101631
## 4                   0.3784966                 0.02131999
## 5                   0.3943715                 0.02398821
## 6                   0.3775695                 0.03282877
##   Working.Capital.to.Total.Assets Quick.Assets.Total.Assets
## 1                       0.6727753                0.16667296
## 2                       0.7511109                0.12723600
## 3                       0.8295019                0.34020088
## 4                       0.7257542                0.16157453
## 5                       0.7518225                0.26032988
## 6                       0.6867286                0.08026371
##   Current.Assets.Total.Assets Cash.Total.Assets Quick.Assets.Current.Liability
## 1                   0.1906430      0.0040944060                    0.001996771
## 2                   0.1824191      0.0149477270                    0.004136030
## 3                   0.6028057      0.0009909445                    0.006302481
## 4                   0.2258149      0.0188506248                    0.002961238
## 5                   0.3583802      0.0141609738                    0.004274771
## 6                   0.2145360      0.0026452256                    0.000988425
##   Cash.Current.Liability Current.Liability.to.Assets
## 1           1.473360e-04                  0.14730845
## 2           1.383910e-03                  0.05696283
## 3           5.340000e+09                  0.09816206
## 4           1.010646e-03                  0.09871463
## 5           6.804636e-04                  0.11019485
## 6           1.008563e-04                  0.13900211
##   Operating.Funds.to.Liability Inventory.Working.Capital
## 1                    0.3340152                 0.2769202
## 2                    0.3411060                 0.2896416
## 3                    0.3367315                 0.2774555
## 4                    0.3487164                 0.2765803
## 5                    0.3446388                 0.2879127
## 6                    0.3505631                 0.2766785
##   Inventory.Current.Liability Current.Liabilities.Liability
## 1                 0.001035990                     0.6762692
## 2                 0.005209682                     0.3085886
## 3                 0.013878786                     0.4460275
## 4                 0.003540148                     0.6158484
## 5                 0.004868570                     0.9750066
## 6                 0.004879131                     0.7333519
##   Working.Capital.Equity Current.Liabilities.Equity
## 1              0.7212746                  0.3390770
## 2              0.7319753                  0.3297401
## 3              0.7427286                  0.3347769
## 4              0.7298249                  0.3315090
## 5              0.7319996                  0.3307263
## 6              0.7252016                  0.3355344
##   Long.term.Liability.to.Current.Assets Retained.Earnings.to.Total.Assets
## 1                           0.025592368                         0.9032248
## 2                           0.023946819                         0.9310652
## 3                           0.003715116                         0.9099034
## 4                           0.022165200                         0.9069022
## 5                           0.000000000                         0.9138502
## 6                           0.003772505                         0.9030413
##   Total.income.Total.expense Total.expense.Assets Current.Asset.Turnover.Rate
## 1                0.002021613           0.06485571                7.010000e+08
## 2                0.002225608           0.02551586                1.065198e-04
## 3                0.002060071           0.02138743                1.791094e-03
## 4                0.001831359           0.02416107                8.140000e+09
## 5                0.002223930           0.02638525                6.680000e+09
## 6                0.001865609           0.04009362                8.010000e+09
##   Quick.Asset.Turnover.Rate Working.capitcal.Turnover.Rate Cash.Turnover.Rate
## 1              6.550000e+09                      0.5938305           4.58e+08
## 2              7.700000e+09                      0.5939155           2.49e+09
## 3              1.022676e-03                      0.5945019           7.61e+08
## 4              6.050000e+09                      0.5938888           2.03e+09
## 5              5.050000e+09                      0.5939153           8.24e+08
## 6              2.810000e+09                      0.5938458           2.95e+08
##   Cash.Flow.to.Sales Fixed.Assets.to.Assets Current.Liability.to.Liability
## 1          0.6715677              0.4242058                      0.6762692
## 2          0.6715699              0.4688281                      0.3085886
## 3          0.6715713              0.2761792                      0.4460275
## 4          0.6715192              0.5591440                      0.6158484
## 5          0.6715631              0.3095549                      0.9750066
## 6          0.6715676              0.6031935                      0.7333519
##   Current.Liability.to.Equity Equity.to.Long.term.Liability
## 1                   0.3390770                     0.1265495
## 2                   0.3297401                     0.1209161
## 3                   0.3347769                     0.1179223
## 4                   0.3315090                     0.1207605
## 5                   0.3307263                     0.1109332
## 6                   0.3355344                     0.1129172
##   Cash.Flow.to.Total.Assets Cash.Flow.to.Liability CFO.to.Assets
## 1                 0.6375554              0.4586091     0.5203819
## 2                 0.6411000              0.4590011     0.5671013
## 3                 0.6427646              0.4592540     0.5384905
## 4                 0.5790393              0.4485179     0.6041051
## 5                 0.6223741              0.4544109     0.5784689
## 6                 0.6374698              0.4584993     0.6221901
##   Cash.Flow.to.Equity Current.Liability.to.Current.Assets Liability.Assets.Flag
## 1           0.3129049                          0.11825048                     0
## 2           0.3141631                          0.04777528                     0
## 3           0.3145154                          0.02534649                     0
## 4           0.3023823                          0.06724962                     0
## 5           0.3115672                          0.04772537                     0
## 6           0.3132685                          0.09952193                     0
##   Net.Income.to.Total.Assets Total.assets.to.GNP.price No.credit.Interval
## 1                  0.7168453               0.009219440          0.6228790
## 2                  0.7952971               0.008323302          0.6236517
## 3                  0.7746697               0.040002853          0.6238410
## 4                  0.7395545               0.003252475          0.6229287
## 5                  0.7950159               0.003877563          0.6235207
## 6                  0.7104205               0.005277875          0.6226046
##   Gross.Profit.to.Sales Net.Income.to.Stockholder.s.Equity Liability.to.Equity
## 1             0.6014533                          0.8278902           0.2902019
## 2             0.6102365                          0.8399693           0.2838460
## 3             0.6014493                          0.8367743           0.2901885
## 4             0.5835376                          0.8346971           0.2817212
## 5             0.5987815                          0.8399727           0.2785138
## 6             0.5901723                          0.8299390           0.2850871
##   Degree.of.Financial.Leverage..DFL.
## 1                         0.02660063
## 2                         0.26457682
## 3                         0.02655472
## 4                         0.02669663
## 5                         0.02475185
## 6                         0.02667537
##   Interest.Coverage.Ratio..Interest.expense.to.EBIT. Net.Income.Flag
## 1                                          0.5640501               1
## 2                                          0.5701749               1
## 3                                          0.5637061               1
## 4                                          0.5646634               1
## 5                                          0.5756166               1
## 6                                          0.5645383               1
##   Equity.to.Liability
## 1          0.01646874
## 2          0.02079431
## 3          0.01647411
## 4          0.02398233
## 5          0.03549020
## 6          0.01953448
#summary(bankruptcy)
#is.na(bankruptcy)
#str(bankruptcy)

First Impression :

The dataset has a combination of 6819 observations per each of 96 features. The data has 93 numerical features and 2 categorical features (Net.Income.Flag column only has one unique value). *The data looks clean without any missing data or null values.

Visualization

So we move on to plot some graphs to understand the data better to check for the distribution and potential outliers.

colnames(bankruptcy)[1] <- 'Bankrupt' #readbility purpose

Correlation

cor.matrix<-as.matrix(cor(bankruptcy))
correlation<-sort(cor.matrix[2:95],decreasing = T)

data1<-bankruptcy[,-95]
correlationMatrix <-cor(data1[,1:94])

hist1 = ggplot(bankruptcy, aes(Bankrupt,)) + geom_bar(fill=c("Green","Red")) + theme_bw()+ggtitle("Survive(0) VS Bankruptcy(1)")+theme(plot.title = element_text(hjust = 0.5))+xlab("Survive(0)                              Bankruptcy(1)")
corr1 = GGally::ggcorr(bankruptcy[,1:20],size=2,hjust=1)+geom_point()+scale_alpha_manual()+guides()
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
corr2 = corrplot(corr=correlationMatrix, tl.cex=0.1)

The plot shows the correlation between each features.

Outliers

bankruptcy$Bankrupt <- factor(bankruptcy$Bankrupt , levels = c(0,1) ,labels = c('NO' , 'YES'))
bankruptcy %>% dplyr::select(where(is.numeric)) %>% multi.hist()

table(bankruptcy$Bankrupt)
## 
##   NO  YES 
## 6599  220
prop.table(table(bankruptcy$Bankrupt))
## 
##        NO       YES 
## 0.9677372 0.0322628
barplot(table(bankruptcy$Bankrupt),col = c("#eb8060", "#b9e38d"),
       main="Frequency of Bankrutcy",
       xlab="Bankruptcy Tag",
       ylab="Number of Companies")

Out of the 6819 comapnies, 6599(97%) did not go bankrupt and 220(3%) went bankrupt. We see it’s highly class imbalanced - will want to play with downsampling/upsampling in some of our model development or we might have to overfit the data.

Data Preparation

From out exploration, Net.Income.Flag act as a noise so it will be dropped.

bankruptcy.clean <- bankruptcy[,-95]

Normalize our data

normalize <- function(x){
  return((x-min(x))/(max(x)-min(x)))
}

bankruptcy.clean <- as.data.frame(lapply(bankruptcy.clean[,2:94],normalize))
bankruptcy.clean <- as.data.frame(cbind(bankruptcy$Bankrupt, bankruptcy.clean))
colnames(bankruptcy.clean)[1] <- 'Bankrupt'

Check to make sure there is no missing data

is_missing <- function(x){
  missing_strs <- c('', 'null', 'na', 'nan', 'inf', '-inf', '-9', 'unknown', 'missing')
  ifelse((is.na(x) | is.nan(x) | is.infinite(x)), TRUE,
         ifelse(trimws(tolower(x)) %in% missing_strs, TRUE, FALSE))
}

missing_summary<-summarise_all(bankruptcy.clean, ~(sum(is_missing(.) / nrow(bankruptcy.clean))))

stack(sort(missing_summary, decreasing = TRUE))
##    values                                                     ind
## 1       0                                                Bankrupt
## 2       0 ROA.C..before.interest.and.depreciation.before.interest
## 3       0                  ROA.A..before.interest.and...after.tax
## 4       0       ROA.B..before.interest.and.depreciation.after.tax
## 5       0                                  Operating.Gross.Margin
## 6       0                             Realized.Sales.Gross.Margin
## 7       0                                   Operating.Profit.Rate
## 8       0                               Pre.tax.net.Interest.Rate
## 9       0                             After.tax.net.Interest.Rate
## 10      0             Non.industry.income.and.expenditure.revenue
## 11      0                    Continuous.interest.rate..after.tax.
## 12      0                                  Operating.Expense.Rate
## 13      0                   Research.and.development.expense.rate
## 14      0                                          Cash.flow.rate
## 15      0                     Interest.bearing.debt.interest.rate
## 16      0                                            Tax.rate..A.
## 17      0                                 Net.Value.Per.Share..B.
## 18      0                                 Net.Value.Per.Share..A.
## 19      0                                 Net.Value.Per.Share..C.
## 20      0                 Persistent.EPS.in.the.Last.Four.Seasons
## 21      0                                     Cash.Flow.Per.Share
## 22      0                             Revenue.Per.Share..Yuan.Â..
## 23      0                    Operating.Profit.Per.Share..Yuan.Â..
## 24      0               Per.Share.Net.profit.before.tax..Yuan.Â..
## 25      0                 Realized.Sales.Gross.Profit.Growth.Rate
## 26      0                            Operating.Profit.Growth.Rate
## 27      0                        After.tax.Net.Profit.Growth.Rate
## 28      0                          Regular.Net.Profit.Growth.Rate
## 29      0                       Continuous.Net.Profit.Growth.Rate
## 30      0                                 Total.Asset.Growth.Rate
## 31      0                                   Net.Value.Growth.Rate
## 32      0                    Total.Asset.Return.Growth.Rate.Ratio
## 33      0                                     Cash.Reinvestment..
## 34      0                                           Current.Ratio
## 35      0                                             Quick.Ratio
## 36      0                                  Interest.Expense.Ratio
## 37      0                              Total.debt.Total.net.worth
## 38      0                                            Debt.ratio..
## 39      0                                        Net.worth.Assets
## 40      0                    Long.term.fund.suitability.ratio..A.
## 41      0                                    Borrowing.dependency
## 42      0                        Contingent.liabilities.Net.worth
## 43      0                        Operating.profit.Paid.in.capital
## 44      0                   Net.profit.before.tax.Paid.in.capital
## 45      0             Inventory.and.accounts.receivable.Net.value
## 46      0                                    Total.Asset.Turnover
## 47      0                            Accounts.Receivable.Turnover
## 48      0                                 Average.Collection.Days
## 49      0                         Inventory.Turnover.Rate..times.
## 50      0                         Fixed.Assets.Turnover.Frequency
## 51      0                         Net.Worth.Turnover.Rate..times.
## 52      0                                      Revenue.per.person
## 53      0                             Operating.profit.per.person
## 54      0                              Allocation.rate.per.person
## 55      0                         Working.Capital.to.Total.Assets
## 56      0                               Quick.Assets.Total.Assets
## 57      0                             Current.Assets.Total.Assets
## 58      0                                       Cash.Total.Assets
## 59      0                          Quick.Assets.Current.Liability
## 60      0                                  Cash.Current.Liability
## 61      0                             Current.Liability.to.Assets
## 62      0                            Operating.Funds.to.Liability
## 63      0                               Inventory.Working.Capital
## 64      0                             Inventory.Current.Liability
## 65      0                           Current.Liabilities.Liability
## 66      0                                  Working.Capital.Equity
## 67      0                              Current.Liabilities.Equity
## 68      0                   Long.term.Liability.to.Current.Assets
## 69      0                       Retained.Earnings.to.Total.Assets
## 70      0                              Total.income.Total.expense
## 71      0                                    Total.expense.Assets
## 72      0                             Current.Asset.Turnover.Rate
## 73      0                               Quick.Asset.Turnover.Rate
## 74      0                          Working.capitcal.Turnover.Rate
## 75      0                                      Cash.Turnover.Rate
## 76      0                                      Cash.Flow.to.Sales
## 77      0                                  Fixed.Assets.to.Assets
## 78      0                          Current.Liability.to.Liability
## 79      0                             Current.Liability.to.Equity
## 80      0                           Equity.to.Long.term.Liability
## 81      0                               Cash.Flow.to.Total.Assets
## 82      0                                  Cash.Flow.to.Liability
## 83      0                                           CFO.to.Assets
## 84      0                                     Cash.Flow.to.Equity
## 85      0                     Current.Liability.to.Current.Assets
## 86      0                                   Liability.Assets.Flag
## 87      0                              Net.Income.to.Total.Assets
## 88      0                               Total.assets.to.GNP.price
## 89      0                                      No.credit.Interval
## 90      0                                   Gross.Profit.to.Sales
## 91      0                      Net.Income.to.Stockholder.s.Equity
## 92      0                                     Liability.to.Equity
## 93      0                      Degree.of.Financial.Leverage..DFL.
## 94      0      Interest.Coverage.Ratio..Interest.expense.to.EBIT.

Prepare data

set.seed(1)
#divide into training and testing data
inTrain <- createDataPartition(bankruptcy.clean$Bankrupt, p = .75, list = F)#training set 75%
training_set <- bankruptcy.clean[ inTrain, ]
test_set  <- bankruptcy.clean[-inTrain, ]

Model Development

logit_1 <- glm(Bankrupt~., family = binomial,data = training_set)

summary(logit_1)
## 
## Call:
## glm(formula = Bankrupt ~ ., family = binomial, data = training_set)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
##  -8.49    0.00    0.00    0.00    8.49  
## 
## Coefficients: (3 not defined because of singularities)
##                                                           Estimate Std. Error
## (Intercept)                                              2.171e+23  5.269e+15
## ROA.C..before.interest.and.depreciation.before.interest -5.858e+15  1.444e+08
## ROA.A..before.interest.and...after.tax                   3.513e+16  1.133e+08
## ROA.B..before.interest.and.depreciation.after.tax       -3.018e+15  1.799e+08
## Operating.Gross.Margin                                   1.528e+19  4.555e+11
## Realized.Sales.Gross.Margin                             -3.958e+16  1.861e+09
## Operating.Profit.Rate                                   -1.891e+21  1.636e+13
## Pre.tax.net.Interest.Rate                                1.576e+21  1.366e+13
## After.tax.net.Interest.Rate                             -5.871e+17  7.603e+09
## Non.industry.income.and.expenditure.revenue             -9.025e+20  7.821e+12
## Continuous.interest.rate..after.tax.                     2.630e+18  5.781e+09
## Operating.Expense.Rate                                   3.386e+14  3.270e+06
## Research.and.development.expense.rate                    3.463e+14  3.796e+06
## Cash.flow.rate                                           2.346e+16  2.061e+08
## Interest.bearing.debt.interest.rate                     -1.033e+14  8.786e+06
## Tax.rate..A.                                             4.522e+14  7.761e+06
## Net.Value.Per.Share..B.                                 -5.321e+16  6.952e+08
## Net.Value.Per.Share..A.                                  2.914e+16  2.127e+09
## Net.Value.Per.Share..C.                                  2.276e+16  2.012e+09
## Persistent.EPS.in.the.Last.Four.Seasons                 -2.289e+16  2.435e+08
## Cash.Flow.Per.Share                                      4.459e+15  1.104e+08
## Revenue.Per.Share..Yuan.Â..                             -3.388e+16  2.124e+08
## Operating.Profit.Per.Share..Yuan.Â..                     3.364e+16  9.902e+08
## Per.Share.Net.profit.before.tax..Yuan.Â..               -1.457e+16  1.316e+08
## Realized.Sales.Gross.Profit.Growth.Rate                 -5.167e+17  6.937e+07
## Operating.Profit.Growth.Rate                            -2.881e+16  3.063e+08
## After.tax.Net.Profit.Growth.Rate                        -1.481e+19  6.835e+08
## Regular.Net.Profit.Growth.Rate                           1.481e+19  6.773e+08
## Continuous.Net.Profit.Growth.Rate                       -2.164e+17  8.190e+07
## Total.Asset.Growth.Rate                                  9.233e+13  3.502e+06
## Net.Value.Growth.Rate                                    8.069e+16  1.051e+09
## Total.Asset.Return.Growth.Rate.Ratio                    -5.473e+15  1.296e+08
## Cash.Reinvestment..                                      3.683e+15  8.877e+07
## Current.Ratio                                            4.065e+15  8.405e+07
## Quick.Ratio                                             -3.829e+15  4.882e+07
## Interest.Expense.Ratio                                  -4.530e+15  1.072e+08
## Total.debt.Total.net.worth                              -6.719e+15  7.104e+07
## Debt.ratio..                                             2.409e+16  9.393e+07
## Net.worth.Assets                                                NA         NA
## Long.term.fund.suitability.ratio..A.                    -4.157e+15  3.782e+07
## Borrowing.dependency                                     2.030e+16  3.741e+08
## Contingent.liabilities.Net.worth                         7.822e+15  2.609e+08
## Operating.profit.Paid.in.capital                        -9.573e+15  9.959e+08
## Net.profit.before.tax.Paid.in.capital                    7.962e+15  2.715e+08
## Inventory.and.accounts.receivable.Net.value              4.701e+15  4.380e+08
## Total.Asset.Turnover                                     1.963e+15  2.510e+07
## Accounts.Receivable.Turnover                            -1.767e+16  4.323e+07
## Average.Collection.Days                                 -1.001e+16  4.553e+07
## Inventory.Turnover.Rate..times.                         -8.249e+13  3.083e+06
## Fixed.Assets.Turnover.Frequency                          3.059e+14  4.417e+06
## Net.Worth.Turnover.Rate..times.                         -1.566e+16  7.299e+07
## Revenue.per.person                                      -5.536e+15  2.204e+08
## Operating.profit.per.person                              4.120e+14  3.990e+07
## Allocation.rate.per.person                              -1.154e+15  3.441e+07
## Working.Capital.to.Total.Assets                         -2.875e+23  7.006e+15
## Quick.Assets.Total.Assets                                9.928e+14  1.041e+07
## Current.Assets.Total.Assets                              7.876e+22  1.919e+15
## Cash.Total.Assets                                       -1.137e+15  1.195e+07
## Quick.Assets.Current.Liability                           6.028e+14  6.747e+07
## Cash.Current.Liability                                   4.744e+14  1.754e+07
## Current.Liability.to.Assets                             -2.565e+23  6.250e+15
## Operating.Funds.to.Liability                            -5.418e+13  9.064e+07
## Inventory.Working.Capital                               -5.422e+15  8.654e+07
## Inventory.Current.Liability                             -1.336e+15  1.698e+07
## Current.Liabilities.Liability                            2.174e+15  1.439e+07
## Working.Capital.Equity                                  -5.537e+15  5.812e+08
## Current.Liabilities.Equity                               1.505e+16  1.180e+09
## Long.term.Liability.to.Current.Assets                   -1.099e+14  1.480e+07
## Retained.Earnings.to.Total.Assets                        4.201e+15  7.436e+07
## Total.income.Total.expense                              -4.829e+17  2.670e+09
## Total.expense.Assets                                    -1.038e+16  6.998e+07
## Current.Asset.Turnover.Rate                              1.668e+14  4.083e+06
## Quick.Asset.Turnover.Rate                                2.523e+14  3.333e+06
## Working.capitcal.Turnover.Rate                          -2.684e+17  2.539e+09
## Cash.Turnover.Rate                                       7.230e+13  3.460e+06
## Cash.Flow.to.Sales                                       3.460e+17  8.844e+08
## Fixed.Assets.to.Assets                                   4.614e+15  7.496e+07
## Current.Liability.to.Liability                                  NA         NA
## Current.Liability.to.Equity                                     NA         NA
## Equity.to.Long.term.Liability                            6.480e+15  3.305e+08
## Cash.Flow.to.Total.Assets                               -3.063e+15  4.368e+07
## Cash.Flow.to.Liability                                  -4.277e+14  5.218e+07
## CFO.to.Assets                                           -3.160e+15  4.391e+07
## Cash.Flow.to.Equity                                     -2.578e+14  1.431e+08
## Current.Liability.to.Current.Assets                     -2.254e+15  5.720e+07
## Liability.Assets.Flag                                    5.350e+14  3.798e+07
## Net.Income.to.Total.Assets                              -4.559e+16  1.467e+08
## Total.assets.to.GNP.price                               -4.532e+14  2.451e+07
## No.credit.Interval                                       1.033e+15  7.557e+07
## Gross.Profit.to.Sales                                   -1.521e+19  4.555e+11
## Net.Income.to.Stockholder.s.Equity                       9.086e+14  2.304e+08
## Liability.to.Equity                                     -4.593e+16  1.431e+09
## Degree.of.Financial.Leverage..DFL.                       1.518e+15  5.346e+07
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.      -1.703e+15  8.026e+07
##                                                            z value Pr(>|z|)    
## (Intercept)                                              4.121e+07   <2e-16 ***
## ROA.C..before.interest.and.depreciation.before.interest -4.056e+07   <2e-16 ***
## ROA.A..before.interest.and...after.tax                   3.101e+08   <2e-16 ***
## ROA.B..before.interest.and.depreciation.after.tax       -1.677e+07   <2e-16 ***
## Operating.Gross.Margin                                   3.355e+07   <2e-16 ***
## Realized.Sales.Gross.Margin                             -2.126e+07   <2e-16 ***
## Operating.Profit.Rate                                   -1.156e+08   <2e-16 ***
## Pre.tax.net.Interest.Rate                                1.153e+08   <2e-16 ***
## After.tax.net.Interest.Rate                             -7.722e+07   <2e-16 ***
## Non.industry.income.and.expenditure.revenue             -1.154e+08   <2e-16 ***
## Continuous.interest.rate..after.tax.                     4.549e+08   <2e-16 ***
## Operating.Expense.Rate                                   1.035e+08   <2e-16 ***
## Research.and.development.expense.rate                    9.122e+07   <2e-16 ***
## Cash.flow.rate                                           1.138e+08   <2e-16 ***
## Interest.bearing.debt.interest.rate                     -1.176e+07   <2e-16 ***
## Tax.rate..A.                                             5.827e+07   <2e-16 ***
## Net.Value.Per.Share..B.                                 -7.654e+07   <2e-16 ***
## Net.Value.Per.Share..A.                                  1.370e+07   <2e-16 ***
## Net.Value.Per.Share..C.                                  1.131e+07   <2e-16 ***
## Persistent.EPS.in.the.Last.Four.Seasons                 -9.400e+07   <2e-16 ***
## Cash.Flow.Per.Share                                      4.038e+07   <2e-16 ***
## Revenue.Per.Share..Yuan.Â..                             -1.595e+08   <2e-16 ***
## Operating.Profit.Per.Share..Yuan.Â..                     3.397e+07   <2e-16 ***
## Per.Share.Net.profit.before.tax..Yuan.Â..               -1.107e+08   <2e-16 ***
## Realized.Sales.Gross.Profit.Growth.Rate                 -7.449e+09   <2e-16 ***
## Operating.Profit.Growth.Rate                            -9.405e+07   <2e-16 ***
## After.tax.Net.Profit.Growth.Rate                        -2.167e+10   <2e-16 ***
## Regular.Net.Profit.Growth.Rate                           2.187e+10   <2e-16 ***
## Continuous.Net.Profit.Growth.Rate                       -2.643e+09   <2e-16 ***
## Total.Asset.Growth.Rate                                  2.636e+07   <2e-16 ***
## Net.Value.Growth.Rate                                    7.681e+07   <2e-16 ***
## Total.Asset.Return.Growth.Rate.Ratio                    -4.222e+07   <2e-16 ***
## Cash.Reinvestment..                                      4.149e+07   <2e-16 ***
## Current.Ratio                                            4.837e+07   <2e-16 ***
## Quick.Ratio                                             -7.843e+07   <2e-16 ***
## Interest.Expense.Ratio                                  -4.228e+07   <2e-16 ***
## Total.debt.Total.net.worth                              -9.459e+07   <2e-16 ***
## Debt.ratio..                                             2.565e+08   <2e-16 ***
## Net.worth.Assets                                                NA       NA    
## Long.term.fund.suitability.ratio..A.                    -1.099e+08   <2e-16 ***
## Borrowing.dependency                                     5.426e+07   <2e-16 ***
## Contingent.liabilities.Net.worth                         2.998e+07   <2e-16 ***
## Operating.profit.Paid.in.capital                        -9.612e+06   <2e-16 ***
## Net.profit.before.tax.Paid.in.capital                    2.933e+07   <2e-16 ***
## Inventory.and.accounts.receivable.Net.value              1.073e+07   <2e-16 ***
## Total.Asset.Turnover                                     7.824e+07   <2e-16 ***
## Accounts.Receivable.Turnover                            -4.087e+08   <2e-16 ***
## Average.Collection.Days                                 -2.197e+08   <2e-16 ***
## Inventory.Turnover.Rate..times.                         -2.675e+07   <2e-16 ***
## Fixed.Assets.Turnover.Frequency                          6.926e+07   <2e-16 ***
## Net.Worth.Turnover.Rate..times.                         -2.146e+08   <2e-16 ***
## Revenue.per.person                                      -2.512e+07   <2e-16 ***
## Operating.profit.per.person                              1.033e+07   <2e-16 ***
## Allocation.rate.per.person                              -3.354e+07   <2e-16 ***
## Working.Capital.to.Total.Assets                         -4.104e+07   <2e-16 ***
## Quick.Assets.Total.Assets                                9.535e+07   <2e-16 ***
## Current.Assets.Total.Assets                              4.104e+07   <2e-16 ***
## Cash.Total.Assets                                       -9.513e+07   <2e-16 ***
## Quick.Assets.Current.Liability                           8.934e+06   <2e-16 ***
## Cash.Current.Liability                                   2.706e+07   <2e-16 ***
## Current.Liability.to.Assets                             -4.104e+07   <2e-16 ***
## Operating.Funds.to.Liability                            -5.978e+05   <2e-16 ***
## Inventory.Working.Capital                               -6.265e+07   <2e-16 ***
## Inventory.Current.Liability                             -7.868e+07   <2e-16 ***
## Current.Liabilities.Liability                            1.511e+08   <2e-16 ***
## Working.Capital.Equity                                  -9.527e+06   <2e-16 ***
## Current.Liabilities.Equity                               1.275e+07   <2e-16 ***
## Long.term.Liability.to.Current.Assets                   -7.426e+06   <2e-16 ***
## Retained.Earnings.to.Total.Assets                        5.649e+07   <2e-16 ***
## Total.income.Total.expense                              -1.809e+08   <2e-16 ***
## Total.expense.Assets                                    -1.483e+08   <2e-16 ***
## Current.Asset.Turnover.Rate                              4.086e+07   <2e-16 ***
## Quick.Asset.Turnover.Rate                                7.570e+07   <2e-16 ***
## Working.capitcal.Turnover.Rate                          -1.057e+08   <2e-16 ***
## Cash.Turnover.Rate                                       2.090e+07   <2e-16 ***
## Cash.Flow.to.Sales                                       3.913e+08   <2e-16 ***
## Fixed.Assets.to.Assets                                   6.156e+07   <2e-16 ***
## Current.Liability.to.Liability                                  NA       NA    
## Current.Liability.to.Equity                                     NA       NA    
## Equity.to.Long.term.Liability                            1.961e+07   <2e-16 ***
## Cash.Flow.to.Total.Assets                               -7.014e+07   <2e-16 ***
## Cash.Flow.to.Liability                                  -8.198e+06   <2e-16 ***
## CFO.to.Assets                                           -7.196e+07   <2e-16 ***
## Cash.Flow.to.Equity                                     -1.802e+06   <2e-16 ***
## Current.Liability.to.Current.Assets                     -3.940e+07   <2e-16 ***
## Liability.Assets.Flag                                    1.409e+07   <2e-16 ***
## Net.Income.to.Total.Assets                              -3.108e+08   <2e-16 ***
## Total.assets.to.GNP.price                               -1.849e+07   <2e-16 ***
## No.credit.Interval                                       1.367e+07   <2e-16 ***
## Gross.Profit.to.Sales                                   -3.338e+07   <2e-16 ***
## Net.Income.to.Stockholder.s.Equity                       3.944e+06   <2e-16 ***
## Liability.to.Equity                                     -3.210e+07   <2e-16 ***
## Degree.of.Financial.Leverage..DFL.                       2.840e+07   <2e-16 ***
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.      -2.122e+07   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance:  1457.8  on 5114  degrees of freedom
## Residual deviance: 17877.7  on 5024  degrees of freedom
## AIC: 18060
## 
## Number of Fisher Scoring iterations: 17

Now for efficiency and because we had run a logit model earlier in the semester, let’s build an AIC model. AIC Stands for Akaike Information Criterion, and ultimately is an estimator of in-sample prediction error and is similar to the adjusted R-squared measures we see in our regression output summaries. It will give us the features with the lowest score AIC. Lower scores can indicate a more parsimonious model, relative to a model fit with a higher AIC. It can therefore give an indication of the relative quality of statistical models for a given set of data.

#logit_3 <- stepAIC(logit_1, direction = "backward")
logit_3 <- readRDS("final_aic.rds")

summary(logit_3)
## 
## Call:
## glm(formula = Bankrupt ~ ROA.C..before.interest.and.depreciation.before.interest + 
##     Pre.tax.net.Interest.Rate + Cash.flow.rate + Net.Value.Per.Share..B. + 
##     Net.Value.Per.Share..C. + Persistent.EPS.in.the.Last.Four.Seasons + 
##     Operating.Profit.Growth.Rate + Cash.Reinvestment.. + Debt.ratio.. + 
##     Borrowing.dependency + Operating.profit.Paid.in.capital + 
##     Total.Asset.Turnover + Accounts.Receivable.Turnover + Revenue.per.person + 
##     Operating.profit.per.person + Quick.Assets.Total.Assets + 
##     Cash.Total.Assets + Cash.Current.Liability + Current.Liability.to.Assets + 
##     Current.Liabilities.Liability + Working.Capital.Equity + 
##     Current.Liabilities.Equity + Cash.Turnover.Rate + Fixed.Assets.to.Assets + 
##     Equity.to.Long.term.Liability + Cash.Flow.to.Total.Assets + 
##     Liability.Assets.Flag + Liability.to.Equity, family = binomial, 
##     data = training_set)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.3919  -0.1668  -0.0798  -0.0356   3.7216  
## 
## Coefficients:
##                                                           Estimate Std. Error
## (Intercept)                                                14.0297    92.3977
## ROA.C..before.interest.and.depreciation.before.interest   -10.1596     3.6290
## Pre.tax.net.Interest.Rate                                  98.2074   118.2243
## Cash.flow.rate                                            -19.6468     9.3738
## Net.Value.Per.Share..B.                                  -151.4631    62.5933
## Net.Value.Per.Share..C.                                   144.3462    61.1721
## Persistent.EPS.in.the.Last.Four.Seasons                   -45.9139    11.1659
## Operating.Profit.Growth.Rate                              -61.6672    20.4207
## Cash.Reinvestment..                                        13.1558     4.4724
## Debt.ratio..                                               42.0130    10.1384
## Borrowing.dependency                                       49.2731    18.8769
## Operating.profit.Paid.in.capital                           37.7966    12.1538
## Total.Asset.Turnover                                       -5.8001     1.7736
## Accounts.Receivable.Turnover                             -451.0242 17325.6193
## Revenue.per.person                                         99.1115 22566.5788
## Operating.profit.per.person                                -9.6809     6.5689
## Quick.Assets.Total.Assets                                   1.1761     0.7939
## Cash.Total.Assets                                          -6.4419     1.9548
## Cash.Current.Liability                                      1.1019     0.7086
## Current.Liability.to.Assets                               -26.8032    12.1972
## Current.Liabilities.Liability                               4.3072     1.9735
## Working.Capital.Equity                                    -34.6268    12.9214
## Current.Liabilities.Equity                                138.7132    65.6824
## Cash.Turnover.Rate                                         -1.1436     0.4224
## Fixed.Assets.to.Assets                                     22.6078 17720.7527
## Equity.to.Long.term.Liability                              38.1454    18.5837
## Cash.Flow.to.Total.Assets                                  -7.2718     2.5117
## Liability.Assets.Flag                                      -6.5825     2.2724
## Liability.to.Equity                                      -240.9508    83.2862
##                                                         z value Pr(>|z|)    
## (Intercept)                                               0.152 0.879313    
## ROA.C..before.interest.and.depreciation.before.interest  -2.800 0.005117 ** 
## Pre.tax.net.Interest.Rate                                 0.831 0.406151    
## Cash.flow.rate                                           -2.096 0.036088 *  
## Net.Value.Per.Share..B.                                  -2.420 0.015529 *  
## Net.Value.Per.Share..C.                                   2.360 0.018291 *  
## Persistent.EPS.in.the.Last.Four.Seasons                  -4.112 3.92e-05 ***
## Operating.Profit.Growth.Rate                             -3.020 0.002529 ** 
## Cash.Reinvestment..                                       2.942 0.003266 ** 
## Debt.ratio..                                              4.144 3.41e-05 ***
## Borrowing.dependency                                      2.610 0.009048 ** 
## Operating.profit.Paid.in.capital                          3.110 0.001872 ** 
## Total.Asset.Turnover                                     -3.270 0.001074 ** 
## Accounts.Receivable.Turnover                             -0.026 0.979232    
## Revenue.per.person                                        0.004 0.996496    
## Operating.profit.per.person                              -1.474 0.140551    
## Quick.Assets.Total.Assets                                 1.481 0.138502    
## Cash.Total.Assets                                        -3.295 0.000982 ***
## Cash.Current.Liability                                    1.555 0.119928    
## Current.Liability.to.Assets                              -2.197 0.027985 *  
## Current.Liabilities.Liability                             2.183 0.029072 *  
## Working.Capital.Equity                                   -2.680 0.007366 ** 
## Current.Liabilities.Equity                                2.112 0.034697 *  
## Cash.Turnover.Rate                                       -2.707 0.006780 ** 
## Fixed.Assets.to.Assets                                    0.001 0.998982    
## Equity.to.Long.term.Liability                             2.053 0.040109 *  
## Cash.Flow.to.Total.Assets                                -2.895 0.003790 ** 
## Liability.Assets.Flag                                    -2.897 0.003771 ** 
## Liability.to.Equity                                      -2.893 0.003815 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1457.84  on 5114  degrees of freedom
## Residual deviance:  821.24  on 5086  degrees of freedom
## AIC: 879.24
## 
## Number of Fisher Scoring iterations: 19

We also know this is a highly class imbalanced dataset, however, with our bankrupted companies making up the minority class. We use the care upSample package to create an upsampled training dataset, and create a logit model and AIC model with that dataset as well:

set.seed(1)
training_set$Bankrupt <- as.factor(training_set$Bankrupt)

table(training_set$Bankrupt)
## 
##   NO  YES 
## 4950  165
up_train <- upSample(x = training_set[, -1],
                    y=training_set$Bankrupt,
                    yname = 'Bankrupt')

table(up_train$Bankrupt)
## 
##   NO  YES 
## 4950 4950
logit_1_up <- glm(Bankrupt~., family = binomial,data = up_train)
summary(logit_1_up)
## 
## Call:
## glm(formula = Bankrupt ~ ., family = binomial, data = up_train)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
##  -8.49    0.00    0.00    0.00    8.49  
## 
## Coefficients: (3 not defined because of singularities)
##                                                           Estimate Std. Error
## (Intercept)                                              1.982e+23  4.063e+15
## ROA.C..before.interest.and.depreciation.before.interest -7.851e+15  8.785e+07
## ROA.A..before.interest.and...after.tax                   1.520e+16  7.194e+07
## ROA.B..before.interest.and.depreciation.after.tax        4.839e+15  1.178e+08
## Operating.Gross.Margin                                   3.993e+19  3.409e+11
## Realized.Sales.Gross.Margin                             -4.822e+16  1.714e+09
## Operating.Profit.Rate                                   -8.496e+20  1.285e+13
## Pre.tax.net.Interest.Rate                                7.097e+20  1.073e+13
## After.tax.net.Interest.Rate                              3.352e+17  6.521e+09
## Non.industry.income.and.expenditure.revenue             -4.061e+20  6.144e+12
## Continuous.interest.rate..after.tax.                    -4.580e+17  3.847e+09
## Operating.Expense.Rate                                   1.971e+14  2.424e+06
## Research.and.development.expense.rate                    2.914e+14  3.017e+06
## Cash.flow.rate                                          -3.218e+16  1.777e+08
## Interest.bearing.debt.interest.rate                     -3.097e+14  8.712e+06
## Tax.rate..A.                                             5.490e+14  6.174e+06
## Net.Value.Per.Share..B.                                 -6.313e+16  5.494e+08
## Net.Value.Per.Share..A.                                  5.622e+16  1.177e+09
## Net.Value.Per.Share..C.                                  7.006e+15  1.033e+09
## Persistent.EPS.in.the.Last.Four.Seasons                 -2.612e+16  1.855e+08
## Cash.Flow.Per.Share                                      1.932e+15  8.799e+07
## Revenue.Per.Share..Yuan.Â..                              1.098e+16  1.902e+08
## Operating.Profit.Per.Share..Yuan.Â..                    -1.186e+17  7.722e+08
## Per.Share.Net.profit.before.tax..Yuan.Â..                6.876e+15  1.242e+08
## Realized.Sales.Gross.Profit.Growth.Rate                  3.370e+13  6.573e+07
## Operating.Profit.Growth.Rate                            -1.609e+16  2.223e+08
## After.tax.Net.Profit.Growth.Rate                         1.902e+16  5.613e+08
## Regular.Net.Profit.Growth.Rate                          -1.084e+16  5.594e+08
## Continuous.Net.Profit.Growth.Rate                        3.453e+14  7.712e+07
## Total.Asset.Growth.Rate                                  4.380e+14  2.861e+06
## Net.Value.Growth.Rate                                    2.163e+16  7.291e+08
## Total.Asset.Return.Growth.Rate.Ratio                    -1.686e+15  1.151e+08
## Cash.Reinvestment..                                     -2.318e+14  3.535e+07
## Current.Ratio                                            7.817e+14  7.398e+07
## Quick.Ratio                                             -5.852e+15  4.799e+07
## Interest.Expense.Ratio                                  -3.280e+15  5.835e+07
## Total.debt.Total.net.worth                               2.232e+15  6.727e+07
## Debt.ratio..                                             2.716e+15  5.344e+07
## Net.worth.Assets                                                NA         NA
## Long.term.fund.suitability.ratio..A.                     1.426e+14  3.158e+07
## Borrowing.dependency                                     8.281e+15  1.612e+08
## Contingent.liabilities.Net.worth                        -5.472e+15  1.139e+08
## Operating.profit.Paid.in.capital                         1.314e+17  7.806e+08
## Net.profit.before.tax.Paid.in.capital                   -5.892e+13  2.237e+08
## Inventory.and.accounts.receivable.Net.value             -2.864e+16  2.419e+08
## Total.Asset.Turnover                                     2.046e+15  1.899e+07
## Accounts.Receivable.Turnover                            -8.869e+15  4.141e+07
## Average.Collection.Days                                 -6.795e+15  4.515e+07
## Inventory.Turnover.Rate..times.                         -3.851e+14  2.359e+06
## Fixed.Assets.Turnover.Frequency                          4.166e+14  2.975e+06
## Net.Worth.Turnover.Rate..times.                         -8.812e+15  5.337e+07
## Revenue.per.person                                       1.494e+16  1.765e+08
## Operating.profit.per.person                             -1.208e+15  3.370e+07
## Allocation.rate.per.person                              -1.799e+15  3.362e+07
## Working.Capital.to.Total.Assets                         -2.630e+23  5.404e+15
## Quick.Assets.Total.Assets                               -3.100e+14  7.384e+06
## Current.Assets.Total.Assets                              7.204e+22  1.480e+15
## Cash.Total.Assets                                       -1.835e+15  9.701e+06
## Quick.Assets.Current.Liability                           6.034e+14  6.733e+07
## Cash.Current.Liability                                   1.082e+15  7.181e+06
## Current.Liability.to.Assets                             -2.346e+23  4.820e+15
## Operating.Funds.to.Liability                             6.624e+15  7.656e+07
## Inventory.Working.Capital                               -7.562e+15  8.098e+07
## Inventory.Current.Liability                              4.361e+14  1.402e+07
## Current.Liabilities.Liability                           -1.222e+13  1.001e+07
## Working.Capital.Equity                                   2.526e+16  3.102e+08
## Current.Liabilities.Equity                               8.641e+16  5.935e+08
## Long.term.Liability.to.Current.Assets                   -9.112e+14  1.001e+07
## Retained.Earnings.to.Total.Assets                       -2.495e+15  5.661e+07
## Total.income.Total.expense                              -1.583e+17  2.477e+09
## Total.expense.Assets                                    -8.844e+14  4.230e+07
## Current.Asset.Turnover.Rate                              8.103e+13  2.977e+06
## Quick.Asset.Turnover.Rate                               -7.042e+13  2.480e+06
## Working.capitcal.Turnover.Rate                          -8.844e+16  2.221e+09
## Cash.Turnover.Rate                                      -4.868e+14  2.796e+06
## Cash.Flow.to.Sales                                      -1.750e+15  8.031e+08
## Fixed.Assets.to.Assets                                   4.939e+15  2.998e+07
## Current.Liability.to.Liability                                  NA         NA
## Current.Liability.to.Equity                                     NA         NA
## Equity.to.Long.term.Liability                            1.671e+16  1.885e+08
## Cash.Flow.to.Total.Assets                                2.955e+15  3.097e+07
## Cash.Flow.to.Liability                                  -4.745e+15  4.205e+07
## CFO.to.Assets                                            1.437e+15  2.836e+07
## Cash.Flow.to.Equity                                     -6.762e+15  9.215e+07
## Current.Liability.to.Current.Assets                      2.052e+15  3.442e+07
## Liability.Assets.Flag                                    7.706e+14  1.459e+07
## Net.Income.to.Total.Assets                              -2.573e+16  7.801e+07
## Total.assets.to.GNP.price                                1.067e+15  1.308e+07
## No.credit.Interval                                      -4.834e+15  7.259e+07
## Gross.Profit.to.Sales                                   -3.989e+19  3.409e+11
## Net.Income.to.Stockholder.s.Equity                       1.059e+16  7.970e+07
## Liability.to.Equity                                     -6.038e+16  8.285e+08
## Degree.of.Financial.Leverage..DFL.                       1.480e+14  5.283e+07
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.       3.935e+15  7.288e+07
##                                                            z value Pr(>|z|)    
## (Intercept)                                               48774985   <2e-16 ***
## ROA.C..before.interest.and.depreciation.before.interest  -89363994   <2e-16 ***
## ROA.A..before.interest.and...after.tax                   211267754   <2e-16 ***
## ROA.B..before.interest.and.depreciation.after.tax         41072030   <2e-16 ***
## Operating.Gross.Margin                                   117155887   <2e-16 ***
## Realized.Sales.Gross.Margin                              -28128004   <2e-16 ***
## Operating.Profit.Rate                                    -66106236   <2e-16 ***
## Pre.tax.net.Interest.Rate                                 66119344   <2e-16 ***
## After.tax.net.Interest.Rate                               51403458   <2e-16 ***
## Non.industry.income.and.expenditure.revenue              -66103101   <2e-16 ***
## Continuous.interest.rate..after.tax.                    -119062556   <2e-16 ***
## Operating.Expense.Rate                                    81314459   <2e-16 ***
## Research.and.development.expense.rate                     96582471   <2e-16 ***
## Cash.flow.rate                                          -181139773   <2e-16 ***
## Interest.bearing.debt.interest.rate                      -35549670   <2e-16 ***
## Tax.rate..A.                                              88914620   <2e-16 ***
## Net.Value.Per.Share..B.                                 -114913491   <2e-16 ***
## Net.Value.Per.Share..A.                                   47752353   <2e-16 ***
## Net.Value.Per.Share..C.                                    6778975   <2e-16 ***
## Persistent.EPS.in.the.Last.Four.Seasons                 -140836983   <2e-16 ***
## Cash.Flow.Per.Share                                       21953193   <2e-16 ***
## Revenue.Per.Share..Yuan.Â..                               57707717   <2e-16 ***
## Operating.Profit.Per.Share..Yuan.Â..                    -153638273   <2e-16 ***
## Per.Share.Net.profit.before.tax..Yuan.Â..                 55364741   <2e-16 ***
## Realized.Sales.Gross.Profit.Growth.Rate                     512743   <2e-16 ***
## Operating.Profit.Growth.Rate                             -72378464   <2e-16 ***
## After.tax.Net.Profit.Growth.Rate                          33894274   <2e-16 ***
## Regular.Net.Profit.Growth.Rate                           -19376351   <2e-16 ***
## Continuous.Net.Profit.Growth.Rate                          4477255   <2e-16 ***
## Total.Asset.Growth.Rate                                  153109118   <2e-16 ***
## Net.Value.Growth.Rate                                     29662706   <2e-16 ***
## Total.Asset.Return.Growth.Rate.Ratio                     -14648422   <2e-16 ***
## Cash.Reinvestment..                                       -6558039   <2e-16 ***
## Current.Ratio                                             10565354   <2e-16 ***
## Quick.Ratio                                             -121941091   <2e-16 ***
## Interest.Expense.Ratio                                   -56220547   <2e-16 ***
## Total.debt.Total.net.worth                                33187318   <2e-16 ***
## Debt.ratio..                                              50823643   <2e-16 ***
## Net.worth.Assets                                                NA       NA    
## Long.term.fund.suitability.ratio..A.                       4516366   <2e-16 ***
## Borrowing.dependency                                      51376723   <2e-16 ***
## Contingent.liabilities.Net.worth                         -48051884   <2e-16 ***
## Operating.profit.Paid.in.capital                         168335637   <2e-16 ***
## Net.profit.before.tax.Paid.in.capital                      -263452   <2e-16 ***
## Inventory.and.accounts.receivable.Net.value             -118372477   <2e-16 ***
## Total.Asset.Turnover                                     107732110   <2e-16 ***
## Accounts.Receivable.Turnover                            -214201845   <2e-16 ***
## Average.Collection.Days                                 -150511256   <2e-16 ***
## Inventory.Turnover.Rate..times.                         -163282993   <2e-16 ***
## Fixed.Assets.Turnover.Frequency                          140029776   <2e-16 ***
## Net.Worth.Turnover.Rate..times.                         -165129573   <2e-16 ***
## Revenue.per.person                                        84641756   <2e-16 ***
## Operating.profit.per.person                              -35840179   <2e-16 ***
## Allocation.rate.per.person                               -53525092   <2e-16 ***
## Working.Capital.to.Total.Assets                          -48676155   <2e-16 ***
## Quick.Assets.Total.Assets                                -41984969   <2e-16 ***
## Current.Assets.Total.Assets                               48676154   <2e-16 ***
## Cash.Total.Assets                                       -189160341   <2e-16 ***
## Quick.Assets.Current.Liability                             8961247   <2e-16 ***
## Cash.Current.Liability                                   150686382   <2e-16 ***
## Current.Liability.to.Assets                              -48676154   <2e-16 ***
## Operating.Funds.to.Liability                              86530516   <2e-16 ***
## Inventory.Working.Capital                                -93382649   <2e-16 ***
## Inventory.Current.Liability                               31109860   <2e-16 ***
## Current.Liabilities.Liability                             -1221326   <2e-16 ***
## Working.Capital.Equity                                    81423100   <2e-16 ***
## Current.Liabilities.Equity                               145585258   <2e-16 ***
## Long.term.Liability.to.Current.Assets                    -91024388   <2e-16 ***
## Retained.Earnings.to.Total.Assets                        -44067120   <2e-16 ***
## Total.income.Total.expense                               -63892634   <2e-16 ***
## Total.expense.Assets                                     -20906800   <2e-16 ***
## Current.Asset.Turnover.Rate                               27214347   <2e-16 ***
## Quick.Asset.Turnover.Rate                                -28390980   <2e-16 ***
## Working.capitcal.Turnover.Rate                           -39822121   <2e-16 ***
## Cash.Turnover.Rate                                      -174088436   <2e-16 ***
## Cash.Flow.to.Sales                                        -2179647   <2e-16 ***
## Fixed.Assets.to.Assets                                   164715310   <2e-16 ***
## Current.Liability.to.Liability                                  NA       NA    
## Current.Liability.to.Equity                                     NA       NA    
## Equity.to.Long.term.Liability                             88688438   <2e-16 ***
## Cash.Flow.to.Total.Assets                                 95431608   <2e-16 ***
## Cash.Flow.to.Liability                                  -112820913   <2e-16 ***
## CFO.to.Assets                                             50672600   <2e-16 ***
## Cash.Flow.to.Equity                                      -73378295   <2e-16 ***
## Current.Liability.to.Current.Assets                       59616788   <2e-16 ***
## Liability.Assets.Flag                                     52801457   <2e-16 ***
## Net.Income.to.Total.Assets                              -329823548   <2e-16 ***
## Total.assets.to.GNP.price                                 81537944   <2e-16 ***
## No.credit.Interval                                       -66593370   <2e-16 ***
## Gross.Profit.to.Sales                                   -117001064   <2e-16 ***
## Net.Income.to.Stockholder.s.Equity                       132864319   <2e-16 ***
## Liability.to.Equity                                      -72874766   <2e-16 ***
## Degree.of.Financial.Leverage..DFL.                         2800766   <2e-16 ***
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.        53990995   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance:  13724  on 9899  degrees of freedom
## Residual deviance: 116709  on 9809  degrees of freedom
## AIC: 116891
## 
## Number of Fisher Scoring iterations: 25
#logit_3_up <- stepAIC(logit_1_up, direction = "backward")
logit_3_up <- readRDS("final_aic_up.rds")
summary(logit_3_up)
## 
## Call:
## glm(formula = Bankrupt ~ ROA.C..before.interest.and.depreciation.before.interest + 
##     ROA.A..before.interest.and...after.tax + ROA.B..before.interest.and.depreciation.after.tax + 
##     Operating.Gross.Margin + Realized.Sales.Gross.Margin + Operating.Profit.Rate + 
##     Pre.tax.net.Interest.Rate + After.tax.net.Interest.Rate + 
##     Non.industry.income.and.expenditure.revenue + Continuous.interest.rate..after.tax. + 
##     Operating.Expense.Rate + Research.and.development.expense.rate + 
##     Cash.flow.rate + Interest.bearing.debt.interest.rate + Tax.rate..A. + 
##     Net.Value.Per.Share..B. + Net.Value.Per.Share..A. + Net.Value.Per.Share..C. + 
##     Persistent.EPS.in.the.Last.Four.Seasons + Cash.Flow.Per.Share + 
##     Revenue.Per.Share..Yuan.Â.. + Operating.Profit.Per.Share..Yuan.Â.. + 
##     Per.Share.Net.profit.before.tax..Yuan.Â.. + Realized.Sales.Gross.Profit.Growth.Rate + 
##     Operating.Profit.Growth.Rate + After.tax.Net.Profit.Growth.Rate + 
##     Regular.Net.Profit.Growth.Rate + Continuous.Net.Profit.Growth.Rate + 
##     Total.Asset.Growth.Rate + Net.Value.Growth.Rate + Total.Asset.Return.Growth.Rate.Ratio + 
##     Cash.Reinvestment.. + Current.Ratio + Quick.Ratio + Interest.Expense.Ratio + 
##     Total.debt.Total.net.worth + Debt.ratio.. + Net.worth.Assets + 
##     Long.term.fund.suitability.ratio..A. + Borrowing.dependency + 
##     Contingent.liabilities.Net.worth + Operating.profit.Paid.in.capital + 
##     Net.profit.before.tax.Paid.in.capital + Inventory.and.accounts.receivable.Net.value + 
##     Total.Asset.Turnover + Accounts.Receivable.Turnover + Average.Collection.Days + 
##     Inventory.Turnover.Rate..times. + Fixed.Assets.Turnover.Frequency + 
##     Net.Worth.Turnover.Rate..times. + Revenue.per.person + Operating.profit.per.person + 
##     Allocation.rate.per.person + Working.Capital.to.Total.Assets + 
##     Quick.Assets.Total.Assets + Current.Assets.Total.Assets + 
##     Cash.Total.Assets + Quick.Assets.Current.Liability + Cash.Current.Liability + 
##     Current.Liability.to.Assets + Operating.Funds.to.Liability + 
##     Inventory.Working.Capital + Inventory.Current.Liability + 
##     Current.Liabilities.Liability + Working.Capital.Equity + 
##     Current.Liabilities.Equity + Long.term.Liability.to.Current.Assets + 
##     Retained.Earnings.to.Total.Assets + Total.income.Total.expense + 
##     Total.expense.Assets + Current.Asset.Turnover.Rate + Quick.Asset.Turnover.Rate + 
##     Working.capitcal.Turnover.Rate + Cash.Turnover.Rate + Cash.Flow.to.Sales + 
##     Fixed.Assets.to.Assets + Current.Liability.to.Liability + 
##     Current.Liability.to.Equity + Equity.to.Long.term.Liability + 
##     Cash.Flow.to.Total.Assets + Cash.Flow.to.Liability + CFO.to.Assets + 
##     Cash.Flow.to.Equity + Net.Income.to.Total.Assets + No.credit.Interval + 
##     Gross.Profit.to.Sales + Net.Income.to.Stockholder.s.Equity + 
##     Liability.to.Equity + Degree.of.Financial.Leverage..DFL. + 
##     Interest.Coverage.Ratio..Interest.expense.to.EBIT., family = binomial, 
##     data = up_train)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
##  -8.49    0.00    0.00    0.00    8.49  
## 
## Coefficients: (3 not defined because of singularities)
##                                                           Estimate Std. Error
## (Intercept)                                              5.556e+21  4.054e+15
## ROA.C..before.interest.and.depreciation.before.interest -9.409e+15  7.644e+07
## ROA.A..before.interest.and...after.tax                   1.755e+16  7.059e+07
## ROA.B..before.interest.and.depreciation.after.tax        4.287e+15  1.070e+08
## Operating.Gross.Margin                                   1.016e+19  3.406e+11
## Realized.Sales.Gross.Margin                              9.469e+16  1.708e+09
## Operating.Profit.Rate                                   -1.334e+21  1.280e+13
## Pre.tax.net.Interest.Rate                                1.114e+21  1.069e+13
## After.tax.net.Interest.Rate                              3.698e+17  6.483e+09
## Non.industry.income.and.expenditure.revenue             -6.376e+20  6.121e+12
## Continuous.interest.rate..after.tax.                    -2.907e+17  3.727e+09
## Operating.Expense.Rate                                   1.410e+14  2.422e+06
## Research.and.development.expense.rate                    2.505e+14  2.998e+06
## Cash.flow.rate                                          -3.195e+16  1.759e+08
## Interest.bearing.debt.interest.rate                     -6.294e+14  8.704e+06
## Tax.rate..A.                                            -7.492e+13  6.142e+06
## Net.Value.Per.Share..B.                                 -7.869e+16  5.478e+08
## Net.Value.Per.Share..A.                                  1.129e+17  1.176e+09
## Net.Value.Per.Share..C.                                 -3.475e+16  1.029e+09
## Persistent.EPS.in.the.Last.Four.Seasons                 -2.230e+16  1.791e+08
## Cash.Flow.Per.Share                                      4.972e+15  8.661e+07
## Revenue.Per.Share..Yuan.Â..                              1.437e+16  1.893e+08
## Operating.Profit.Per.Share..Yuan.Â..                    -9.569e+16  7.694e+08
## Per.Share.Net.profit.before.tax..Yuan.Â..                3.861e+15  1.241e+08
## Realized.Sales.Gross.Profit.Growth.Rate                  3.028e+15  6.571e+07
## Operating.Profit.Growth.Rate                            -2.561e+16  2.003e+08
## After.tax.Net.Profit.Growth.Rate                        -6.637e+14  5.606e+08
## Regular.Net.Profit.Growth.Rate                           5.053e+15  5.589e+08
## Continuous.Net.Profit.Growth.Rate                        1.375e+15  7.709e+07
## Total.Asset.Growth.Rate                                  4.026e+14  2.856e+06
## Net.Value.Growth.Rate                                    2.445e+16  6.837e+08
## Total.Asset.Return.Growth.Rate.Ratio                    -2.665e+15  1.150e+08
## Cash.Reinvestment..                                      3.586e+15  3.448e+07
## Current.Ratio                                           -2.672e+15  6.767e+07
## Quick.Ratio                                             -7.515e+15  4.798e+07
## Interest.Expense.Ratio                                  -6.897e+15  5.834e+07
## Total.debt.Total.net.worth                               2.545e+15  6.707e+07
## Debt.ratio..                                             7.779e+15  4.828e+07
## Net.worth.Assets                                                NA         NA
## Long.term.fund.suitability.ratio..A.                     1.048e+15  3.144e+07
## Borrowing.dependency                                     1.003e+16  1.570e+08
## Contingent.liabilities.Net.worth                        -2.639e+15  1.114e+08
## Operating.profit.Paid.in.capital                         1.058e+17  7.778e+08
## Net.profit.before.tax.Paid.in.capital                   -3.441e+14  2.209e+08
## Inventory.and.accounts.receivable.Net.value             -3.466e+16  2.233e+08
## Total.Asset.Turnover                                     2.407e+13  1.796e+07
## Accounts.Receivable.Turnover                            -1.002e+16  4.135e+07
## Average.Collection.Days                                 -6.546e+15  4.514e+07
## Inventory.Turnover.Rate..times.                         -4.658e+14  2.355e+06
## Fixed.Assets.Turnover.Frequency                          4.406e+14  2.968e+06
## Net.Worth.Turnover.Rate..times.                         -9.015e+15  4.924e+07
## Revenue.per.person                                       1.769e+16  1.758e+08
## Operating.profit.per.person                             -2.007e+15  3.364e+07
## Allocation.rate.per.person                              -2.119e+15  3.361e+07
## Working.Capital.to.Total.Assets                         -6.541e+21  5.391e+15
## Quick.Assets.Total.Assets                                1.803e+14  7.247e+06
## Current.Assets.Total.Assets                              1.792e+21  1.477e+15
## Cash.Total.Assets                                       -1.315e+15  9.499e+06
## Quick.Assets.Current.Liability                          -3.656e+15  6.733e+07
## Cash.Current.Liability                                   1.717e+14  7.141e+06
## Current.Liability.to.Assets                             -5.834e+21  4.809e+15
## Operating.Funds.to.Liability                             8.347e+15  7.627e+07
## Inventory.Working.Capital                                2.372e+15  8.095e+07
## Inventory.Current.Liability                             -3.275e+14  1.127e+07
## Current.Liabilities.Liability                            9.375e+14  9.620e+06
## Working.Capital.Equity                                   3.641e+16  2.799e+08
## Current.Liabilities.Equity                               6.914e+16  5.907e+08
## Long.term.Liability.to.Current.Assets                   -1.576e+14  1.000e+07
## Retained.Earnings.to.Total.Assets                        3.235e+15  5.463e+07
## Total.income.Total.expense                               1.898e+15  2.421e+09
## Total.expense.Assets                                     4.729e+15  4.134e+07
## Current.Asset.Turnover.Rate                              4.067e+14  2.966e+06
## Quick.Asset.Turnover.Rate                               -1.451e+14  2.473e+06
## Working.capitcal.Turnover.Rate                          -1.309e+17  2.202e+09
## Cash.Turnover.Rate                                      -4.126e+14  2.789e+06
## Cash.Flow.to.Sales                                       2.593e+15  7.986e+08
## Fixed.Assets.to.Assets                                   4.838e+15  2.988e+07
## Current.Liability.to.Liability                                  NA         NA
## Current.Liability.to.Equity                                     NA         NA
## Equity.to.Long.term.Liability                            9.807e+15  1.853e+08
## Cash.Flow.to.Total.Assets                                4.061e+15  3.079e+07
## Cash.Flow.to.Liability                                  -5.635e+15  4.184e+07
## CFO.to.Assets                                           -7.739e+14  2.813e+07
## Cash.Flow.to.Equity                                     -1.252e+16  9.140e+07
## Net.Income.to.Total.Assets                              -2.611e+16  7.429e+07
## No.credit.Interval                                      -6.865e+15  7.259e+07
## Gross.Profit.to.Sales                                   -1.026e+19  3.407e+11
## Net.Income.to.Stockholder.s.Equity                       6.210e+15  7.584e+07
## Liability.to.Equity                                     -3.524e+16  7.877e+08
## Degree.of.Financial.Leverage..DFL.                      -3.191e+15  5.277e+07
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.      -5.001e+14  7.286e+07
##                                                            z value Pr(>|z|)    
## (Intercept)                                                1370611   <2e-16 ***
## ROA.C..before.interest.and.depreciation.before.interest -123088945   <2e-16 ***
## ROA.A..before.interest.and...after.tax                   248614035   <2e-16 ***
## ROA.B..before.interest.and.depreciation.after.tax         40050839   <2e-16 ***
## Operating.Gross.Margin                                    29817538   <2e-16 ***
## Realized.Sales.Gross.Margin                               55428482   <2e-16 ***
## Operating.Profit.Rate                                   -104179772   <2e-16 ***
## Pre.tax.net.Interest.Rate                                104176294   <2e-16 ***
## After.tax.net.Interest.Rate                               57038948   <2e-16 ***
## Non.industry.income.and.expenditure.revenue             -104171378   <2e-16 ***
## Continuous.interest.rate..after.tax.                     -78000272   <2e-16 ***
## Operating.Expense.Rate                                    58218147   <2e-16 ***
## Research.and.development.expense.rate                     83534305   <2e-16 ***
## Cash.flow.rate                                          -181641470   <2e-16 ***
## Interest.bearing.debt.interest.rate                      -72305299   <2e-16 ***
## Tax.rate..A.                                             -12197460   <2e-16 ***
## Net.Value.Per.Share..B.                                 -143651240   <2e-16 ***
## Net.Value.Per.Share..A.                                   96001928   <2e-16 ***
## Net.Value.Per.Share..C.                                  -33782701   <2e-16 ***
## Persistent.EPS.in.the.Last.Four.Seasons                 -124552284   <2e-16 ***
## Cash.Flow.Per.Share                                       57403862   <2e-16 ***
## Revenue.Per.Share..Yuan.Â..                               75876487   <2e-16 ***
## Operating.Profit.Per.Share..Yuan.Â..                    -124361620   <2e-16 ***
## Per.Share.Net.profit.before.tax..Yuan.Â..                 31107919   <2e-16 ***
## Realized.Sales.Gross.Profit.Growth.Rate                   46076620   <2e-16 ***
## Operating.Profit.Growth.Rate                            -127836823   <2e-16 ***
## After.tax.Net.Profit.Growth.Rate                          -1183757   <2e-16 ***
## Regular.Net.Profit.Growth.Rate                             9041319   <2e-16 ***
## Continuous.Net.Profit.Growth.Rate                         17834207   <2e-16 ***
## Total.Asset.Growth.Rate                                  140962057   <2e-16 ***
## Net.Value.Growth.Rate                                     35763516   <2e-16 ***
## Total.Asset.Return.Growth.Rate.Ratio                     -23168127   <2e-16 ***
## Cash.Reinvestment..                                      104007432   <2e-16 ***
## Current.Ratio                                            -39486446   <2e-16 ***
## Quick.Ratio                                             -156613086   <2e-16 ***
## Interest.Expense.Ratio                                  -118220499   <2e-16 ***
## Total.debt.Total.net.worth                                37948302   <2e-16 ***
## Debt.ratio..                                             161136597   <2e-16 ***
## Net.worth.Assets                                                NA       NA    
## Long.term.fund.suitability.ratio..A.                      33327043   <2e-16 ***
## Borrowing.dependency                                      63864379   <2e-16 ***
## Contingent.liabilities.Net.worth                         -23691249   <2e-16 ***
## Operating.profit.Paid.in.capital                         135987347   <2e-16 ***
## Net.profit.before.tax.Paid.in.capital                     -1557518   <2e-16 ***
## Inventory.and.accounts.receivable.Net.value             -155216042   <2e-16 ***
## Total.Asset.Turnover                                       1340304   <2e-16 ***
## Accounts.Receivable.Turnover                            -242377587   <2e-16 ***
## Average.Collection.Days                                 -145011977   <2e-16 ***
## Inventory.Turnover.Rate..times.                         -197757140   <2e-16 ***
## Fixed.Assets.Turnover.Frequency                          148459224   <2e-16 ***
## Net.Worth.Turnover.Rate..times.                         -183083657   <2e-16 ***
## Revenue.per.person                                       100604097   <2e-16 ***
## Operating.profit.per.person                              -59653468   <2e-16 ***
## Allocation.rate.per.person                               -63067136   <2e-16 ***
## Working.Capital.to.Total.Assets                           -1213320   <2e-16 ***
## Quick.Assets.Total.Assets                                 24880846   <2e-16 ***
## Current.Assets.Total.Assets                                1213319   <2e-16 ***
## Cash.Total.Assets                                       -138381307   <2e-16 ***
## Quick.Assets.Current.Liability                           -54302467   <2e-16 ***
## Cash.Current.Liability                                    24042724   <2e-16 ***
## Current.Liability.to.Assets                               -1213320   <2e-16 ***
## Operating.Funds.to.Liability                             109438597   <2e-16 ***
## Inventory.Working.Capital                                 29298193   <2e-16 ***
## Inventory.Current.Liability                              -29051800   <2e-16 ***
## Current.Liabilities.Liability                             97451990   <2e-16 ***
## Working.Capital.Equity                                   130081184   <2e-16 ***
## Current.Liabilities.Equity                               117042372   <2e-16 ***
## Long.term.Liability.to.Current.Assets                    -15747335   <2e-16 ***
## Retained.Earnings.to.Total.Assets                         59207193   <2e-16 ***
## Total.income.Total.expense                                  783703   <2e-16 ***
## Total.expense.Assets                                     114384412   <2e-16 ***
## Current.Asset.Turnover.Rate                              137086315   <2e-16 ***
## Quick.Asset.Turnover.Rate                                -58683491   <2e-16 ***
## Working.capitcal.Turnover.Rate                           -59440091   <2e-16 ***
## Cash.Turnover.Rate                                      -147934153   <2e-16 ***
## Cash.Flow.to.Sales                                         3247095   <2e-16 ***
## Fixed.Assets.to.Assets                                   161895554   <2e-16 ***
## Current.Liability.to.Liability                                  NA       NA    
## Current.Liability.to.Equity                                     NA       NA    
## Equity.to.Long.term.Liability                             52922374   <2e-16 ***
## Cash.Flow.to.Total.Assets                                131900646   <2e-16 ***
## Cash.Flow.to.Liability                                  -134672516   <2e-16 ***
## CFO.to.Assets                                            -27507102   <2e-16 ***
## Cash.Flow.to.Equity                                     -136952103   <2e-16 ***
## Net.Income.to.Total.Assets                              -351446409   <2e-16 ***
## No.credit.Interval                                       -94577643   <2e-16 ***
## Gross.Profit.to.Sales                                    -30117980   <2e-16 ***
## Net.Income.to.Stockholder.s.Equity                        81891302   <2e-16 ***
## Liability.to.Equity                                      -44734287   <2e-16 ***
## Degree.of.Financial.Leverage..DFL.                       -60472808   <2e-16 ***
## Interest.Coverage.Ratio..Interest.expense.to.EBIT.        -6863935   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance:  13724  on 9899  degrees of freedom
## Residual deviance: 113465  on 9812  degrees of freedom
## AIC: 113641
## 
## Number of Fisher Scoring iterations: 25

Model Analysis

Model 1

logit_1.preds<-as.vector(ifelse(predict(logit_1,test_set)>0.5,"YES","NO"))
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :
## prediction from a rank-deficient fit may be misleading
cm1<-confusionMatrix(data=as.factor(logit_1.preds),test_set$Bankrupt)
cm1
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   NO  YES
##        NO  1593   37
##        YES   56   18
##                                           
##                Accuracy : 0.9454          
##                  95% CI : (0.9336, 0.9557)
##     No Information Rate : 0.9677          
##     P-Value [Acc > NIR] : 1.00000         
##                                           
##                   Kappa : 0.2513          
##                                           
##  Mcnemar's Test P-Value : 0.06197         
##                                           
##             Sensitivity : 0.9660          
##             Specificity : 0.3273          
##          Pos Pred Value : 0.9773          
##          Neg Pred Value : 0.2432          
##              Prevalence : 0.9677          
##          Detection Rate : 0.9349          
##    Detection Prevalence : 0.9566          
##       Balanced Accuracy : 0.6467          
##                                           
##        'Positive' Class : NO              
## 
#print(c(paste0("Accuracy of LR with all features:",mean(logit_1.preds == test_set$Bankrupt))))

#print(c(paste0("F1-score of LR with all features:",F1_Score(logit_1.preds,test_set$Bankrupt))))

resultsCmp <- tibble(model = "Model 1",F1 = cm1$byClass[7],
                  deviance=logit_1$deviance, 
                  Accuracy = cm1$overall[1],
                  Sensitivity = cm1$byClass[1],
                  Specificity = cm1$byClass[2],
                  Precision = cm1$byClass[5],
                  r2 = 1 - logit_1$deviance/logit_1$null.deviance,
                  AIC=logit_1$aic)

As we can see the this model training with all features has accuracy 0.9454 and F-1 score of 0.971, although the accuracy looks high but when we focus on the confusion matrix we can find the specificity is only 0.3273 (means we are missing real bankrupting companies), our main purpose for this prediction is to help do Bankrupt company prediction. We should aim to increase the specificity so the model won’t miss real bankrupting companies.

Model 2

logit_3.preds<-as.vector(ifelse(predict(logit_3,test_set)>0.5,"YES","NO"))

cm2<-confusionMatrix(data=as.factor(logit_3.preds),test_set$Bankrupt)
cm2
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   NO  YES
##        NO  1635   47
##        YES   14    8
##                                           
##                Accuracy : 0.9642          
##                  95% CI : (0.9543, 0.9725)
##     No Information Rate : 0.9677          
##     P-Value [Acc > NIR] : 0.8148          
##                                           
##                   Kappa : 0.1929          
##                                           
##  Mcnemar's Test P-Value : 4.182e-05       
##                                           
##             Sensitivity : 0.9915          
##             Specificity : 0.1455          
##          Pos Pred Value : 0.9721          
##          Neg Pred Value : 0.3636          
##              Prevalence : 0.9677          
##          Detection Rate : 0.9595          
##    Detection Prevalence : 0.9871          
##       Balanced Accuracy : 0.5685          
##                                           
##        'Positive' Class : NO              
## 
resultsCmp <- rbind(resultsCmp,tibble(model = "Model 2",
                                F1 = cm2$byClass[7],
                                deviance = logit_3$deviance,
                                Accuracy = cm2$overall[1],
                                Sensitivity = cm2$byClass[1],
                                Specificity = cm2$byClass[2],
                                Precision = cm2$byClass[5],
                                r2 = 1 - logit_3$deviance / logit_3$null.deviance,
                                AIC = logit_3$aic))

We applied backward stepwise regression on the Model 1 to build this Model 2. Even though the accuracy has improved and AIC has reduced, but the specificity has drastically gone down (14.54%) which is not good.

Model 3

logit_1_up.preds<-as.vector(ifelse(predict(logit_1_up,test_set)>0.5,"YES","NO"))
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :
## prediction from a rank-deficient fit may be misleading
cm3<-confusionMatrix(data=as.factor(logit_1_up.preds),test_set$Bankrupt)
cm3
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   NO  YES
##        NO  1497   15
##        YES  152   40
##                                           
##                Accuracy : 0.902           
##                  95% CI : (0.8869, 0.9157)
##     No Information Rate : 0.9677          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.2882          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.9078          
##             Specificity : 0.7273          
##          Pos Pred Value : 0.9901          
##          Neg Pred Value : 0.2083          
##              Prevalence : 0.9677          
##          Detection Rate : 0.8785          
##    Detection Prevalence : 0.8873          
##       Balanced Accuracy : 0.8175          
##                                           
##        'Positive' Class : NO              
## 
resultsCmp <- rbind(resultsCmp,tibble(model = "Model 3",
                                F1 = cm3$byClass[7],
                                deviance = logit_1_up$deviance,
                                Accuracy = cm3$overall[1],
                                Sensitivity = cm3$byClass[1],
                                Specificity = cm3$byClass[2],
                                Precision = cm3$byClass[5],
                                r2 = 1 - logit_1_up$deviance / logit_1_up$null.deviance,
                                AIC = logit_1_up$aic))

Considering the imbalanced nature of test data, we did up sampling of the training data set and generated the model 3.

Model 4

logit_3_up.preds<-as.vector(ifelse(predict(logit_3_up,test_set)>0.5,"YES","NO"))
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == :
## prediction from a rank-deficient fit may be misleading
cm4<-confusionMatrix(data=as.factor(logit_3_up.preds),test_set$Bankrupt)
cm4
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   NO  YES
##        NO  1473   17
##        YES  176   38
##                                           
##                Accuracy : 0.8867          
##                  95% CI : (0.8707, 0.9014)
##     No Information Rate : 0.9677          
##     P-Value [Acc > NIR] : 1               
##                                           
##                   Kappa : 0.2437          
##                                           
##  Mcnemar's Test P-Value : <2e-16          
##                                           
##             Sensitivity : 0.8933          
##             Specificity : 0.6909          
##          Pos Pred Value : 0.9886          
##          Neg Pred Value : 0.1776          
##              Prevalence : 0.9677          
##          Detection Rate : 0.8644          
##    Detection Prevalence : 0.8744          
##       Balanced Accuracy : 0.7921          
##                                           
##        'Positive' Class : NO              
## 
resultsCmp <- rbind(resultsCmp,tibble(model = "Model 4",
                                F1 = cm4$byClass[7],
                                deviance = logit_3_up$deviance,
                                Accuracy = cm4$overall[1],
                                Sensitivity = cm4$byClass[1],
                                Specificity = cm4$byClass[2],
                                Precision = cm4$byClass[5],
                                r2 = 1 - logit_3_up$deviance / logit_3_up$null.deviance,
                                AIC = logit_3_up$aic))

We applied backward stepwise regression model 3 to built model 4.

Model Comparison

#resultsCmp
kbl(resultsCmp) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
model F1 deviance Accuracy Sensitivity Specificity Precision r2 AIC
Model 1 0.9716377 17877.6521 0.9454225 0.9660400 0.3272727 0.9773006 -11.2631517 18059.6521
Model 2 0.9816872 821.2444 0.9642019 0.9915100 0.1454545 0.9720571 0.4366685 879.2444
Model 3 0.9471686 116709.3497 0.9019953 0.9078229 0.7272727 0.9900794 -7.5038384 116891.3497
Model 4 0.9385155 113465.4209 0.8867371 0.8932686 0.6909091 0.9885906 -7.2674747 113641.4209

Model Selection

We could see that Model1 and Model2 have high F1,Accuracy,Sensitivity but the specificity values are really low(32 % and 14.54%). Hence we could reject both the Model 1 and Model 2.

Our earlier analysis showed that the data set has only 3% cases where bankruptcy has happened. Due to the imbalance nature of the data set , we did up sampling of the data and developed the model 3. We could see that Specificity has improved to 72.27%.

Model 4 was built by applying stepwise regression on Model 3. Even though model 4 has lower AIC, model 3 has better precision and sensitivity and accuracy. Hence model 3 is our choice.