I am trying to calculate the ROC of a target variable that is binary(0,1) versus a decision tree prediction.
When I set the prediction value to be binary, it gives me the following error:
> roc(as.numeric(pred),as.numeric(data$target))
Setting levels: control = 0, case = 1
Setting direction: controls < cases
When I set the prediction value to be a probability, it gives me the following error:
> roc(pred[,2],as.numeric(data$target))
'response' has more than two levels. Consider setting 'levels'
explicitly or using 'multiclass.roc' insteadSetting levels:
control = 0.166666666666667, case = 0.232876712328767
Setting direction: controls < cases
So I am confused about what format should I set to the prediction to so that the ROC is calculated correctly? Why is my function showing these errors?