plot.interpretation_result: Plot an interpretation_result, as returned by confinterpret()

Description Usage Arguments Details Examples

View source: R/plot.R

Description

Produces a diagram that illustrates the confidence interval that was interpreted using confinterpret against a background illustrating the interpretation_set that it was the basis for the interpretation.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'interpretation_result'
plot(x, extra_boundaries = NULL,
  estimate = NULL, boundary_values = TRUE, boundary_label_pos = "below",
  interpretation_label_pos = "right", x_axis_pos = "below",
  y_axis_pos = "none", inner_margin = c(-0.1, 0.05, -0.1, 0.05),
  edge_margin = c(0, 0.02, 0, 0.02), edge_type = "gradient",
  interval_type = "norm", interval_value_labels = TRUE,
  estimate_value_labels = TRUE, plot_estimate_marks = TRUE,
  estimate_mark_points = c(0, 0.05, 0, -0.05), ...)

Arguments

x

An interpretation_result object, of the type returned by confinterpret.

extra_boundaries

A vector of numerical values specifying the position for displaying additional boundaries, not specified in the interpretation_set. May optionally be named values; if named, the names will be labelled on the plot axis.

estimate

Estimate value that the interval relates to. If not specified, a default of the central point between the two ends of the interval will be assumed.

boundary_values

A logical value indicating whether the values should be appended to the boundaries' names.

boundary_label_pos

Where to put the boundary labels. Options are c("below", "above", "on top", "none"). If you are planning to plot values on the canvas and want the boundary labels on top then you may want to choose "none" and make a call to label_ontop_boundaries() after plotting values.

interpretation_label_pos

Options are c("right", "left", "none")

x_axis_pos

Location of a numerical x axis. Options are c("none", "below", "above").

y_axis_pos

Location of a numerical y axis. Default "none" will almost always be right. Options are c("none", "left", "right").

inner_margin

Numerical vector of the form c(bottom, left, top, right), which gives the amount of inner margin to be added, expressed as a proportion of the plotted area. This is space designed to be past any plotted objects but before the edging (defined separately via edge_margin). See Details.

edge_margin

Numerical vector of the form c(bottom, left, top, right), which gives the amount of 'edge margin' to be added, expressed as a proportion of the plotted width. This is the space designed to be occupied by plot edges (e.g. a gradient fading out). Currently only implemented for left and right; top and bottom values are ignored. See Details.

edge_type

What style of edge to draw at the sides of the plot. Currently supported options are "gradient" (the default) and "zigzag".

interval_type

Set the way the interval is presented. Current options are c("norm", "unif") for a normal distribution-based curve and a box, respectively.

interval_value_labels

Logical value specifying whether interval value labels are to be added.

estimate_value_labels

Logical value specifying whether estimate value labels are to be added.

plot_estimate_marks

Whether to plot marks at the x location of the estimates.

estimate_mark_points

y positions of the ends of the estimate marks as a numeric vector of length 4. Values are, in order: start (relative to centre), end (relative to box top), start (relative to centre), end (relative to box bottom).

...

Further arguments passed to and from methods.

Details

Additional boundaries can be displayed using the extra_boundaries parameter. This can be helpful if you want to show a position that is of some practical relevance, but is not defined as a boundary for the purposes of the interpretation_set.

If you wish to plot multiple interpretation_result objects on one chart, see plot_interpretation_result_list.

Plots use the current R Graphics Palette, so you may wish to set that to something attractive before plotting. See ?palette.

Examples

1
2
3
4
5
6
7
8
9
# Set a nice colour scheme
grDevices::palette(c("#FF671F99", "#F2A90099", "#0085CA99"))
# Set up a confidence interval to interpret
ci_test <- matrix(c(-0.03, 0.05),
                  nrow = 1,
                  dimnames = list("estimate", c("2.5 %", "97.5 %")))
noninf <- interpret_noninferiority(ci_test, 0, 0.05, c("Treatment as usual",
                                                       "New treatment"))
plot(noninf)

jimvine/confinterpret documentation built on May 19, 2019, 10:35 a.m.