Package 'NNTbiomarker'

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

Help Index


Plan a biomarker validation study by focusing on desired clinical actionability.

Description

Clarifying what performance would suffice if the test is to improve medical care makes it possible to design meaningful validation studies.

Details

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

Author(s)

Roger Day

Maintainer: Roger Day <[email protected]>

References

See author for unpublished manuscript.

Examples

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)

%&% string concatenation

Description

From mvbutils

Usage

a %&% b

Arguments

a

a string

b

another string

Value

paste0(a, b)


argmin Argmin function for a vector.

Description

Return the index minimizing distance from v to target.

Usage

argmin(v, target = 0)

Arguments

v

The vector to compare to target.

target

The value sought in the vector; default=0.

Value

The index in v of the value which is closest to target.


binom.confint

Description

Exact confidence intervals for a binomial proportion parameter.

Usage

binom.confint(k, n, alpha = 0.05, side = c("two", "upper", "lower"))

Arguments

k

#"heads"

n

sample size

alpha

Confidence level

side

Sidedness of the hypothesis: c("two", "upper", "lower")


NNT.to.pv

Description

Convert between (NNTpos, NNTneg) and (PPV, NPV).

Usage

NNT.to.pv(NNTpos, NNTneg, NNT, prev, calculate.se.sp = F)

Arguments

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.

Value

For matrix input, cbind(ppv=ppv, npv=npv). For vector input, c(ppv=ppv, npv=npv).


NNTintervalsRetrospective

Description

Bayes predictive intervals for sensitivity, specificity, NNTpos and NNTneg in a case-control retrospective study.

Usage

NNTintervalsRetrospective(Ncases = 10, Ncontrols = 30, NposCases = 6,
  NposControls = 2, prev = 0.15, alpha = 0.025, prior = c(1/2, 1/2))

Arguments

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.

Value

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.


ROCplots

Description

A variety of ROC-related plots for a binary target and a single continuous predictor.

Usage

ROCplots(data, whichPlots = c("density", "raw", "ROC", "pv", "nnt",
  "nntRange"), NNTlower = 3, NNTupper = 10, N = 1000, prev = 0.2,
  diffInSD = 2, ...)

Arguments

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.

Details

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

Description

Run a shiny app for this package.

Usage

run(shinyDir)

Arguments

shinyDir

Current options are "shinyElicit" and "shinyCombinePlots". If not provided, a menu of the options is provided.

Details

The selected shiny app is run. See the vignette Using_the_NNTbiomarker_package for details, and the vignette The_Biomarker_Crisis for an overview.


runCombinePlots

Description

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).

Usage

runCombinePlots()

See Also

run


runElicit

Description

Run a shiny app outlining the process of specifying a design for a biomarker validation study.

Usage

runElicit()

See Also

run


setVerboseCatOption

Description

Allows user to toggle on and off printing messages on a per-function basis. Should be usable in other packages, but not by importing.

Usage

setVerboseCatOption(fname, value)

Arguments

fname

Name of the function to control.

value

Boolean value: should this function print out messages?

Value

The new value of the namespace option for fname ifVerboseCat