Linear regression
Regression analysis is a statistical method used to estimate the relationship among continuous variables. Linear regression is the simplest and most frequently used type of regression analysis. The aim of linear regression is to describe the response variable y through a linear combination of one or more explanatory variables x1, x2, x3, …, xp. In other words, the explanatory variables get weighted with constants and then summarized. For example, the simplest linear model is y = a + bx, where the two parameters a and b are the intercept and slope, respectively. The model formula for this relationship in R is y ~ x. Note that all parameters are left out. So, if our linear model was y = a + bx + cz, then our model formula will be y ~ x + z.
Plotting a slope
Before going into a detailed example of linear regression analysis, I think it's worth going over how to plot a slope (or the change in y divided by the change in x). Say you wanted to plot a slope given the Cartesian coordinates...