[R-sig-ME] ggplot, loess function without 95%CI option

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Tue Oct 15 06:54:50 CEST 2019

This isn't really the appropriate forum for that question because the
question has nothing to do with mixed-effects models.

That said, it really helps to just read the documentation:


The default for loess in modern ggplot2 is indeed the 95% CI. You can
adjust this with the level option, e.g.

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() +
  geom_smooth(method = 'loess', fill='darkred', level=0.68) +

  geom_smooth(method = 'loess')

Note that level=0.68 corresponds to the SE case and provides a shaded
area about half as wide as the the default case, which is in line with
the Wald approximation that 95% CI = ±2 * SE.



On 11/10/2019 20:36, Slik, F.W.P. van der wrote:
> Hi listers,
> In ggplot, the loess function is only available with SE. The 95%CI option (level=.95) is unavailable, unfortunately.
> I think there is demand for such an option. Well, at least I would like to make use of it.
> Several contributors to stackoverflow have expressed their need and some of them have tried to program a workaround for this issue:
> https://stackoverflow.com/questions/19643234/fill-region-between-two-loess-smoothed-lines-in-r-with-ggplot,
> https://stackoverflow.com/questions/44736600/confidence-interval-band-for-a-loess-to-replicate-geom-smooth
> Unfortunately, their workarounds have their shortcomings.
> Has anyone a solution for the missing 95%CI option for loess in ggplot? It would be wonderful if the 95%CI band would look like the se band in the ggplot.
> Thanks in advance.
> Cheers, Frans van der Slik
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

More information about the R-sig-mixed-models mailing list