Guys,

I select 70% of my data and keep 30% of it for model validation.

mydata <- read.csv(file.choose(), header=TRUE)
select <- sample(nrow(mydata), nrow(mydata) * .7)
data70 <- mydata[select,]  # select
data30 <- mydata[-select,]  # testing
temp.glm <- glm(Death~Temperature, data=data70,
family=binomial(link="logit"))

library(ROCR)  # ROC curve and assessment of my prediction
pred <- prediction(data30$pred, data30$Death)
perf <- performance(pred,"tpr","fpr")
plot(perf); abline(0, 1, col="red")
attributes(performance(pred, 'auc'))$y.values[[1]] # area under the ROC

How do i make a loop so that the process could be repeated several time,
producing randomly ROC curve and under ROC values?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to