This week, Ellis Hughes and I explain the code Rebecca Stevick, who shows us how to plot a linear regression model with the regression line, regression equation, and correlation coefficient all conveniently visualized on the plot. The plot was created using data on The Uncanny X-Men comic books and was supplied by the TidyTuesday Project.
Following Rebecca’s code we delve into other ways of looking at the regression equation and discuss using Ellis’ R package, {colortable}, to produce conditionally formatted tables for model outputs. We then move on to using the X-Men data to build and visualize a KMeans Cluster and PCA.
The episode is a little longer than usual (50 minutes) but combines a number of different thoughts around coding and visualizing statistical models in R.