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
Get step-by-step solutions from verified subject matter experts
