shade_p_value() plots p-value region(s) on top of the visualize() output. It should be used as {ggplot2} layer function (see examples). shade_pvalue() is its alias.

shade_p_value(obs_stat, direction, color = "red2", fill = "pink", ...)

shade_pvalue(obs_stat, direction, color = "red2", fill = "pink", ...)

## Arguments

obs_stat A numeric value or 1x1 data frame corresponding to what the observed statistic is. A string specifying in which direction the shading should occur. Options are "less", "greater", or "two_sided". Can also give "left", "right", or "both". If NULL then no shading is actually done. A character or hex string specifying the color of the observed statistic as a vertical line on the plot. A character or hex string specifying the color to shade the p-value region. If NULL then no shading is actually done. Other arguments passed along to {ggplot2} functions.

## Value

A list of {ggplot2} objects to be added to the visualize() output.

shade_confidence_interval() to add information about confidence interval.

## Examples

viz_plot <- mtcars %>%
dplyr::mutate(am = factor(am)) %>%
specify(mpg ~ am) %>% # alt: response = mpg, explanatory = am
hypothesize(null = "independence") %>%
generate(reps = 100, type = "permute") %>%
calculate(stat = "t", order = c("1", "0")) %>%
visualize(method = "both")#> Warning: Check to make sure the conditions have been met for the theoretical method. {infer} currently does not check these for you.
viz_plot + shade_p_value(1.5, direction = "right")viz_plot + shade_p_value(1.5, direction = "both")viz_plot + shade_p_value(1.5, direction = NULL)