plot.viztest | R Documentation |
Plots the output of viztest objects with optional reference lines
## S3 method for class 'viztest'
plot(
x,
...,
ref_lines = "none",
viz_diff_thresh = 0.02,
make_plot = TRUE,
level = c("ce", "max", "min", "median"),
trans = I
)
x |
Object to be plotted, should be of class |
... |
Other arguments passed down. Currently not implemented. |
ref_lines |
Reference lines to be plotted - one of "all", "ambiguous", "none". This could also be a vector of stimulus names to plot - they should be the same as the names of the estimates in |
viz_diff_thresh |
Threshold for identifying visual difficulty, see details. |
make_plot |
Logical indicating whether the plot should be constructed or the data returned. |
level |
Level at which to plot the estimates. Accepts both numeric entries or one of "ce", "max", "min", "median" - defaults to "ce", the cognitively easiest level. |
trans |
A function to transform the estimates and their confidence intervals like |
The ref_lines
argument identifies what reference lines will be plotted in the figure. For any particular stimulus, the reference lines run along the upper bound of the stimulus from the stimulus location to the most distant stimulus with overlapping confidence intervals.
When ref_lines = "all"
, all lines are plotted, though in displays with many stimuli, this can make for a messy graph. When "ref_lines = ambiguous"
is specified, then only the ones that help discriminate in cases where the result might be visually difficult to discern are plotted.
A comparison is determined to be visually difficult if the upper bound of the stimulus in question is within viz_diff_thresh
times the difference between the smallest lower bound and the largest upper bound. If ref_lines = "non"
, then none of the reference lines are plotted.
Alternatively, you can specify the names of stimuli whose reference lines will be plotted. These should be the same as the names in the data. The viztest()
function returns an object est
, which contains the data that are used as input to this function. The variable vbl
in
The est
data frame contains the stimulus names.
By default, a ggplot is returned. If make_plot = FALSE
, the data for the plot are returned, but the plot is not constructed. If the data are returned, the following variables are in the dataset:
vbl
- The name of the parameter.
est
- The parameter estimate
se
- The standard error of the estimate
lwr
, upr
- The inferential confidence bounds being used
label
- Factor giving the parameter names
stim_start
, stim_end
- y-axis bounds of the reference line
bound_start
, bound_end
- x-axis values for reference lines
ambiguous
- Logical vector indicating whether the comparison is considered "ambiguous".
data(mtcars)
mod2 <- lm(mpg ~ as.factor(cyl) + vs + am + as.factor(gear), data = mtcars)
v <- viztest(mod2)
plot(v, ref_lines="ambiguous") + ggplot2::theme_classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.