I am looking at a dataset with one continuous independent variable (Quant) and one binary dependent variable (Binary). I used a multinomial model to predict the binary value from the continuous independent variable. I was hoping to make a ROC curve. This is the code below:
mymodel <- multinom(Quant~., data = dataset)
pred <- predict(mymodel,dataset)
roc_pred <- prediction(pred,dataset$Binary)
roc <- performance(roc_pred,"tpr","fpr")
Right now, if I run this code, I get the following error message: "Format of predictions is invalid." I'm not sure why my pred object wouldn't satisfy the requirements for the prediction function? The only way this will work is if I put in the following line of code instead :
pred <- predict(mymodel,dataset,type="prob")
However, this is getting me some strange values in the pred matrix. As my dependent variable is binary, I am expecting to get either a value of 0 or 1 in my pred variable (which is what I get with the original line of code), but when I add the type="prob", it gives me a 0.3 value for all of the observations where the independent variable (Quant) is equal to 0. What is the type="prob" changing, and why can't I just use the original line of code to get my ROC curve? Thank you.