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

stat_density_confidence(
  mapping = NULL,
  data = NULL,
  geom = "ribbon",
  position = "identity",
  na.rm = TRUE,
  inherit.aes = TRUE,
  h = NULL,
  fill = "skyblue",
  fade = FALSE,
  model = "none",
  ...
)

Arguments

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.

Aesthetics

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