powerPlot: Exclusion/inclusion power plots

Description Usage Arguments Details Value See Also Examples

View source: R/powerPlot.R

Description

This function offers four different visualisations of exclusion/inclusion powers, particularly for missing person cases. Output from MPPsims() may be fed directly as input to this function. The actual plotting is done with ggplot2.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
powerPlot(
  ep,
  ip = NULL,
  type = 1,
  majorpoints = TRUE,
  minorpoints = TRUE,
  ellipse = FALSE,
  col = NULL,
  labs = NULL,
  alpha = 1,
  stroke = 1.5,
  shape = "circle",
  size = 1,
  hline = NULL,
  vline = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL
)

Arguments

ep, ip

Lists of equal length, with outputs from one or more runs of missingPersonEP() and missingPersonIP() respectively. Alternatively, ep can be a single output from MPPsims(), in which case ip should be NULL. See Examples.

type

Plot type; either 1, 2, 3 or 4.

majorpoints

A logical indicating whether "major" points should be drawn (see Details).

minorpoints

A logical indicating whether "minor" points should be drawn (see Details).

ellipse

A logical. If TRUE, data ellipsis are drawn for each group containing more than 1 element. NB: This fails with a warning if all points in a group fall on a line.

col

A colour vector, recycle to match the top level length of ep.

labs

A character of the same length as ep. If NULL, the names of ep are used, if present.

alpha

Transparency for minor points (see Details).

stroke

Border width for major points (see Details).

shape

Either "circle", "square", "diamond", "triangleUp" or "triangleDown", determining the shapes of both minor and major points.

size

Point size.

hline, vline

Single numbers indicating positions for horizontal/vertical "threshold" lines. If NULL (default), no lines are drawn.

xlim, ylim

Axis limits; automatically chosen if NULL.

xlab, ylab

Axis labels; automatically chosen if NULL.

Details

The plot types are as follows:

type = 1: x = Exclusion power; y = Inclusion power

type = 2: x = Exclusion odds ratio; y = Inclusion odds ratio

type = 3: x = Expected number of exclusions; y = average log(LR)

type = 4: x = Exclusion power; y = average LR

In the most general case ep (and similarly for ip) can be a list of lists of EPresult objects. We refer to the inner lists as "groups". A group may consist of a single output, or several (typically many simulations of the same situation). Points within the same group are always drawn with the same colour and shape.

When plotting several groups, two sets of points are drawn by default:

The parameters majorpoints and minorpoints control which of the above points are included.

Value

A ggplot2 plot object.

See Also

MPPsims(), missingPersonEP(), missingPersonEP()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
ref = nuclearPed(father = "fa", mother = "mo", child = "MP")
ref = setMarkers(ref, marker(ref, alleles = 1:5))

# Alternatives for genotyping
sel = list("fa", c("fa", "mo"))

# Simulate power for each selection
simData = MPPsims(ref, selections = sel, nProfiles = 3, lrSims = 5,
                  thresholdIP = 2, seed = 123, numCores = 1)

# Power plot 1: EP vs IP
powerPlot(simData, type = 1)
powerPlot(simData, type = 1, minorpoints = FALSE, hline = 0.8)



# Change shape, and modify legend order
powerPlot(simData[3:1], type = 1, shape = c("ci", "sq", "di"))

# Zoom in, and add threshold lines
powerPlot(simData, type = 1, xlim = c(0.2, 1), ylim = c(0.5, 1),
          hline = 0.8, vline = 0.8)

# Power plot 3: Expected number of exclusions vs E[log LR]
powerPlot(simData, type = 3)

# With horizontal/vertical lines
powerPlot(simData, type = 3, hline = log10(2), vline = 1)

# Plot 4: Illustrating the general inequality ELR > 1/(1-EP)
powerPlot(simData, type = 4)

forrel documentation built on March 14, 2021, 1:06 a.m.