Monotone Spline Risk Estimates
getMSPLINEest.Rd
Fits a Monotone constrained Generalized Additive Model (GAM) to estimate risk, given a vector of binary outcomes and a vector of scores.
Arguments
- outcome
Vector of binary outcome for each observation.
- score
Numeric vector of continuous predicted risk score.
- k
Numeric to specify the upper limit of basis functions to fit for GAM. See
mgcv::s()
for more details. Defaults to -1.- fitonPerc
Logical; if
TRUE
, fit gam on risk percentiles. Defaults toTRUE
.
Examples
# Read in example data
auroc <- read.csv(system.file("extdata", "sample.csv", package = "stats4phc"))
rscore <- auroc$predicted
truth <- as.numeric(auroc$actual)
tail(getMSPLINEest(outcome = truth, score = rscore), 10)
#> score percentile outcome estimate
#> 324 0.3472267 0.81081081 0 0.39218604
#> 325 0.2940563 0.63063063 0 0.35211614
#> 326 0.2956584 0.63963964 0 0.35636133
#> 327 0.3173334 0.70870871 0 0.38029566
#> 328 0.1957009 0.21621622 0 0.08332628
#> 329 0.2909602 0.61561562 0 0.34466754
#> 330 0.1466197 0.03603604 0 0.08332628
#> 331 0.2335213 0.40240240 0 0.18794378
#> 332 0.1310011 0.01201201 0 0.08332628
#> 333 0.3696760 0.85885886 0 0.41581142