DATA 621: HW 2
David Quarshie - Group 3
Load Data
Question 2: Table
| Actual_Class | Predicted_Class | Freq |
|---|---|---|
| 0 | 0 | 119 |
| 1 | 0 | 30 |
| 0 | 1 | 5 |
| 1 | 1 | 27 |
The table shows the observations prediction outcomes. There were 119 that were class 0 and correctly predicted as class 0, 30 that were class 1 but predicted as class 0, 5 that were class 0 but predicted as class 1, and 27 that were class 1 and predicted as class 1.
Question 3-8 & 11: Classification Metrics
Verify that the accuracy and error rate sum to 1:
## [1] 1
Print all the classification metrics:
| accuracy | error_rate | precision | sensitivity | specificity | f1 |
|---|---|---|---|---|---|
| 0.8066298 | 0.1933702 | 0.7986577 | 0.9596774 | 0.4736842 | 0.8717949 |
Question 9: F1 Score
The precision and sensitivity scores are each bounded between 0 and 1, with the F1 score being calculated with those metrics we know that it must also be between 0 and 1.
Question 10: ROC Curve
Question 12: Caret Package
| accuracy | error_rate | precision | sensitivity | specificity | f1 | |
|---|---|---|---|---|---|---|
| MyFunction | 0.8066298 | 0.1933702 | 0.7986577 | 0.9596774 | 0.4736842 | 0.8717949 |
| Caret | 0.8066298 | 0.1933702 | 0.7986577 | 0.9596774 | 0.4736842 | 0.8717949 |
As shown in the table we got the same results by using the caret function.
Question 12: pROC Package
The ROC package got us the same plot and area under the curve.
Appendix
Code for this assignment can be found here:
https://github.com/dquarshie89/Data-621/blob/master/DQ_HW2.Rmd