Learn R Programming

analogue (version 0.4-0)

bayesF: Bayes factors

Description

Calculates Bayes factors or likelihood ratios of analogue and no-analogue results.

Usage

bayesF(x, prior = NULL)

Arguments

x
an object of class roc.
prior
numeric; the prior probabilities of analogue and no-analogue, provided as a vector of length 2 whose elements sum to 1. If not provided, the function will use the relative occurences of analogue and no analogue situations used to evaluate the

Value

  • A list with the followin components, some of which may be NULL depending on argument which:
  • posBayes factor or likelihood ratio of a positive event (analogue).
  • negBayes factor or likelihood ratio of anegative event (analogue).
  • posteriorlist with components pos and neg containing the posterior probabilities of positive and negative events, respectively.
  • priorlist with components pos and neg containing the prior probabilities of positive and negative events, respectively.
  • roc.pointsvector of points at which the ROC curve was evaluated and for which Bayes factors and prior and posterior probabilities are available.
  • optimalnumeric; the optimal dissimilarity, as assessed by the ROC curve.
  • objectname of the object passed as argument x.

concept

  • likelihood ratios
  • Bayes factors

Details

LR(+), is the likelihood ratio of a positive test result, that the value of d assigns the sample to the group it belongs to. LR(-) is the likelihood ratio of a negative test result, that the value of d assigns the sample to the wrong group.

LR(+) is defined as $LR(+) = TPF / FPF$ (or sensitivity / (1 - specificity)), and LR(-) is defined as $LR(-) = FPF / TNF$ (or (1 - sensitivity) / specificity), in Henderson (1993).

The posterior probability of analogue given a dissimilarity is the LR(+) likelihood ratio values multiplied by the prior odds of analogue, for given values of the dissimilarity, and is then converted to a probability.

References

Brown, C.D., and Davis, H.T. (2006) Receiver operating characteristics curves and related decision measures: A tutorial. Chemometrics and Intelligent Laboratory Systems 80, 24--38. Gavin, D.G., Oswald, W.W., Wahl, E.R. and Williams, J.W. (2003) A statistical approach to evaluating distance metrics and analog assignments for pollen records. Quaternary Research 60, 356--367.

Henderson, A.R. (1993) Assessing test accuracy and its clinical consequences: a primer for receiver operating characteristic curve analysis. Annals of Clinical Biochemistry 30, 834--846.

See Also

roc and plot.bayesF.

Examples

Run this code
## continue the example from ?roc
example(roc)

## calculate the Bayes factors of analogue and no-analogue
## (uses observed probabilities of analogue/no-analogue
swap.bayes <- bayesF(swap.roc)
swap.bayes

## plot the probability of analogue
plot(swap.bayes)

## calculate the Bayes factors of analogue and no-analogue
## with prior probabilities c(0.5, 0.05)
swap.bayes2 <- bayesF(swap.roc, prior = c(0.5, 0.05))
swap.bayes

## plot the probability of analogue
plot(swap.bayes2)

Run the code above in your browser using DataLab