I was unsure whether this question would be more appropriate here or on Cross Validated. I hope I made the right choice.
Consider the example:
library(dplyr)
setosa <- iris %>% filter(Species == "setosa") %>% select(Sepal.Length, Sepal.Width, Species)
library(ggplot2)
ggplot(data = setosa, aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point() +
geom_smooth(method ="lm", formula = y ~ poly(x,2))
By default,
ggplot
"displays confidence interval around smooth" (see here), given by the gray area around the regression curve. I've always assumed these are simultaneous confidence bands for the regression curve, not pointwise confidence bands. ggplot2
documentation refers to the predict
function for details on how the standard errors are computed. However, reading the doc for predict.lm, it doesn't say explicitly that simultaneous confidence bands are computed. So, what is the correct interpretation here?