Hatshepsut
Hatshepsut

Reputation: 6642

How does the error ribbon on geom_smooth work?

What determines the bounds of the error/uncertainty ribbon around a geom_smooth() curve?

I know it's a 95% confidence interval from the documentation. What calculation is used for a smooth confidence ribbon like this?

Upvotes: 0

Views: 1197

Answers (1)

conjugateprior
conjugateprior

Reputation: 398

The documentation also tells you that, unless you specify otherwise, the method used to make the smoothed mean and its confidence interval is either loess or gam. So you should look those up to find out the answer to your question.

Some googling finds your question asked for loess and points to this document (see section 4.1).

A little more googling reveals for gam that "The standard errors produced by predict.gam are based on the Bayesian posterior covariance matrix of the parameters Vp in the fitted gam object." (from the help for predict.gam). The details implementation seem somewhat convoluted. The literature on generalized additive models might be the first place to look to see what will be happening down there. Sec 7.7 of the 6th edition of James, Witten, Hastie, and Tibshirani 2016 is probably the place to start.

Indeed, the whole of chapter 7 would be a good thing to read to understand what's going on with these local regression methods.

Upvotes: 6

Related Questions