Search code examples
rggplot2

What does `se` stand for in geom_smooth(..., se = FALSE)?


From documentation:

se Display confidence interval around smooth (TRUE by default, see level to control.)

Source: https://ggplot2.tidyverse.org/reference/geom_smooth.html

So where did "s" and "e" come from???


Solution

  • This is admittedly a slightly oblique name, but as @Guillaume says, it refers to the standard error of the estimated response. Internally, ggplot is typically calling the predict() method of the smoothed object with se.fit = TRUE; e.g. you can see the code here. It then computes the confidence interval based on a set number of standard-error intervals around the predicted value (for the typical 95% CI, this is predicted ± 1.96 * se).

    The Details section of geom_smooth says:

    Calculation is performed by the (currently undocumented) ‘predictdf()’ generic and its methods. For most methods the standard error bounds are computed using the ‘predict()’ method - the exceptions are ‘loess()’, which uses a t-based approximation, and ‘glm()’, where the normal confidence interval is constructed on the link scale and then back-transformed to the response scale.