🏠 Home
Correlation & Regression
Unit IV · Lecture 33

BDS113 — Introduction to Statistics

Unit IV Review & Problem-Solving Session

Formula Sheet · Concept Map · Worked Exam-Style Problems · Mixed Practice · Common Mistakes


Unit IV · Lecture 33 of 40 · B.Sc. Data Science, 1st Year, Semester II

Correlation & Regression
Unit IV · Lecture 33

The Review Journey


📋
Complete Formula Sheet
Every formula from Lectures 24–32 in one place — curve fitting, correlation, regression
🗺️
Concept Map: How Everything Connects
Visual overview · When to use what · Decision flowchart
✏️
Worked Exam-Style Problems (6 Full Problems)
Click to reveal solutions · Step-by-step · Covering all topics
⚠️
Common Mistakes & Exam Tips + Comprehensive Quiz
Pitfalls to avoid · Time management · 15-question mixed quiz
Correlation & Regression
Unit IV · Lecture 33

📋 Formula Sheet — Curve Fitting (Lectures 24–26)


Straight Line: ŷ = a + bx

b = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²]   |   a = ȳ − bx̄

Parabola: ŷ = a + bx + cx² — Normal Equations

Σy = na + bΣx + cΣx²  |  Σxy = aΣx + bΣx² + cΣx³  |  Σx²y = aΣx² + bΣx³ + cΣx⁴

Exponential: ŷ = abˣ

Log transform: log y = log a + x·log b → Y = A + Bx  |  a = 10ᴬ, b = 10ᴮ

Natural Exponential: ŷ = aeᵇˣ

Log transform: ln y = ln a + bx → Y = A + bx  |  a = eᴬ

Power Curve: ŷ = axᵇ

Log transform: log y = log a + b·log x → Y = A + bX  |  a = 10ᴬ

Key Principle (All Curve Fitting)

Minimise S = Σ(yᵢ − ŷᵢ)² — the Principle of Least Squares
Correlation & Regression
Unit IV · Lecture 33

📋 Formula Sheet — Correlation (Lectures 27–30)


Pearson's r (Simple Correlation)

r = [nΣxy − ΣxΣy] / √{[nΣx² − (Σx)²] · [nΣy² − (Σy)²]}

Alternative: r from Regression Coefficients

r = √(bᵧₓ · bₓᵧ)   |   r² = bᵧₓ · bₓᵧ

Coefficient of Determination

r² = (Explained variation) / (Total variation) = 1 − (Unexplained / Total)

Spearman's Rank Correlation

rₛ = 1 − [6Σdᵢ²] / [n(n²−1)]   where dᵢ = R(xᵢ) − R(yᵢ)

Partial Correlation (controlling for X₃)

r₁₂·₃ = (r₁₂ − r₁₃·r₂₃) / √[(1−r₁₃²)(1−r₂₃²)]

Multiple Correlation

R²₁·₂₃ = (r₁₂² + r₁₃² − 2r₁₂r₁₃r₂₃) / (1 − r₂₃²)
Correlation & Regression
Unit IV · Lecture 33

📋 Formula Sheet — Regression (Lectures 31–32)


Regression of y on x: ŷ = a + bᵧₓx

bᵧₓ = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²] = r·Sᵧ/Sₓ  |  a = ȳ − bᵧₓx̄

Regression of x on y: x̂ = a' + bₓᵧy

bₓᵧ = [nΣxy − ΣxΣy] / [nΣy² − (Σy)²] = r·Sₓ/Sᵧ  |  a' = x̄ − bₓᵧȳ

Master Relationship

bᵧₓ · bₓᵧ = r²   |   Both lines pass through (x̄, ȳ)

Standard Error of Estimate

Sᵧₓ = Sᵧ · √(1 − r²)   |   Always Sᵧₓ ≤ Sᵧ

Angle Between Regression Lines

tan θ = |bᵧₓ − bₓᵧ| / |1 + bᵧₓ·bₓᵧ| = |bᵧₓ − bₓᵧ| / (1 + r²)

Critical Reminders

Correlation ≠ Causation  |  r = 0 ≠ Independence  |  Always plot first!  |  bᵧₓ ≠ 1/bₓᵧ
Correlation & Regression
Unit IV · Lecture 33

🗺️ Concept Map: Unit IV at a Glance


Part A: Curve Fitting

L24: Principle of Least Squares
→ ŷ = a + bx (straight line)
→ Normal equations: Σy=na+bΣx

L25: Fitting Polynomials
→ ŷ = a + bx + cx² (parabola)
→ 3 normal equations

L26: Exponential Curves
→ y = abˣ, y = aeᵇˣ, y = axᵇ
→ Linearise by logarithms

Part B: Correlation

L27: Bivariate Data & Scatter Plots
→ Direction, form, strength, outliers

L28: Pearson's r
→ Measures linear association
→ −1 ≤ r ≤ +1, unit-free

L29: Partial & Multiple Correlation
→ r₁₂·₃ controls for X₃
→ R₁·₂₃ = combined predictive power

L30: Spearman's rₛ
→ Rank-based, monotonic
→ rₛ = 1 − 6Σd²/[n(n²−1)]

Part C: Regression

L31: Simple Linear Regression
→ y on x: ŷ = a + bᵧₓx
→ x on y: x̂ = a' + bₓᵧy
→ Both pass through (x̄, ȳ)

L32: Coefficient of Regression
→ bᵧₓ · bₓᵧ = r²
→ Sᵧₓ = Sᵧ√(1−r²)
→ R² = r² (simple regression)

L33: This Review Session!


Central thread: All three parts use the Principle of Least Squares. Curve fitting finds the best equation. Correlation measures how strong the relationship is. Regression uses the equation for prediction.

Correlation & Regression
Unit IV · Lecture 33

🧭 Decision Flowchart: Which Method to Use?


1 What is your goal?
→ Find the best equation? → Go to Curve Fitting (Part A)
→ Measure how strongly two variables are related? → Go to Correlation (Part B)
→ Predict one variable from another? → Go to Regression (Part C)
A Curve Fitting — What shape?
→ Scatter plot looks linear → Fit y = a + bx (Lecture 24)
→ Scatter plot has one bend → Fit y = a + bx + cx² (Lecture 25)
→ Scatter plot shows exponential growth/decay → Fit y = abˣ or y = aeᵇˣ (Lecture 26)
→ Log-log plot is linear → Fit y = axᵇ (Lecture 26)
B Correlation — What kind of data?
→ Quantitative data, linear pattern → Pearson's r (Lecture 28)
→ Ordinal data OR non-linear monotonic → Spearman's rₛ (Lecture 30)
→ Three variables, want to control for one → Partial correlation r₁₂·₃ (Lecture 29)
→ Three variables, want combined prediction → Multiple correlation R (Lecture 29)
C Regression — Which direction?
→ Predict y from x → Use regression of y on x: ŷ = a + bᵧₓx (Lecture 31)
→ Predict x from y → Use regression of x on y: x̂ = a' + bₓᵧy (Lecture 31)
→ Assess prediction quality → Compute R² and Sᵧₓ (Lecture 32)
Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 1: Complete Regression Analysis


📝 Problem: Given x = 2,4,5,6,8 and y = 10,12,15,16,20, find: (a) r, (b) both regression equations, (c) R², (d) Sᵧₓ, (e) predict y when x = 7

▶ Click to reveal solution

Step 1: Compute the table

xyxyx²y²
210204100
4124816144
5157525225
6169636256
82016064400
25733991451125

(a) Pearson's r:

n=5, Σx=25, Σy=73, Σxy=399, Σx²=145, Σy²=1125
Numerator: 5(399) − 25(73) = 1995 − 1825 = 170
Denominator: √{[5(145)−625] · [5(1125)−5329]} = √{100 · 296} = √29600 = 172.05
r = 170/172.05 = 0.9881


(b) Regression of y on x:

bᵧₓ = 170/100 = 1.7,   a = 73/5 − 1.7(25/5) = 14.6 − 8.5 = 6.1
ŷ = 6.1 + 1.7x

Regression of x on y:

bₓᵧ = 170/296 = 0.5743,   a' = 5 − 0.5743(14.6) = 5 − 8.385 = −3.385
x̂ = −3.385 + 0.5743y


(c) R² = r² = 0.9881² = 0.9764 → 97.6% of variance explained

(d) Sᵧₓ: Sᵧ = √[1125/5 − 14.6²] = √[225−213.16] = √11.84 = 3.441. Sᵧₓ = 3.441√(1−0.9764) = 3.441(0.1536) = 0.529

(e) Prediction at x=7: ŷ = 6.1 + 1.7(7) = 6.1 + 11.9 = 18.0

Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 2: Exponential Curve Fitting


📝 Problem: Fit y = abˣ to x = 1,2,3,4,5 and y = 3,9,27,81,243. Find a, b, and predict y at x = 6.

▶ Click to reveal solution

Step 1: Transform — Y = log₁₀(y)

xyY = log yxYx²
130.47710.47711
290.95421.90844
3271.43144.29429
4811.90857.634016
52432.385611.928025
157.156826.241755

B = [5(26.2417) − 15(7.1568)] / [5(55) − 225] = [131.2085 − 107.352] / 50 = 23.8565/50 = 0.47713
A = 7.1568/5 − 0.47713(3) = 1.43136 − 1.43139 ≈ 0
a = 10⁰ = 1,   b = 10^0.47713 = 3

ŷ = 1 × 3ˣ = 3ˣ (perfect fit — the data is exactly 3ˣ!)
At x = 6: ŷ = 3⁶ = 729

Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 3: Spearman's rₛ with Ties


📝 Problem: Two judges rank 7 students. Compute Spearman's rₛ. Judge 1: 1,3,2,5,4,7,6. Judge 2: 2,1,3,5,4,6,7.

▶ Click to reveal solution
StudentR₁R₂d = R₁−R₂d²
A12−11
B31+24
C23−11
D5500
E4400
F76+11
G67−11
Σd² =8

rₛ = 1 − 6(8) / [7(49−1)] = 1 − 48/336 = 1 − 0.1429 = 0.8571

Interpretation: Strong positive agreement between the two judges' rankings.

Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 4: Partial & Multiple Correlation


📝 Problem: Given r₁₂ = 0.85, r₁₃ = 0.70, r₂₃ = 0.60. Find r₁₂·₃ and R₁·₂₃.

▶ Click to reveal solution

Partial correlation:

r₁₂·₃ = (0.85 − 0.70×0.60) / √[(1−0.49)(1−0.36)]
= (0.85 − 0.42) / √[0.51 × 0.64]
= 0.43 / √0.3264 = 0.43 / 0.5713 = 0.7526


Multiple correlation:

R²₁·₂₃ = (0.85² + 0.70² − 2(0.85)(0.70)(0.60)) / (1 − 0.60²)
= (0.7225 + 0.49 − 0.714) / (1 − 0.36)
= 0.4985 / 0.64 = 0.7789
R₁·₂₃ = √0.7789 = 0.8826


Interpretation: After controlling for X₃, the correlation drops from 0.85 to 0.75 — some confounding, but the relationship remains strong. Together, X₂ and X₃ explain 77.9% of the variance in X₁.

Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 5: From r to Regression (Shortcut Method)


📝 Problem: Given x̄ = 30, ȳ = 50, Sₓ = 5, Sᵧ = 8, r = 0.75. Find both regression equations, R², Sᵧₓ, and the angle between the lines.

▶ Click to reveal solution

Regression coefficients:

bᵧₓ = r·Sᵧ/Sₓ = 0.75 × 8/5 = 1.2
bₓᵧ = r·Sₓ/Sᵧ = 0.75 × 5/8 = 0.46875


Regression equations:

y on x: ŷ = ȳ − bᵧₓx̄ + bᵧₓx = 50 − 1.2(30) + 1.2x = 14 + 1.2x
x on y: x̂ = x̄ − bₓᵧȳ + bₓᵧy = 30 − 0.46875(50) + 0.46875y = 6.5625 + 0.46875y


Verification: bᵧₓ × bₓᵧ = 1.2 × 0.46875 = 0.5625 = r² = 0.75² = 0.5625 ✓


R² = r² = 0.5625 = 56.25%
Sᵧₓ = Sᵧ√(1−r²) = 8√(1−0.5625) = 8√0.4375 = 8(0.6614) = 5.29
tan θ = |1.2 − 0.46875| / (1 + 0.5625) = 0.73125 / 1.5625 = 0.468
θ = arctan(0.468) = 25.1°

Correlation & Regression
Unit IV · Lecture 33

✏️ Problem 6: Parabola Fitting


📝 Problem: Fit y = a + bx + cx² to x = 1,2,3,4,5 and y = 1,4,9,16,25. What do you notice?

▶ Click to reveal solution

These are perfect squares: y = x². Let's verify the parabola fit captures this.

xyxyx²yx²x³x⁴
1111111
248164816
39278192781
416642561664256
52512562525125625
155522597955225979

Normal equations:

55 = 5a + 15b + 55c  …(1)
225 = 15a + 55b + 225c  …(2)
979 = 55a + 225b + 979c  …(3)

Solving: a = 0, b = 0, c = 1

ŷ = x² — Perfect fit with SSE = 0!

This makes sense: the data was generated by y = x², and the parabola fit recovers this exactly.

Correlation & Regression
Unit IV · Lecture 33

⚠️ Common Mistakes to Avoid


Mistakes in Correlation

1. Using Pearson's r for non-linear data (use scatter plot first!)

2. Concluding causation from correlation

3. Confusing r = 0 with "no relationship" (only no linear relationship)

4. Forgetting that r has no units while regression coefficients do

5. Computing r² and calling it r (or vice versa)

Mistakes in Regression

1. Using the wrong regression line (y on x vs x on y)

2. Thinking bₓᵧ = 1/bᵧₓ (they are NOT reciprocals!)

3. Forgetting that both lines pass through (x̄, ȳ)

4. Extrapolating far beyond the data range

5. Confusing explained and unexplained variation

Mistakes in Curve Fitting

1. Taking log of zero or negative values in exponential fitting

2. Using wrong normal equations (check: j-th equation has Σxʲy on left)

3. Forgetting to transform back (a = 10ᴬ, not a = A)

4. Overfitting with too high a polynomial degree

5. Not checking: does the curve make sense for the data?


💬 Exam Tip: Always show your computation table (Σx, Σy, Σxy, Σx², Σy²). Even if you make an arithmetic error, you get partial credit for the correct method. Write the formula first, then substitute, then compute.
Correlation & Regression
Unit IV · Lecture 33

📝 Exam Tips for Unit IV


📊

Always Show Tables

Create computation tables with all columns. This earns method marks even if the final answer has an error.

✅

Verify Your Answers

Check: Σ residuals ≈ 0. Line passes through (x̄,ȳ). bᵧₓ × bₓᵧ = r². −1 ≤ r ≤ 1.

⏱️

Time Management

Curve fitting problems take longer (more sums). Correlation/regression are faster once you know the formulas.

🎯

Interpret Every Answer

Don't just give the number. Say what it means: "r = 0.85 means strong positive linear correlation."


📖 High-Frequency Exam Questions

1. Compute Pearson's r from a data table and interpret. (Almost every exam)
2. Find both regression equations from data or from given statistics (x̄, ȳ, Sₓ, Sᵧ, r). (Very common)
3. Compute Spearman's rₛ from ranked data. (Common)
4. Fit y = abˣ or y = axᵇ to given data. (Common)
5. State and explain properties of regression lines or correlation. (Theory question)
6. Given r₁₂, r₁₃, r₂₃, find partial or multiple correlation. (Occasional)
7. Given regression equation, make predictions and interpret coefficients. (Common)
8. Prove that both regression lines pass through (x̄, ȳ). (Occasional proof)

Correlation & Regression
Unit IV · Lecture 33

🧠 Comprehensive Quiz — Unit IV (15 Questions)


Q1: The least squares method minimises:

A) Σ|yᵢ − ŷᵢ|
B) Σ(yᵢ − ŷᵢ)²
C) max|yᵢ − ŷᵢ|
D) Σ(yᵢ − ȳ)²

Q2: To fit a second-degree polynomial, you need at least:

A) 2 data points
B) 3 data points
C) 4 data points
D) 5 data points

Q3: To fit y = abˣ, we transform by taking:

A) Square root of y
B) Logarithm of y
C) Logarithm of x
D) Reciprocal of y

Q4: If r = −0.9, then r² = ?

A) −0.81
B) 0.81
C) 0.90
D) −0.90

Q5: Spearman's rₛ = 1 − 6Σd²/[n(n²−1)]. If Σd² = 0, then rₛ = ?

A) 0
B) +1
C) −1
D) Undefined

Q6: The regression of y on x and x on y both pass through:

A) The origin
B) The point (x̄, ȳ)
C) The point (a, b)
D) Different points

Q7: bᵧₓ · bₓᵧ = ?

A) r
B) r²
C) 1
D) 2r

Q8: If r = 1, the two regression lines:

A) Coincide
B) Are perpendicular
C) Are parallel
D) Do not exist

Q9: For the power curve y = axᵇ, the linearised form is:

A) log y = log a + x·log b
B) log y = log a + b·log x
C) y = a + b·log x
D) ln y = ln a + bx

Q10: The standard error of estimate Sᵧₓ is related to Sᵧ by:

A) Sᵧₓ = Sᵧ / r
B) Sᵧₓ = Sᵧ · √(1 − r²)
C) Sᵧₓ = Sᵧ · r²
D) Sᵧₓ = Sᵧ + r

Q11: Partial correlation r₁₂·₃ measures:

A) Total correlation between X₁ and X₂
B) Correlation between X₁ and X₂ after removing X₃'s effect
C) Average of all three pairwise correlations
D) The correlation between X₃ and the residuals

Q12: Which is always true?

A) |r₁₂·₃| ≥ |r₁₂|
B) |r₁₂·₃| ≤ |r₁₂|
C) r₁₂·₃ = r₁₂
D) r₁₂·₃ = 0 always

Q13: Overfitting in polynomial regression means:

A) The polynomial degree is too low
B) The model captures noise rather than the true pattern
C) The SSE is very large
D) The data has too few points

Q14: Anscombe's Quartet shows that:

A) r is always 0.816
B) Identical summary statistics can come from very different datasets
C) Correlation always implies causation
D) Linear regression is always the best model

Q15: If bᵧₓ = 1.5 and bₓᵧ = 0.6, then r = ?

A) 2.1
B) 0.9
C) √(1.5 × 0.6) = √0.9 = 0.9487
D) 0.6/1.5 = 0.4
Correlation & Regression
Unit IV · Lecture 33

⚡ Quick-Reference: When to Use What


SituationMethodKey FormulaLecture
Data follows a straight lineFit y = a + bxNormal equations (2)L24
Data has one curve (U-shape)Fit y = a + bx + cx²Normal equations (3)L25
Data grows/decays exponentiallyFit y = abˣ or y = aeᵇˣLog transform → linearL26
Data follows a power lawFit y = axᵇLog-log transform → linearL26
Measure linear association (quantitative)Pearson's rr = [nΣxy−ΣxΣy]/√{…}L28
Measure association (ordinal/non-linear)Spearman's rₛrₛ = 1−6Σd²/[n(n²−1)]L30
Control for a third variablePartial correlationr₁₂·₃ formulaL29
Combined predictive powerMultiple correlationR²₁·₂₃ formulaL29
Predict y from xRegression y on xŷ = a + bᵧₓxL31
Predict x from yRegression x on yx̂ = a' + bₓᵧyL31
Assess prediction accuracyStandard error / R²Sᵧₓ = Sᵧ√(1−r²)L32

💬 The Golden Rule: Before computing anything, always draw a scatter plot. The plot tells you which method is appropriate, reveals outliers, and shows whether your model makes sense. No number can replace the insight from a good visualisation.
Correlation & Regression
Unit IV · Lecture 33

Unit IV Complete!


What You've Mastered

Least Squares Curve Fitting Polynomials Exponential Curves Scatter Plots Pearson's r Spearman's rₛ Partial Correlation Regression Lines R² & Sᵧₓ Prediction Properties

Upcoming: Unit V

Probability — Random experiments, sample spaces, events, axioms of probability, conditional probability, Bayes' theorem

Unit IV · Lecture 33 · BDS113 Introduction to Statistics · B.Sc. Data Science, Semester II