display: Diagnostic tests display with forest plots.

Description Usage Arguments Value See Also

Description

This group of functions have the purpose to graphically display and compare either the same diagnostic test across several subsets (e.g. groups formed by clinical characteristics), several diagnostic tests or a combination of both. The diagnosis function is invocked and tests perfomances are stacked in a data.frame, and forest plots may be called from these.

diag.subset and forest.diag.subset display test performance across one or several groups represented by an additional columns in the same data.frame.

diag.stack and forest.diag.stack display two or more tests performances against the very same reference standard in the same sample. The index tests are represented by an additional columns in the same data.frame.

diag.by and forest.diag.by display two or more tests performances against the very same reference standard, across subsets defined by a single variable. The index tests and the subset variable are represented by an additional columns in the same data.frame.

Usage

 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diag.by(ref, test, group.var, data, CL = 0.95, CL.type = c("wilson",
  "exact", "approximate"), group.var.labels = attr(data,
  "var.labels")[match(group.var, names(data))], test.var.labels = attr(data,
  "var.labels")[match(test, names(data))])

diag.stack(ref, test, data, CL = 0.95, CL.type = c("wilson", "exact",
  "approximate"), var.labels = attr(data, "var.labels")[match(test,
  names(data))])

diag.subset(ref, test, group.var, data, CL = 0.95, CL.type = c("wilson",
  "exact", "approximate"), var.labels = attr(data,
  "var.labels")[match(group.var, names(data))])

forest.diag.by(x, type = c("SeSp", "PLR"), mar1 = c(5.1, 1, 4.1, 1),
  mar.se = c(5.1, 9, 4.1, 1), mar.sp = c(5.1, 1, 4.1, 9), mar.plr = c(5.1,
  1, 4.1, 9), seg.list = list(col = "blue", lty = 1, lwd = 1, xpd = NA),
  points.list = list(pch = 18, cex = 2, col = 1, xpd = NA, type = "p"),
  var.list = list(x = 0.1, cex = 1, col = "black", font = 2, adj = 0),
  cat.list = list(x = 0.2, cex = 0.95, col = "gray30", font = 3, adj = 0, xpd
  = NA), x.n = 0.65, x.prev = 0.85, adj.se = 1, adj.sp = 0,
  adj.plr = 0, se.xlim = "auto", sp.xlim = "auto", plr.xlim = "auto",
  se.xlab = "Sensitivity", sp.xlab = "Specificity",
  plr.xlab = "Positive likelihood ratio", se.pos = 0.06, sp.pos = 0.06,
  plr.pos = 0.06, se.col.label = "Se [95% CI]",
  sp.col.label = "Sp [95% CI]", plr.col.label = "PLR [95% CI]",
  digits = 3, grid = TRUE)

forest.diag.stack(x, type = c("SeSp", "PLR"), mar1 = c(5.1, 1, 4.1, 1),
  mar.se = c(5.1, 9, 4.1, 1), mar.sp = c(5.1, 1, 4.1, 9), mar.plr = c(5.1,
  1, 4.1, 9), seg.list = list(col = "blue", lty = 1, lwd = 1, xpd = NA),
  points.list = list(pch = 18, cex = 2, col = 1, xpd = NA, type = "p"),
  var.list = list(x = 0.01, cex = 1, col = "black", font = 2, adj = 0),
  num.list = list(x = 0.7, cex = 0.95, col = "gray30", font = 3, adj = 0, xpd
  = NA), x.n = 0.65, x.prev = 0.85, adj.se = 1, adj.sp = 0,
  adj.plr = 0, se.xlim = "auto", sp.xlim = "auto", plr.xlim = "auto",
  se.xlab = "Sensitivity", sp.xlab = "Specificity",
  plr.xlab = "Positive likelihood ratio", se.pos = 0.06, sp.pos = 0.06,
  plr.pos = 0.06, se.col.label = "Se [95% CI]",
  sp.col.label = "Sp [95% CI]", plr.col.label = "PLR [95% CI]",
  digits = 3, grid = TRUE)

forest.diag.subset(x, type = c("SeSp", "PLR"), mar1 = c(5.1, 1, 4.1, 1),
  mar.se = c(5.1, 9, 4.1, 1), mar.sp = c(5.1, 1, 4.1, 9), mar.plr = c(5.1,
  1, 4.1, 9), seg.list = list(col = "blue", lty = 1, lwd = 1, xpd = NA),
  points.list = list(pch = 18, cex = 2, col = 1, xpd = NA, type = "p"),
  var.list = list(x = 0.1, cex = 1, col = "black", font = 2, adj = 0),
  cat.list = list(x = 0.2, cex = 0.95, col = "gray30", font = 3, adj = 0, xpd
  = NA), x.n = 0.65, x.prev = 0.85, adj.se = 1, adj.sp = 0,
  adj.plr = 0, se.xlim = "auto", sp.xlim = "auto", plr.xlim = "auto",
  se.xlab = "Sensitivity", sp.xlab = "Specificity",
  plr.xlab = "Positive likelihood ratio", se.pos = 0.06, sp.pos = 0.06,
  plr.pos = 0.06, se.col.label = "Se [95% CI]",
  sp.col.label = "Sp [95% CI]", plr.col.label = "PLR [95% CI]",
  digits = 3, grid = TRUE)

Arguments

ref

A character vector of length 1 representing the reference standard variable in data. If it is formated as character, the function will convert it to a factor, then use the reference factor level as the absence of the condition. See diagnosis

test

A character vector representing the test under evaluation variable in data. If the test variables are formated as character, the function will convert it to a factor, then use the reference factor level as the absence of the condition. See diagnosis. In diag.subset this must be o length 1, in diag.by and diag.stack this can be of length 2 or more.

group.var

A character vector representing the names of categorical variables in data to make subsets of data. In diag.by, this argument must be a single variable, while in diag.subset it could two or more variables.

data

A data.frame contining the required variables

CL

Confidece interval limit. Default is 0.95. Must be a number between 0 and 1. See binom.CI

CL.type

Method to estimate the confidece interval. Default is "wilson". See binom.CI

group.var.labels, test.var.labels

For diag.by, these are the labels of the variables in the group.var and test arguments (respectively), respectively. If not informed, the function will try to retrieve the labels from the "var.labels" attribute of the original data.frame. If there is no labels in this attribute, the function will return the variable names.

var.labels

For diag.subset and diag.stack, this is the labels (in the same order) of the variables in the group.var and test arguments, respectively. If not informed, the function will try to retrieve the labels from the "var.labels" attribute of the original data.frame. If there is no labels in this attribute, the function will return the variable names.

x

An object resulting from the function diag.subset, diag.stack or diag.by.

type

Type of forest plot. "SeSp" is a three window plot, showing Sensitivity and Specificty in the right windows. "PLR" (not yet implemented) is a two window plot showing the Positive likelihood ratio in right window.

mar1, mar.se, mar.sp, mar.plr

These are the margins that will be passed to par()$mar in the left window, the sensitivity window, the specificity window and the positive likelyhood ratio window respectively. See par.

seg.list

A list of arguments that will be passed to segments to plot the sensitivity, specificity and positive likelihood ratio confidence intervals. Internally the x and y coordenates are automatically replaced.

points.list

A list of arguments that will be passed to points to plot the sensitivity, specificity and positive likelihood ratio point estimate. Internally the x and y coordenates are automatically replaced.

var.list

A list of arguments that will be passed to text to plot variables or major group names (or labels) in the left window. Internally the y coordenates are automatically replaced.

cat.list

A list of arguments that will be passed to text to plot category names (or labels) in the left window . Internally the y coordenates are automatically replaced.

x.n, x.prev

x axis coordenates of the samples N and Prevalences in the left window (from 0 to 1). Internally, these will replace the x argument in the cat.list.

adj.se, adj.sp, adj.plr

The adjustment of the labels argument passed to text, to plot the sensitivity, specificity and positive likelihood ratio (respectively). 0 means left adjustment and 1 means right adjustment.

se.xlim, sp.xlim, plr.xlim

Limits of the horizontal axis of each window. This will be pased to plot.default. This may receive either "auto" or a numeric vector of length 2, representing the lower and upper limits of the horizontal axis. If auto, the function picks the lower values of the lower confidence limit and the upper value of the upper confidence limits.

se.xlab, sp.xlab, plr.xlab

Labels of the horizontal axis of each window. This will be pased to plot.default

se.pos, sp.pos, plr.pos

This is added to the horizontal positioning to the left of the lower limit of the axis (in case of sensitivity and positive lieklihood ratio) to plot the text of the point and confidence interval estimates. In the case of specificity, this is added to the right of th upper limit of the horizontal axis. This is intended to be an argument to make the text scoot over from the plot area and avoid overplot with the confidence interval lines in the edge of the graph.

se.col.label, sp.col.label, plr.col.label

Character strings representing the labels of the sensitivity, specificity and positive likelihood ratios columns.

digits

Number of digits to plot all numbers. Should an integer number.

grid

Logical. If TRUE, the default value, it invokes the grid function with its default arguments.

num.list

A list of arguments that will be passed to text to plot in the left window the samples N and Prevalences. Internally the y coordenates are automatically replaced.

Value

diag.by, diag.stack, diag.subset return data.frames with each strata sample size, sample prevalence, the sensitivities, the specificities and positive likelihood ratios (and their confidence intervals). The forest.diag.by, forest.diag.stack, forest.diag.subset return plots.

See Also

diagnosis, LRgraph


DiagnosisMed documentation built on May 2, 2019, 5:21 p.m.