Plotting function for collection of interpretation_result objects
Plotting function for collection of interpretation_result objects
Produces a plot presenting a collection of interpretation_result
objects on a single chart. If the interpretation_result objects are named then the names will be used for labelling the relevant intervals on the chart.
x: A list of interpretation_result objects, length at least 2. The objects may optionally be named. See Details.
extra_boundaries: Names optional.
estimates: Estimate values that the intervals assessed in each interpretation_result object relate to. If not specified, a default of the central point between the two ends of each 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.
y_scale: How tall the interval plots are to be drawn
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.
...: Further arguments passed to and from methods.
Details
For a single interpretation_result object a plot() method is provided; see plot.interpretation_result.
To be a valid group of interpretation_result objects, each of the items in x must be a valid interpretation_result, and they must all share some characteristics. Each of the component objects must have been generated using the same interpretation_set, with the same boundaries, and the low_to_high parameter must be the same. This enables them to be meaningfully plotted on the same canvas.
Examples
# Set up some intervals to test:ci_stage_1 <- matrix(c(0.023,0.131), nrow =1, dimnames = list("estimate", c("2.5 %","97.5 %")))ci_stage_2 <- matrix(c(-0.016,0.096), nrow =1, dimnames = list("estimate", c("2.5 %","97.5 %")))# Conduct the interpretations:interp_stage_1 <- interpret_noninferiority(ci_stage_1, actual_null =0, ni_margin =0.05, groups = c("Business as usual","New approach"))interp_stage_2 <- interpret_noninferiority(ci_stage_2, actual_null =0, ni_margin =0.05, groups = c("Business as usual","New approach"))# Assemble the list object:interp_1_and_2 <- list("Stage 1"= interp_stage_1,"Stage 2"= interp_stage_2)# Set a nice colour schemegrDevices::palette(c("#FF671F99","#F2A90099","#0085CA99"))plot_interpretation_result_list(interp_1_and_2, boundary_label_pos ="on top")