I use the smbinning R package to calculate the value of the variable information included in my dataset.
The smbinning() function is quite simple and should be used as follows:
result = smbinning(df= dataframe, y= "target_variable", x="characteristic_variable", p = 0.05)
So, df is the data set that you want to analyze, y target variable and x is the variable from which you want to compute statistics of information values; I list all the characteristic variables as z1, z2, ... z417 in order to be able to use the for loop to mechanize the entire analysis process.
I tried using the following for a loop:
for (i in 1:417) { result = smbinning(df=DATA, y = "FLAG", x = "DATA[,i]", p=0.05) }
in order to be able to calculate the information value for each variable corresponding to column i of the data frame.
The DATA class is "data.frame" and the result is "character" .
So my question is how to calculate the value of the information for each variable and store it in the declared result object?
Thanks! Any help would be appreciated!
for-loop r statistics binning
Quantopik
source share