Slide 2: Intro to simple linear regression

Simple linear regression is a statistical method used to model the relationship between two variables, lets assume independent var. X and a dependent var. Y

For example, predicting house prices

Slide 3: The concept of Linear Regression

linear regression fits into a straight line observed data points

The line basically represents the prediction of var. X from var. Y

For example:

X = House size

Y = House price

The objective is to find out how house sizes changes with price

Slide 4: Regression Eqn.

Eqn . for linear regression

\[ Y = \beta_0 + \beta_1 X + \epsilon \]

\(Y\) = dependent variable
\(X\) = independent variable
\(\beta_0\) = intercept
\(\beta_1\) = slope
\(\epsilon\) = error

Slide 5: Slopes and prediction

The slope \(\beta_1\) tells us how \(Y\) changes with \(X\):

\[ \Delta Y = \beta_1 \Delta X \]

For example, if \(\beta_1 = 120\), then increasing house size by 100 sqft increases the price by:

\[ \Delta Y = 120 \times 100 = 12000 \]

Slide 6: Example in R

##   House_size House_price
## 1        800      150000
## 2       1000      180000
## 3       1200      200000
## 4       1500      240000
## 5       1800      280000
## 6       2000      310000
## 7       2200      330000
## 8       2500      370000

Slide 7: Plotting the data (scatter plot)

This plots shows the linear regression trend between house price and size

Slide 8: Plotting the data (curve)

Slide 9: Plot 3 (boxplot)

Slide 10: Plotly Scatter plot