R計算IV

參考文章bash

#讀取文件
rawdata = read.csv("/path/to/csv/file/credit.csv",header=T)
# colnames(rawdata)[18] <- "y"     //重命名因變量y

#數據分區 訓練集測試集
trainIdx <- sample(nrow(rawdata), round(0.6*nrow(rawdata)))
traindata <- rawdata[trainIdx,]
validdata <- rawdata[-trainIdx,]
# nrow(traindata)

# binning cutoff calculation
library(smbinning)
V1bin=smbinning(df=traindata, y="application_approved", x="credit_score", p=0.05)
V1bin$ivtable
V1bin$bands

相關文章
相關標籤/搜索