Sub topic 1
Starting Point: Simple Linear Regression in Brief
Simple linear regression models the relationship between one dependent variable and one independent variable. The dependent variable is the outcome we want to explain or predict. The independent variable is the variable used as an explanatory input.
This chapter assumes that you know descriptive statistics, probability distributions, hypothesis tests, p-values, and the basic meaning of a slope and intercept. It also assumes that you can read a regression equation and distinguish a sample statistic from a population parameter.
Prerequisites
You should be comfortable with:
- Means, variances, covariance, and correlation.
- The null hypothesis, alternative hypothesis, test statistic, and p-value.
- The difference between a population parameter and a sample estimate.
- The interpretation of a simple regression slope.
The simple regression model
The population model is:
Y_i = β_0 + β_1 X_i + ε_i
Here:
Y_iis the dependent variable for observationi.X_iis the independent variable.β_0is the population intercept.β_1is the population slope.ε_iis the error term, which contains influences onY_inot represented byX_i.
The fitted sample equation is:
Ŷ_i = b_0 + b_1 X_i
The symbols b_0 and b_1 estimate the unknown population parameters β_0 and β_1. The fitted value Ŷ_i is the model's prediction for observation i. The residual is the difference between the observed and fitted values:
e_i = Y_i - Ŷ_i
Ordinary least squares, or OLS, chooses b_0 and b_1 to minimize the sum of squared residuals. Squaring prevents positive and negative errors from canceling and gives greater weight to large errors.
import numpy as np
import statsmodels.api as sm
x = np.array([1, 2, 3, 4, 5])
y = np.array([2, 4, 5, 8, 9])
X = sm.add_constant(x)
model = sm.OLS(y, X).fit()
print("intercept:", model.params[0])
print("slope:", model.params[1])
print("R-squared:", model.rsquared)Interpreting the coefficients
The intercept b_0 is the predicted value of Y when X equals zero. This interpretation is meaningful only when X = 0 is possible and relevant to the data.
The slope b_1 is the estimated change in the predicted value of Y for a one-unit increase in X. For example, if a regression estimates the relation between portfolio return and market return, a slope of 1.2 means that the portfolio's expected return changes by 1.2 percentage points for each one-percentage-point change in the market return, within the model and sample context.
The slope describes association. By itself, it does not prove that changing X causes a change in Y. A third variable may affect both, or the direction of influence may be unclear.
Visual model and residuals
A scatter plot shows the observed pairs (X_i, Y_i). The fitted regression line summarizes the average pattern. Each vertical distance from an observation to the line is a residual.
What makes OLS useful
Under the standard assumptions, OLS estimates have useful statistical properties. The expected value of the error is zero, the error is unrelated to the explanatory variable, the error variance is constant, and observations are appropriately independent. For exact small-sample t-tests, normal errors are also commonly assumed.
Violations matter because they can change the reliability of coefficient estimates, standard errors, or both. A slope can still describe a pattern while its usual p-value is misleading. Later chapters extend this review to multiple explanatory variables and examine these failures in detail.
| Quantity | Meaning |
|---|---|
| Slope | Estimated change in predicted `Y` for a one-unit increase in `X` |
| Intercept | Predicted `Y` when `X` equals zero |
| Residual | Observed `Y` minus fitted `Y` |
| R-squared | Fraction of sample variation in `Y` explained by the fitted line |
Bridge to multiple regression
Simple regression has one explanatory variable. Multiple regression adds other variables so that the coefficient on one variable can describe its relationship with Y while holding the included variables constant. That “holding constant” interpretation is the central idea of a partial slope.
The simple model remains the foundation. Its intercept, slope, fitted values, residuals, OLS criterion, and assumptions all carry forward. The main challenge is deciding whether the added variables improve the model or introduce problems such as multicollinearity, omitted-variable bias, or misspecification.
Exercise
A fitted model is Ŷ = 4 + 3X. What does the slope mean, and what is the predicted value when X = 2?
Show answer
The slope means that predicted Y increases by 3 units for each one-unit increase in X. When X = 2, the predicted value is 4 + 3(2) = 10.