Title: | Calculate Design Parameters for Biomarker Validation Studies |
---|---|
Description: | Helps a clinical trial team discuss the clinical goals of a well-defined biomarker with a diagnostic, staging, prognostic, or predictive purpose. From this discussion will come a statistical plan for a (non-randomized) validation trial. Both prospective and retrospective trials are supported. In a specific focused discussion, investigators should determine the range of "discomfort" for the NNT, number needed to treat. The meaning of the discomfort range, [NNTlower, NNTupper], is that within this range most physicians would feel discomfort either in treating or withholding treatment. A pair of NNT values bracketing that range, NNTpos and NNTneg, become the targets of the study's design. If the trial can demonstrate that a positive biomarker test yields an NNT less than NNTlower, and that a negative biomarker test yields an NNT less than NNTlower, then the biomarker may be useful for patients. A highlight of the package is visualization of a "contra-Bayes" theorem, which produces criteria for retrospective case-controls studies. |
Authors: | Roger Day |
Maintainer: | Roger Day <[email protected]> |
License: | GPL-3 |
Version: | 0.31 |
Built: | 2025-03-02 03:18:47 UTC |
Source: | https://github.com/professorbeautiful/nntbiomarkerhome |
Clarifying what performance would suffice if the test is to improve medical care makes it possible to design meaningful validation studies.
Package: | NNTbiomarker |
Type: | Package |
Version: | 0.1 |
Date: | 2015-03-21 |
License: | What license is it under? |
This package bases the design of a biomarker study on the idea of "number needed to treat" (NNT). It postulates a "range of discomfort" for NNT, within which the clinical decision is uncomfortable for a treating physician. provides a shiny
window for eliciting the boundaries of the range of number needed to
Roger Day
Maintainer: Roger Day <[email protected]>
See author for unpublished manuscript.
NNT.to.pv(NNTpos=5, NNTneg=28) NNT.from.sesp(se=0.7, sp=0.9, prev=0.1) pv.to.sesp(pv = cbind(ppv=seq(.5, .9, .1), npv=0.9), prev = 0.2)
NNT.to.pv(NNTpos=5, NNTneg=28) NNT.from.sesp(se=0.7, sp=0.9, prev=0.1) pv.to.sesp(pv = cbind(ppv=seq(.5, .9, .1), npv=0.9), prev = 0.2)
From mvbutils
a %&% b
a %&% b
a |
a string |
b |
another string |
paste0(a, b)
Return the index minimizing distance from v to target.
argmin(v, target = 0)
argmin(v, target = 0)
v |
The vector to compare to target. |
target |
The value sought in the vector; default=0. |
The index in v of the value which is closest to target.
Exact confidence intervals for a binomial proportion parameter.
binom.confint(k, n, alpha = 0.05, side = c("two", "upper", "lower"))
binom.confint(k, n, alpha = 0.05, side = c("two", "upper", "lower"))
k |
#"heads" |
n |
sample size |
alpha |
Confidence level |
side |
Sidedness of the hypothesis: c("two", "upper", "lower") |
Convert between (NNTpos, NNTneg) and (PPV, NPV).
NNT.to.pv(NNTpos, NNTneg, NNT, prev, calculate.se.sp = F)
NNT.to.pv(NNTpos, NNTneg, NNT, prev, calculate.se.sp = F)
NNTpos |
NNT for a patient with positive test result |
NNTneg |
NNT for a patient with negative test result |
NNT |
A matrix or vector of (NNTpos, NNTneg) values. |
prev |
Prevalence of the "BestToTreat" group before testing. |
calculate.se.sp |
(default=FALSE) If TRUE, also calculate the sensitivity and specificity using the contra-Bayes theorem. |
For matrix input, cbind(ppv=ppv, npv=npv). For vector input, c(ppv=ppv, npv=npv).
Bayes predictive intervals for sensitivity, specificity, NNTpos and NNTneg in a case-control retrospective study.
NNTintervalsRetrospective(Ncases = 10, Ncontrols = 30, NposCases = 6, NposControls = 2, prev = 0.15, alpha = 0.025, prior = c(1/2, 1/2))
NNTintervalsRetrospective(Ncases = 10, Ncontrols = 30, NposCases = 6, NposControls = 2, prev = 0.15, alpha = 0.025, prior = c(1/2, 1/2))
Ncases |
Number of cases in the study |
Ncontrols |
Number of controls in the study |
NposCases |
Number of cases with positive test |
NposControls |
Number of controls with positive test |
prev |
Prevalence of the BestToTreat (versus BestToWait) |
alpha |
Significance level for interval. |
prior |
Beta parameters for prior. Default is the Jeffreys prior = c(1/2,1/2). Jaynes prior = c(0,0) won't work when #fp=1. |
A list with 3 components containing intervals (predictive or otherwise), with names intervalsForSN, intervalsForSP, intervalsForNNT. The intervals derive from assuming independent Jeffreys priors for SN and SP, sampling from joint independent posteriors for SN and SP incorporating the anticipated results, and applying NNT.from.sesp (Bayes theorem) to each sampled pair to obtain a sample of NNTpos and NNTneg.
A variety of ROC-related plots for a binary target and a single continuous predictor.
ROCplots(data, whichPlots = c("density", "raw", "ROC", "pv", "nnt", "nntRange"), NNTlower = 3, NNTupper = 10, N = 1000, prev = 0.2, diffInSD = 2, ...)
ROCplots(data, whichPlots = c("density", "raw", "ROC", "pv", "nnt", "nntRange"), NNTlower = 3, NNTupper = 10, N = 1000, prev = 0.2, diffInSD = 2, ...)
data |
Data frame with columns "class" (binary target variable) and "X" (predictor). |
whichPlots |
Which plots to do. Options are c("density", "raw", "ROC", "pv", "nnt") |
NNTlower |
Subjective input. If NNT < NNTlower, the decision is clearly to Treat. |
NNTupper |
Subjective input. If NNT > NNTupper, the decision is clearly to Wait. |
N |
For simulated data: sample size |
prev |
For simulated data: Prevalence |
diffInSD |
For simulated data: Difference: E(X | group=1) - E(X | group=0),measured in units of S.D (common to the 2 groups). |
... |
Extra arguments for a plot. Do not supply unless length(whichPlots)==1. |
The plots display the values achievable by changing the cutoff, in comparison with the desired values as determined by NNTlower and NNTupper. The "whichPlots" options are as follows:
"density"Marginal density of X, with rug.
"raw"X versus class.
"ROC"Standard ROC curve.
"pv"Plot of ppv versus npv, with indication of the acceptable range for cutoff.
"nnt"Plot of NNTpos versus NNTneg, with indication of the acceptable region
"nntRange"Plot of NNTpos and NNTneg versus cutoff, with indication of the acceptable range.
By default, all the plots are made.
Run a shiny app for this package.
run(shinyDir)
run(shinyDir)
shinyDir |
Current options are "shinyElicit" and "shinyCombinePlots". If not provided, a menu of the options is provided. |
The selected shiny app is run. See the vignette Using_the_NNTbiomarker_package for details, and the vignette The_Biomarker_Crisis for an overview.
Run a shiny app connecting a visual scale for NNT quantities and a "contra-Bayes" plot for mapping from predictive values to sensitivity/specificity (Bayes theorem in reverse).
runCombinePlots()
runCombinePlots()
run
Run a shiny app outlining the process of specifying a design for a biomarker validation study.
runElicit()
runElicit()
run
Allows user to toggle on and off printing messages on a per-function basis. Should be usable in other packages, but not by importing.
setVerboseCatOption(fname, value)
setVerboseCatOption(fname, value)
fname |
Name of the function to control. |
value |
Boolean value: should this function print out messages? |
The new value of the namespace option for fname ifVerboseCat