Slide 1: Introduction

Simple Linear Regression is a statistical technique used to model the relationship between two continuous variables:
- A dependent variable (response) \(y\)
- An independent variable (predictor) \(x\)

We express this as:

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

Slide 2: Motivation and Goal

We use simple linear regression to:

  • Predict outcomes

  • Understand relationships between variables

  • Quantify the effect of one variable on another

Example:
How does house size or location affect its price?

Slide 3: Mathematical Model

The linear regression equation is:

\[ \hat{y} = b_0 + b_1 x \]

Where: - \(\hat{y}\): predicted response
- \(b_0\): estimated intercept
- \(b_1\): estimated slope

The slope is computed as:

\[ b_1 = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2} \]

Slide 4: Simulated Data

##          x         y
## 1 1.000000  3.318573
## 2 1.183673  4.676814
## 3 1.367347 10.410819
## 4 1.551020  6.313566
## 5 1.734694  6.857251
## 6 1.918367 11.981930

SLide 5: Fiting the Model

## 
## Call:
## lm(formula = y ~ x, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.0336 -1.8667 -0.2458  1.9977  6.4790 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3.2251     0.9140   3.529 0.000932 ***
## x             1.9778     0.1497  13.212  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.806 on 48 degrees of freedom
## Multiple R-squared:  0.7843, Adjusted R-squared:  0.7798 
## F-statistic: 174.6 on 1 and 48 DF,  p-value: < 2.2e-16

SLide 6: Visualization

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

SLide 7: Residual Plot

## Slide 8: 3D Visualization

Slide 9: Conclusion

Beta_1 is the expected change in y for a one unit change in x.

Beta_0 is the expected value when x = 0.

The simple lienar regression allows us to determine the effect one variable has on another.

A multiple regression model would allow us to compare multipel variables combined effect on a dependent variable.