Simultaneous Confidence Bands

In linear regression, simultaneous confidence bands are used to provide a visual representation of uncertainty associated with the estimated regression line. These bands show the range within which the true regression line is likely to fall with a certain level of confidence.

R




library(ggplot2)
data(mtcars)
  
#regression model
fit <- lm(mpg ~ wt, data = mtcars)
  
ci <- predict(fit, interval = "confidence",
              level = 0.95)
  
ggplot(data = mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  geom_ribbon(aes(ymin = ci[, 2], ymax = ci[, 3]),
              alpha = 0.2)


Output:

Simultaneous Confidence Bands

Plot Simultaneous and Pointwise Confidence Bands for Linear Regression

When performing linear regression analysis it can be useful to plot the confidence bands around the regression line to indicate the range of possible values for the response variable. 

There are two types of confidence bands that can be plotted: pointwise and simultaneous.

  • Pointwise confidence bands indicate the uncertainty in the predicted response variable at each value of the predictor variable. 
  • Simultaneous confidence bands indicate the range of the possible values for the entire regression line.

 We will use the ggplot2 package in R Programming Language to plot both pointwise and simultaneous confidence bands for linear regression.

Similar Reads

Simultaneous Confidence Bands

In linear regression, simultaneous confidence bands are used to provide a visual representation of uncertainty associated with the estimated regression line. These bands show the range within which the true regression line is likely to fall with a certain level of confidence....

Pointwise Confidence Bands

...

Contact Us