Skip to content

Commit 1d417f3

Browse files
author
LProcopi15
committed
final touches
1 parent f695ccf commit 1d417f3

File tree

1 file changed

+17
-1
lines changed
  • Week 6 - Assumptions and Transformations

1 file changed

+17
-1
lines changed

Week 6 - Assumptions and Transformations/Lecture6.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ fert$output <- as.integer(fert$output)
8989
fert.glm <- glm(output~., family = binomial(link = "logit"), data = fert)
9090
summary(fert.glm)
9191

92+
93+
# Prediction using logistic regression model
94+
fert.pred <- predict(fert.glm, type = "response")
95+
# Score table: gives the values of false positive, false negative, true positive and true negative
96+
# Based on a specific cut off probability: 0.3 means that R should classify all probabilities of less than 0.3 as false and greater than 0.3 as true
97+
score.table(fert.pred,fert$output,0.3)
98+
# ROC plot: Ratio of true positives to false positives
99+
# Upper right-hand corner is an ideal curve
100+
plot.roc(fert.pred, fert$output, main = "ROC Curve - Fertility", col = "blue")
101+
92102
######################
93103
#
94104
# Practice Problems
@@ -117,6 +127,12 @@ summary(fert.glm)
117127

118128
# 10. Compare the models using ajd-R2 (won't work for logistic)
119129

120-
# 11. Use the first linear regression model and for the logistic regression model to predict test values
130+
# 11. Use the first and second linear regression model to predict test values
121131

122132
# 12. Compare these two models using MSE
133+
134+
# 13. Using your logistic regression model construct a confusion matrix
135+
136+
# 14. Using your logistic regression model construct a ROC curve
137+
138+
# 15. Compare the logistic regression model you made with the one we constructed as a class using ROC and confusion matrix

0 commit comments

Comments
 (0)