Learn R Programming

riskyr (version 0.1.0)

plot_mosaic: Plot a mosaic plot of population frequencies.

Description

plot_mosaic draws a mosaic plot that represents the proportions of frequencies in the current population popu as relatives sizes of rectangular areas.

Usage

plot_mosaic(prev = num$prev, sens = num$sens, mirt = NA,
  spec = num$spec, fart = NA, N = num$N, vsplit = TRUE,
  show.accu = TRUE, w.acc = 0.5, title.lbl = txt$scen.lbl,
  col.sdt = c(pal["hi"], pal["mi"], pal["fa"], pal["cr"]))

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.

N

The number of individuals in the population. (This value is not represented in the plot, but used when new frequency information freq and a new population table popu are computed from scratch from current probabilities.)

vsplit

Option for toggling between vertical and horizontal split. Default: vsplit = TRUE.

show.accu

Option for showing current accuracy metrics accu in the plot. Default: show.accu = TRUE.

w.acc

Weigthing parameter w used to compute weighted accuracy w.acc in comp_accu. Default: w.acc = .50.

title.lbl

Text label for current plot title. Default: title.lbl = txt$scen.lbl.

col.sdt

Colors for cases of 4 essential frequencies. Default: col.sdt = c(pal["hi"], pal["mi"], pal["fa"], pal["cr"]).

Details

If a sufficient and valid set of 3 essential probabilities (prev, and sens or its complement mirt, and spec or its complement fart) is provided, new frequency information freq and a new population table popu are computed from scratch. Otherwise, the existing population popu is shown.

Rectangles corresponding to the areas of the mosaic plot can be visualized byopting for vertical rectangles (by selecting the option box = "vr") in plot_tree and plot_fnet.

plot_mosaic requires and uses the R packages "vcd" and "grid" (library("vcd", "grid")).

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_curve, plot_fnet, plot_icons, plot_plane, plot_tree

Examples

Run this code
# NOT RUN {
plot_mosaic()                # => default options
plot_mosaic(title.lbl = "")  # => no title
plot_mosaic(vsplit = FALSE)  # => horizontal split
plot_mosaic(title.lbl = "My favorite scenario", col.sdt = "goldenrod")

# Accuracy:
plot_mosaic(show.accu = TRUE)               # => default w = .5 (balanced accuracy "bacc")
plot_mosaic(show.accu = TRUE, w.acc = 1/3)  # => (weighted accuracy "wacc")
plot_mosaic(show.accu = FALSE)              # => no accuracy info.


# }

Run the code above in your browser using DataLab