I am trying to do a ROC curve in R but I am having some difficulty. I have the following code:
library(ROCR)
train.pred <- prediction(predict(LOL.out,type="response"),LOL.train$Win)
train.perf <- performance(train.pred,measure="tpr", x.measure="fpr")
plot(train.perf,xlab="1-specificity",ylab="sensitivity", main="ROC curve")
abline(0,1,col="gray")
The LOL.out is the output from my linear model and I am trying to predict wins. The difficultly I have is that when I run the code the first time in a new R environment, it runs fine. However, when I run the exact same code again, it gives me the following output:
Error in ets(object, lambda = lambda, biasadj = biasadj, allow.multiplicative.trend = allow.multiplicative.trend, :
No model able to be fitted
When I restart R again, it sometimes runs fine but I cannot run the code more than once or I get the same error. In trying to implement this code elsewhere on other projects, I get the same error there. The problem lies in the prediction() function. I have been trying to find more information on this function and debugging it but there doesn't seem to be a lot of documentation on it. I have had issues with this in the past. Does anyone know a good solution to this? What experiences has everyone else had with the prediction() function?