Simple Linear Regression and Housing Price Prediction, MAT 240 Module 3 – Study Notes
offline

TL;DR

Simple linear regression lets you predict one variable (listing price) from another (square footage) by fitting a straight line to your data. The correlation coefficient r tells you how tightly the points cluster around that line, while R-squared tells you how much of the variation in price your model explains. For the Pacific region sample, square footage explains about 41% of the variation in listing price, and each additional square foot adds roughly $118 to the predicted price.


Difficulty: Introductory to Intermediate

Prerequisites: Basic descriptive statistics (mean, median, standard deviation). Familiarity with scatterplots and the coordinate plane.


Big Picture

This module sits at the heart of MAT 240 Applied Statistics: you are moving from describing data (Module 2, descriptive statistics) to modelling relationships between variables and making predictions. Simple linear regression is the foundational predictive technique in statistics, and almost every more advanced method (multiple regression, logistic regression, time-series models) builds directly on the concepts here. You should already be comfortable computing means, medians, and standard deviations, and you should know how to read a scatterplot. If those feel shaky, revisit Module 2 before continuing.


Key Terms

Simple linear regression

A statistical method that models the relationship between two quantitative variables by fitting a straight line (the "least-squares" line) to observed data. Think of it as drawing the single best straight line through a cloud of points on a scatterplot.

Regression equation (y = mx + b)

The equation of the best-fit line, where y is the predicted value of the response variable, x is the value of the explanatory variable, m is the slope, and b is the y-intercept. In simple terms, this is the formula you plug numbers into to make predictions.

Explanatory variable (independent variable, predictor, X)

The variable you use to predict or explain the other. In the housing example, this is square footage.

Response variable (dependent variable, outcome, Y)

The variable you are trying to predict. In the housing example, this is listing price.

Slope (m)

The amount the predicted Y changes for every one-unit increase in X. In simple terms, it is the rate of change, the "per unit" effect. A slope of 118.44 means each extra square foot adds $118.44 to the predicted price.

Y-intercept (b)

The predicted value of Y when X equals zero. It anchors the line on the Y axis. Sometimes it has a real-world meaning (e.g. the baseline land value before any house is built), and sometimes it does not make practical sense (e.g. a house with zero square feet).

Correlation coefficient (r)

A number between -1 and +1 that measures the strength and direction of the linear relationship between two variables. Values near +1 or -1 indicate a strong linear pattern; values near 0 indicate little or no linear pattern. Think of it as a score for how closely the data points follow a straight line.

Coefficient of determination (R-squared, r²)

The square of the correlation coefficient. It tells you the proportion (percentage) of the variation in Y that is explained by the linear relationship with X. An R² of 0.41 means 41% of the variation in listing price is explained by square footage, and 59% is explained by other factors.

Scatterplot

A graph that plots individual data points as dots, with one variable on the X axis and another on the Y axis. It is the first step in regression analysis because it lets you visually check whether a linear model is reasonable.

Interpolation

Using your regression equation to predict Y for an X value that falls within the range of your observed data. These predictions tend to be more reliable.

Extrapolation

Using your regression equation to predict Y for an X value that falls outside the range of your observed data. These predictions are riskier because the linear relationship may not hold beyond the data you actually collected.


Core Content

Descriptive Statistics for the Sample

  • Before building a regression model, summarise both variables with standard descriptive measures.

  • For the Pacific region random sample in this analysis:

    • Mean price: $391,187; mean square footage: 1,628 sqft

    • Median price: $391,300; median square footage: 1,620 sqft

    • Standard deviation of price: $50,144.53; standard deviation of square footage: 272.23 sqft

  • The mean and median are very close for both variables, which suggests the distributions are roughly symmetric (no extreme skew).

Building the Regression Equation

  • Plot your data as a scatterplot first: X axis = square footage, Y axis = listing price.

  • Fit a trendline (least-squares line) to the scatterplot. In Excel, this means adding a trendline and selecting "display equation on chart."

  • The resulting equation for this data: y = 118.44x + 198,391.

  • This equation is your prediction tool. For any given square footage, plug it in as x and solve for y to get the predicted listing price.

Interpreting the Correlation Coefficient (r)

  • r measures both the strength and the direction of the linear relationship.

  • Direction: positive r means as X increases, Y tends to increase (upward trend). Negative r means as X increases, Y tends to decrease.

  • Strength benchmarks (approximate, context-dependent):

    • |r| < 0.30: weak

    • 0.30 ≤ |r| < 0.50: moderate

    • 0.50 ≤ |r| < 0.70: moderately strong

    • |r| ≥ 0.70: strong

  • For this analysis, r = 0.643, which is positive and moderately strong. Square footage and listing price move together, but with considerable scatter.

  • In Excel, r is calculated using =CORREL(X range, Y range).

Interpreting R-Squared (r²)

  • R² = r × r. For this analysis, R² = 0.413 (about 41%).

  • Interpretation: 41% of the variation in listing price is explained by the variation in square footage. The remaining 59% is due to other factors (location, condition, number of bedrooms, market conditions, etc.).

  • In Excel, R² is calculated using =RSQ(Y range, X range).

  • R² is always between 0 and 1. Higher is better in terms of explanatory power, but a "good" R² depends entirely on the field and context.

Interpreting the Slope

  • Slope = 118.44. For every additional square foot, the predicted listing price increases by $118.44.

  • The slope is the most practically useful number in the equation. It directly answers: "How much more should I expect to pay per square foot?"

  • Always state the slope with its units: dollars per square foot, in this case.

Interpreting the Y-Intercept

  • Y-intercept = 198,391. When square footage is zero, the model predicts a listing price of $198,391.

  • One interpretation: this represents the baseline value of the land itself, before any structure is built.

  • Be cautious: the y-intercept often falls outside the range of the data (no house in the sample has zero square feet), so its practical meaning may be limited.

Making Predictions and the Limits of the Model

  • To predict a price, substitute the square footage into the equation. Example: a 100 sqft home would predict y = 118.44(100) + 198,391 = $210,235.

  • The model is most reliable for predictions within the range of the observed data (interpolation). For this sample, that range is approximately 1,101 to 2,082 square feet.

  • Predictions outside that range (extrapolation) should be treated with caution. The linear relationship may not hold for very small or very large homes.

Comparing Regional and National Data

  • The Pacific region homes in this sample are generally smaller than the national average across all summary statistics (mean, standard deviation, Q1, median, Q3, and maximum square footage).

  • Regional differences matter: a regression model built on one region's data may not generalise well to another region. Always check whether your sample is representative of the population you want to predict for.


Formulas

Regression equation (general form)

y = mx + b

Where y = predicted response, m = slope, x = explanatory variable value, b = y-intercept.

This analysis

y = 118.44x + 198,391

Correlation coefficient

r = CORREL(X values, Y values) in Excel. Ranges from -1 to +1.

Coefficient of determination

r² = RSQ(Y values, X values) in Excel. Equivalently, r² = r × r. Ranges from 0 to 1.

Prediction example

For a home with 1,500 sqft: y = 118.44(1,500) + 198,391 = 177,660 + 198,391 = $376,051.


Real-World Applications

Real estate companies use regression models exactly like this one to set competitive listing prices based on property features. A slope of $118.44 per square foot gives agents a quick rule of thumb for pricing homes in the Pacific region. More broadly, simple linear regression is the starting point for predictive modelling in fields from finance (predicting stock returns from market factors) to engineering (predicting material strength from temperature) to medicine (predicting blood pressure from age).


Common Misconceptions

  • Students often think a high r means that X causes Y. It does not. Correlation measures association, not causation. Square footage is associated with higher prices, but the regression alone cannot prove that adding square footage causes the price to rise.

  • Students often confuse r and R². r = 0.643 measures the strength and direction of the linear relationship. R² = 0.413 measures the proportion of variance explained. They answer different questions.

  • Students sometimes treat the y-intercept as a meaningful prediction. A predicted price of $198,391 for a home with zero square feet is a mathematical artefact of the line, not a real-world prediction. The intercept is outside the range of observed data.

  • Students often extrapolate freely beyond the data range and trust those predictions equally. A prediction for a 5,000 sqft home using a model built on 1,101 to 2,082 sqft data is unreliable. The relationship may curve, flatten, or behave differently outside the observed range.


Why It Matters / Exam Flags

  • ⚠️ You will almost certainly be asked to interpret a slope in context. Practice saying it in a full sentence with units: "For every one-unit increase in [X], the predicted [Y] increases by [slope] [units]."

  • ⚠️ Interpreting R² is a favourite exam question. Memorise the template: "[R² × 100]% of the variation in [Y] is explained by the variation in [X]."

  • ⚠️ Know the difference between interpolation and extrapolation and when each is appropriate. If an exam gives you a regression equation and asks you to predict for a value outside the data range, flag it as extrapolation and note the reduced reliability.

  • ⚠️ Be able to compute r from R² (take the square root, then assign the sign based on the slope direction) and R² from r (square it).

  • ⚠️ Know which Excel functions to use: =CORREL() for r, =RSQ() for R², trendline for the regression equation.


Quick Self-Test

  1. True or false: An r value of -0.85 indicates a weaker linear relationship than an r value of +0.60.
    Answer: False. The strength is determined by the absolute value. |-0.85| = 0.85, which is stronger than |+0.60| = 0.60.

  1. Fill in the blank: If R² = 0.413, then ___% of the variation in Y is explained by X.
    Answer: 41.3%.

  1. True or false: The y-intercept always has a meaningful real-world interpretation.
    Answer: False. When X = 0 falls outside the range of observed data, the intercept is a mathematical artefact.

  1. Fill in the blank: Using a regression equation to predict Y for an X value outside the observed data range is called ___.
    Answer: Extrapolation.

  1. True or false: If the slope of a regression line is positive, the correlation coefficient r must also be positive.
    Answer: True. The slope and r always share the same sign.


Practice Q&A

Q: A regression equation for predicting home price from square footage is y = 85.50x + 150,000. Interpret the slope in context.

A: For every additional square foot of living space, the predicted listing price increases by $85.50.

Q: Using the equation y = 118.44x + 198,391, predict the listing price for a home with 1,800 square feet.

A: y = 118.44(1,800) + 198,391 = 213,192 + 198,391 = $411,583.

Q: A student computes r = 0.643 and then reports that square footage explains 64.3% of the variation in price. What is their mistake?

A: They confused r with R². The proportion of variance explained is R² = (0.643)² = 0.413, so square footage explains about 41.3% of the variation, not 64.3%.

Q: The data used to build a regression model has square footage values ranging from 1,101 to 2,082. A colleague asks you to predict the price of a 3,500 sqft home using the model. What should you say?

A: This would be extrapolation, because 3,500 is well outside the observed data range (1,101 to 2,082). The prediction is unreliable because the linear relationship may not hold at that size.

Q: If R² = 0.75 and the scatterplot shows a positive trend, what is the value of r?

A: r = √0.75 ≈ 0.866. The positive sign comes from the positive trend in the scatterplot.


Connections to Other Topics

This connects directly to Module 2 (descriptive statistics), which provided the summary measures (mean, median, standard deviation) you need before fitting a regression. It also sets the stage for multiple regression, where you would add more explanatory variables (number of bedrooms, lot size, neighbourhood) to improve R² beyond 41%. The concept of R² as "variance explained" recurs throughout inferential statistics and hypothesis testing: when you later test whether the slope is statistically significant, you are asking whether the relationship captured by r could have arisen by chance.


Related Terms / Search Tags

Simple linear regression, least-squares regression, best-fit line, trendline, regression equation, y = mx + b, slope, y-intercept, correlation coefficient, Pearson r, r value, R-squared, coefficient of determination, r², scatterplot, scatter diagram, explanatory variable, independent variable, predictor, response variable, dependent variable, outcome variable, interpolation, extrapolation, residuals, variance explained, housing price prediction, MAT 240, applied statistics, SNHU, D.M. Pan Real Estate, Pacific region housing data