Learn R Programming

riskyr (version 0.1.0)

plot_curve: Plot curves of selected values (e.g., PPV or NPV) as a function of prevalence.

Description

plot_curve draws curves of selected values (including PPV, NPV) as a function of the prevalence (prev) for given values of sensitivity sens (or miss rate mirt) and specificity spec (or false alarm rate fart).

Usage

plot_curve(prev = num$prev, sens = num$sens, mirt = NA, spec = num$spec,
  fart = NA, what = c("prev", "PPV", "NPV"), what.col = pal,
  show.points = TRUE, log.scale = FALSE, title.lbl = txt$scen.lbl,
  cex.lbl = 0.85)

Arguments

prev

The condition's prevalence prev (i.e., the probability of condition being TRUE).

sens

The decision's sensitivity sens (i.e., the conditional probability of a positive decision provided that the condition is TRUE). sens is optional when its complement mirt is provided.

mirt

The decision's miss rate mirt (i.e., the conditional probability of a negative decision provided that the condition is TRUE). mirt is optional when its complement sens is provided.

spec

The decision's specificity spec (i.e., the conditional probability of a negative decision provided that the condition is FALSE). spec is optional when its complement fart is provided.

fart

The decision's false alarm rate fart (i.e., the conditional probability of a positive decision provided that the condition is FALSE). fart is optional when its complement spec is provided.

what

A vector of character codes that specify the selection of curves to be plotted. Currently available options are c("prev", "PPV", "NPV", "ppod", "acc") (shortcut: what = "all"). Default: what = c("prev", "PPV", "NPV").

what.col

A vector of colors corresponding to the elements specified in what. Default: what.col = pal.

show.points

Boolean option for showing the point of intersection with the current prevalence prev in all selected curves. Default: show.points = TRUE.

log.scale

Boolean value for switching from a linear to a logarithmic x-axis. Default: log.scale = FALSE.

title.lbl

The title of the current plot. Default: title.lbl = txt$scen.lbl.

cex.lbl

Scaling factor for the size of text labels (e.g., on axes, legend, margin text). Default: cex.lbl = .85.

Details

plot_curve is a generalization of plot_PV (see legacy code) that allows for additional dependent values.

See Also

comp_prob computes current probability information; prob contains current probability information; comp_freq computes current frequency information; freq contains current frequency information; num for basic numeric parameters; txt for current text settings; pal for current color settings.

Other visualization functions: plot.riskyr, plot_fnet, plot_icons, plot_mosaic, plot_plane, plot_tree

Examples

Run this code
# NOT RUN {
# Basics:
plot_curve()                     # => default: what = ("prev", "PPV", "NPV")
plot_curve(show.points = FALSE)  # => default without points

# all curves:
plot_curve(what = "all") # => all curves: what = ("prev", "PPV", "NPV", "ppod", "acc")
plot_curve(what = "all", show.points = FALSE)  # => all curves, no points

# selected curves:
plot_curve(what = c("PPV", "NPV"))                  # => PPV and NPV
plot_curve(what = c("prev", "PPV", "NPV", "acc"))   # => prev, PPV, NPV, and acc
plot_curve(what = c("prev", "PPV", "NPV", "ppod"))  # => prev, PPV, NPV, and acc

# X-axis as linear vs. log scale:
plot_curve(prev = .01, sens = .9, spec = .8)                     # => linear scale
plot_curve(prev = .01, sens = .9, spec = .8, log.scale = TRUE)   # => log scale

plot_curve(prev = .0001, sens = .7, spec = .6)                   # => linear scale
plot_curve(prev = .0001, sens = .7, spec = .6, log.scale = TRUE) # => log scale

# Other options:
plot_curve(title.lbl = "Testing smaller text labels", cex.lbl = .60)
plot_curve(what = "all", what.col = c("grey", "red3", "green3", "blue3", "gold"))


# }

Run the code above in your browser using DataLab