R logistic regression area under curve -
i performing logistic regression using page. code below.
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv") mylogit <- glm(admit ~ gre, data = mydata, family = "binomial") summary(mylogit) prob=predict(mylogit,type=c("response")) mydata$prob=prob
after running code mydata dataframe has 2 columns - 'admit' , 'prob'. shouldn't 2 columns sufficient roc curve?
how can roc curve.
secondly, loooking @ mydata, seems model predicting probablity of admit=1
.
is correct?
how find out particular event model predicting?
thanks
update: seems below 3 commands useful. provide cut-off have maximum accuracy , roc curve.
coords(g, "best") mydata$prediction=ifelse(prob>=0.3126844,1,0) confusionmatrix(mydata$prediction,mydata$admit
the roc curve compares rank of prediction , answer. therefore, evaluate roc curve package proc
follow:
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv") mylogit <- glm(admit ~ gre, data = mydata, family = "binomial") summary(mylogit) prob=predict(mylogit,type=c("response")) mydata$prob=prob library(proc) g <- roc(admit ~ prob, data = mydata) plot(g)
Comments
Post a Comment