class: center, middle, inverse, title-slide # Simple Linear Regression ## Foundation ### Prof. Maria Tackett --- class: middle, center ## [Click for PDF of slides](05-slr-foundation.pdf) --- ## General form of model .eq[ `$$\Large{Y = f(X) + \epsilon}$$` ] -- `\(Y\)`: response variable -- `\(X\)`: predictor variable -- `\(f\)`: fixed but unknown function -- `\(\epsilon\)`: random error --- ## Simple linear regression -- .eq[ `$$\begin{aligned} Y &= \color{purple}{\textbf{Model}} + \text{Error} \\[8pt] &= \color{purple}{\mathbf{f(X)}} + \epsilon \\[8pt] &= \color{purple}{\boldsymbol{\mu_{Y|X}}} + \epsilon \\[8pt] &= \color{purple}{\boldsymbol{\beta_0 + \beta_1 X}} + \epsilon \end{aligned}$$` ] --- class: middle .eq[ `$$\Large{Y = \color{purple}{\boldsymbol{\beta_0 + \beta_1 X}} + \epsilon }$$` ] <br> where the errors are independent and normally distributed `\(\epsilon \sim N(0, \sigma^2_{\epsilon})\)` --- class: middle .eq[ `$$Y|X \sim N(\beta_0 + \beta_1 X, \sigma^2_\epsilon)$$` ] <img src="05-slr-foundation_files/figure-html/unnamed-chunk-2-1.png" style="display: block; margin: auto;" /> --- class: middle .eq[ `$$Y|X \sim N(\beta_0 + \beta_1 X, \sigma_\epsilon^2)$$` ] <img src="05-slr-foundation_files/figure-html/unnamed-chunk-3-1.png" style="display: block; margin: auto;" /> --- class: middle .eq[ `$$Y|X \sim N(\beta_0 + \beta_1 X, \sigma_\epsilon^2)$$` ] <img src="05-slr-foundation_files/figure-html/unnamed-chunk-4-1.png" style="display: block; margin: auto;" /> --- ## Regression standard error Once we fit the model, we can use the residuals to calculate the .vocab[regression standard error] .alert[ `$$\hat{\sigma}_\epsilon = \sqrt{\frac{\sum_\limits{i=1}^n(y_i - \hat{y}_i)^2}{n-2}} = \sqrt{\frac{\sum_\limits{i=1}^ne_i^2}{n-2}}$$` ] --- ## Standard error of `\(\hat{\beta}_1\)` .eq[ `$$SE_{\hat{\beta}_1} = \hat{\sigma}_\epsilon\sqrt{\frac{1}{(n-1)s_X^2}}$$` ] --- class: middle <img src="05-slr-foundation_files/figure-html/unnamed-chunk-5-1.png" style="display: block; margin: auto;" />