Docsity

Linear Regression & Prediction Study Notes | Statistics PDF, Summaries of Mathematics

Toggle sidebar
bg1
LINEAR REGRESSION & PREDICTION
Equations • Residuals • Solved Examples | Study Notes for Statistics Students
1. Introduction to Linear Regression
Linear regression is a statistical method that models the relationship between two numerical variables using a
straight line. It lets us predict the value of one variable based on the value of another.
Why it's useful: Regression turns a general trend into a precise, usable equation — instead of just knowing two
variables are related, we can estimate an actual predicted value.
Real-world applications: Predicting house prices from square footage, estimating sales from advertising spend,
forecasting exam scores from hours studied, and estimating crop yield from rainfall.
2. Variables in Regression
Regression always involves two roles: one variable is used to make the prediction, and the other is the value being
predicted.
Term Also Called Example
Independent variable (x) Predictor variable Hours studied
Dependent variable (y) Response variable Exam score
In short: x is the input we already know; y (or ŷ) is the output we are trying to predict or explain. The independent variable is
plotted on the horizontal axis, and the dependent variable on the vertical axis.
More Examples
• Predicting rent price (y) from apartment size (x).
• Predicting fuel consumption (y) from driving speed (x).
• Predicting plant height (y) from amount of sunlight (x).
Page 1 of 5 | Linear Regression & Prediction: Study Notes
pf3
pf4
pf5

Partial preview of the text

Download Linear Regression & Prediction Study Notes | Statistics PDF and more Summaries Mathematics in PDF only on Docsity!

LINEAR REGRESSION & PREDICTION

Equations • Residuals • Solved Examples | Study Notes for Statistics Students

1. Introduction to Linear Regression

Linear regression is a statistical method that models the relationship between two numerical variables using a straight line. It lets us predict the value of one variable based on the value of another. Why it's useful: Regression turns a general trend into a precise, usable equation — instead of just knowing two variables are related, we can estimate an actual predicted value. Real-world applications: Predicting house prices from square footage, estimating sales from advertising spend, forecasting exam scores from hours studied, and estimating crop yield from rainfall.

2. Variables in Regression

Regression always involves two roles: one variable is used to make the prediction, and the other is the value being predicted. Term Also Called Example

Independent variable (x) Predictor variable Hours studied

Dependent variable (y) Response variable Exam score

In short: x is the input we already know; y (or ŷ) is the output we are trying to predict or explain. The independent variable is plotted on the horizontal axis, and the dependent variable on the vertical axis.

More Examples

  • Predicting rent price (y) from apartment size (x).
  • Predicting fuel consumption (y) from driving speed (x).
  • Predicting plant height (y) from amount of sunlight (x).

3. The Linear Regression Equation Linear regression fits a straight line through the data using this equation: ŷ = a + bx Symbol Meaning

ŷ (y-hat) The predicted value of the dependent variable

a The intercept — predicted value of ŷ when x = 0

b The slope — change in ŷ for each 1-unit increase in x

x The independent variable (the known input)

4. Understanding the Slope The slope (b) tells us how much ŷ changes for every 1-unit increase in x — it controls both the direction and the steepness of the line.

Slope Meaning

Positive (b > 0) ŷ increases as x increases

Negative (b < 0) ŷ decreases as x increases

Zero (b ≈ 0) x has little or no effect on ŷ

5. Understanding the Intercept The intercept (a) is the predicted value of ŷ when x = 0. It anchors the regression line on the y-axis. When it has practical meaning: If x = 0 is a realistic, observable situation (e.g. 0 hours of studying), the intercept can be meaningfully interpreted. When it may not make sense: If x = 0 falls far outside the range of the observed data, or is not physically possible (e.g. a house with 0 square feet), the intercept is just a mathematical anchor point, not a real-world prediction. Quick example: In ŷ = 10 + 2.5x (x = hours studied), the intercept a = 10 makes sense — it's the predicted score for a student who studies 0 hours, a realistic scenario.

9. Correlation and Regression

Aspect Correlation Regression

Purpose Measures strength & direction of a relationship Models the relationship to make predictions

Output A single number, r An equation, ŷ = a + bx

Prediction Cannot make predictions Can predict ŷ for a given x

Variables No distinction between variables Distinguishes independent (x) / dependent (y)

Interpretation Sign and size show direction & strength Slope & intercept describe the relationship precisely

10. Coefficient of Determination (r²) r² (r-squared) tells us the percentage of variation in y that is explained by x. It ranges from 0 to 1 (or 0% to 100%). Example: If r² = 0.81, then 81% of the variation in y is explained by x through the regression line; the remaining 19% is due to other factors or random variation. A higher r² means a better-fitting model. 11. Solved Examples

Example 1 — Making a Prediction

Given: ŷ = 10 + 2.5x (x = hours studied, ŷ = predicted quiz score). Predict the score for x = 6 hours. Formula: ŷ = a + bx. Substitution: ŷ = 10 + 2.5(6). Calculation: ŷ = 10 + 15 = 25. Interpretation: A student who studies 6 hours is predicted to score 25 on the quiz.

Example 2 — Calculating a Residual

Given: The student from Example 1 (x = 6) actually scored y = 29. Predicted ŷ = 25. Formula: Residual = y − ŷ. Substitution: Residual = 29 − 25. Calculation: Residual = +. Interpretation: The actual score was 4 points higher than the model predicted (a positive residual).

Example 3 — Interpreting Slope, Intercept & r²

Given: ŷ = 10 + 2.5x, with r² = 0.81. Slope (b = 2.5): Each extra hour of studying is associated with a 2.5-point increase in predicted quiz score. Intercept (a = 10): A student who studies 0 hours is predicted to score 10. r² = 0.81: 81% of the variation in quiz scores is explained by hours studied.

Try It Yourself

A regression equation for advertising spend (x, $1000s) and sales (ŷ, $1000s) is ŷ = 5 + 3x. Predict sales for x = 4, then find the residual if actual sales were y = 20. Step 1: ŷ = 5 + 3(4) = 5 + 12 = 17 (predicted sales = $17,000). Step 2: Residual = y − ŷ = 20 − 17 = +3 — actual sales were $3,000 higher than predicted.

12. Common Student Mistakes - Confusing correlation with regression: Correlation (r) measures strength; regression gives an equation for predicting values. - Predicting far outside the observed data range (extrapolation) — regression equations are only reliable within the range of x used to build them. - Ignoring residual patterns: A curved or funnel-shaped residual plot means a straight line may not be the best model. - Misinterpreting the slope: The slope describes an association , not automatically a cause-and-effect relationship. - Misinterpreting the intercept: It is not always practically meaningful, especially when x = 0 is unrealistic. - Confusing r with r²: r shows direction and strength (−1 to +1); r² shows percentage of variation explained (0 to 1). 13. Exam Tips & Quick Revision Summary

Key Formulas & Concepts

Concept Key Point

Regression equation ŷ = a + bx

Residual Residual = y − ŷ

Meaning of slope (b) Change in ŷ for each 1-unit increase in x

Meaning of intercept (a) Predicted ŷ when x = 0

Meaning of r² % of variation in y explained by x

Key Symbols

x y ŷ a b r r² Independent variable Actual value Predicted value Intercept Slope Correlation coefficient

Variation explained

8-Step Problem-Solving Checklist

  • 1. Identify x and y. 2. Write the regression equation. 3. Substitute the correct x value. 4. Calculate ŷ.
  • 5. Compare predicted and actual values if needed. 6. Calculate the residual. 7. Interpret the result in context. 8. Check whether the prediction is reasonable (within the data range).

Self-Test

    1. Given ŷ = 8 + 1.5x, what is the predicted value when x = 10?
    1. If actual y = 25 and predicted ŷ = 22, what is the residual, and what does it mean?
    1. If r² = 0.64, what percentage of the variation in y is explained by x? Answer key: (1) ŷ = 8 + 1.5(10) = 23. (2) Residual = 25 − 22 = +3 — the actual value was 3 units higher than predicted. (3) r² = 0.64 means 64% of the variation in y is explained by x.

Final Reminders

  • A regression line minimizes the sum of squared residuals (the “least squares” method).
  • Always check the residual plot before trusting a linear model's predictions.
  • A high r² means a good fit to the observed data, but it still does not prove causation. Page 5 of 5 | Linear Regression & Prediction: Study Notes — End of Notes