[R] How to create a ROC curve for a model which has log of odds as response?

Bhim Chaulagain @gr|bh|mch@u|@g@|n @end|ng |rom gm@||@com
Wed Apr 24 20:35:00 CEST 2019


I have a question on plotting ROC curve for my model which has log of odds as
the response. For example:

model<-lm((ln(y/1-y)~Temp+RH+DmaxT, data=fit) #'y' is a proportion

Predicted response was obtained for a new data set as:

Predicted_model<-predict(model, newdata, type = 'response')

Predicted values were back-transformed to get values in proportion

I have new observations in proportion and I used 0.05 cutoff value to
represent control (<0.05) and cases (>0.05)

newdata$observed<-ifelse(newdata$observed > 0.05, "cases", "controls")

I plotted ROC curve using the following formula

roc(newdata$observed, predicted_model_backtrans, legacy.axes = TRUE,
plot = TRUE, print.auc = TRUE)

With this formula, I got AUC value 1 and the plot is different than
expected. I couldn't figure out what would be the best way to create ROC
curve for my model type. Any help would be appreciated.

I also tried to create ROC curve where I changed observed and predicted
proportion into binary characteristics (control (<0.05) and cases (>0.05))
which gave me straight line curve rather than smooth.
r <https://stackoverflow.com/questions/tagged/r> linear-regression
<https://stackoverflow.com/questions/tagged/linear-regression> roc
<https://stackoverflow.com/questions/tagged/roc>


-- 
Regards
Bhim Chaulagain

	[[alternative HTML version deleted]]



More information about the R-help mailing list