Question
#construct ROC curve alph
#construct ROC curve alph<-seq(0.01,1,0.01)
roc1<-matrix(0,length(alph),3) roc1[,1]<-alph for(i in 1:length(alph)) {mLR.cli<-ifelse(mLR.pr>alph[i],1,0) mLR.cmi<-table(mLR.cli,ojTest[,1])
if((dim(mLR.cmi)[1])<2) {mLR.cmi<-rbind(mLR.cmi,c(0,0))} #what is this? roc1[i,2]<-1-(conf.fun(mLR.cmi)[3]) roc1[i,3]<-conf.fun(mLR.cmi)[2]}
plot(roc1[,2],roc1[,3],type="l",col=2,ylab="sensitivity", xlab="1-specificity",main="ROC curve - Logistic Regression") abline(0,1,col="grey")
Q: if((dim(mLR.cmi)[1])<2) {mLR.cmi<-rbind(mLR.cmi,c(0,0))} #what is this?
What is the function of this line of code? Thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started