I am trying to calculate sensitivity and specificity. I used the caret package and the pROC package . However, why do I get different results using two different packages?
I have converted the data into binary form(whenever there is a correct call it is labelled as 1 and 0 for incorrect call .i.e any of the rest 39 class).
The confusion matrix is as follows:
table(actual_labels,app_labels)
app_labels
actual_labels 0 1
0 1183 23
1 5 18
Method 1: Using the caret package
> sensitivity(table(actual_labels,app_labels))
[1] 0.9957912
> specificity(table(actual_labels,app_labels))
[1] 0.4390244
cutoff of =0.5
Method 2: Using the pROC package
aa <- roc(actual_labels,app_labels)
Setting levels: control = 0, case = 1
Setting direction: controls < cases
> aa$sensitivities
[1] 1.0000000 0.7826087 0.0000000
> aa$specificities
[1] 0.0000000 0.9809287 1.0000000
> aa$thresholds
[1] -Inf 0.5 Inf
Why do I get different results using two different packages?