Custom Confidence bands with ggplot2 in R?

318 views Asked by At

I would like to define my own confidence intervals, instead of ggplot2 automatically calculating them for me. I have put some reproducible code that outputs the graph below. In the example I have given, how may I define my own lower and upper confidence intervals?

library(ggplot2)
x = 1:10
y = rnorm(10)
upper_confidence_band = y + 1
lower_confidence_band = y - 1
qplot(x,y, geom="smooth")
# `geom_smooth()` using method = 'loess' and formula 'y ~ x' 

enter image description here

0

There are 0 answers