Search code examples
rggplot2loess

Loess function in ggplot when SE fails


I would like to plot a loess function with standard errors:

geom_smooth(method="loess", se=TRUE)

However, I get an error:

Computation failed in `stat_smooth()`:
workspace required (XXXXX) is too large probably because of setting 'se = TRUE'. 

Is there an alternative way, or a fix to get SEs?


Solution

  • The fix is to use mgcv::gam() instead of stats::loess():

    geom_smooth(method="gam", se=TRUE)