Hi Brian,
Thanks for your code. It works nicely, though I have the feeling that the ROC curve is not calculated correctly when there are ties. The following example should demonstrate that.
[xx,yy]=roc([-1 1; 1 2; -1 3; -1 4; 1 5; -1 6; 1 7; -1 8; 1 9; 1 10; 1 11; -1 13; 1 13; 1 14; 1 14])
yields:
0
0.1111
0.2222
0.4444
0.5556
0.6667
0.6667
0.7778
0.7778
0.8889
0.8889
0.8889
1.0000
1.0000
1.0000
yy =
0
0
0.1667
0.1667
0.1667
0.1667
0.3333
0.3333
0.5000
0.5000
0.6667
0.8333
0.8333
1.0000
1.0000
Manually doing this exercise, it's easy to show that the first non-zero value should be 0.2222 not 0.1111 (2 out of 9 signals are seen when no non-signals are detected yet). This is what SPSS (which is well aware of ties) yields as well:
Coordinates of the Curve
Test Result Variable(s): VAR00008
Positive if Greater Than or Equal Toa Sensitivity 1 - Specificity
.0000 1.000 1.000
1.5000 1.000 .833
2.5000 .889 .833
3.5000 .889 .667
4.5000 .889 .500
5.5000 .778 .500
6.5000 .778 .333
7.5000 .667 .333
8.5000 .667 .167
9.5000 .556 .167
10.5000 .444 .167
12.0000 .333 .167
13.5000 .222 .000
15.0000 .000 .000
The test result variable(s): VAR00008 has at least one tie between the positive actual state group and the negative actual state group.
a The smallest cutoff value is the minimum observed test value minus 1, and the largest cutoff value is the maximum observed test value plus 1. All the other cutoff values are the averages of two consecutive ordered observed test values.
Hi Brian,
Thanks for your code. It works nicely, though I have the feeling that the ROC curve is not calculated correctly when there are ties. The following example should demonstrate that.
[xx,yy]=roc([-1 1; 1 2; -1 3; -1 4; 1 5; -1 6; 1 7; -1 8; 1 9; 1 10; 1 11; -1 13; 1 13; 1 14; 1 14])
yields:
yy =
Manually doing this exercise, it's easy to show that the first non-zero value should be 0.2222 not 0.1111 (2 out of 9 signals are seen when no non-signals are detected yet). This is what SPSS (which is well aware of ties) yields as well:
Coordinates of the Curve
Test Result Variable(s): VAR00008
Positive if Greater Than or Equal Toa Sensitivity 1 - Specificity
.0000 1.000 1.000
1.5000 1.000 .833
2.5000 .889 .833
3.5000 .889 .667
4.5000 .889 .500
5.5000 .778 .500
6.5000 .778 .333
7.5000 .667 .333
8.5000 .667 .167
9.5000 .556 .167
10.5000 .444 .167
12.0000 .333 .167
13.5000 .222 .000
15.0000 .000 .000
The test result variable(s): VAR00008 has at least one tie between the positive actual state group and the negative actual state group.
a The smallest cutoff value is the minimum observed test value minus 1, and the largest cutoff value is the maximum observed test value plus 1. All the other cutoff values are the averages of two consecutive ordered observed test values.