Loess function in ggplot when SE fails

352 Views Asked by At

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?

1

There are 1 best solutions below

0
jkortner On BEST ANSWER

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

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