diff --git a/v0.1/404.html b/v0.1/404.html index b61f788..53ea950 100644 --- a/v0.1/404.html +++ b/v0.1/404.html @@ -32,7 +32,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/articles/index.html b/v0.1/articles/index.html index 1fe3493..03ce468 100644 --- a/v0.1/articles/index.html +++ b/v0.1/articles/index.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/articles/stats4phc.html b/v0.1/articles/stats4phc.html index 40832c5..08acb05 100644 --- a/v0.1/articles/stats4phc.html +++ b/v0.1/articles/stats4phc.html @@ -34,7 +34,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/authors.html b/v0.1/authors.html index 0b4528e..dfc3851 100644 --- a/v0.1/authors.html +++ b/v0.1/authors.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 @@ -90,14 +90,14 @@ Citation Slama O, Shen D, Steffen V, Kelkhoff D, Friesenhahn M, Rabe C (2024). stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values. -R package version 0.01, https://genentech.github.io/stats4phc. +R package version 0.1, https://genentech.github.io/stats4phc. @Manual{, title = {stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values}, author = {Ondrej Slama and Darrick Shen and Verena Steffen and Doug Kelkhoff and Michel Friesenhahn and Christina Rabe}, year = {2024}, - note = {R package version 0.01}, + note = {R package version 0.1}, url = {https://genentech.github.io/stats4phc}, } diff --git a/v0.1/index.html b/v0.1/index.html index 89d1715..349b9ea 100644 --- a/v0.1/index.html +++ b/v0.1/index.html @@ -40,7 +40,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/pkgdown.yml b/v0.1/pkgdown.yml index 3ff32ac..20b5c78 100644 --- a/v0.1/pkgdown.yml +++ b/v0.1/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: stats4phc: stats4phc.html -last_built: 2024-03-23T06:16Z +last_built: 2024-03-23T06:58Z urls: reference: https://genentech.github.io/stats4phc/reference article: https://genentech.github.io/stats4phc/articles diff --git a/v0.1/reference/calibrationProfile.html b/v0.1/reference/calibrationProfile.html index e8ba2fb..639dad5 100644 --- a/v0.1/reference/calibrationProfile.html +++ b/v0.1/reference/calibrationProfile.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getASISest.html b/v0.1/reference/getASISest.html index 5a308cf..d020c0b 100644 --- a/v0.1/reference/getASISest.html +++ b/v0.1/reference/getASISest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getBINNEDest.html b/v0.1/reference/getBINNEDest.html index 6303c5c..d15164b 100644 --- a/v0.1/reference/getBINNEDest.html +++ b/v0.1/reference/getBINNEDest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getCGAMest.html b/v0.1/reference/getCGAMest.html index 26b3100..29ca4e7 100644 --- a/v0.1/reference/getCGAMest.html +++ b/v0.1/reference/getCGAMest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getGAMest.html b/v0.1/reference/getGAMest.html index c241c7d..b36382c 100644 --- a/v0.1/reference/getGAMest.html +++ b/v0.1/reference/getGAMest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getMSPLINEest.html b/v0.1/reference/getMSPLINEest.html index 3b90508..1b21a46 100644 --- a/v0.1/reference/getMSPLINEest.html +++ b/v0.1/reference/getMSPLINEest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/getPAVAest.html b/v0.1/reference/getPAVAest.html index bbd314b..62f3734 100644 --- a/v0.1/reference/getPAVAest.html +++ b/v0.1/reference/getPAVAest.html @@ -12,7 +12,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/index.html b/v0.1/reference/index.html index 5f47d76..b5ec112 100644 --- a/v0.1/reference/index.html +++ b/v0.1/reference/index.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/riskProfile.html b/v0.1/reference/riskProfile.html index a992721..71b751f 100644 --- a/v0.1/reference/riskProfile.html +++ b/v0.1/reference/riskProfile.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/sensSpec.html b/v0.1/reference/sensSpec.html index 1789e85..8d154c7 100644 --- a/v0.1/reference/sensSpec.html +++ b/v0.1/reference/sensSpec.html @@ -10,7 +10,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/reference/stats4phc-package.html b/v0.1/reference/stats4phc-package.html index 196e8f6..e3ea6a1 100644 --- a/v0.1/reference/stats4phc-package.html +++ b/v0.1/reference/stats4phc-package.html @@ -14,7 +14,7 @@ stats4phc - 0.01 + 0.1 diff --git a/v0.1/search.json b/v0.1/search.json index 7454aad..b6263e1 100644 --- a/v0.1/search.json +++ b/v0.1/search.json @@ -1 +1 @@ -[{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"introduction-to-stats4phc","dir":"Articles","previous_headings":"","what":"Introduction to stats4phc","title":"stats4phc","text":"package provides functions performance evaluation prognostic value predictive models outcomes interest binary. describe 3 aspects support performance evaluation: Predictiveness curves Calibration Sensitivity specificity begin , let’s align terminology.","code":""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"terminology","dir":"Articles","previous_headings":"Introduction to stats4phc","what":"Terminology","title":"stats4phc","text":"define terms used across article: outcome: true observation quantity interest; score: either raw value (e.g. biomarker) purpose measuring (approximating) outcome, prediction score given predictive model, outcome modeled response; estimate: output statistical methodology, score used independent variable outcome dependent variable.","code":""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"predictiveness-curves","dir":"Articles","previous_headings":"","what":"Predictiveness curves","title":"stats4phc","text":"Predictiveness curves insightful visualization assess inherent ability prognostic models provide predictions individual patients. Cumulative versions predictiveness curves represent positive predictive values (PPV) 1 - negative predictive values (1 - NPV) also informative eventual goal use cutoff clinical decision making. can use riskProfile function visualize assess quantities. example: extensive documentation function examples run ?riskProfile. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section) use \"asis\" estimation. can adjust prevalence setting prev.adj desired amount. show.nonparam.pv controls whether show/hide non-parametric estimation PPV, 1-NPV, NPV. show.best.pv controls whether show/hide theoretically best possible PPV, 1-NPV, NPV. Use include argument specify quantities show: PC = predictiveness curve PPV = positive predictive value NPV = negative predictive value 1-NPV = 1 - negative predictive value plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome). output plot underlying data.","code":"library(stats4phc) # Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) p <- riskProfile(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 7 ## method score percentile outcome estimate pv pvValue ## ## 1 asis NA 0 NA 0.0640 PC NA ## 2 asis 0.0640 0.00300 0 0.0640 PC NA ## 3 asis 0.0654 0.00601 0 0.0654 PC NA ## 4 asis 0.0659 0.00901 1 0.0659 PC NA ## 5 asis 0.0702 0.0120 0 0.0702 PC NA ## 6 asis 0.0709 0.0150 0 0.0709 PC NA"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"calibration","dir":"Articles","previous_headings":"","what":"Calibration","title":"stats4phc","text":"Calibration assessment systematic bias score. Visually, plotting score x-axis vs. outcomes y-axis, model calibrated points centered around identity line. case, talk miscalibration (see reference). improving calibration, one can improve performance model. can use calibrationProfile function visualize assess calibration. extensive documentation function examples run ?calibrationProfile. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section). case, \"asis\" allowed. Use include argument specify additional quantities show: \"loess\": Adds non-parametric Loess fit. \"citl\": Adds “Calibration Large”, overall mean outcome score. \"rug\": Adds “rug”, .e. ticks x-axis showing individual data points (top axis shows score outcome == 1, bottom axis shows score outcome == 0). \"datapoints\": Similar rug, just shows jittered points instead ticks. plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome). Use margin.type add marginal plot ggExtra::ggMarginal. can select one c(\"density\", \"histogram\", \"boxplot\", \"violin\", \"densigram\"). adds selected 1d graph top calibrtion plot suitable investigating score. output plot underlying data.","code":"p <- calibrationProfile(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 5 ## method score percentile outcome estimate ## ## 1 gam 0.0640 0.00300 0 0.0707 ## 2 gam 0.0654 0.00601 0 0.0714 ## 3 gam 0.0659 0.00901 1 0.0716 ## 4 gam 0.0702 0.0120 0 0.0739 ## 5 gam 0.0709 0.0150 0 0.0742 ## 6 gam 0.0721 0.0180 1 0.0749"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"sensitivity-and-specificity","dir":"Articles","previous_headings":"","what":"Sensitivity and specificity","title":"stats4phc","text":"Ultimately, provide sensitivity specificity plot. quantities need define cutoff can trasnform numeric score binary. use data-driven cutoffs, meaning every single value score taken cutoff, allowing us visualize sensitivity specificity function score. graph may inform best suitable cutoff model, although usually recommend output whole score range, just binary decisions. can use sensSpec function visualize assess sensitivity specificity. extensive documentation function examples run ?sensSpec. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section) use \"asis\" estimation. show.best controls whether show/hide theoretically best possible sensitivity specificity. plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome).","code":"p <- sensSpec(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 5 ## method score percentile pf value ## ## 1 asis 0.0640 0 Sensitivity 1 ## 2 asis 0.0640 0 Specificity 0 ## 3 asis 0.0640 0.00300 Sensitivity 1 ## 4 asis 0.0640 0.00300 Specificity 0.00413 ## 5 asis 0.0654 0.00601 Sensitivity 1 ## 6 asis 0.0654 0.00601 Specificity 0.00826"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"adjusting-the-graphs","dir":"Articles","previous_headings":"","what":"Adjusting the graphs","title":"stats4phc","text":"functions return ggplot object $plot element can adjust adding layers. risk might overwrite one previous layers, please double check results. example, want use following graph publication minor adjustments, can change colours line types: Otherwise, can use $data element construct graph well.","code":"p <- riskProfile( outcome = truth, score = rscore, methods = c(\"asis\", \"gam\"), include = \"PC\" ) ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values. p$plot ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values. library(ggplot2) p$plot + # change the colours to blue for \"gam\" and darkgreen for \"asis\" scale_colour_manual(values = c(\"gam\" = \"blue\", \"asis\" = \"darkgreen\")) + # change the linetypes to solid for both scale_linetype_manual(values = c(\"gam\" = \"solid\", \"asis\" = \"solid\")) ## Scale for colour is already present. ## Adding another scale for colour, which will replace the existing scale. ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values."},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"estimations-in-stats4phc","dir":"Articles","previous_headings":"","what":"Estimations in stats4phc","title":"stats4phc","text":"plotting functions package, possibility define estimation function, applied given score. calibrationProfile, serves calibration curve. riskProfile, smooths given score. always driven methods argument, available plotting functions. couple predefined estimation methods: Users can also define estimation function needed.","code":"## [1] \"asis\" \"binned\" \"cgam\" \"gam\" \"mspline\" \"pava\""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"predefined-estimation-functions","dir":"Articles","previous_headings":"Estimations in stats4phc","what":"Predefined estimation functions","title":"stats4phc","text":"predefined estimation functions can given character, case default values estimation function arguments used, list, case can change parameters estimation. character vector approach, using default parameter values, follows: see possible arguments defaults, look estimation function documentation, always available getXest, X stands estimation function (e.g. getCGAMest). list : example, running ?getGAMest, see \"gam\" sets k, number knots, -1, refers automatic selection. Otherwise, can specify estimation methods list, case can change argument values, e.g.: Note list elements must (uniquely) named, inner outer lists, always needs element \"method\", specifies estimation function. default, \"gam\", \"cgam\", \"mspline\" always fit percentiles. want change , need specify argument fitonPerc, : Finally, method \"asis\" specific “estimation method”, takes input “”, perform estimation. listed consistency. can use method case want assess score without adjustments.","code":"methods = c(\"gam\", \"cgam\") ## [1] \"getASISest\" \"getBINNEDest\" \"getCGAMest\" \"getGAMest\" ## [5] \"getMSPLINEest\" \"getPAVAest\" methods = list( gam3 = list(method = \"gam\", k = 3), gam5 = list(method = \"gam\", k = 5), cgam = list(method = \"cgam\", numknots = 0) # automatic knot selection ) methods = list(mspline = list(method = \"mspline\", fitonPerc = FALSE))"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"user-defined-estimation-functions","dir":"Articles","previous_headings":"Estimations in stats4phc","what":"User-defined estimation functions","title":"stats4phc","text":"can also define estimation function. , define function : takes exactly 2 arguments: outcome score. performs estimation choice, based outcome score. returns data.frame exactly 4 columns: score, percentile (percentile score), outcome, estimate (result estimation). example: Note can also combine user-defined functions already predefined functions, e.g.: Hint: get function work correctly, use browser() function interactively debug order see ’s wrong.","code":"# User-defined estimation function - logistic regression # Function needs to take exactly these two arguments my_logistic <- function(outcome, score) { # Calculate percentiles perc <- ecdf(score)(score) # Fit logistic regression on percentiles m <- glm(outcome ~ perc, family = \"binomial\") # Generate predictions preds <- predict(m, type = \"response\") # Return a data.frame with these 4 columns return( data.frame( score = score, percentile = perc, outcome = outcome, estimate = preds ) ) } # Then provide it to the `methods` argument as a named list methods = list(my_logistic = my_logistic) methods = list(my_logistic = my_logistic, gam = list(method = \"gam\"))"},{"path":"https://genentech.github.io/stats4phc/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Ondrej Slama. Author, maintainer. Darrick Shen. Author. Verena Steffen. Author. Doug Kelkhoff. Author. Michel Friesenhahn. Author. Christina Rabe. Author. F. Hoffmann-La Roche AG. Copyright holder, funder.","code":""},{"path":"https://genentech.github.io/stats4phc/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Slama O, Shen D, Steffen V, Kelkhoff D, Friesenhahn M, Rabe C (2024). stats4phc: Performance Evaluation Prognostic Value Predictive Models Intended Support Personalized Healthcare Predictiveness Curves Positive / Negative Predictive Values. R package version 0.01, https://genentech.github.io/stats4phc.","code":"@Manual{, title = {stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values}, author = {Ondrej Slama and Darrick Shen and Verena Steffen and Doug Kelkhoff and Michel Friesenhahn and Christina Rabe}, year = {2024}, note = {R package version 0.01}, url = {https://genentech.github.io/stats4phc}, }"},{"path":"https://genentech.github.io/stats4phc/index.html","id":"stats4phc-","dir":"","previous_headings":"","what":"stats4phc","title":"stats4phc","text":"Performance evaluation prognostic value predictive models intended support personalized healthcare (phc) outcomes interest binary. Predictiveness curves insightful visualization assess inherent ability models provide predictions individual patients. Cumulative versions predictiveness curves represent positive predictive values 1 - negative predictive values also informative eventual goal use cutoff clinical decision making. addition, predictiveness curves cumulative versions naturally related net benefit performance metrics assess clinical utility phc. Finally, authors proposed visualization assesses prognostic value predictive models performance classifier. package provides variety functions estimation plotting performance evaluation curves metrics.","code":""},{"path":"https://genentech.github.io/stats4phc/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"stats4phc","text":"reproducibility, refer specific version tag, example","code":"remotes::install_github(repo = \"genentech/stats4phc\") remotes::install_github(repo = \"genentech/stats4phc\", ref = \"v0.1\")"},{"path":"https://genentech.github.io/stats4phc/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"stats4phc","text":"Please refer https://genentech.github.io/stats4phc can see function reference well introduction vignette.","code":""},{"path":"https://genentech.github.io/stats4phc/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"stats4phc","text":"basic example demonstrates riskProfile function (.e. Predictiveness Curve): sensSpec function (Sensitivity Specificity Plot):","code":"library(stats4phc) # Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default plot includes 1-NPV, PPV, and a predictiveness curve (PC) p1 <- riskProfile(outcome = truth, score = rscore) p1$plot # You can also access the underlying data with `p1$data` p2 <- sensSpec(outcome = truth, score = rscore) p2$plot"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":null,"dir":"Reference","previous_headings":"","what":"Calibration plot — calibrationProfile","title":"Calibration plot — calibrationProfile","text":"Calibration curve risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calibration plot — calibrationProfile","text":"","code":"calibrationProfile( outcome, score, methods = list(gam = list(method = \"gam\", fitonPerc = FALSE)), include = c(\"loess\", \"citl\"), plot.raw = TRUE, rev.order = FALSE, margin.type = NULL, ... )"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calibration plot — calibrationProfile","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set list(gam = list(method = \"gam\", fitonPerc = FALSE)). Full options : c(\"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. include Character vector (case-insensitive, partial matching) NULL specifying quantities include plot. Default : c(\"loess\", \"citl\"). Full options : c(\"loess\", \"citl\", \"rug\", \"datapoints\") NULL. \"loess\" adds Loess fit, \"citl\" stands \"Calibration large\", \"rug\" adds rug ticks score outcome (top x-axis: score outcome == 1, bottom x-axis: score outcome == 0), \"datapoints\" adds jittered score outcome (slightly shifted away 0 / 1 y-values), \"NULL\" stands extra information. plot.raw Logical show percentiles raw values. Defaults TRUE (.e. raw score). rev.order Logical reverse ordering scores. Defaults FALSE. margin.type Type additional margin plot, can one c(\"density\", \"histogram\", \"boxplot\", \"violin\", \"densigram\"). See ggExtra::ggMarginal() details. ... Additional arguments passed ggExtra::ggMarginal().","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), )"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calibration plot — calibrationProfile","text":"list containing plot data, plus citl data requested.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Calibration plot — calibrationProfile","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calibration plot — calibrationProfile","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default calibration plot p1 <- calibrationProfile(outcome = truth, score = rscore) p1$plot # Specifying multiple estimation methods # By default, all the methods fit on percentiles calibrationProfile( outcome = truth, score = rscore, methods = c(\"gam\", \"mspline\", \"binned\") )$plot # Specifying multiple estimation methods with parameters calibrationProfile( outcome = truth, score = rscore, methods = list( gam = list(method = \"gam\", fitonPerc = FALSE, k = 3), mspline = list(method = \"mspline\"), bin = list(method = \"binned\", quantiles = 5) ) )$plot # Additional quantities and marginal histogram with specified number of bins calibrationProfile( outcome = truth, score = rscore, include = c(\"rug\", \"datapoints\", \"citl\"), # or use partial matching: include = c(\"r\", \"d\", \"c\"), margin.type = \"histogram\", bins = 100 # passed to ggExtra::ggMarginal )$plot"},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":null,"dir":"Reference","previous_headings":"","what":"","title":"","text":"function estimation, uses score (works like identity function).","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"","text":"","code":"getASISest(outcome, score)"},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getASISest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.3472267 #> 325 0.2940563 0.63063063 0 0.2940563 #> 326 0.2956584 0.63963964 0 0.2956584 #> 327 0.3173334 0.70870871 0 0.3173334 #> 328 0.1957009 0.21621622 0 0.1957009 #> 329 0.2909602 0.61561562 0 0.2909602 #> 330 0.1466197 0.03603604 0 0.1466197 #> 331 0.2335213 0.40240240 0 0.2335213 #> 332 0.1310011 0.01201201 0 0.1310011 #> 333 0.3696760 0.85885886 0 0.3696760"},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":null,"dir":"Reference","previous_headings":"","what":"Binned Risk Estimates — getBINNEDest","title":"Binned Risk Estimates — getBINNEDest","text":"Calculates bins based number evenly spaced bins n-tiles. Determines average risk within bins, used risk estimates.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Binned Risk Estimates — getBINNEDest","text":"","code":"getBINNEDest( outcome, score, quantiles = NULL, bins = NULL, right = TRUE, errorbar.sem = NULL )"},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Binned Risk Estimates — getBINNEDest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. quantiles Numeric; quantiles split bins. bins Numeric; number evenly spaced bins bin locations. right Logical indicating right closed interval. Defaults TRUE. errorbar.sem Scalar numeric representing number standard error means (SEM) used calculate risk error bar.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Binned Risk Estimates — getBINNEDest","text":"data frame 4 columns (score, score percentile, outcome, estimate). Additionally, attribute \"errorbar\" holding error-bar data errorbar.sem specified.","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Binned Risk Estimates — getBINNEDest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) getBINNEDest(outcome = truth, score = rscore) #> score percentile outcome estimate #> 1 0.1500925 0.1021021 NA 0.11764706 #> 2 0.1833072 0.2012012 NA 0.09090909 #> 3 0.2034668 0.3003003 NA 0.09090909 #> 4 0.2232864 0.4024024 NA 0.08823529 #> 5 0.2529264 0.5015015 NA 0.24242424 #> 6 0.2759024 0.6006006 NA 0.30303030 #> 7 0.3000654 0.7027027 NA 0.35294118 #> 8 0.3329956 0.8018018 NA 0.54545455 #> 9 0.3679189 0.9009009 NA 0.27272727 #> 10 0.4471575 1.0000000 NA 0.63636364"},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":null,"dir":"Reference","previous_headings":"","what":"Constrained GAM (cgam) Risk Estimates — getCGAMest","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"Fits Constrained Generalized Additive Model estimate risk, given vector binary outcomes vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"","code":"getCGAMest( outcome, score, numknots = 0, smoother = \"s.incr\", logscores = FALSE, fitonPerc = TRUE )"},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. numknots Numeric specify number knots. Passed smoother function. Defaults 3. smoother Character string specify smoother (cgam package). Defaults \"s.incr\". logscores Logical; TRUE, fit gam log scores. Defaults FALSE. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getCGAMest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.40075444 #> 325 0.2940563 0.63063063 0 0.35099559 #> 326 0.2956584 0.63963964 0 0.35801069 #> 327 0.3173334 0.70870871 0 0.39452407 #> 328 0.1957009 0.21621622 0 0.08465909 #> 329 0.2909602 0.61561562 0 0.33884696 #> 330 0.1466197 0.03603604 0 0.08465909 #> 331 0.2335213 0.40240240 0 0.18912208 #> 332 0.1310011 0.01201201 0 0.08465909 #> 333 0.3696760 0.85885886 0 0.40075444"},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":null,"dir":"Reference","previous_headings":"","what":"GAM Risk Estimates — getGAMest","title":"GAM Risk Estimates — getGAMest","text":"Fits Generalized Additive Model estimate risk, given vector binary outcome, vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"GAM Risk Estimates — getGAMest","text":"","code":"getGAMest( outcome, score, k = -1, bs = \"tp\", method = \"REML\", logscores = FALSE, fitonPerc = TRUE )"},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"GAM Risk Estimates — getGAMest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. k Numeric specify upper limit basis functions fit GAM. See mgcv::s() details. Defaults -1. bs Character string specify spline type. See mgcv::s() details. Defaults \"tp\". method Character string specify method type. See mgcv::s() details. Defaults \"REML\". logscores Logical; TRUE, fit gam log scores. Defaults FALSE. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"GAM Risk Estimates — getGAMest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"GAM Risk Estimates — getGAMest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getGAMest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.45508813 #> 325 0.2940563 0.63063063 0 0.32083905 #> 326 0.2956584 0.63963964 0 0.32707834 #> 327 0.3173334 0.70870871 0 0.37683329 #> 328 0.1957009 0.21621622 0 0.11300295 #> 329 0.2909602 0.61561562 0 0.31058179 #> 330 0.1466197 0.03603604 0 0.06721966 #> 331 0.2335213 0.40240240 0 0.18669186 #> 332 0.1310011 0.01201201 0 0.06261003 #> 333 0.3696760 0.85885886 0 0.49295297"},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":null,"dir":"Reference","previous_headings":"","what":"Monotone Spline Risk Estimates — getMSPLINEest","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"Fits Monotone constrained Generalized Additive Model (GAM) estimate risk, given vector binary outcomes vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"","code":"getMSPLINEest(outcome, score, k = 10, fitonPerc = TRUE)"},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. k Numeric specify upper limit basis functions fit GAM. See mgcv::s() details. Defaults -1. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"","code":"# 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"},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":null,"dir":"Reference","previous_headings":"","what":"PAVA Risk Estimates — getPAVAest","title":"PAVA Risk Estimates — getPAVAest","text":"Determines isotonic regression estimates via pava, given vector binary outcomes, vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PAVA Risk Estimates — getPAVAest","text":"","code":"getPAVAest( outcome, score, weights = rep(1, length(outcome)), ties = \"primary\", low_events = NULL, low_nonevents = NULL, high_events = NULL, high_nonevents = NULL, hilo_obs = NULL )"},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PAVA Risk Estimates — getPAVAest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. weights Vector numerics specify PAVA observation weighting. ties String specify ties handled PAVA. low_events Numeric, specifying number events lowest bin. low_nonevents Numeric, specifying number nonevents lowest bin. high_events Numeric, specifying number events highest bin. high_nonevents Numeric, specifying number nonevents highest bin. hilo_obs Numeric, specifying number observations highest lowest bins.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PAVA Risk Estimates — getPAVAest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"PAVA Risk Estimates — getPAVAest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getPAVAest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.41818182 #> 325 0.2940563 0.63063063 0 0.32203390 #> 326 0.2956584 0.63963964 0 0.32203390 #> 327 0.3173334 0.70870871 0 0.38095238 #> 328 0.1957009 0.21621622 0 0.08602151 #> 329 0.2909602 0.61561562 0 0.32203390 #> 330 0.1466197 0.03603604 0 0.08602151 #> 331 0.2335213 0.40240240 0 0.09803922 #> 332 0.1310011 0.01201201 0 0.08602151 #> 333 0.3696760 0.85885886 0 0.41818182"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":null,"dir":"Reference","previous_headings":"","what":"Risk profile plot — riskProfile","title":"Risk profile plot — riskProfile","text":"Predictiveness curve, PPV, NPV 1-NPV risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Risk profile plot — riskProfile","text":"","code":"riskProfile( outcome, score, methods = \"asis\", prev.adj = NULL, show.prev = TRUE, show.nonparam.pv = TRUE, show.best.pv = TRUE, include = c(\"PC\", \"PPV\", \"1-NPV\"), plot.raw = FALSE, rev.order = FALSE )"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Risk profile plot — riskProfile","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set \"asis\". Full options : c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. prev.adj NULL (default) scalar numeric 0 1 prevalence adjustment. show.prev Logical, show prevalence value graph. Defaults TRUE. show.nonparam.pv Logical, show non-parametric calculation PVs. Defaults TRUE. show.best.pv Logical, show best possible PVs. Defaults TRUE. include Character vector (case-insensitive, partial matching) specifying quantities include plot. Default : c(\"PC\", \"PPV\", \"1-NPV\"). Full options : c(\"NPV\", \"PC\", \"PPV\", \"1-NPV\"). plot.raw Logical show percentiles raw values. Defaults FALSE (.e. percentiles). rev.order Logical, reverse ordering scores. Defaults FALSE.","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), risk = list(method = \"asis\") )"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Risk profile plot — riskProfile","text":"list containing plot data, plus errorbar data requested (\"binned\" estimation method parameter errorbar.sem).","code":""},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Risk profile plot — riskProfile","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Risk profile plot — riskProfile","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default plot includes 1-NPV, PPV, and a predictiveness curve (PC) based on risk-cutoff p1 <- riskProfile(outcome = truth, score = rscore) p1$plot p1$data #> # A tibble: 3,006 × 7 #> method score percentile outcome estimate pv pvValue #> #> 1 asis NA 0 NA 0.0640 PC NA #> 2 asis 0.0640 0.00300 0 0.0640 PC NA #> 3 asis 0.0654 0.00601 0 0.0654 PC NA #> 4 asis 0.0659 0.00901 1 0.0659 PC NA #> 5 asis 0.0702 0.0120 0 0.0702 PC NA #> 6 asis 0.0709 0.0150 0 0.0709 PC NA #> 7 asis 0.0721 0.0180 1 0.0721 PC NA #> 8 asis 0.0753 0.0210 0 0.0753 PC NA #> 9 asis 0.0764 0.0240 0 0.0764 PC NA #> 10 asis 0.0770 0.0270 0 0.0770 PC NA #> # ℹ 2,996 more rows # Show also NPV p2 <- riskProfile( outcome = truth, score = rscore, include = c(\"PC\", \"NPV\", \"PPV\", \"1-NPV\") # or use partial matching: include = c(\"PC\", \"N\", \"PPV\", \"1\") ) p2$plot p2$data #> # A tibble: 3,340 × 7 #> method score percentile outcome estimate pv pvValue #> #> 1 asis NA 0 NA 0.0640 PC NA #> 2 asis 0.0640 0.00300 0 0.0640 PC NA #> 3 asis 0.0654 0.00601 0 0.0654 PC NA #> 4 asis 0.0659 0.00901 1 0.0659 PC NA #> 5 asis 0.0702 0.0120 0 0.0702 PC NA #> 6 asis 0.0709 0.0150 0 0.0709 PC NA #> 7 asis 0.0721 0.0180 1 0.0721 PC NA #> 8 asis 0.0753 0.0210 0 0.0753 PC NA #> 9 asis 0.0764 0.0240 0 0.0764 PC NA #> 10 asis 0.0770 0.0270 0 0.0770 PC NA #> # ℹ 3,330 more rows # All estimates of prediction curve p3 <- riskProfile( outcome = truth, score = rscore, methods = c(\"mspline\", \"gam\", \"cgam\", \"binned\", \"pava\", \"asis\"), include = c(\"PC\", \"PPV\", \"1-NPV\") ) p3$plot # Specifying method arguments (note each list has a \"method\" element) p4 <- riskProfile( outcome = truth, score = rscore, methods = list( \"gam\" = list(method = \"gam\", bs = \"tp\", logscores = FALSE, fitonPerc = TRUE), \"risk\" = list(method = \"asis\"), # no available arguments for this method \"bin\" = list(method = \"binned\", quantiles = 10, errorbar.sem = 1.2) ) ) p4$plot # Compare multiple GAMs in terms of Predictiveness Curves p5 <- riskProfile( outcome = truth, score = rscore, methods = list( \"gam_3\" = list(method = \"gam\", k = 3), \"gam_4\" = list(method = \"gam\", k = 4), \"gam_7\" = list(method = \"gam\", k = 7) ), include = \"PC\" ) #> Warning: No shared levels found between `names(values)` of the manual scale and the #> data's linewidth values. p5$plot #> Warning: No shared levels found between `names(values)` of the manual scale and the #> data's linewidth values. # Using logistic regression as user-defined estimation function, fitting on percentiles # Function needs to take exactly these two arguments my_est <- function(outcome, score) { # Calculate percentiles perc <- ecdf(score)(score) # Fit m <- glm(outcome ~ perc, family = \"binomial\") # Generate predictions preds <- predict(m, type = \"response\") # Return a data.frame with exactly these columns return( data.frame( score = score, percentile = perc, outcome = outcome, estimate = preds ) ) } p6 <- riskProfile( outcome = truth, score = rscore, methods = list(my_lr = my_est) ) p6$plot # Using cgam as user-defined estimation function # Note that you can also use the predefined cgam using methods = \"cgam\" # Attach needed library # Watch out for masking of mgcv::s and cgam::s if both are attached library(cgam, quietly = TRUE) #> #> Attaching package: ‘cgam’ #> The following objects are masked from ‘package:coneproj’: #> #> conc, conv, decr, decr.conc, decr.conv, incr, incr.conc, incr.conv # Function needs to take exactly these two arguments my_est <- function(outcome, score) { # Fit on raw predictions with space = \"E\" m <- cgam( outcome ~ s.incr(score, numknots = 5, space = \"E\"), family = \"binomial\" ) # Generate predictions and convert to vector preds <- predict(m, type = \"response\")$fit # Return a data.frame with exactly these columns out <- data.frame( score = score, percentile = ecdf(score)(score), outcome = outcome, estimate = preds ) return(out) } p7 <- riskProfile( outcome = truth, score = rscore, methods = list(my_cgam = my_est) ) p7$plot # Prevalence adjustment to 0.1 p8 <- riskProfile(outcome = truth, score = rscore, prev.adj = 0.1) p8$plot"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":null,"dir":"Reference","previous_headings":"","what":"Sensitivity and specificity plot — sensSpec","title":"Sensitivity and specificity plot — sensSpec","text":"Sensitivity specificity risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sensitivity and specificity plot — sensSpec","text":"","code":"sensSpec( outcome, score, methods = \"asis\", show.best = TRUE, plot.raw = FALSE, rev.order = FALSE )"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sensitivity and specificity plot — sensSpec","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set \"asis\". Full options : c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. show.best Logical; Include best possible sensitivity specificity? Defaults TRUE. plot.raw Logical show percentiles raw values. Defaults FALSE (.e. percentiles). rev.order Logical, reverse ordering scores. Defaults FALSE.","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), risk = list(method = \"asis\") )"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sensitivity and specificity plot — sensSpec","text":"list containing plot data.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sensitivity and specificity plot — sensSpec","text":"Given individual binary outcomes scores, function plots sensitivity specificity (using score cutoff) respective score percentiles.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Sensitivity and specificity plot — sensSpec","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sensitivity and specificity plot — sensSpec","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Plot sensitivity and specificity p1 <- sensSpec(outcome = truth, score = rscore) p1$plot # Same with smoothed estimates p2 <- sensSpec(outcome = truth, score = rscore, methods = c(\"asis\", \"gam\")) p2$plot"},{"path":"https://genentech.github.io/stats4phc/reference/stats4phc-package.html","id":null,"dir":"Reference","previous_headings":"","what":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","title":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","text":"vignette(\"stats4phc.Rmd\")","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/stats4phc-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","text":"Maintainer: Ondrej Slama ondrej.slama@roche.com Authors: Darrick Shen shend9@gene.com Verena Steffen steffen.verena@gene.com Michel Friesenhahn friesem1@gene.com Christina Rabe rabec@gene.com contributors: F. Hoffmann-La Roche AG [copyright holder, funder]","code":""}] +[{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"introduction-to-stats4phc","dir":"Articles","previous_headings":"","what":"Introduction to stats4phc","title":"stats4phc","text":"package provides functions performance evaluation prognostic value predictive models outcomes interest binary. describe 3 aspects support performance evaluation: Predictiveness curves Calibration Sensitivity specificity begin , let’s align terminology.","code":""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"terminology","dir":"Articles","previous_headings":"Introduction to stats4phc","what":"Terminology","title":"stats4phc","text":"define terms used across article: outcome: true observation quantity interest; score: either raw value (e.g. biomarker) purpose measuring (approximating) outcome, prediction score given predictive model, outcome modeled response; estimate: output statistical methodology, score used independent variable outcome dependent variable.","code":""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"predictiveness-curves","dir":"Articles","previous_headings":"","what":"Predictiveness curves","title":"stats4phc","text":"Predictiveness curves insightful visualization assess inherent ability prognostic models provide predictions individual patients. Cumulative versions predictiveness curves represent positive predictive values (PPV) 1 - negative predictive values (1 - NPV) also informative eventual goal use cutoff clinical decision making. can use riskProfile function visualize assess quantities. example: extensive documentation function examples run ?riskProfile. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section) use \"asis\" estimation. can adjust prevalence setting prev.adj desired amount. show.nonparam.pv controls whether show/hide non-parametric estimation PPV, 1-NPV, NPV. show.best.pv controls whether show/hide theoretically best possible PPV, 1-NPV, NPV. Use include argument specify quantities show: PC = predictiveness curve PPV = positive predictive value NPV = negative predictive value 1-NPV = 1 - negative predictive value plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome). output plot underlying data.","code":"library(stats4phc) # Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) p <- riskProfile(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 7 ## method score percentile outcome estimate pv pvValue ## ## 1 asis NA 0 NA 0.0640 PC NA ## 2 asis 0.0640 0.00300 0 0.0640 PC NA ## 3 asis 0.0654 0.00601 0 0.0654 PC NA ## 4 asis 0.0659 0.00901 1 0.0659 PC NA ## 5 asis 0.0702 0.0120 0 0.0702 PC NA ## 6 asis 0.0709 0.0150 0 0.0709 PC NA"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"calibration","dir":"Articles","previous_headings":"","what":"Calibration","title":"stats4phc","text":"Calibration assessment systematic bias score. Visually, plotting score x-axis vs. outcomes y-axis, model calibrated points centered around identity line. case, talk miscalibration (see reference). improving calibration, one can improve performance model. can use calibrationProfile function visualize assess calibration. extensive documentation function examples run ?calibrationProfile. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section). case, \"asis\" allowed. Use include argument specify additional quantities show: \"loess\": Adds non-parametric Loess fit. \"citl\": Adds “Calibration Large”, overall mean outcome score. \"rug\": Adds “rug”, .e. ticks x-axis showing individual data points (top axis shows score outcome == 1, bottom axis shows score outcome == 0). \"datapoints\": Similar rug, just shows jittered points instead ticks. plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome). Use margin.type add marginal plot ggExtra::ggMarginal. can select one c(\"density\", \"histogram\", \"boxplot\", \"violin\", \"densigram\"). adds selected 1d graph top calibrtion plot suitable investigating score. output plot underlying data.","code":"p <- calibrationProfile(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 5 ## method score percentile outcome estimate ## ## 1 gam 0.0640 0.00300 0 0.0707 ## 2 gam 0.0654 0.00601 0 0.0714 ## 3 gam 0.0659 0.00901 1 0.0716 ## 4 gam 0.0702 0.0120 0 0.0739 ## 5 gam 0.0709 0.0150 0 0.0742 ## 6 gam 0.0721 0.0180 1 0.0749"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"sensitivity-and-specificity","dir":"Articles","previous_headings":"","what":"Sensitivity and specificity","title":"stats4phc","text":"Ultimately, provide sensitivity specificity plot. quantities need define cutoff can trasnform numeric score binary. use data-driven cutoffs, meaning every single value score taken cutoff, allowing us visualize sensitivity specificity function score. graph may inform best suitable cutoff model, although usually recommend output whole score range, just binary decisions. can use sensSpec function visualize assess sensitivity specificity. extensive documentation function examples run ?sensSpec. briefly highlight functionalities: Use methods argument specify desired estimation method (see last section) use \"asis\" estimation. show.best controls whether show/hide theoretically best possible sensitivity specificity. plot.raw sets whether plot raw values percentiles. rev.order sets whether reverse order score (useful higher score refers lower outcome).","code":"p <- sensSpec(outcome = truth, score = rscore) p$plot head(p$data) ## # A tibble: 6 × 5 ## method score percentile pf value ## ## 1 asis 0.0640 0 Sensitivity 1 ## 2 asis 0.0640 0 Specificity 0 ## 3 asis 0.0640 0.00300 Sensitivity 1 ## 4 asis 0.0640 0.00300 Specificity 0.00413 ## 5 asis 0.0654 0.00601 Sensitivity 1 ## 6 asis 0.0654 0.00601 Specificity 0.00826"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"adjusting-the-graphs","dir":"Articles","previous_headings":"","what":"Adjusting the graphs","title":"stats4phc","text":"functions return ggplot object $plot element can adjust adding layers. risk might overwrite one previous layers, please double check results. example, want use following graph publication minor adjustments, can change colours line types: Otherwise, can use $data element construct graph well.","code":"p <- riskProfile( outcome = truth, score = rscore, methods = c(\"asis\", \"gam\"), include = \"PC\" ) ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values. p$plot ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values. library(ggplot2) p$plot + # change the colours to blue for \"gam\" and darkgreen for \"asis\" scale_colour_manual(values = c(\"gam\" = \"blue\", \"asis\" = \"darkgreen\")) + # change the linetypes to solid for both scale_linetype_manual(values = c(\"gam\" = \"solid\", \"asis\" = \"solid\")) ## Scale for colour is already present. ## Adding another scale for colour, which will replace the existing scale. ## Warning: No shared levels found between `names(values)` of the manual scale and the ## data's linewidth values."},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"estimations-in-stats4phc","dir":"Articles","previous_headings":"","what":"Estimations in stats4phc","title":"stats4phc","text":"plotting functions package, possibility define estimation function, applied given score. calibrationProfile, serves calibration curve. riskProfile, smooths given score. always driven methods argument, available plotting functions. couple predefined estimation methods: Users can also define estimation function needed.","code":"## [1] \"asis\" \"binned\" \"cgam\" \"gam\" \"mspline\" \"pava\""},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"predefined-estimation-functions","dir":"Articles","previous_headings":"Estimations in stats4phc","what":"Predefined estimation functions","title":"stats4phc","text":"predefined estimation functions can given character, case default values estimation function arguments used, list, case can change parameters estimation. character vector approach, using default parameter values, follows: see possible arguments defaults, look estimation function documentation, always available getXest, X stands estimation function (e.g. getCGAMest). list : example, running ?getGAMest, see \"gam\" sets k, number knots, -1, refers automatic selection. Otherwise, can specify estimation methods list, case can change argument values, e.g.: Note list elements must (uniquely) named, inner outer lists, always needs element \"method\", specifies estimation function. default, \"gam\", \"cgam\", \"mspline\" always fit percentiles. want change , need specify argument fitonPerc, : Finally, method \"asis\" specific “estimation method”, takes input “”, perform estimation. listed consistency. can use method case want assess score without adjustments.","code":"methods = c(\"gam\", \"cgam\") ## [1] \"getASISest\" \"getBINNEDest\" \"getCGAMest\" \"getGAMest\" ## [5] \"getMSPLINEest\" \"getPAVAest\" methods = list( gam3 = list(method = \"gam\", k = 3), gam5 = list(method = \"gam\", k = 5), cgam = list(method = \"cgam\", numknots = 0) # automatic knot selection ) methods = list(mspline = list(method = \"mspline\", fitonPerc = FALSE))"},{"path":"https://genentech.github.io/stats4phc/articles/stats4phc.html","id":"user-defined-estimation-functions","dir":"Articles","previous_headings":"Estimations in stats4phc","what":"User-defined estimation functions","title":"stats4phc","text":"can also define estimation function. , define function : takes exactly 2 arguments: outcome score. performs estimation choice, based outcome score. returns data.frame exactly 4 columns: score, percentile (percentile score), outcome, estimate (result estimation). example: Note can also combine user-defined functions already predefined functions, e.g.: Hint: get function work correctly, use browser() function interactively debug order see ’s wrong.","code":"# User-defined estimation function - logistic regression # Function needs to take exactly these two arguments my_logistic <- function(outcome, score) { # Calculate percentiles perc <- ecdf(score)(score) # Fit logistic regression on percentiles m <- glm(outcome ~ perc, family = \"binomial\") # Generate predictions preds <- predict(m, type = \"response\") # Return a data.frame with these 4 columns return( data.frame( score = score, percentile = perc, outcome = outcome, estimate = preds ) ) } # Then provide it to the `methods` argument as a named list methods = list(my_logistic = my_logistic) methods = list(my_logistic = my_logistic, gam = list(method = \"gam\"))"},{"path":"https://genentech.github.io/stats4phc/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Ondrej Slama. Author, maintainer. Darrick Shen. Author. Verena Steffen. Author. Doug Kelkhoff. Author. Michel Friesenhahn. Author. Christina Rabe. Author. F. Hoffmann-La Roche AG. Copyright holder, funder.","code":""},{"path":"https://genentech.github.io/stats4phc/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Slama O, Shen D, Steffen V, Kelkhoff D, Friesenhahn M, Rabe C (2024). stats4phc: Performance Evaluation Prognostic Value Predictive Models Intended Support Personalized Healthcare Predictiveness Curves Positive / Negative Predictive Values. R package version 0.1, https://genentech.github.io/stats4phc.","code":"@Manual{, title = {stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values}, author = {Ondrej Slama and Darrick Shen and Verena Steffen and Doug Kelkhoff and Michel Friesenhahn and Christina Rabe}, year = {2024}, note = {R package version 0.1}, url = {https://genentech.github.io/stats4phc}, }"},{"path":"https://genentech.github.io/stats4phc/index.html","id":"stats4phc-","dir":"","previous_headings":"","what":"stats4phc","title":"stats4phc","text":"Performance evaluation prognostic value predictive models intended support personalized healthcare (phc) outcomes interest binary. Predictiveness curves insightful visualization assess inherent ability models provide predictions individual patients. Cumulative versions predictiveness curves represent positive predictive values 1 - negative predictive values also informative eventual goal use cutoff clinical decision making. addition, predictiveness curves cumulative versions naturally related net benefit performance metrics assess clinical utility phc. Finally, authors proposed visualization assesses prognostic value predictive models performance classifier. package provides variety functions estimation plotting performance evaluation curves metrics.","code":""},{"path":"https://genentech.github.io/stats4phc/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"stats4phc","text":"reproducibility, refer specific version tag, example","code":"remotes::install_github(repo = \"genentech/stats4phc\") remotes::install_github(repo = \"genentech/stats4phc\", ref = \"v0.1\")"},{"path":"https://genentech.github.io/stats4phc/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"stats4phc","text":"Please refer https://genentech.github.io/stats4phc can see function reference well introduction vignette.","code":""},{"path":"https://genentech.github.io/stats4phc/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"stats4phc","text":"basic example demonstrates riskProfile function (.e. Predictiveness Curve): sensSpec function (Sensitivity Specificity Plot):","code":"library(stats4phc) # Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default plot includes 1-NPV, PPV, and a predictiveness curve (PC) p1 <- riskProfile(outcome = truth, score = rscore) p1$plot # You can also access the underlying data with `p1$data` p2 <- sensSpec(outcome = truth, score = rscore) p2$plot"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":null,"dir":"Reference","previous_headings":"","what":"Calibration plot — calibrationProfile","title":"Calibration plot — calibrationProfile","text":"Calibration curve risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calibration plot — calibrationProfile","text":"","code":"calibrationProfile( outcome, score, methods = list(gam = list(method = \"gam\", fitonPerc = FALSE)), include = c(\"loess\", \"citl\"), plot.raw = TRUE, rev.order = FALSE, margin.type = NULL, ... )"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calibration plot — calibrationProfile","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set list(gam = list(method = \"gam\", fitonPerc = FALSE)). Full options : c(\"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. include Character vector (case-insensitive, partial matching) NULL specifying quantities include plot. Default : c(\"loess\", \"citl\"). Full options : c(\"loess\", \"citl\", \"rug\", \"datapoints\") NULL. \"loess\" adds Loess fit, \"citl\" stands \"Calibration large\", \"rug\" adds rug ticks score outcome (top x-axis: score outcome == 1, bottom x-axis: score outcome == 0), \"datapoints\" adds jittered score outcome (slightly shifted away 0 / 1 y-values), \"NULL\" stands extra information. plot.raw Logical show percentiles raw values. Defaults TRUE (.e. raw score). rev.order Logical reverse ordering scores. Defaults FALSE. margin.type Type additional margin plot, can one c(\"density\", \"histogram\", \"boxplot\", \"violin\", \"densigram\"). See ggExtra::ggMarginal() details. ... Additional arguments passed ggExtra::ggMarginal().","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), )"},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calibration plot — calibrationProfile","text":"list containing plot data, plus citl data requested.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Calibration plot — calibrationProfile","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/calibrationProfile.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calibration plot — calibrationProfile","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default calibration plot p1 <- calibrationProfile(outcome = truth, score = rscore) p1$plot # Specifying multiple estimation methods # By default, all the methods fit on percentiles calibrationProfile( outcome = truth, score = rscore, methods = c(\"gam\", \"mspline\", \"binned\") )$plot # Specifying multiple estimation methods with parameters calibrationProfile( outcome = truth, score = rscore, methods = list( gam = list(method = \"gam\", fitonPerc = FALSE, k = 3), mspline = list(method = \"mspline\"), bin = list(method = \"binned\", quantiles = 5) ) )$plot # Additional quantities and marginal histogram with specified number of bins calibrationProfile( outcome = truth, score = rscore, include = c(\"rug\", \"datapoints\", \"citl\"), # or use partial matching: include = c(\"r\", \"d\", \"c\"), margin.type = \"histogram\", bins = 100 # passed to ggExtra::ggMarginal )$plot"},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":null,"dir":"Reference","previous_headings":"","what":"","title":"","text":"function estimation, uses score (works like identity function).","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"","text":"","code":"getASISest(outcome, score)"},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getASISest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getASISest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.3472267 #> 325 0.2940563 0.63063063 0 0.2940563 #> 326 0.2956584 0.63963964 0 0.2956584 #> 327 0.3173334 0.70870871 0 0.3173334 #> 328 0.1957009 0.21621622 0 0.1957009 #> 329 0.2909602 0.61561562 0 0.2909602 #> 330 0.1466197 0.03603604 0 0.1466197 #> 331 0.2335213 0.40240240 0 0.2335213 #> 332 0.1310011 0.01201201 0 0.1310011 #> 333 0.3696760 0.85885886 0 0.3696760"},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":null,"dir":"Reference","previous_headings":"","what":"Binned Risk Estimates — getBINNEDest","title":"Binned Risk Estimates — getBINNEDest","text":"Calculates bins based number evenly spaced bins n-tiles. Determines average risk within bins, used risk estimates.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Binned Risk Estimates — getBINNEDest","text":"","code":"getBINNEDest( outcome, score, quantiles = NULL, bins = NULL, right = TRUE, errorbar.sem = NULL )"},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Binned Risk Estimates — getBINNEDest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. quantiles Numeric; quantiles split bins. bins Numeric; number evenly spaced bins bin locations. right Logical indicating right closed interval. Defaults TRUE. errorbar.sem Scalar numeric representing number standard error means (SEM) used calculate risk error bar.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Binned Risk Estimates — getBINNEDest","text":"data frame 4 columns (score, score percentile, outcome, estimate). Additionally, attribute \"errorbar\" holding error-bar data errorbar.sem specified.","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getBINNEDest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Binned Risk Estimates — getBINNEDest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) getBINNEDest(outcome = truth, score = rscore) #> score percentile outcome estimate #> 1 0.1500925 0.1021021 NA 0.11764706 #> 2 0.1833072 0.2012012 NA 0.09090909 #> 3 0.2034668 0.3003003 NA 0.09090909 #> 4 0.2232864 0.4024024 NA 0.08823529 #> 5 0.2529264 0.5015015 NA 0.24242424 #> 6 0.2759024 0.6006006 NA 0.30303030 #> 7 0.3000654 0.7027027 NA 0.35294118 #> 8 0.3329956 0.8018018 NA 0.54545455 #> 9 0.3679189 0.9009009 NA 0.27272727 #> 10 0.4471575 1.0000000 NA 0.63636364"},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":null,"dir":"Reference","previous_headings":"","what":"Constrained GAM (cgam) Risk Estimates — getCGAMest","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"Fits Constrained Generalized Additive Model estimate risk, given vector binary outcomes vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"","code":"getCGAMest( outcome, score, numknots = 0, smoother = \"s.incr\", logscores = FALSE, fitonPerc = TRUE )"},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. numknots Numeric specify number knots. Passed smoother function. Defaults 3. smoother Character string specify smoother (cgam package). Defaults \"s.incr\". logscores Logical; TRUE, fit gam log scores. Defaults FALSE. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getCGAMest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Constrained GAM (cgam) Risk Estimates — getCGAMest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getCGAMest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.40075444 #> 325 0.2940563 0.63063063 0 0.35099559 #> 326 0.2956584 0.63963964 0 0.35801069 #> 327 0.3173334 0.70870871 0 0.39452407 #> 328 0.1957009 0.21621622 0 0.08465909 #> 329 0.2909602 0.61561562 0 0.33884696 #> 330 0.1466197 0.03603604 0 0.08465909 #> 331 0.2335213 0.40240240 0 0.18912208 #> 332 0.1310011 0.01201201 0 0.08465909 #> 333 0.3696760 0.85885886 0 0.40075444"},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":null,"dir":"Reference","previous_headings":"","what":"GAM Risk Estimates — getGAMest","title":"GAM Risk Estimates — getGAMest","text":"Fits Generalized Additive Model estimate risk, given vector binary outcome, vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"GAM Risk Estimates — getGAMest","text":"","code":"getGAMest( outcome, score, k = -1, bs = \"tp\", method = \"REML\", logscores = FALSE, fitonPerc = TRUE )"},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"GAM Risk Estimates — getGAMest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. k Numeric specify upper limit basis functions fit GAM. See mgcv::s() details. Defaults -1. bs Character string specify spline type. See mgcv::s() details. Defaults \"tp\". method Character string specify method type. See mgcv::s() details. Defaults \"REML\". logscores Logical; TRUE, fit gam log scores. Defaults FALSE. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"GAM Risk Estimates — getGAMest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getGAMest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"GAM Risk Estimates — getGAMest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getGAMest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.45508813 #> 325 0.2940563 0.63063063 0 0.32083905 #> 326 0.2956584 0.63963964 0 0.32707834 #> 327 0.3173334 0.70870871 0 0.37683329 #> 328 0.1957009 0.21621622 0 0.11300295 #> 329 0.2909602 0.61561562 0 0.31058179 #> 330 0.1466197 0.03603604 0 0.06721966 #> 331 0.2335213 0.40240240 0 0.18669186 #> 332 0.1310011 0.01201201 0 0.06261003 #> 333 0.3696760 0.85885886 0 0.49295297"},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":null,"dir":"Reference","previous_headings":"","what":"Monotone Spline Risk Estimates — getMSPLINEest","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"Fits Monotone constrained Generalized Additive Model (GAM) estimate risk, given vector binary outcomes vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"","code":"getMSPLINEest(outcome, score, k = 10, fitonPerc = TRUE)"},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. k Numeric specify upper limit basis functions fit GAM. See mgcv::s() details. Defaults -1. fitonPerc Logical; TRUE, fit gam risk percentiles. Defaults TRUE.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getMSPLINEest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Monotone Spline Risk Estimates — getMSPLINEest","text":"","code":"# 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"},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":null,"dir":"Reference","previous_headings":"","what":"PAVA Risk Estimates — getPAVAest","title":"PAVA Risk Estimates — getPAVAest","text":"Determines isotonic regression estimates via pava, given vector binary outcomes, vector scores.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PAVA Risk Estimates — getPAVAest","text":"","code":"getPAVAest( outcome, score, weights = rep(1, length(outcome)), ties = \"primary\", low_events = NULL, low_nonevents = NULL, high_events = NULL, high_nonevents = NULL, hilo_obs = NULL )"},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PAVA Risk Estimates — getPAVAest","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. weights Vector numerics specify PAVA observation weighting. ties String specify ties handled PAVA. low_events Numeric, specifying number events lowest bin. low_nonevents Numeric, specifying number nonevents lowest bin. high_events Numeric, specifying number events highest bin. high_nonevents Numeric, specifying number nonevents highest bin. hilo_obs Numeric, specifying number observations highest lowest bins.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PAVA Risk Estimates — getPAVAest","text":"data frame 4 columns (score, score percentile, outcome, estimate).","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/getPAVAest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"PAVA Risk Estimates — getPAVAest","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted truth <- as.numeric(auroc$actual) tail(getPAVAest(outcome = truth, score = rscore), 10) #> score percentile outcome estimate #> 324 0.3472267 0.81081081 0 0.41818182 #> 325 0.2940563 0.63063063 0 0.32203390 #> 326 0.2956584 0.63963964 0 0.32203390 #> 327 0.3173334 0.70870871 0 0.38095238 #> 328 0.1957009 0.21621622 0 0.08602151 #> 329 0.2909602 0.61561562 0 0.32203390 #> 330 0.1466197 0.03603604 0 0.08602151 #> 331 0.2335213 0.40240240 0 0.09803922 #> 332 0.1310011 0.01201201 0 0.08602151 #> 333 0.3696760 0.85885886 0 0.41818182"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":null,"dir":"Reference","previous_headings":"","what":"Risk profile plot — riskProfile","title":"Risk profile plot — riskProfile","text":"Predictiveness curve, PPV, NPV 1-NPV risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Risk profile plot — riskProfile","text":"","code":"riskProfile( outcome, score, methods = \"asis\", prev.adj = NULL, show.prev = TRUE, show.nonparam.pv = TRUE, show.best.pv = TRUE, include = c(\"PC\", \"PPV\", \"1-NPV\"), plot.raw = FALSE, rev.order = FALSE )"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Risk profile plot — riskProfile","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set \"asis\". Full options : c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. prev.adj NULL (default) scalar numeric 0 1 prevalence adjustment. show.prev Logical, show prevalence value graph. Defaults TRUE. show.nonparam.pv Logical, show non-parametric calculation PVs. Defaults TRUE. show.best.pv Logical, show best possible PVs. Defaults TRUE. include Character vector (case-insensitive, partial matching) specifying quantities include plot. Default : c(\"PC\", \"PPV\", \"1-NPV\"). Full options : c(\"NPV\", \"PC\", \"PPV\", \"1-NPV\"). plot.raw Logical show percentiles raw values. Defaults FALSE (.e. percentiles). rev.order Logical, reverse ordering scores. Defaults FALSE.","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), risk = list(method = \"asis\") )"},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Risk profile plot — riskProfile","text":"list containing plot data, plus errorbar data requested (\"binned\" estimation method parameter errorbar.sem).","code":""},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Risk profile plot — riskProfile","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/riskProfile.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Risk profile plot — riskProfile","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Default plot includes 1-NPV, PPV, and a predictiveness curve (PC) based on risk-cutoff p1 <- riskProfile(outcome = truth, score = rscore) p1$plot p1$data #> # A tibble: 3,006 × 7 #> method score percentile outcome estimate pv pvValue #> #> 1 asis NA 0 NA 0.0640 PC NA #> 2 asis 0.0640 0.00300 0 0.0640 PC NA #> 3 asis 0.0654 0.00601 0 0.0654 PC NA #> 4 asis 0.0659 0.00901 1 0.0659 PC NA #> 5 asis 0.0702 0.0120 0 0.0702 PC NA #> 6 asis 0.0709 0.0150 0 0.0709 PC NA #> 7 asis 0.0721 0.0180 1 0.0721 PC NA #> 8 asis 0.0753 0.0210 0 0.0753 PC NA #> 9 asis 0.0764 0.0240 0 0.0764 PC NA #> 10 asis 0.0770 0.0270 0 0.0770 PC NA #> # ℹ 2,996 more rows # Show also NPV p2 <- riskProfile( outcome = truth, score = rscore, include = c(\"PC\", \"NPV\", \"PPV\", \"1-NPV\") # or use partial matching: include = c(\"PC\", \"N\", \"PPV\", \"1\") ) p2$plot p2$data #> # A tibble: 3,340 × 7 #> method score percentile outcome estimate pv pvValue #> #> 1 asis NA 0 NA 0.0640 PC NA #> 2 asis 0.0640 0.00300 0 0.0640 PC NA #> 3 asis 0.0654 0.00601 0 0.0654 PC NA #> 4 asis 0.0659 0.00901 1 0.0659 PC NA #> 5 asis 0.0702 0.0120 0 0.0702 PC NA #> 6 asis 0.0709 0.0150 0 0.0709 PC NA #> 7 asis 0.0721 0.0180 1 0.0721 PC NA #> 8 asis 0.0753 0.0210 0 0.0753 PC NA #> 9 asis 0.0764 0.0240 0 0.0764 PC NA #> 10 asis 0.0770 0.0270 0 0.0770 PC NA #> # ℹ 3,330 more rows # All estimates of prediction curve p3 <- riskProfile( outcome = truth, score = rscore, methods = c(\"mspline\", \"gam\", \"cgam\", \"binned\", \"pava\", \"asis\"), include = c(\"PC\", \"PPV\", \"1-NPV\") ) p3$plot # Specifying method arguments (note each list has a \"method\" element) p4 <- riskProfile( outcome = truth, score = rscore, methods = list( \"gam\" = list(method = \"gam\", bs = \"tp\", logscores = FALSE, fitonPerc = TRUE), \"risk\" = list(method = \"asis\"), # no available arguments for this method \"bin\" = list(method = \"binned\", quantiles = 10, errorbar.sem = 1.2) ) ) p4$plot # Compare multiple GAMs in terms of Predictiveness Curves p5 <- riskProfile( outcome = truth, score = rscore, methods = list( \"gam_3\" = list(method = \"gam\", k = 3), \"gam_4\" = list(method = \"gam\", k = 4), \"gam_7\" = list(method = \"gam\", k = 7) ), include = \"PC\" ) #> Warning: No shared levels found between `names(values)` of the manual scale and the #> data's linewidth values. p5$plot #> Warning: No shared levels found between `names(values)` of the manual scale and the #> data's linewidth values. # Using logistic regression as user-defined estimation function, fitting on percentiles # Function needs to take exactly these two arguments my_est <- function(outcome, score) { # Calculate percentiles perc <- ecdf(score)(score) # Fit m <- glm(outcome ~ perc, family = \"binomial\") # Generate predictions preds <- predict(m, type = \"response\") # Return a data.frame with exactly these columns return( data.frame( score = score, percentile = perc, outcome = outcome, estimate = preds ) ) } p6 <- riskProfile( outcome = truth, score = rscore, methods = list(my_lr = my_est) ) p6$plot # Using cgam as user-defined estimation function # Note that you can also use the predefined cgam using methods = \"cgam\" # Attach needed library # Watch out for masking of mgcv::s and cgam::s if both are attached library(cgam, quietly = TRUE) #> #> Attaching package: ‘cgam’ #> The following objects are masked from ‘package:coneproj’: #> #> conc, conv, decr, decr.conc, decr.conv, incr, incr.conc, incr.conv # Function needs to take exactly these two arguments my_est <- function(outcome, score) { # Fit on raw predictions with space = \"E\" m <- cgam( outcome ~ s.incr(score, numknots = 5, space = \"E\"), family = \"binomial\" ) # Generate predictions and convert to vector preds <- predict(m, type = \"response\")$fit # Return a data.frame with exactly these columns out <- data.frame( score = score, percentile = ecdf(score)(score), outcome = outcome, estimate = preds ) return(out) } p7 <- riskProfile( outcome = truth, score = rscore, methods = list(my_cgam = my_est) ) p7$plot # Prevalence adjustment to 0.1 p8 <- riskProfile(outcome = truth, score = rscore, prev.adj = 0.1) p8$plot"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":null,"dir":"Reference","previous_headings":"","what":"Sensitivity and specificity plot — sensSpec","title":"Sensitivity and specificity plot — sensSpec","text":"Sensitivity specificity risk estimates","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sensitivity and specificity plot — sensSpec","text":"","code":"sensSpec( outcome, score, methods = \"asis\", show.best = TRUE, plot.raw = FALSE, rev.order = FALSE )"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sensitivity and specificity plot — sensSpec","text":"outcome Vector binary outcome observation. score Numeric vector continuous predicted risk score. methods Character vector method names (case-insensitive) plotting curves named list elements method function arguments. Default set \"asis\". Full options : c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\"). specify arguments per method, use lists. example: See section \"Estimation\" details. show.best Logical; Include best possible sensitivity specificity? Defaults TRUE. plot.raw Logical show percentiles raw values. Defaults FALSE (.e. percentiles). rev.order Logical, reverse ordering scores. Defaults FALSE.","code":"list( pava = list(method = \"pava\", ties = \"primary\"), mspline = list(method = \"mspline\", fitonPerc = TRUE), gam = list(method = \"gam\", bs = \"tp\", logscores = FALSE), bin = list(method = \"binned\", bins = 10), risk = list(method = \"asis\") )"},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sensitivity and specificity plot — sensSpec","text":"list containing plot data.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sensitivity and specificity plot — sensSpec","text":"Given individual binary outcomes scores, function plots sensitivity specificity (using score cutoff) respective score percentiles.","code":""},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"estimation","dir":"Reference","previous_headings":"","what":"Estimation","title":"Sensitivity and specificity plot — sensSpec","text":"methods argument specifies estimation method. can provide either vector strings, (\"asis\" available calibrationProfile), named list lists. latter case, inner list must element \"method\", specifies estimation function (one ), optionally elements, passed estimation function. example: see arguments available estimation method, see documentation function. naming convention getXest, X stands estimation method, example getGAMest(). \"gam\", \"cgam\", \"mspline\" always fit percentiles default. change , use fitonPerc = FALSE, example \"gam\" \"cgam\" methods wrappers mgcv::gam() cgam::cgam(), respectively. default values function arguments (like k, number knots mgcv::s()) mirror package defaults.","code":"c(\"asis\", \"binned\", \"pava\", \"mspline\", \"gam\", \"cgam\") list( gam = list(method = \"gam\", k = 3), c_gam = list(method = \"cgam\", numknots = 3) ) list(gam = list(method = \"gam\", fitonPerc = FALSE))"},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/sensSpec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sensitivity and specificity plot — sensSpec","text":"","code":"# Read in example data auroc <- read.csv(system.file(\"extdata\", \"sample.csv\", package = \"stats4phc\")) rscore <- auroc$predicted_calibrated truth <- as.numeric(auroc$actual) # Plot sensitivity and specificity p1 <- sensSpec(outcome = truth, score = rscore) p1$plot # Same with smoothed estimates p2 <- sensSpec(outcome = truth, score = rscore, methods = c(\"asis\", \"gam\")) p2$plot"},{"path":"https://genentech.github.io/stats4phc/reference/stats4phc-package.html","id":null,"dir":"Reference","previous_headings":"","what":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","title":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","text":"vignette(\"stats4phc.Rmd\")","code":""},{"path":[]},{"path":"https://genentech.github.io/stats4phc/reference/stats4phc-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"stats4phc: Performance evaluation for the prognostic value of predictive models intended to\nsupport personalized healthcare through predictiveness curves and positive / negative\npredictive values — stats4phc-package","text":"Maintainer: Ondrej Slama ondrej.slama@roche.com Authors: Darrick Shen shend9@gene.com Verena Steffen steffen.verena@gene.com Michel Friesenhahn friesem1@gene.com Christina Rabe rabec@gene.com contributors: F. Hoffmann-La Roche AG [copyright holder, funder]","code":""}]
Slama O, Shen D, Steffen V, Kelkhoff D, Friesenhahn M, Rabe C (2024). stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values. -R package version 0.01, https://genentech.github.io/stats4phc. +R package version 0.1, https://genentech.github.io/stats4phc.
@Manual{, title = {stats4phc: Performance Evaluation for the Prognostic Value of Predictive Models Intended to Support Personalized Healthcare Through Predictiveness Curves and Positive / Negative Predictive Values}, author = {Ondrej Slama and Darrick Shen and Verena Steffen and Doug Kelkhoff and Michel Friesenhahn and Christina Rabe}, year = {2024}, - note = {R package version 0.01}, + note = {R package version 0.1}, url = {https://genentech.github.io/stats4phc}, }