I have a 5 variable data set called EYETESTS. The variables are MAD, SAD, RED, BLUE, LEVEL.
MAD, SAD, RED AND BLUE AND LEVEL are all factor variables with 2 factors that represent yes(1) or no(0).
Example:
MAD | SAD | RED | BLUE | LEVEL |
---|---|---|---|---|
0 | 0 | 0 | 1 | 1 |
0 | 1 | 1 | 0 | 0 |
1 | 0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 |
1 | 0 | 0 | 0 | 1 |
I am trying to create a confusion matrix of MAD against LEVEL. My Reference variable is LEVEL. The other variables are all predictor/test variables.
Then a separate confusion matrix of SAD against LEVEL. Then a separate confusion matrix of RED against LEVEL. Then a separate confusion matrix of BLUE against LEVEL.
The issue that I am having trouble with is calculating the 95% Confidence Intervals for the sensitivity and specificity alongside the others.
I can get the output in the form I want using the caret library.
library(caret)
confusionMatrix(as.factor(SAD), as.factor(LEVEL))
This gives me the output I want in terms of sensitivity, specificity and accuracy but I want the 95% Confidence Intervals for the sensitivity and specificity.
Would be incredibly grateful for help with this. I have tried using the conf
package and the epiR
package but they do not give the confidence intervals for the sensitivity and specificity.