Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do AIC and ROC in the above sample give consistent results? Why or why not? ## ROC Curve and calculating the area under the curve

Do AIC and ROC in the above sample give consistent results? Why or why not?
## ROC Curve and calculating the area under the curve(AUC)
> library(ROCR)
> predictions - predict(model, newdata=test, type="response")
> ROCRpred - prediction(predictions, test$Survived)
> ROCRperf - performance(ROCRpred, measure ="tpr", x.measure ="fpr")
> plot(ROCRperf, colorize = TRUE, text.adj = c(-0.2,1.7), print.cutoffs.at = seq(0,1,0.1))
>
> auc - performance(ROCRpred, measure = "auc")
> auc - auc@y.values[[1]]
> auc
[1]0.8714211> model - glm(Survived , family=binomial(1ink='logit'), data=train)
> summary (model)
Ca17:
g1m(formu1a = Survived ., fami1y = binomia1(1ink ="1ogit"),
data = train)
Coefficients: (3 not defined because of singularities)
Signif; codes:
n to be 1)
Nu11 deviance: 891.99 on 666 degrees of freedom Resiual deviance: 605.78 on 657 degrees
of freedom
AIC: 625.78
Number of Fisher Scoring iterations: 5.
## ROC Curve and calculating the area under the curve(AUC)
> library(ROCR)> ROCRpred - prediction(predictions, test$Survived)
> ROCRperf - performance(ROCRpred, measure ="tpr", x. measure ="fpr")
> plot(ROCRperf, colorize = TRUE, text.adj =c(-0.2,1.7),
print.cutoffs.at =seq(0,1,0.1)
> auc - performance(ROCRpred, measure = "auc")
> auc - auc@y. values [[1]]
> auc
[1]0.8714211
False positive rate
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions