shade_confidence_interval: Add information about confidence interval

Description Usage Arguments Value See Also Examples

View source: R/visualize.R

Description

shade_confidence_interval() plots confidence interval region on top of the visualize() output. It should be used as {ggplot2} layer function (see examples). shade_ci() is its alias.

Usage

1
2
3
4
5
shade_confidence_interval(endpoints, color = "mediumaquamarine",
  fill = "turquoise", ...)

shade_ci(endpoints, color = "mediumaquamarine", fill = "turquoise",
  ...)

Arguments

endpoints

A 2 element vector or a 1 x 2 data frame containing the lower and upper values to be plotted. Most useful for visualizing conference intervals.

color

A character or hex string specifying the color of the end points as a vertical lines on the plot.

fill

A character or hex string specifying the color to shade the confidence interval. 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_p_value() to add information about p-value region.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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_confidence_interval(c(-1.5, 1.5))
viz_plot + shade_confidence_interval(c(-1.5, 1.5), fill = NULL)

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