ezPlot2: Plot bootstrap predictions and confidence intervals

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ezPlot2.R

Description

This function provides easy visualization of any given user-requested effect from the bootstrap predictions computed by ezPredict or ezBoot.

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
ezPlot2(
    preds
    , CI = .95
    , x = NULL
    , split = NULL
    , row = NULL
    , col = NULL
    , do_lines = TRUE
    , ribbon = FALSE
    , CI_alpha = .5
    , point_alpha = .8
    , line_alpha = .8
    , bar_width = NULL
    , to_numeric = NULL
    , x_lab = NULL
    , y_lab = NULL
    , split_lab = NULL
    , levels = NULL
    , diff = NULL
    , reverse_diff = NULL
    , y_free = FALSE
    , alarm = FALSE
    , do_plot = TRUE
    , print_code = FALSE
    , parallel = FALSE
)

Arguments

preds

An list object resulting from a call to ezPredict or ezBoot.

CI

Numeric vector of one or more confidence levels to use for plotting error bars. If plotting multiple confidence regions, it is suggested that an equal number of different values are supplied to the bar_width argument for differentiation.

x

Name of the variable to plot on the x-axis.

split

Name of a variable by which to split the data into different shapes/colors (and line types, if do_lines==TRUE).

row

Name of a variable by which to split the data into facet rows.

col

Name of a variable by which to split the data into facet columns.

do_lines

Logical. If TRUE, lines will be plotted connecting groups of points.

ribbon

Logical. If TRUE, a ribbon will be plotted instead of error bars (and no points will actually be plotted, just lines).

CI_alpha

Numeric value between 0 and 1 specifying the opacity of the CI bars/ribbon.

point_alpha

Numeric value between 0 and 1 specifying the opacity of the plotted points.

line_alpha

Numeric value between 0 and 1 specifying the opacity of the plotted lines.

bar_width

Numeric value or vector specifying custom widths for the error bar hat. Must either have a length of 1, or the same length as CI.

to_numeric

Names of any variables that need to be converted to the numeric class before plotting. If a single value, may be specified by name alone; if multiple values, must be specified as a .() list.

x_lab

Character string specifying the x-axis label.

y_lab

Character string specifying the y-axis label.

split_lab

Character string specifying the key label.

levels

Named list where each item name matches a factored column in data that needs either reordering of levels, renaming of levels, or both. Each item should be a list containing named elements new_order or new_names or both.

diff

Names of any variables to collapse to a difference score. If a single value, may be specified by name alone; if multiple values, must be specified as a .() list. All supplied variables must be factors, ideally with only two levels (especially if setting the reverse_diff argument to TRUE).

reverse_diff

Logical. If TRUE, triggers reversal of the difference collapse requested by diff. Take care with variables with more than 2 levels.

y_free

Logical. If TRUE, then rows will permit different y-axis scales.

alarm

Logical. If TRUE, call the alarm function when ezPlot2 completes (useful for plots that take a long time).

do_plot

Logical. If TRUE, no plot will be produced but instead a data frame containing point predictions and confidence limits will be returned.

print_code

Logical. If TRUE, the code for creating the ggplot2 plot object is printed and the data to be plotted is returned instead of the plot itself.

parallel

Logical. If TRUE, computation will be parallel, assuming that a parallel backend has been specified (as in library(doMC);options(cores=4);registerDoMC(). Likely only to work when running R from a unix terminal.)

Value

If do_plot is TRUE (default) and print_code if FALSE (default), a printable/modifiable ggplot2 object representing the predictions and confidence intervals. If do_plot is FALSE or print_code is TRUE, a list containing the cell predictions and bootstrapped CIs is returned.

Author(s)

Michael A. Lawrence mike.lwrnc@gmail.com
Visit the ez development site at http://github.com/mike-lawrence/ez
for the bug/issue tracker and the link to the mailing list.

See Also

ezBoot, ezMixed, ezPredict

Examples

1
#see example in ezPredict documentation

Example output



ez documentation built on May 2, 2019, 3:46 a.m.