Created
January 23, 2019 16:10
-
-
Save mrchypark/d4f478f2fcccd4678d844b91c62a39ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(randomForestSRC) | |
library(dplyr) | |
library(ROCR) | |
library(doParallel) | |
data(pbc, package="randomForestSRC") | |
data_na <- na.omit(pbc) | |
data_na <- data_na %>% dplyr::select(-days) | |
head <- names(data_na[,2:15]) | |
result <- foreach(VAR=head) %do% { | |
model <- glm(status~. | |
,data=data_na[,c("status", VAR)] | |
,family="binomial") | |
p <- predict(model, data_na, type="response") | |
pr <- prediction(p, data_na$status) | |
auc_list <- performance(pr, measure="auc") | |
auc <- [email protected][[1]] %>% | |
list %>% | |
(function(x) {names(x) <- VAR; return(x)}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment