expected.coords <- structure(c(-Inf, 0, 1, 0.36283185840708, 0, 41, 0, 72, NaN, 0.36283185840708, 0.63716814159292, 1, 1, 0, 0, 1, 0, 0.63716814159292, NaN, 0.63716814159292, 0.36283185840708, 1, 1, 1, 0.035, 0, 0.975609756097561, 0.353982300884956, 0, 40, 1, 72, 0, 0.357142857142857, 0.642857142857143, 1, 0.975609756097561, 0, 0.024390243902439, 1, 0.024390243902439, 0.646017699115044, 1, 0.642857142857143, 0.357142857142857, 0.975609756097561, 0.975609756097561, 1.00059488399762, 0.045, 0.0694444444444444, 0.975609756097561, 0.398230088495575, 5, 40, 1, 67, 0.833333333333333, 0.373831775700935, 0.626168224299065, 0.930555555555556, 0.975609756097561, 0.0694444444444444, 0.024390243902439, 0.930555555555556, 0.024390243902439, 0.601769911504425, 0.166666666666667, 0.626168224299065, 0.373831775700935, 0.975609756097561, 1.04505420054201, 0.866528525972929, 0.055, 0.111111111111111, 0.975609756097561, 0.424778761061947, 8, 40, 1, 64, 0.888888888888889, 0.384615384615385, 0.615384615384615, 0.888888888888889, 0.975609756097561, 0.111111111111111, 0.024390243902439, 0.888888888888889, 0.024390243902439, 0.575221238938053, 0.111111111111111, 0.615384615384615, 0.384615384615385, 0.975609756097561, 1.08672086720867, 0.790718340787744, 0.065, 0.138888888888889, 0.975609756097561, 0.442477876106195, 10, 40, 1, 62, 0.909090909090909, 0.392156862745098, 0.607843137254902, 0.861111111111111, 0.975609756097561, 0.138888888888889, 0.024390243902439, 0.861111111111111, 0.024390243902439, 0.557522123893805, 0.0909090909090909, 0.607843137254902, 0.392156862745098, 0.975609756097561, 1.11449864498645, 0.742107229676633, 0.075, 0.222222222222222, 0.902439024390244, 0.469026548672566, 16, 37, 4, 56, 0.8, 0.397849462365591, 0.602150537634409, 0.777777777777778, 0.902439024390244, 0.222222222222222, 0.0975609756097561, 0.777777777777778, 0.0975609756097561, 0.530973451327434, 0.2, 0.602150537634409, 0.397849462365591, 0.902439024390244, 1.12466124661247, 0.614456415566866, 0.085, 0.305555555555556, 0.878048780487805, 0.513274336283186, 22, 36, 5, 50, 0.814814814814815, 0.418604651162791, 0.581395348837209, 0.694444444444444, 0.878048780487805, 0.305555555555556, 0.121951219512195, 0.694444444444444, 0.121951219512195, 0.486725663716814, 0.185185185185185, 0.581395348837209, 0.418604651162791, 0.878048780487805, 1.18360433604336, 0.497125186360265, 0.095, 0.388888888888889, 0.829268292682927, 0.548672566371681, 28, 34, 7, 44, 0.8, 0.435897435897436, 0.564102564102564, 0.611111111111111, 0.829268292682927, 0.388888888888889, 0.170731707317073, 0.611111111111111, 0.170731707317073, 0.451327433628319, 0.2, 0.564102564102564, 0.435897435897436, 0.829268292682927, 1.21815718157182, 0.40260610600686, 0.105, 0.486111111111111, 0.780487804878049, 0.592920353982301, 35, 32, 9, 37, 0.795454545454545, 0.463768115942029, 0.536231884057971, 0.513888888888889, 0.780487804878049, 0.486111111111111, 0.219512195121951, 0.513888888888889, 0.219512195121951, 0.407079646017699, 0.204545454545455, 0.536231884057971, 0.463768115942029, 0.780487804878049, 1.26659891598916, 0.312267393930714, 0.115, 0.541666666666667, 0.75609756097561, 0.619469026548673, 39, 31, 10, 33, 0.795918367346939, 0.484375, 0.515625, 0.458333333333333, 0.75609756097561, 0.541666666666667, 0.24390243902439, 0.458333333333333, 0.24390243902439, 0.380530973451327, 0.204081632653061, 0.515625, 0.484375, 0.75609756097561, 1.29776422764228, 0.269557844206491, 0.125, 0.541666666666667, 0.731707317073171, 0.610619469026549, 39, 30, 11, 33, 0.78, 0.476190476190476, 0.523809523809524, 0.458333333333333, 0.731707317073171, 0.541666666666667, 0.268292682926829, 0.458333333333333, 0.268292682926829, 0.389380530973451, 0.22, 0.523809523809524, 0.476190476190476, 0.731707317073171, 1.27337398373984, 0.282050408156521, 0.135, 0.583333333333333, 0.682926829268293, 0.619469026548673, 42, 28, 13, 30, 0.763636363636364, 0.482758620689655, 0.517241379310345, 0.416666666666667, 0.682926829268293, 0.583333333333333, 0.317073170731707, 0.416666666666667, 0.317073170731707, 0.380530973451327, 0.236363636363636, 0.517241379310345, 0.482758620689655, 0.682926829268293, 1.26626016260163, 0.274146506708969, 0.145, 0.638888888888889, 0.658536585365854, 0.646017699115044, 46, 27, 14, 26, 0.766666666666667, 0.509433962264151, 0.490566037735849, 0.361111111111111, 0.658536585365854, 0.638888888888889, 0.341463414634146, 0.361111111111111, 0.341463414634146, 0.353982300884956, 0.233333333333333, 0.490566037735849, 0.509433962264151, 0.658536585365854, 1.29742547425474, 0.246998498101512, 0.155, 0.694444444444444, 0.658536585365854, 0.68141592920354, 50, 27, 14, 22, 0.78125, 0.551020408163265, 0.448979591836735, 0.305555555555556, 0.658536585365854, 0.694444444444444, 0.341463414634146, 0.305555555555556, 0.341463414634146, 0.31858407079646, 0.21875, 0.448979591836735, 0.551020408163265, 0.658536585365854, 1.3529810298103, 0.209961461064475, 0.165, 0.736111111111111, 0.634146341463415, 0.699115044247788, 53, 26, 15, 19, 0.779411764705882, 0.577777777777778, 0.422222222222222, 0.263888888888889, 0.634146341463415, 0.736111111111111, 0.365853658536585, 0.263888888888889, 0.365853658536585, 0.300884955752212, 0.220588235294118, 0.422222222222222, 0.577777777777778, 0.634146341463415, 1.37025745257453, 0.203486245143617, 0.175, 0.763888888888889, 0.634146341463415, 0.716814159292035, 55, 26, 15, 17, 0.785714285714286, 0.604651162790698, 0.395348837209302, 0.236111111111111, 0.634146341463415, 0.763888888888889, 0.365853658536585, 0.236111111111111, 0.365853658536585, 0.283185840707965, 0.214285714285714, 0.395348837209302, 0.604651162790698, 0.634146341463415, 1.3980352303523, 0.189597356254728, 0.185, 0.777777777777778, 0.634146341463415, 0.725663716814159, 56, 26, 15, 16, 0.788732394366197, 0.619047619047619, 0.380952380952381, 0.222222222222222, 0.634146341463415, 0.777777777777778, 0.365853658536585, 0.222222222222222, 0.365853658536585, 0.274336283185841, 0.211267605633803, 0.380952380952381, 0.619047619047619, 0.634146341463415, 1.41192411924119, 0.183231615513987, 0.205, 0.805555555555556, 0.634146341463415, 0.743362831858407, 58, 26, 15, 14, 0.794520547945205, 0.65, 0.35, 0.194444444444444, 0.634146341463415, 0.805555555555556, 0.365853658536585, 0.194444444444444, 0.365853658536585, 0.256637168141593, 0.205479452054795, 0.35, 0.65, 0.634146341463415, 1.43970189701897, 0.171657541439913, 0.225, 0.805555555555556, 0.609756097560976, 0.734513274336283, 58, 25, 16, 14, 0.783783783783784, 0.641025641025641, 0.358974358974359, 0.194444444444444, 0.609756097560976, 0.805555555555556, 0.390243902439024, 0.194444444444444, 0.390243902439024, 0.265486725663717, 0.216216216216216, 0.358974358974359, 0.641025641025641, 0.609756097560976, 1.41531165311653, 0.190098945366147, 0.235, 0.805555555555556, 0.585365853658537, 0.725663716814159, 58, 24, 17, 14, 0.773333333333333, 0.631578947368421, 0.368421052631579, 0.194444444444444, 0.585365853658537, 0.805555555555556, 0.414634146341463, 0.194444444444444, 0.414634146341463, 0.274336283185841, 0.226666666666667, 0.368421052631579, 0.631578947368421, 0.585365853658537, 1.39092140921409, 0.209730117287623, 0.245, 0.819444444444444, 0.585365853658537, 0.734513274336283, 59, 24, 17, 13, 0.776315789473684, 0.648648648648649, 0.351351351351351, 0.180555555555556, 0.585365853658537, 0.819444444444444, 0.414634146341463, 0.180555555555556, 0.414634146341463, 0.265486725663717, 0.223684210526316, 0.351351351351351, 0.648648648648649, 0.585365853658537, 1.40481029810298, 0.204521783954289, 0.255, 0.819444444444444, 0.560975609756098, 0.725663716814159, 59, 23, 18, 13, 0.766233766233766, 0.638888888888889, 0.361111111111111, 0.180555555555556, 0.560975609756098, 0.819444444444444, 0.439024390243902, 0.180555555555556, 0.439024390243902, 0.274336283185841, 0.233766233766234, 0.361111111111111, 0.638888888888889, 0.560975609756098, 1.38042005420054, 0.225342723871006, 0.265, 0.819444444444444, 0.536585365853659, 0.716814159292035, 59, 22, 19, 13, 0.756410256410256, 0.628571428571429, 0.371428571428571, 0.180555555555556, 0.536585365853659, 0.819444444444444, 0.463414634146341, 0.180555555555556, 0.463414634146341, 0.283185840707965, 0.243589743589744, 0.371428571428571, 0.628571428571429, 0.536585365853659, 1.3560298102981, 0.247353431782963, 0.275, 0.819444444444444, 0.51219512195122, 0.707964601769911, 59, 21, 20, 13, 0.746835443037975, 0.617647058823529, 0.382352941176471, 0.180555555555556, 0.51219512195122, 0.819444444444444, 0.48780487804878, 0.180555555555556, 0.48780487804878, 0.292035398230089, 0.253164556962025, 0.382352941176471, 0.617647058823529, 0.51219512195122, 1.33163956639566, 0.270553907690161, 0.29, 0.833333333333333, 0.51219512195122, 0.716814159292035, 60, 21, 20, 12, 0.75, 0.636363636363636, 0.363636363636364, 0.166666666666667, 0.51219512195122, 0.833333333333333, 0.48780487804878, 0.166666666666667, 0.48780487804878, 0.283185840707965, 0.25, 0.363636363636364, 0.636363636363636, 0.51219512195122, 1.34552845528455, 0.265731376825963, 0.31, 0.833333333333333, 0.48780487804878, 0.707964601769911, 60, 20, 21, 12, 0.740740740740741, 0.625, 0.375, 0.166666666666667, 0.48780487804878, 0.833333333333333, 0.51219512195122, 0.166666666666667, 0.51219512195122, 0.292035398230089, 0.259259259259259, 0.375, 0.625, 0.48780487804878, 1.32113821138211, 0.290121620728402, 0.325, 0.847222222222222, 0.463414634146341, 0.707964601769911, 61, 19, 22, 11, 0.734939759036145, 0.633333333333333, 0.366666666666667, 0.152777777777778, 0.463414634146341, 0.847222222222222, 0.536585365853659, 0.152777777777778, 0.536585365853659, 0.292035398230089, 0.265060240963855, 0.366666666666667, 0.633333333333333, 0.463414634146341, 1.31063685636856, 0.311264904231021, 0.335, 0.861111111111111, 0.439024390243902, 0.707964601769911, 62, 18, 23, 10, 0.729411764705882, 0.642857142857143, 0.357142857142857, 0.138888888888889, 0.439024390243902, 0.861111111111111, 0.560975609756098, 0.138888888888889, 0.560975609756098, 0.292035398230089, 0.270588235294118, 0.357142857142857, 0.642857142857143, 0.439024390243902, 1.30013550135501, 0.333983758198016, 0.345, 0.875, 0.439024390243902, 0.716814159292035, 63, 18, 23, 9, 0.732558139534884, 0.666666666666667, 0.333333333333333, 0.125, 0.439024390243902, 0.875, 0.560975609756098, 0.125, 0.560975609756098, 0.283185840707965, 0.267441860465116, 0.333333333333333, 0.666666666666667, 0.439024390243902, 1.3140243902439, 0.330318634741226, 0.365, 0.875, 0.414634146341463, 0.707964601769911, 63, 17, 24, 9, 0.724137931034483, 0.653846153846154, 0.346153846153846, 0.125, 0.414634146341463, 0.875, 0.585365853658537, 0.125, 0.585365853658537, 0.292035398230089, 0.275862068965517, 0.346153846153846, 0.653846153846154, 0.414634146341463, 1.28963414634146, 0.358278182629387, 0.395, 0.888888888888889, 0.414634146341463, 0.716814159292035, 64, 17, 24, 8, 0.727272727272727, 0.68, 0.32, 0.111111111111111, 0.414634146341463, 0.888888888888889, 0.585365853658537, 0.111111111111111, 0.585365853658537, 0.283185840707965, 0.272727272727273, 0.32, 0.68, 0.414634146341463, 1.30352303523035, 0.354998861641733, 0.42, 0.888888888888889, 0.390243902439024, 0.707964601769911, 64, 16, 25, 8, 0.719101123595506, 0.666666666666667, 0.333333333333333, 0.111111111111111, 0.390243902439024, 0.888888888888889, 0.609756097560976, 0.111111111111111, 0.609756097560976, 0.292035398230089, 0.280898876404494, 0.333333333333333, 0.666666666666667, 0.390243902439024, 1.27913279132791, 0.384148177525136, 0.435, 0.902777777777778, 0.390243902439024, 0.716814159292035, 65, 16, 25, 7, 0.722222222222222, 0.695652173913043, 0.304347826086957, 0.0972222222222222, 0.390243902439024, 0.902777777777778, 0.609756097560976, 0.0972222222222222, 0.609756097560976, 0.283185840707965, 0.277777777777778, 0.304347826086957, 0.695652173913043, 0.390243902439024, 1.2930216802168, 0.381254659006617, 0.445, 0.902777777777778, 0.341463414634146, 0.699115044247788, 65, 14, 27, 7, 0.706521739130435, 0.666666666666667, 0.333333333333333, 0.0972222222222222, 0.341463414634146, 0.902777777777778, 0.658536585365854, 0.0972222222222222, 0.658536585365854, 0.300884955752212, 0.293478260869565, 0.333333333333333, 0.666666666666667, 0.341463414634146, 1.24424119241192, 0.443122594759145, 0.455, 0.916666666666667, 0.341463414634146, 0.707964601769911, 66, 14, 27, 6, 0.709677419354839, 0.7, 0.3, 0.0833333333333334, 0.341463414634146, 0.916666666666667, 0.658536585365854, 0.0833333333333334, 0.658536585365854, 0.292035398230089, 0.290322580645161, 0.3, 0.7, 0.341463414634146, 1.25813008130081, 0.440614878709763, 0.465, 0.930555555555556, 0.341463414634146, 0.716814159292035, 67, 14, 27, 5, 0.712765957446808, 0.736842105263158, 0.263157894736842, 0.0694444444444444, 0.341463414634146, 0.930555555555556, 0.658536585365854, 0.0694444444444444, 0.658536585365854, 0.283185840707965, 0.287234042553192, 0.263157894736842, 0.736842105263158, 0.341463414634146, 1.2720189701897, 0.438492965129516, 0.475, 0.958333333333333, 0.341463414634146, 0.734513274336283, 69, 14, 27, 3, 0.71875, 0.823529411764706, 0.176470588235294, 0.0416666666666666, 0.341463414634146, 0.958333333333333, 0.658536585365854, 0.0416666666666666, 0.658536585365854, 0.265486725663717, 0.28125, 0.176470588235294, 0.823529411764706, 0.341463414634146, 1.29979674796748, 0.435406545376429, 0.485, 0.972222222222222, 0.317073170731707, 0.734513274336283, 70, 13, 28, 2, 0.714285714285714, 0.866666666666667, 0.133333333333333, 0.0277777777777778, 0.317073170731707, 0.972222222222222, 0.682926829268293, 0.0277777777777778, 0.682926829268293, 0.265486725663717, 0.285714285714286, 0.133333333333333, 0.866666666666667, 0.317073170731707, 1.28929539295393, 0.467160659072715, 0.495, 0.972222222222222, 0.292682926829268, 0.725663716814159, 70, 12, 29, 2, 0.707070707070707, 0.857142857142857, 0.142857142857143, 0.0277777777777778, 0.292682926829268, 0.972222222222222, 0.707317073170732, 0.0277777777777778, 0.707317073170732, 0.274336283185841, 0.292929292929293, 0.142857142857143, 0.857142857142857, 0.292682926829268, 1.26490514905149, 0.501069046937082, 0.51, 1, 0.292682926829268, 0.743362831858407, 72, 12, 29, 0, 0.712871287128713, 1, 0, 0, 0.292682926829268, 1, 0.707317073170732, 0, 0.707317073170732, 0.256637168141593, 0.287128712871287, 0, 1, 0.292682926829268, 1.29268292682927, 0.50029744199881, 0.54, 1, 0.268292682926829, 0.734513274336283, 72, 11, 30, 0, 0.705882352941177, 1, 0, 0, 0.268292682926829, 1, 0.731707317073171, 0, 0.731707317073171, 0.265486725663717, 0.294117647058823, 0, 1, 0.268292682926829, 1.26829268292683, 0.535395597858418, 0.57, 1, 0.24390243902439, 0.725663716814159, 72, 10, 31, 0, 0.699029126213592, 1, 0, 0, 0.24390243902439, 1, 0.75609756097561, 0, 0.75609756097561, 0.274336283185841, 0.300970873786408, 0, 1, 0.24390243902439, 1.24390243902439, 0.571683521713266, 0.64, 1, 0.219512195121951, 0.716814159292035, 72, 9, 32, 0, 0.692307692307692, 1, 0, 0, 0.219512195121951, 1, 0.780487804878049, 0, 0.780487804878049, 0.283185840707965, 0.307692307692308, 0, 1, 0.219512195121951, 1.21951219512195, 0.609161213563355, 0.705, 1, 0.195121951219512, 0.707964601769911, 72, 8, 33, 0, 0.685714285714286, 1, 0, 0, 0.195121951219512, 1, 0.804878048780488, 0, 0.804878048780488, 0.292035398230089, 0.314285714285714, 0, 1, 0.195121951219512, 1.19512195121951, 0.647828673408685, 0.725, 1, 0.146341463414634, 0.690265486725664, 72, 6, 35, 0, 0.672897196261682, 1, 0, 0, 0.146341463414634, 1, 0.853658536585366, 0, 0.853658536585366, 0.309734513274336, 0.327102803738318, 0, 1, 0.146341463414634, 1.14634146341463, 0.728732897085068, 0.755, 1, 0.121951219512195, 0.68141592920354, 72, 5, 36, 0, 0.666666666666667, 1, 0, 0, 0.121951219512195, 1, 0.878048780487805, 0, 0.878048780487805, 0.31858407079646, 0.333333333333333, 0, 1, 0.121951219512195, 1.1219512195122, 0.770969660916121, 0.795, 1, 0.0975609756097561, 0.672566371681416, 72, 4, 37, 0, 0.660550458715596, 1, 0, 0, 0.0975609756097561, 1, 0.902439024390244, 0, 0.902439024390244, 0.327433628318584, 0.339449541284404, 0, 1, 0.0975609756097561, 1.09756097560976, 0.814396192742415, 0.84, 1, 0.0731707317073171, 0.663716814159292, 72, 3, 38, 0, 0.654545454545455, 1, 0, 0, 0.0731707317073171, 1, 0.926829268292683, 0, 0.926829268292683, 0.336283185840708, 0.345454545454545, 0, 1, 0.0731707317073171, 1.07317073170732, 0.85901249256395, 0.91, 1, 0.0487804878048781, 0.654867256637168, 72, 2, 39, 0, 0.648648648648649, 1, 0, 0, 0.0487804878048781, 1, 0.951219512195122, 0, 0.951219512195122, 0.345132743362832, 0.351351351351351, 0, 1, 0.0487804878048781, 1.04878048780488, 0.904818560380726, 1.515, 1, 0.024390243902439, 0.646017699115044, 72, 1, 40, 0, 0.642857142857143, 1, 0, 0, 0.024390243902439, 1, 0.975609756097561, 0, 0.975609756097561, 0.353982300884956, 0.357142857142857, 0, 1, 0.024390243902439, 1.02439024390244, 0.951814396192742, Inf, 1, 0, 0.63716814159292, 72, 0, 41, 0, 0.63716814159292, NaN, NaN, 0, 0, 1, 1, 0, 1, 0.36283185840708, 0.36283185840708, NaN, NaN, 0, 1, 1), .Dim = c(24L, 51L), .Dimnames = list( c("threshold", "specificity", "sensitivity", "accuracy", "tn", "tp", "fn", "fp", "npv", "ppv", "fdr", "fpr", "tpr", "tnr", "fnr", "1-specificity", "1-sensitivity", "1-accuracy", "1-npv", "1-ppv", "precision", "recall", "youden", "closest.topleft" ), NULL)) r.100b.reversed <- roc(aSAH$outcome, aSAH$s100b, direction=">", quiet=TRUE) expected.coords.reverse <- structure(c(0.05, 0.888888888888889, 0.024390243902439, 0.575221238938053, 64, 1, 40, 8, 0.615384615384615, 0.111111111111111, 0.111111111111111, 0.975609756097561, 0.424778761061947, 0.384615384615385, 0.888888888888889, 0.055, 0.888888888888889, 0.024390243902439, 0.575221238938053, 64, 1, 40, 8, 0.615384615384615, 0.111111111111111, 0.111111111111111, 0.975609756097561, 0.424778761061947, 0.384615384615385, 0.888888888888889, 0.205, 0.194444444444444, 0.365853658536585, 0.256637168141593, 14, 15, 26, 58, 0.35, 0.205479452054795, 0.805555555555556, 0.634146341463415, 0.743362831858407, 0.65, 0.794520547945206, 0.52, 0, 0.731707317073171, 0.265486725663717, 0, 30, 11, 72, 0, 0.294117647058824, 1, 0.268292682926829, 0.734513274336283, 1, 0.705882352941176), .Dim = c(15L, 4L), .Dimnames = list( c("threshold", "specificity", "sensitivity", "accuracy", "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity", "1-sensitivity", "1-accuracy", "1-npv", "1-ppv"), NULL))