[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] How to create a ROC curve for a model which has log of odds as response?
From: Bhim Chaulagain <agribhimchaulagain () gmail ! com>
Date: 2019-04-24 18:35:00
Message-ID: CADsnGAxbp5pRMD+PAbW10O2QgYVU4=aSoDuZd+QpOzZVn3qZjg () mail ! gmail ! com
[Download RAW message or body]
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]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic