GGPLOT confidence interval too narrow to see or not plotted at all

Welcome to the forum!

It is OK to cross-post here and other sites, but we do ask that you link to any other posts. See FAQ: Is it OK if I cross-post?.

Here is a link to your question on Stack Overflow:

For help on making a reproducible example, see our FAQ here: FAQ: What's a reproducible example (`reprex`) and how do I do one?

As I said in a comment on Stack Overflow, you need to calculate your CI from your model. Right now you are having geom_smooth() calculate the standard error based on a linear model fit to your predictions with lm(). Ideally ggpredict() will calculate the CI for you (I haven't checked the documentation), which should make things a little more straightforward.

I show a basic example of adding CI calculated from the model with geom_ribbon() in this section of a blog post, which may help demonstrate the concept.

1 Like