What is Simple Linear Regression?

Simple linear regression models how a response \(Y\) changes with a predictor \(X\).

Examples: - Cars: MPG vs weight (mtcars dataset in R) - Finance: stock return vs market return (simulated CAPM-style data)

Model (Math)

\[ Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i \]

Assumptions (common): \[ E(\varepsilon_i)=0, \qquad Var(\varepsilon_i)=\sigma^2 \]

R Code to Fit Models

#Car example: Mpg vs weight
fit_cars <- lm(mpg ~ wt, data = mtcars)


#Finance example: simulated returns
set.seed(42)
market <- rnorm(120, 0.0005, 0.01)
stock <- 0.0002 + 1.2*market + rnorm(120, 0, 0.012)

fit_fin <- lm(stock ~ market)

ggplot #1: Car MPG vs Weight

Finance Interpretation

Let: - \(X\) = market daily return
- \(Y\) = stock daily return

Interpretation: - \(\beta_1\) = “beta” (market sensitivity) - \(\beta_0\) = “alpha” (return not explained by market)

ggplot #2: Stock vs Market

Least Squares + 3D Plotly

OLS minimizes:

\[ S(\beta_0,\beta_1)=\sum_{i=1}^{n}\left(Y_i-(\beta_0+\beta_1X_i)\right)^2 \]

Inference on the Slope

Test:

\[ H_0:\beta_1 = 0 \quad \text{vs} \quad H_a:\beta_1 \neq 0 \]

Statistic: \[ t = \frac{\hat{\beta}_1}{SE(\hat{\beta}_1)} \]

  • A small p-value provides evidence that \(X\) is linearly related to \(Y\)
  • A large p-value suggests there is not enough evidence of a linear relationship