Main Ideas of Linear Regression
1. Introduction and fundamentals of linear regression
Linear regression is a statistical modeling technique used to describe the linear relationship between a dependent variable and one or more independent variables by fitting a straight line to the data to facilitate predictions. The core methodology discussed here for finding this best-fit line is the Ordinary Least Squares (OLS) method 2.
1.1 Components of a simple linear regression model
A simple linear regression model specifically utilizes only one predictor variable to model the target variable. The general structure involves several key components 3:
- Target/Response/Dependent Variable (Y): This is the variable we aim to predict or explain.
- Input/Predictor/Independent Variable (X1): This is the variable used to make the prediction.
- Intercept (β0): This is the value of the target variable when the predictor variable is zero.
- Slope Coefficient (β1): This dictates the magnitude and direction of the relationship between X1 and Y.
- Stochastic Component or Error Term (ϵ): This represents the inherent randomness or variation not explained by the model.
The conceptual relationship is represented by the linear equation:
Y=β0+β1X1+ϵ

1.2 The goal: Fitting a line to data
The fundamental goal when introducing linear regression is "fitting a line with data". This process involves finding the specific line that best summarizes the observed trend in the relationship between the predictor and the response variables.
When visualizing this, data points are scattered based on their observed values for the predictor (e.g., Height on the x-axis) and the response (e.g., Weight on the y-axis). The fitted regression line attempts to minimize the overall distance between itself and all observed data points5.
Example: In a Height versus Weight analysis, the data points represent individual observations, and the goal is to draw a line that captures the general positive correlation observed.

1.3 The Ordinary Least Squares (OLS) iterative fitting process
The OLS method determines the best-fit line through an iterative process focused on minimizing the total error associated with the model. This process involves several systematic steps to achieve the optimal line rotation 4 8.
Step 1: Initial visualization and line drawing
The initial step involves plotting the data points (scatter plot) and drawing an initial line passing through them 6.

Step 2: Measuring and summing squared residuals
Once an initial line is established, the model quantifies the error. This involves measuring the vertical distance from each individual data point to the current line; this distance is termed the residual. Each residual is then squared, and these squared distances are summed up to yield the Sum of Squared Residuals (SSR). Minimizing this total sum is the objective of OLS.
Tip: The residual (ei) for an observation i is defined as the difference between the observed value (yi) and the predicted value (y^i): ei=yi−y^i 7.

Step 3 & 4: Iteration and re-evaluation
The next phase involves slightly rotating the initial line and then repeating Step 2: measuring the residuals, squaring them, and calculating the new SSR 9.

This rotation and re-computation are performed multiple times to explore various line orientations and their resulting error measurements 10.

Step 5: Identifying the minimum error
After testing several different rotations, the Sum of Squared Residuals is plotted against the corresponding rotation applied. The goal is to locate the rotation angle that corresponds to the absolute lowest value for the SSR 11.

The rotation that yields the least sum of squares is the one used to define the line of best fit. This determination of the optimal line based on the minimum SSR is precisely why the fitting technique is called the Least Squares Method 12 13.

Tip: Once the least squares line is found, further analysis typically involves calculating the R-squared value (Goodness of Fit) and performing hypothesis tests (e.g., calculating the p-value for the test of significance) 1.
2. Calculating and interpreting R-square and significance testing
This section details the calculation and interpretation of R-square (R2) as the measure of goodness of fit in regression analysis, which quantifies the reduction in variance achieved by the model, and introduces the concept of the p-value for testing statistical significance.
2.1 Quantifying variance reduction using R-square
R-square, or the coefficient of determination, measures how well the regression model fits the data by quantifying the proportion of variance in the dependent variable that is predictable from the independent variable(s). The process involves comparing the variability of the data points around the mean versus the variability around the fitted regression line 14.
The core concept involves dimensionality reduction to isolate the variance components. If we start with a bivariate plot (e.g., Height vs. Weight), we first analyze the total variation in the dependent variable (Weight) by projecting the data onto the vertical axis (Weight axis) to find the mean weight.

Next, the average weight (mean weight) is computed for all observations plotted along the vertical axis.

The total variability remaining when only the mean is known is quantified by calculating the Sum of Squares around the Mean, denoted as SS(mean): SS(mean)=∑(yi−yˉ)2 This calculation measures the distance of each data point from the mean, squares these distances, and sums them up . This value, SS(mean), represents the raw variation in the dependent variable before the model is applied 17.
2.2 Calculating the Sum of Squares for the Fit
Once the regression line (line of best fit) is established, we calculate the error or residual variance—the distance between the actual data points and the fitted line.

The variation around the least squares regression line is called SS(fit) . This represents the variation around the least squares line after accounting for the independent variable (Height) 19 20.

When height is taken into account, the remaining variation in weight is reduced compared to the variation around the simple mean. This reduction signifies that some of the weight variability is explained by height (taller people tend to be heavier) 21.
Example: In the Height vs. Weight example:
2.3 Interpreting the R-square Value
R-square is calculated as the proportion of variance explained, derived from the reduction in variability achieved by the model: R2=Variance(mean)Variance(mean)−Variance(fit) This formula, often expressed using Sums of Squares as SS(mean)SS(mean)−SS(fit) or 1−SS(mean)SS(fit), yields the proportion of variance in the dependent variable explained by the independent variable(s) .
In the running example, the calculated R2 was 0.648, meaning that 64.8% of the variation in weight is explained by height . This demonstrates a 64.8% reduction in the variation of weight once height is included in the model 22 23.

The interpretation of the boundaries of R2 helps contextualize the fit:
- Perfect Fit (R2=1 or 100%): If Variance(fit)=0, the regression line passes perfectly through all data points. Height explains 100% of the variation in weight .

- No Fit (R2=0): If Variance(mean)=Variance(fit), the model explains none of the variation. Knowing the height provides no useful information about the weight 26.

Tip: Always remember that R2 is interpreted in terms of variance explained, not the strength of the slope itself. A high R2 suggests the model accounts for a large portion of the total data spread 25.
2.4 Testing for significance (p-value)
While R2 measures how much variance is explained, the next crucial step is determining if this relationship is statistically significant, which is done by calculating the p-value (Test of Significance) .
Tip: Calculating the p-value involves rigorous statistical testing that confirms whether the observed relationship is likely due to chance or reflects a true underlying relationship in the population .
This significance testing will be demonstrated in the actual application phase of the analysis 27.
Common mistakes to avoid
- Review all topics thoroughly before exams
- Pay attention to formulas and key definitions
- Practice with examples provided in each section
- Don't memorize without understanding the underlying concepts
© 2026 Maeve. All rights reserved. This content is protected by copyright.