Adapted version of sensitivity / specificity for disease detection

JB32

New Member
#1
I have data collected from sensors to detect disease in several individuals. Each individual has a known disease status (labeled Actual in the table below) for each day and a predicted disease status (Predicted in the table below) from prediction equations performed on the sensor data. I am trying to calculate sensitivity/specificity from this. Each individual can have more than one disease case, and cases can last for multiple days. The sensor fairly accurate at detecting disease on the first or second day of disease. On some occasions, the sensor data is able to predict disease the day before a case is observed.
For example in the table below, a disease day is predicted from the sensor data the day before a disease event occurred. A healthy day is denoted by a 0 and an ill/diseased day by 1. There has to be 3 clear (healthy) days between recorded disease events for it to be classed as a new event, so days 41 and 42 are part of the same event as days 37-39. This should be classed as a true positive as it was able to predict the disease event.

Code:
 Day   Actual   Predicted 
----- -------- -----------
34        0           0 
35        0           0 
36        0           1 
37        1           0 
38        1           0 
39        1           0 
40        0           0 
41        1           0 
42        1           0 
43        0           0 
44        0           0
The issue with the “traditional” way of performing sensitivity and specificity (I've been doing this using confusionmatrix in the caret package of R) is that it looks at each day individually rather than on a case by case basis. This gives really poor sensitivity results as cases can last for multiple days, when in fact the sensor is able to detect the disease event on the first day of disease. I would like to class any occasions when Actual and Predicted are in agreement, even if only for 1 day across a disease event.
Is there a way to do this using an adapted version of a confusion matrix (if this exists)? Or would another test be more suitable?