Confidence Interval Visualizations for Bivariate Linear Regression Models

December 9th, 2019

Zhuoyun Wang

Linear regression is a basic and commonly used type of predictive analysis and the simple linear regression model is first model introduced to students in Statistics and sets the foundation for more complicated models. Confidence Intervals (CI) of the linear regression models are computed from the statistics of the observed data and might contain the true value of unknown population parameters. Having a clear understanding of the Confidence Interval should be a requirement for Statistics students since they have close relationships with other statistics topics, such as significance testing, and are crucial to evaluate the reliability of the estimates. This project visualizates confidence bands (surfaces in 3D) for the estimated response variable, and uses bootstrap resampling techniques to illustrate the confidence level. The deliverables can be used as tools to facilitate understanding of CI and linear regression system as a whole.


Code, Visualization, and Narrative Report

View Code View Visualization View Narrative

You can try implementing the algorithm on your own dataset here:

Please follow the instructions:

1. Click on the "View Code" button above to copy and paste the code to the box on the left
2. Change the directory in Line 15 to where your data is located
3. Change the assginment of x, y, and z so that they correspond to your predictor #1, #2, and response variable, respectively
4. Change the value of "r" in Line 32 so that the spheres have proper size
5. Change the values of "r" in Line 91, 102, 110, 118, and 126 so that the spheres of resamples can stand out from the original sample