I'm trying to make a ROC curve using plotly.js
with the values obtained in R.
In plotly
, I have to fill out the values(x-axis, y-axis) to make a plot.
But, I don't know how to get the values when I use Logistic Regression function glm
or multinom
(in nnet
packages).
df <- data.frame(age = c(10, 20, 30, 40, 50),height = c(150, 161, 141, 155, 180), house = c("0", "0", "0", "1", "1"))
smp_size <- floor(nrow(df) * (0.6))
train_idx <- sample(seq_len(nrow(df)), size = smp_size)
train <- df[train_idx, ]
validation <- df[-train_idx, ]
validation_x <- validation[c("age", "height")]
validation_y <- validation[["house"]]
m <- glm(house ~ age + height, data = train, family = 'binomial')
y_pred <- predict(m, validation_x)
library(plotROC)
plotROC(validation_y, y_pred)
I want to know how to get the values of x-axis(FPR) and y-axis(TPR) in ROC curve
thank you.