2024-04-05

What is Simple Linear Regression?

Simple Linear Regression is a statistical method that is used to estimate the relationship between two variables. The two types of variables are Independent (aka the Predictor variable) and Dependent (aka the Response variable). Lets look at an example…

Orange Trees’ Age vs. Circumference

Below is a scatter plot of data from the built-in R data frame “Orange” which represents the circumference size of Orange Trees vs the age of the Orange Trees.

Fitted Line

The orange fitted line in the plot below represents the best estimate between the two variables, age and circumference, of the Orange Trees.

Confidence Inverval Band

The grey band you see around the orange regression line in the previous plot is a 95% confidence interval. This means that we can expect the true value of y, given x, to be within that grey area with 95% confidence.

Equation

The equation for Simple Linear Regression can be represented as \(Y = \beta_0 + \beta_1X + \epsilon\).

The goal is to find the values of \(\beta_0\) and \(\beta_1\) that minimize the Sum of Squares of Errors.

Equation Continued

In our equation, \(Y = \beta_0 + \beta_1X + \epsilon\),

\(Y\) = the response variable.

\(X\) = the predictor variable.

\(\beta_0\) = the Y intercept.

\(\beta_1\) = the slope.

\(\epsilon\) = the error or noise.

Check Out the Estimates

When you move your cursor along the orange line in the interactive plot below, we can see the values that represent the best estimate of the Orange Trees’ circumference based on their ages.

Code for Interactive Plotly Graph

For reference, here is the R code used to create the Plotly graph in the previous slide:

library(plotly)
ggplotly(g)

Thank You!!