I've calculated the model gini for a regression that I have run. I've done this using the method below:
###Model gini
library(MLmetrics)
library(pROC)
# Full Model
predicted <- predict(mylogit, my_data, type="response")
#calculate AUC
aucc <- auc(Insolvency, predicted)
gin = 2*aucc-1
And the regression looks like so:
mylogit = glm(Insolvency ~ Profits + Assets, data = my_data, family="binomial")
summary(mylogit)
I've been asked to calculate gini for all possible variables in one go (so imagine that this is profits, total assets, return on capital, net worth, and leverage). I suggested doing this variable by variable (like the above) however my boss wasn't satisfied with that and wants something that does everything in one go.
So my question is how can I calculate the model gini for all variables in one go (and probably ultimately for each unique variable as well) in a quick way? Is this at all possible?
The data (which I have posted in other threads) looks like so:
Insolvency
0
0
0
0
0
0
0
1
Lprofits
-23.43471027
-23.39077178
-23.1376606
-22.95771212
-22.88628836
-22.69567881
-22.29604723
-22.07703701
Lassets
25.68146508
25.7462893
22.72271675
24.3626251
24.39917186
26.66993697
21.91259524
23.80678002