This function creates a normal theory based confidence envelope for the empirical density. The idea came from functions written by Bowman and Azzalini.

Arguments

mapping

Default list of aesthetic mappings to use for plot.

data

The data to be displayed in this layer.

h

A normal kernel function is used and h is its standard deviation. If this parameter is omitted, a normal optimal smoothing parameter is used.

fill

Fill color for the confidence envelope. The default is fill="skyblue"

model

The model to draw the confidence envelope for. The default is model="none" which creates the confidence envelope from the data. Using model="normal" creates the confidence envelope based on a normal distribution.

...

Other arguments passed to ggplot2::layer().

Aesthetics

These stat uses geom_ribbon() so support the same aesthetics: alpha, colour, fill, linetype, group, and size.

Examples

ggplot(mtcars, aes(x = mpg)) +
  stat_density_confidence(model = "normal") +
  geom_density()