Adopting Functional Perspectives

Hansjörg Neth

2018 02 10

The greatest value of a picture is when it forces us to notice what we never expected to see.
(John W. Tukey)1

The riskyr data structures essentially describe networks of dependencies. This is best illustrated by the network diagram (see examples of plot_fnet in the user guide and data formats). However, sometimes it is instructive to view all possible values of some parameter as a function of others. A functional perspective illustrates how the value of some parameter (or its values) changes as a function of other parameters (and their values).

Functions

The basic format of a function is \(y = f(x)\), which illustrates how values of \(y\) depend on values of \(x\) given some function \(f\). riskyr provides 2 functions for viewing parameters as a function of other parameters (and their values).

Curves as a function of prevalence

The function plot_curve draws the curves (or lines) of selected parameters as a function of the prevalence (with prev ranging from 0 to 1) for a given decision process or diagnostic test (i.e., given values of sens and spec):

As an example, reconsider our original scenario (on mammography screening, see user guide). Earlier, we computed a positive predictive value (PPV) of 7.8%. But rather than just computing a single value, we could ask: How do values of PPV develop as a function of prevalence? The plot_curve function illustrates this relationship:

Showing PPV and NPV as a function of prevalence (for a prevalance of 1% and given values of sensitivity and specificity) in the original mammography screening scenario.

The curves illustrate that values of PPV and NPV crucially depend on the value of prevalence prev in the current population. In fact, they actually vary across their entire range (i.e., from 0 to 1), rendering any communication of their value utterly meaningless without specifying the current population’s prevalence value prev.

The dependency of PPV and NPV on prev can be illustrated by assuming a higher prevalence rate. For instance, if we knew that some woman was genetically tested and known to exhibit the notorious BRCA1 mutation, the prevalence value of her corresponding population (given a positive mammography result in a routine screening) is increased to about 60% (graph not shown here to save space, but try running the following code for yourself):

This shows that — given an increased prevalence value prev of 60% — the positive predictive value PPV of a positive test result increases from 7.8% (in the standard population) to around 93% (given the BRCA1 mutation).

In addition, the actual values of population and test parameters are often unclear. The plot_curve function reflects this by providing an uncertainty parameter uc that is expressed as a percentage of the specified value. For instance, the following assumes that our parameter values may deviate up to 5% from the specified values and marks the corresponding ranges of uncertainty as shaded areas around the curves that assume exact parameter values.

Both the notions of expressing probabilities as a function of prevalence and of uncertainty ranges for imprecise parameter estimates can be extended to other probabilities. The following curves show the full set of curves currently drawn by plot_curve. In addition to the predictive values PPV and NPV, we see that the proportion of positive decisions ppod and the overall accuracy acc also vary as a function of prevalence prev:

Overall, viewing conditional probabilities (like PPV/NPV, but also ppod and acc) as a function of other probabilities (e.g., prev, sens, spec or fart) often provides unexpected relationships and new insights.