2026-04-13

1

Simple Linear Regression

  • Simple Linear Regression is a statistical method used to model the relationship between two continuous variables. It is preferable when attempting to predict a value (dependent variable) based on just one input value (independent variable).

When is Simple Linear Regression Useful?

  • Simple Linear Regression is useful in modelling single, straight-line relationships between x and y variables. This line can help us understand said relationships and whether or not they describe a trend.

Simple Linear Regression Formula Using LaTeX

\[ y = a + bx \]

Formal Regression Model Using LaTeX

\[ y = \beta_0 + \beta_1 x + \epsilon \]

Loading Average Monthly Highs for Phoenix

##    month average
## 1      1      68
## 2      2      72
## 3      3      77
## 4      4      86
## 5      5      94
## 6      6     104
## 7      7     106
## 8      8     105
## 9      9     100
## 10    10      90
## 11    11      77
## 12    12      68

Scatter Plot Using ggplot

Regression Line Using ggplot

## `geom_smooth()` using formula = 'y ~ x'

Interactive Plot Using plotly

## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout