Package `SenSpe’ considers biomarker evaluation and comparison in terms of specificity at a controlled sensitivity level, or sensitivity at a controlled specificity level. Point estimation and exact bootstrap of Huang, Parakati, Patil, and Sanda (2023) for the one- and two-biomarker problems are implemented.
Perform point estimation and exact bootstrap-based inference, with a simulated dataset:
library("SenSpe")
## simulate biomarkers of 100 cases and 100 controls
set.seed(1234)
n1 <- 100
n0 <- 100
mk <- c(rnorm(n1,1,1),rnorm(n0,0,1))
## estimate specificity at controlled 0.95 sensitivity
snsp1m(mk, n1=n1, s0=0.95)
#> $threshold
#> [1] -0.3907009
#>
#> $hss
#> [1] 0.3000 0.2905
#>
#> $hvar1
#> [1] 0.003888629
#>
#> $hvar2
#> [1] 0.002074472
#>
#> $hvar
#> [1] 0.005963102
#>
#> $btpdf
#> [1] 3.952989e-06 3.393394e-05 1.444300e-04 4.062903e-04 8.497248e-04
#> [6] 1.409604e-03 1.933969e-03 2.264204e-03 2.329221e-03 2.187392e-03
#> [11] 1.998374e-03 1.956677e-03 2.229926e-03 2.924559e-03 4.078817e-03
#> [16] 5.673678e-03 7.653984e-03 9.954820e-03 1.252777e-02 1.535999e-02
#> [21] 1.847949e-02 2.194335e-02 2.581051e-02 3.010501e-02 3.477846e-02
#> [26] 3.968231e-02 4.455990e-02 4.906561e-02 5.281161e-02 5.543441e-02
#> [31] 5.666500e-02 5.638367e-02 5.464338e-02 5.165538e-02 4.774191e-02
#> [36] 4.327073e-02 3.858981e-02 3.397836e-02 2.962294e-02 2.561894e-02
#> [41] 2.199055e-02 1.871911e-02 1.577015e-02 1.311257e-02 1.072777e-02
#> [46] 8.609875e-03 6.760455e-03 5.181388e-03 3.868876e-03 2.810141e-03
#> [51] 1.983093e-03 1.358314e-03 9.022963e-04 5.809021e-04 3.622648e-04
#> [56] 2.187408e-04 1.278412e-04 7.230252e-05 3.956722e-05 2.095238e-05
#> [61] 1.073813e-05 5.328120e-06 2.560912e-06 1.193129e-06 5.392772e-07
#> [66] 2.366876e-07 1.009745e-07 4.191380e-08 1.694475e-08 6.678211e-09
#> [71] 2.568484e-09 9.652875e-10 3.551893e-10 1.283687e-10 4.579137e-11
#> [76] 1.623548e-11 5.771440e-12 2.075367e-12 7.597136e-13 2.834223e-13
#> [81] 1.072195e-13 4.073800e-14 1.536847e-14 5.692880e-15 2.050288e-15
#> [86] 7.116898e-16 2.361730e-16 7.432100e-17 2.199044e-17 6.061802e-18
#> [91] 1.541137e-18 3.573595e-19 7.463152e-20 1.383394e-20 2.236376e-21
#> [96] 3.084049e-22 3.523158e-23 3.197816e-24 2.160508e-25 9.652994e-27
#> [101] 2.138301e-28
#>
#> $wald_ci
#> [,1] [,2]
#> [1,] 0.1486494 0.4513506
#> [2,] 0.1391494 0.4418506
#>
#> $pct_ci
#> [1] 0.15 0.45
#>
#> $scr_ci
#> [,1] [,2]
#> [1,] 0.1740170 0.4657600
#> [2,] 0.1666608 0.4560056
#>
#> $zq_ci
#> [1] 0.1648905 0.4563938
Function snsp1m
outputs estimated threshold
(threshold
), estimated specificity at controlled
sensitivity (or sensitivity at controlled specificity)
(hss
), exact bootstrap variance estimate for the
performance metric (hvar
) along with its components
(hvar1
and hvar2
), exact bootstrap
distribution (btpdf
), Wald confidence intervals
(wald_ci
), percentile confidence interval
(pct_ci
), score confidence intervals (scr_ci
),
and exact bootstrap version of the BTII interval in Zhou and Qin (2005,
Statistics in Medicine 24, pp 465–477) (zq_ci
).
## simulate paired biomarkers X and Y, with correlation 0.5, 100 cases and 100 controls
n1 <- 100
n0 <- 100
rho <- 0.5
set.seed(1234)
mkx <- rnorm(n1+n0,0,1)
mky <- rho*mkx + sqrt(1-rho^2)*rnorm(n1+n0,0,1)
mkx <- mkx + c(rep(2,n1),rep(0,n0))
mky <- mky + c(rep(1,n1),rep(0,n0))
mk <- rbind(mkx,mky)
## compare specificity at controlled 0.95 sensitivity
snsp2mp(mk, 100, 0.95)
#> $diff
#> [1] 0.44 0.44
#>
#> $btmn
#> [1] 0.4234849
#>
#> $btva
#> [1] 0.008147207
#>
#> $btdist
#> [1] 7.147434e-52 1.111010e-49 8.560729e-48 4.359525e-46 1.650545e-44
#> [6] 4.955359e-43 1.228805e-41 2.588546e-40 4.728468e-39 7.608286e-38
#> [11] 1.091745e-36 1.411105e-35 1.656444e-34 1.778162e-33 1.755869e-32
#> [16] 1.602996e-31 1.358936e-30 1.073903e-29 7.937960e-29 5.504878e-28
#> [21] 3.591379e-27 2.209597e-26 1.284892e-25 7.076192e-25 3.697554e-24
#> [26] 1.836323e-23 8.681298e-23 3.912482e-22 1.683217e-21 6.921463e-21
#> [31] 2.723594e-20 1.026743e-19 3.712090e-19 1.288414e-18 4.297305e-18
#> [36] 1.378641e-17 4.258128e-17 1.267328e-16 3.637869e-16 1.008032e-15
#> [41] 2.698687e-15 6.986588e-15 1.750650e-14 4.249590e-14 1.000246e-13
#> [46] 2.284979e-13 5.070861e-13 1.094248e-12 2.298229e-12 4.702371e-12
#> [51] 9.381604e-12 1.826607e-11 3.473499e-11 6.455908e-11 1.173530e-10
#> [56] 2.087457e-10 3.635220e-10 6.200153e-10 1.036037e-09 1.696578e-09
#> [61] 2.723432e-09 4.286736e-09 6.618262e-09 1.002613e-08 1.491050e-08
#> [66] 2.177983e-08 3.126728e-08 4.414704e-08 6.135031e-08 8.398047e-08
#> [71] 1.133267e-07 1.508743e-07 1.983089e-07 2.575118e-07 3.305417e-07
#> [76] 4.196003e-07 5.269823e-07 6.550175e-07 8.060259e-07 9.823295e-07
#> [81] 1.186392e-06 1.421191e-06 1.690958e-06 2.002435e-06 2.366760e-06
#> [86] 2.802059e-06 3.336685e-06 4.012930e-06 4.890916e-06 6.052360e-06
#> [91] 7.603945e-06 9.680359e-06 1.244738e-05 1.610585e-05 2.089786e-05
#> [96] 2.711631e-05 3.511908e-05 4.534791e-05 5.835073e-05 7.480412e-05
#> [101] 9.553028e-05 1.215008e-04 1.538181e-04 1.936677e-04 2.422359e-04
#> [106] 3.005983e-04 3.695899e-04 4.496823e-04 5.408993e-04 6.428078e-04
#> [111] 7.546172e-04 8.754137e-04 1.004536e-03 1.142080e-03 1.289494e-03
#> [116] 1.450208e-03 1.630196e-03 1.838392e-03 2.086832e-03 2.390448e-03
#> [121] 2.766452e-03 3.233334e-03 3.809563e-03 4.512199e-03 5.355654e-03
#> [126] 6.350866e-03 7.505119e-03 8.822590e-03 1.030555e-02 1.195601e-02
#> [131] 1.377728e-02 1.577512e-02 1.795775e-02 2.033428e-02 2.291143e-02
#> [136] 2.568825e-02 2.864960e-02 3.175917e-02 3.495341e-02 3.813815e-02
#> [141] 4.118933e-02 4.395889e-02 4.628582e-02 4.801141e-02 4.899655e-02
#> [146] 4.913834e-02 4.838342e-02 4.673563e-02 4.425709e-02 4.106261e-02
#> [151] 3.730851e-02 3.317769e-02 2.886303e-02 2.455116e-02 2.040833e-02
#> [156] 1.656972e-02 1.313293e-02 1.015589e-02 7.658860e-03 5.629812e-03
#> [161] 4.031956e-03 2.812244e-03 1.909589e-03 1.261874e-03 8.111786e-04
#> [166] 5.070629e-04 3.080673e-04 1.818115e-04 1.041579e-04 5.787622e-05
#> [171] 3.116164e-05 1.623888e-05 8.179738e-06 3.976782e-06 1.863067e-06
#> [176] 8.395792e-07 3.632502e-07 1.505842e-07 5.968229e-08 2.256377e-08
#> [181] 8.117535e-09 2.771800e-09 8.958281e-10 2.732246e-10 7.838664e-11
#> [186] 2.107901e-11 5.292179e-12 1.235028e-12 2.665612e-13 5.290317e-14
#> [191] 9.589371e-15 1.574784e-15 2.320205e-16 3.029955e-17 3.453337e-18
#> [196] 3.365922e-19 2.728415e-20 1.766139e-21 8.560343e-23 2.761849e-24
#> [201] 4.448601e-26
#>
#> $wald_ci
#> [,1] [,2]
#> [1,] 0.26309 0.61691
#> [2,] 0.26309 0.61691
#>
#> $pct_ci
#> [1] 0.22 0.58
#>
#> $zq_ci
#> [1] 0.2374532 0.5781842
#>
#> $scr_ci
#> [,1] [,2]
#> [1,] 0.242486 0.5772039
#> [2,] 0.242486 0.5772039
Function snsp2mp
outputs estimated differences
(diff
), exact bootstrap mean of the empirical difference
(btmn
), exact bootstrap variance estimate for the empirical
difference (btva
), exact bootstrap distribution of the
empirical difference (btdist
), Wald confidence intervals
(wald_ci
), percentile confidence interval
(pct_ci
), score confidence intervals (scr_ci
),
and an extension of the BTII interval in Zhou and Qin (2005, Statistics
in Medicine 24, pp 465–477) (zq_ci
).
set.seed(1234)
## simulate biomarker X with 100 cases and 100 controls
mkx <- c(rnorm(100,2,1),rnorm(100,0,1))
## simulate biomarker Y with 100 cases and 100 controls
mky <- c(rnorm(100,1,1),rnorm(100,0,1))
## compare specificity at controlled 0.95 sensitivity
snsp2mup(mkx, 100, mky, 100, 0.95)
#> $diff
#> [1] 0.3100 0.4335
#>
#> $hvar
#> [1] 0.01733071
#>
#> $wald_ci
#> [,1] [,2]
#> [1,] 0.05197827 0.5680217
#> [2,] 0.17547827 0.6915217
#>
#> $pct_ci
#> [1] 0.09 0.60
#>
#> $zq_ci
#> [1] 0.09116874 0.58812194
#>
#> $scr_ci
#> [,1] [,2]
#> [1,] 0.04257325 0.5102005
#> [2,] 0.15616370 0.6087085
Function snsp2mup
outputs estimated differences
(diff
), exact bootstrap variance estimate for the empirical
difference (hvar
), Wald confidence intervals
(wald_ci
), percentile confidence interval
(pct_ci
), score confidence intervals (scr_ci
),
and an extension of the BTII interval in Zhou and Qin (2005, Statistics
in Medicine 24, pp 465–477) (zq_ci
).
Huang, Y., Parakati, I., Patil, D. H.,and Sanda, M. G. (2023). Interval estimation for operating characteristic of continuous biomarkers with controlled sensitivity or specificity, Statistica Sinica 33, 193–214.