I have been trying to calculate some measures about specificity and sensitivity.
The SDMTools R package worked great to get the overall estimates.
library(SDMTools)
a <- c(1,1,1,1,0,0,0,1,0,1,1,1) #observed
b <- c(1,1,0,0,1,0,0,1,0,0,1,1) #predicted
accuracy(a, b)
# threshold AUC omission.rate sensitivity specificity prop.correct Kappa
#1 0.5 0.6875 0.375 0.625 0.75 0.6666667 0.3333333
Unfortunately, I was not able to get the raw numbers for TRUE POSITIVE,TRUE NEGATIVE, FALSE POSITIVE, FALSE NEGATIVE. I would like to have them in four different columns. Does anyone know a package or a function that can do that? The result I would like to get is below.
#TP TN FP FN
#5 3 1 3