shade_p_value: Add information about p-value region(s)

Description Usage Arguments Value See Also Examples

View source: R/visualize.R

Description

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.

Usage

1
2
3
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.

direction

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.

color

A character or hex string specifying the color of the observed statistic as a vertical line on the plot.

fill

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.

See Also

shade_confidence_interval() to add information about confidence interval.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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")

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)

andrewpbray/infer documentation built on Aug. 29, 2019, 5:57 a.m.