riskyr (version 0.2.0)

plot_plane: Plot a plane of selected values (e.g., PPV or NPV) as a function of sensitivity and specificity.

Description

plot_plane draws a 3D-plane of selected values (e.g., predictive values PPV or NPV) as a function of a decision's sensitivity sens and specificity value spec for a given prevalence (prev).

Usage

plot_plane(prev = num$prev, sens = num$sens, mirt = NA,
  spec = num$spec, fart = NA, what = "PPV", what_col = pal,
  line_col = "grey85", point_col = "yellow", show_point = TRUE,
  step_size = 0.05, theta = -45, phi = 0, lbl_txt = txt,
  title_lbl = NA, p_lbl = "def", cex_lbl = 0.85, col_pal = pal,
  mar_notes = TRUE, ...)

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 value 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 character code that specifies one metric to be plotted as a plane. Currently available options are c("PPV", "NPV", "ppod", "acc"). Default: what = "PPV".

what_col

Color for surface facets corresponding to the metric specified in what. Default: what_col uses color corresponding to what in current col_pal.

line_col

Color for lines between surface facets. Default: line_col = "grey85".

point_col

Fill color for showing current value on plane. Default: point_col = "yellow".

show_point

Boolean option for showing the current value of the selected metric for the current conditions (prev, sens, spec) as a point on the plane. Default: show_point = TRUE.

step_size

Sets the granularity of the sens-by-spec grid. (in range .01 <= step_size <= 1). Default: step_size = .05.

theta

Horizontal rotation angle (used by persp). Default: theta = -45.

phi

Vertical rotation angle (used by persp). Default: phi = 0.

lbl_txt

Labels and text elements. Default: lbl_txt = txt.

title_lbl

Main plot title. Default: title_lbl = NA (using lbl_txt$scen_lbl).

p_lbl

Type of label for shown probability values, with the following options:

  1. "abb": show abbreviated probability names;

  2. "def": show abbreviated probability names and values (default);

  3. "nam": show only probability names (as specified in code);

  4. "num": show only numeric probability values;

  5. "namnum": show names and numeric probability values;

  6. "no": hide labels (same for p_lbl = NA or NULL).

cex_lbl

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

col_pal

Color palette (if what_col is unspecified). Default: col_pal = pal.

mar_notes

Boolean value for showing margin notes. Default: mar_notes = TRUE.

...

Other (graphical) parameters.

Details

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

See Also

comp_popu computes the current population; popu contains the current population; 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_area, plot_bar, plot_curve, plot_fnet, plot_icons, plot_mosaic, plot_prism, plot_tab, plot_tree

Examples

Run this code
# NOT RUN {
# Basics:
plot_plane()              # => default plot (what = "PPV")
# same as:
# plot_plane(what = "PPV")  # => plane of PPV

plot_plane(what = "NPV")  # => plane of NPV
plot_plane(what = "ppod") # => plane of ppod
plot_plane(what = "acc")  # => plane of acc

# Plot options:
plot_plane(title_lbl = "Testing smaller text labels", cex_lbl = .60)
plot_plane(show_point = FALSE)  # => no point shown on plane

plot_plane(title_lbl = "Testing plot colors", what_col = "royalblue4", line_col = "sienna2")
plot_plane(title_lbl = "Testing plot in b/w", what_col = "white", line_col = "black")

plot_plane(step_size = .333, what_col = "firebrick")    # => coarser granularity + color
plot_plane(step_size = .025, what_col = "chartreuse4")  # => finer granularity + color
plot_plane(what_col = "steelblue4", theta = -90, phi = 45)   # => rotated, from above

# }

Run the code above in your browser using DataCamp Workspace