Boards
Federal Board (FBISE)865 chapters Punjab Board401 chapters KPK Board472 chapters Sindh Board505 chapters AJK Board436 chapters Balochistan Board290 chaptersUniversity
Mechanical Soon Electrical Soon IT Soon Medical SoonLoading official notes...
Regression is Chapter 6 of Class 11 Statistics (FBISE, old syllabus): the line that best fits a scatter of two variables, so one value can be predicted from the other. The chapter fits the regression lines of Y on X and X on Y by least squares, and covers properties, prediction, the standard error of estimate, and the regression coefficients.
| Item | Detail |
|---|---|
| Chapter | Regression — Chapter 6 of 9, Statistics (old FBISE syllabus) |
| Master data | 8 students — study hours vs marks |
| Line of Y on X | Y = 21.27 + 6.90 X; slope b_yx = 6.90 |
| Mean point | (5.5, 59.25) — both lines pass through it |
| r-squared | r² = b_yx × b_xy |
| Prediction | 7.5 hrs → 73.06 (safe, inside); 12 hrs → 104.13 (impossible, outside) |
| Standard error | Se = 0.72 marks; band ±1.44 marks |
| Exam | Fitting both lines, properties, prediction, standard error |
The complete solved notes for this chapter are in the PDF above — every section, worked example and exercise question.
Regression analysis is a powerful statistical tool used in Class 11 Statistics (FBISE Islamabad Curriculum) to study the functional relationship between two or more variables, enabling us to estimate or predict the value of one variable based on the known value of another. The variable whose value is predicted is called the dependent variable (denoted by $Y$), and the variable used for prediction is called the independent or explanatory variable (denoted by $X$). Unlike correlation, which measures the strength of association symmetrically, regression is directional and asymmetric.
Regression can be classified based on the nature of the relationship and the number of variables. Simple Linear Regression involves only two variables and assumes a linear relationship represented by the equation $Y = \alpha + \beta X + \epsilon$, where $\alpha$ is the $Y$-intercept, $\beta$ is the slope coefficient, and $\epsilon$ is the error term. Multiple Regression involves one dependent variable and two or more independent variables. Furthermore, relationships can be linear (forming a straight line on a scatter diagram) or non-linear/curvilinear.
In bivariate data, there are two distinct lines of regression: 1) Regression line of $Y$ on $X$: Used to estimate the value of $Y$ for a given value of $X$. Its equation is expressed as $\hat{Y} = a + b_{yx}X$. 2) Regression line of $X$ on $Y$: Used to estimate the value of $X$ for a given value of $Y$. Its equation is expressed as $\hat{X} = a' + b_{xy}Y$. The symbols $b_{yx}$ and $b_{xy}$ represent the regression coefficients of $Y$ on $X$ and $X$ on $Y$ respectively.
The slope of the regression line of $Y$ on $X$ ($b_{yx}$) is calculated using the formula: $b_{yx} = \frac{n\sum XY - (\sum X)(\sum Y)}{n\sum X^2 - (\sum X)^2} = r \cdot \frac{S_y}{S_x}$. Similarly, the regression coefficient of $X$ on $Y$ ($b_{xy}$) is given by: $b_{xy} = \frac{n\sum XY - (\sum X)(\sum Y)}{n\sum Y^2 - (\sum Y)^2} = r \cdot \frac{S_x}{S_y}$. Here, $n$ is the number of observations, $r$ is the Karl Pearson correlation coefficient, $S_x$ and $S_y$ are the standard deviations of $X$ and $Y$.
1. The geometric mean of the two regression coefficients is equal to the correlation coefficient: $r = \pm\sqrt{b_{yx} \cdot b_{xy}}$. The sign of $r$ is the same as the common sign of $b_{yx}$ and $b_{xy}$.
2. Both regression lines always pass through the point of averages $(\bar{X}, \bar{Y})$.
3. The product of the regression coefficients ($b_{yx} \cdot b_{xy}$) must be less than or equal to 1 ($0 \le b_{yx}b_{xy} \le 1$).
4. Regression coefficients are independent of the origin (change of scale affects them proportionally, but change of origin has no effect on slope).
To compute the regression line of $Y$ on $X$:
Step 1: Construct a calculation table with columns $X$, $Y$, $X^2$, $Y^2$, and $XY$.
Step 2: Calculate the sums: $\sum X$, $\sum Y$, $\sum X^2$, $\sum Y^2$, and $\sum XY$.
Step 3: Find the means $\bar{X} = \frac{\sum X}{n}$ and $\bar{Y} = \frac{\sum Y}{n}$.
Step 4: Compute the regression coefficient $b_{yx}$ using the standard formula.
Step 5: Determine the intercept $a = \bar{Y} - b_{yx}\bar{X}$.
Step 6: Write the final estimated regression equation: $\hat{Y} = a + b_{yx}X$.
- Always state formulas clearly before substituting values in numerical problems.
- Pay strict attention to whether the question asks for $Y$ on $X$ or $X$ on $Y$, as mixing up the coefficients will result in zero credit.
- Ensure final answers for regression equations and coefficients are rounded to 3 or 4 decimal places as per FBISE standards.
- Remember that if $r = 0$, the regression lines are perpendicular to each other (parallel to the axes), and if $r = \pm 1$, the two lines coincide.
Correlation measures the strength and direction of linear association between two variables symmetrically without any cause-and-effect implication. Regression, on the other hand, establishes a mathematical functional relationship to predict the value of a dependent variable based on a known independent variable.
There are two regression lines because regression minimizes the sum of squared errors in a specific direction. The regression line of Y on X minimizes errors parallel to the Y-axis to predict Y from X, while the regression line of X on Y minimizes errors parallel to the X-axis to predict X from Y.
The correlation coefficient 'r' is the geometric mean of the two regression coefficients, expressed mathematically as $r = \pm\sqrt{b_{yx} \cdot b_{xy}}$. The sign of 'r' is identical to the common algebraic sign of both regression coefficients.
In Chapter 2 we learned correlation: it tells us how strongly two variables move together — with one number, r. But correlation never tells us how much one variable changes when the other changes. If a student studies one hour more, how many marks more will he get? Regression answers that question. It gives us a line — a formula — that predicts the value of one variable from the value of the other.
Regression = predicting Y from X (or X from Y) with a straight line the line is the regression line; its slope is the regression coefficient
Dependent and independent variable. The variable we want to predict is the dependent variable (written Y). The variable we use to predict it is the independent variable (written X). In our master dataset, marks (Y) depend on study hours (X) — so marks are dependent and study hours are independent. But the choice is ours: a farmer may use
rainfall (X) to predict crop yield (Y), or a shopkeeper may use advertising (X) to predict sales (Y).
Situation Independent (X) Dependent (Y)
Question regression
answers
Study hours and 1 hour more study = how many Study hours Marks
marks marks more?
Rs 1,000 more ads = how much Advertising and sales Advertising (Rs) Sales (Rs) more sales?
Rainfall and crop yield
Rainfall (mm) Yield (maunds) 10 mm more rain = how much more yield?
Temperature and 1 °C hotter = how many units Temperature (°C) Electricity (units) electricity use more?
Father's and son's Father's height Son's height How tall will the son be? height
Correlation vs regression — the exam's favourite question. (1) Correlation measures the strength and direction of the relationship (r = 0.9992 in our master data — almost perfect). Regression measures the amount of change — one extra hour of study adds 6.90 marks. (2) Correlation is symmetric: r(X, Y) = r(Y, X) — it does not matter which variable is X and which is Y. Regression is not symmetric: the line of Y on X is different from the line of X on Y. (3) Correlation has no units (r is a pure number between −1 and +1). A regression coefficient has units: byx = 6.90 marks per hour. (4) Correlation tells us nothing about cause and effect — and neither does regression! (Section 9). A little history. Regression was invented by Sir Francis Galton in the 1880s. He studied the heights of fathers and sons and found something strange: tall fathers had sons who were tall — but less tall than their fathers. Short fathers had sons who were short — but less short than their fathers. The sons' heights 'regressed' — moved back — towards the average. That is why the method is called regression: regression towards the mean. (Our father–son data in
Section 11, N7 shows the same thing: a 76-inch father is predicted to have a 73.64-inch son — shorter than the father, closer to the average of 67 inches.)
STEP-BY-STEP — Quick check — Which is X and which is Y? → Step 1: Rainfall and crop yield: X = rainfall, Y = yield. (Rain causes the yield, not the other way round.) cause ko X banao, effect ko Y → Step 2: Price and demand: X = price, Y = demand. (The price decides how much is demanded.) cause ko X banao, effect ko Y → Step 3: Marks in English and marks in Urdu: either can be X — neither causes the other. (Both lines are useful here.) jab cause clear na ho, to dono lines banao
✎ Teacher wali tip! Regression ka sawal aaye to pehle X aur Y pehchano — jo predict karna hai woh Y hai, jis se
lines ko kabhi mix mat karo!
predict karna hai woh X hai! Phir line lagao: Y on X ke liye b_yx, X on Y ke liye b_xy. Dono
!! SAB SE AAM GALTI!
Correlation aur regression ko aik hi cheez mat samjho! Correlation sirf r deta hai (strength),
regression line deti hai (prediction). Exam mein aksar poochha jata hai: 'r = 0.9 ka matlab kya hai?' — jawab: strong relationship, NOT 'Y, X ke 0.9 guna barhta hai'!
Before any formula, we draw the data. A scatter diagram plots every pair (X, Y) as one dot: X on the horizontal axis, Y on the vertical axis. The pattern of the dots tells us, at a glance, whether regression will work at all. Here is our master dataset — 8 students, their study hours and their marks:
Student A B C D E F G H Total
Study hours 2 3 4 5 6 7 8 9 44 (X)
Marks (Y) 35 42 50 55 62 70 76 84 474
X-squared 4 9 16 25 36 49 64 81 284
1,22 1,76 2,50 3,02 3,84 4,90 5,77 7,05 Y-squared 30,090 5 4 0 5 4 0 6 6
X×Y 70 126 200 275 372 490
756 2,897
From this table we read the five sums every regression needs: ΣX = 44, ΣY = 474, ΣX² = 284, ΣY² = 30,090, ΣXY = 2,897. The means are x-bar = 44/8 = 5.5 hours and y-bar = 474/8 = 59.25 marks. Keep these five sums safe — every formula in this chapter uses them.
8 students - more study hours, more marks (almost a straight line)
(8, 76) (9, 84)
(7, 70) 70 (6, 62)
(5, 55) (4, 50) 50 (3, 42) (2, 35)
2 4 6 8 10
each dot = one student - X = study hours, Y = marks out of 100 the dots rise together - a STRONG POSITIVE pattern, ready for a regression line Figure 6.1 — Scatter diagram of the master data. The dots rise from left to right in a tight, almost straight band — a strong positive relationship. What the scatter diagram tells us. (1) Direction: the dots rise from left to right — positive relationship (more hours, more marks). If they fell, it would be negative (like price vs demand). (2) Strength: the dots hug a straight line — the relationship is strong (r = 0.9992). Scattered dots would mean a weak relationship. (3) Shape: the dots follow a straight line, so a linear regression line is the right tool. If the dots curved, a straight line would be wrong. (4) Outliers: a dot far away from the rest would warn us — one strange student could pull the whole line. (Our data has no outlier: the biggest miss from the line is
only 1.11 marks.)
STEP-BY-STEP — Quick check — Read the scatter → Step 1: Student C studied 4 hours and got 50 marks. On the diagram, his dot is at (4, 50). har dot aik student hai → Step 2: Student H studied the most (9 hours) and got the most marks (84). sab se oopar wala dot sab se zyada parhne wala hai → Step 3: If a new student studied 5 hours, the diagram says he should get about 55-56 marks. dots ke beech se andaza lagao
✎ Teacher wali tip! Formula lagane se pehle hamesha scatter diagram banao — agar dots seedhi line mein nahi hain, to regression line bekaar hai! Exam mein scatter diagram ka sawal aaye to dots ko sahi jagah par lagao aur axes par labels likhna mat bhoolo!
The scatter diagram shows the dots almost on a straight line. The regression line of Y on X is the best straight line through them — the line we use to predict marks (Y) from study hours (X). Its equation is:
Y = a + byx X a = intercept (Y when X = 0), b_yx = slope (regression coefficient of Y on X)
Least squares — what 'best' means. Every dot sits a little above or below the line. The vertical gap between a dot and the line is its residual (actual Y minus predicted Y). The least-squares line is the line that makes the sum of the squared residuals as small as possible. Squaring stops positive and negative gaps from cancelling each other out — a miss of +2 and a miss of −2 would cancel to zero, but their squares (4 + 4 = 8) do not. (Section 4 shows the residuals; their squares add up to only SSE = 3.12 for our data.)
The normal equations. The least-squares line comes from two equations — the normal equations — which say: (1) the line passes through the mean point (x-bar, y-bar); (2) the
slope is fixed by the sums. Solving them gives the two formulas you must learn:
byx = Sxy / Sxx = (n ΣXY - ΣX ΣY) / (n ΣX² - (ΣX)²)
S_xy = Σ(X - x-bar)(Y - y-bar), S_xx = Σ(X - x-bar)²
a = y-bar - byx x-bar the intercept comes from the mean point
FORMULA BOX — b_yx = S_xy / S_xx • a = y-bar − b_yx x-bar
A S_xy = ΣXY − ΣXΣY/n, S_xx = ΣX² − (ΣX)²/n
STEP-BY-STEP — Master data: the line of Y on X → Step 1: Sxx = ΣX² − (ΣX)²/n = 284 − 44²/8 = 284 − 242 = 42. pehle S_xx nikalo → Step 2: Sxy = ΣXY − ΣXΣY/n = 2,897 − (44 × 474)/8 = 2,897 − 2,607 = 290. phir S_xy nikalo → Step 3: byx = Sxy/Sxx = 290/42 = 6.9048 marks per hour. slope = S_xy ÷ S_xx → Step 4: a = y-bar − byx x-bar = 59.25 − 6.9048 × 5.5 = 59.25 − 37.98 = 21.27. intercept mean point se nikalo → Step 5: Line of Y on X: Y = 21.27 + 6.90 X. line likho → Step 6: Check: at X = 5.5, the line gives Y = 59.25 = y-bar ✓ — the line passes through the mean point! line likho aur mean point se check karo
The regression line Y on X - the best straight line through the dots
90 Y = 21.27 + 6.90 X slope b_yx = 6.90
70 MEAN POINT (5.5, 59.25)
2 4 6 8 10
every extra study hour adds about 6.90 marks - that is what the slope MEANS the line always passes through the mean point (x-bar, y-bar) = (5.5, 59.25) Figure 6.2 — The regression line Y on X. It passes through the mean point (5.5, 59.25) and hugs the dots; its slope is 6.90 marks per hour.
What the slope means. byx = 6.90 means: one extra hour of study adds about 6.90 marks. Two extra hours add about 13.81 marks; half an hour adds about 3.45 marks. The
slope is the whole point of regression — it turns 'more study helps' into a number. What the intercept means. a = 21.27 means: a student who studies 0 hours is predicted to get 21.27
marks. That is a mathematical fact about the line — not a real prediction (nobody in our data studied 0 hours, and a student who never studies would probably fail; see Section 6 on
extrapolation).
FORMULA BOX — Y = 21.27 + 6.90 X master line of Y on X — X ki value daalo, Y nikalo
STEP-BY-STEP — Quick check — Use the line Y = 21.27 + 6.90 X → Step 1: X = 4 hours: Y = 21.27 + 6.90 × 4 = 48.89 marks (actual: 50 — miss of +1.11). X ki value line mein daalo → Step 2: X = 6 hours: Y = 21.27 + 6.90 × 6 = 62.70 marks (actual: 62 — miss of −0.70). X ki value line mein daalo → Step 3: X = 8 hours: Y = 21.27 + 6.90 × 8 = 76.51 marks (actual: 76 — miss of −0.51). X ki value line mein daalo
✎ Teacher wali tip! b_yx ka formula yaad rakhna asan hai: b_yx = S_xy / S_xx — 'y' wala S upar, 'x' wala S neeche! Aur a = y-bar − b_yx × x-bar — intercept hamesha mean point se nikalta hai!
!! SAB SE AAM GALTI! S_xx aur S_xy ko mix mat karo! S_xx mein sirf X aata hai (ΣX² − (ΣX)²/n), S_xy mein X aur Y dono aate hain (ΣXY − ΣXΣY/n). Agar aap ne S_xy ki jagah S_xx likh diya, to slope bilkul ghalat aayega!
The line of Y on X predicts marks from hours. But what if we want the opposite — to predict hours from marks? A teacher sees a student got 90 marks and asks: 'How many hours did he study?' For that we need a second line — the regression line of X on Y:
X = a' + bxy Y a' = intercept, b_xy = slope (regression coefficient of X on Y)
bxy = Sxy / Syy = (n ΣXY - ΣX ΣY) / (n ΣY² - (ΣY)²) same S_xy on top - but S_yy below now
a' = x-bar - bxy y-bar the intercept comes from the mean point again
FORMULA BOX — b_xy = S_xy / S_yy • a' = x-bar − b_xy y-bar S_xy = ΣXY − ΣXΣY/n, S_yy = ΣY² − (ΣY)²/n
STEP-BY-STEP — Master data: the line of X on Y
pehle S_yy nikalo - S_xy wohi hai → Step 2: Sxy = 290 (as before). → Step 1: Syy = ΣY² − (ΣY)²/n = 30,090 − 474²/8 = 30,090 − 28,084.50 = 2,005.50.
S_xy wohi hai
→ Step 3: bxy = Sxy/Syy = 290/2,005.50 = 0.1446 hours per mark.
slope = S_xy ÷ S_yy → Step 4: a' = x-bar − bxy y-bar = 5.5 − 0.1446 × 59.25 = 5.5 − 8.57 = −3.07. intercept mean point se nikalo → Step 5: Line of X on Y: X = −3.07 + 0.1446 Y. line likho → Step 6: Check: at Y = 59.25, X = −3.07 + 0.1446 × 59.25 = 5.5 = x-bar ✓ — this line also passes through the mean point! line likho aur mean point se check karo
Least squares - every bar is one student's miss from the line residual = actual marks - predicted marks +1.11 +1 +0.58 +0.39 +0.01 -0.08
-0.51 -0.70 -1 -0.80
2 hrs 3 hrs 4 hrs 5 hrs 6 hrs 7 hrs 8 hrs 9 hrs
squares of the bars: 0.01 + 0.00 + 1.23 + 0.64 + 0.49 + 0.15 + 0.26 + 0.34 = SSE = 3.12 least squares moves the line until this sum is MINIMUM - any other line gives a bigger total Figure 6.3 — Least squares in action. Each bar is one student's residual (actual minus predicted); the
line is placed so that the sum of their squares (3.12) is the smallest possible. The residuals, one by one. Predicted marks (y-hat) from Y = 21.27 + 6.90 X are: 35.08,
41.99, 48.89, 55.80, 62.70, 69.61, 76.51, 83.42. The residuals (actual − predicted) are:
−0.08, 0.01, 1.11, −0.80, −0.70, 0.39, −0.51, 0.58. Their sum is 0.00 (as it must be — the least-squares line balances the misses exactly), and the sum of their squares is SSE = 3.12.
best one.
Any other line through these dots would give a bigger SSE — that is what makes this line the
Why two lines, not one? The two lines are different because they minimise different errors: the Y-on-X line minimises the vertical gaps (errors in Y), while the X-on-Y line
minimises the horizontal gaps (errors in X). If you use the Y-on-X line to predict X from Y, your
answer will be wrong — the classic exam trap! To predict X from Y, always use the X-on-Y line: a student with 90 marks studied X = −3.07 + 0.1446 × 90 = 9.95 hours. (The Y-on-X line would give (90 − 21.27)/6.90 = 9.96 hours here — almost the same, only because r is almost 1. With a weaker correlation the two answers are very different!)
FORMULA BOX — X = −3.07 + 0.1446 Y master line of X on Y — Y ki value daalo, X nikalo
STEP-BY-STEP — Quick check — Use the line X = −3.07 + 0.1446 Y → Step 1: Y = 60 marks: X = −3.07 + 0.1446 × 60 = 5.61 hours. Y ki value line mein daalo → Step 2: Y = 40 marks: X = −3.07 + 0.1446 × 40 = 2.72 hours. Y ki value line mein daalo → Step 3: Y = 90 marks: X = −3.07 + 0.1446 × 90 = 9.95 hours. Y ki value line mein daalo
✎ Teacher wali tip! Do lines hamesha yaad rakho: Y predict karna hai to Y on X (b_yx), X predict karna hai to X on Y (b_xy). Jo predict karna hai, woh hamesha LEFT side par hota hai!
!! SAB SE AAM GALTI! Y on X wali line se X predict mat karo! Ye exam ki sab se aam ghalti hai. 90 marks wale student ke hours nikalne ke liye X on Y wali line (X = −3.07 + 0.1446 Y) use karo — Y on X wali line se nahi!
FORMULA BOX — Residual = Y − Y-hat • SSE = Σ (Y − Y-hat)² residuals ka sum hamesha 0 hota hai
STEP-BY-STEP — Quick check — Residuals ka sum zero hota hai → Step 1: Residuals: −0.08, 0.01, 1.11, −0.80, −0.70, 0.39, −0.51, 0.58. In ka sum = 0.00. least-squares line misses ko bilkul balance karti hai
→ Step 2: Squares: 0.0064 + 0.0001 + 1.2321 + 0.64 + 0.49 + 0.1521 + 0.2601 + 0.3364 =
3.1172 ≈ 3.12 = SSE. har residual ko square kar ke jama karo
−0.80).
→ Step 3: X = 5 hours: predicted Y = 21.27 + 6.90 × 5 = 55.80 marks (actual: 55 — residual
line mein X daalo, actual se compare karo
FORMULA BOX — X = −3.07 + 0.1446 Y
master line of X on Y — Y ki value daalo, X nikalo
STEP-BY-STEP — Quick check — X on Y line se check karo → Step 1: Y = 84 marks: X = −3.07 + 0.1446 × 84 = 9.08 hours (actual: 9 hours). Y ki value line mein daalo → Step 2: Y = 35 marks: X = −3.07 + 0.1446 × 35 = 1.99 hours (actual: 2 hours). Y ki value line mein daalo → Step 3: Y = 55 marks: X = −3.07 + 0.1446 × 55 = 4.89 hours (actual: 5 hours). Y ki value line mein daalo
The two regression lines have five properties that the exam asks again and again. Learn them as a list — each one with the master-data numbers as proof. (1) Both lines pass through the mean point (x-bar, y-bar). We checked it twice: the Y-on-X line gives Y = 59.25 at X = 5.5, and the X-on-Y line gives X = 5.5 at Y = 59.25. If your line does not pass through the mean point, your arithmetic is wrong — go back and check. (2) r-squared = byx × bxy. The product of the two regression coefficients is the square of the correlation coefficient:
r² = byx × bxy so r = ± √(b_yx × b_xy) - the sign is the sign of the coefficients
FORMULA BOX — r² = b_yx × b_xy
so r = ± √(b_yx × b_xy) — sign coefficients wala hota hai
STEP-BY-STEP — Master data: r from the two coefficients
→ Step 1: byx × bxy = 6.9048 × 0.1446 = 0.9984. dono coefficients ko multiply karo
square root lo, sign coefficients wala lo
→ Step 2: r = √0.9984 = 0.9992 — and the sign is positive, because both coefficients are positive.
→ Step 3: Check: r² = 0.9984 means 99.84% of the variation in marks is explained by study hours.
r-squared ka matlab samjho
(3) Both coefficients have the same sign as r. If r is positive, both byx and bxy are
positive (study hours vs marks: +6.90 and +0.1446). If r is negative, both are negative (price vs demand: −3.50 and −0.2813). The two coefficients can never have opposite signs — if your calculation gives byx = +2 and bxy = −0.5, you have made a mistake. (4) byx × bxy ≤ 1. Because r² ≤ 1, the product of the two coefficients can never be more than 1. If you get a product of 1.44, your arithmetic is wrong. (If the product is exactly 1, then r = ±1 and the two lines coincide — see property 5.)
Two regression lines - Y on X and X on Y - and the angle between them Y on X
theta X on Y
mean point (x-bar, y-bar)
r = 0.6, sigma-x = 2, sigma-y = 3 -> tan theta = 0.49, theta = 26.21 deg if r = 1 the two lines COINCIDE (theta = 0) - if r = 0 they are PERPENDICULAR the closer r is to 1, the smaller the angle - and the better the prediction
Figure 6.4 — The two lines and the angle between them. Both pass through the mean point; the angle between them shrinks as r grows towards 1.
(5) The angle between the two lines depends on r. The two lines cross at the mean point. The angle θ between them is given by tan θ = [(1 − r²)/r] × [σxσy / (σx² + σy²)]. Two
special cases matter: if r = ±1, tan θ = 0, so θ = 0° — the two lines coincide into one line (perfect prediction). If r = 0, tan θ is infinite, so θ = 90° — the two lines are perpendicular
prediction.
(no prediction at all). In between, a bigger r means a smaller angle — and a better
o σ_y²)] t FORMULA BOX — tan θ = [(1 − r²) / r] × [σ_x σ_y / (σ_x² +
θ = lines ke darmiyan angle
STEP-BY-STEP — Worked example — angle between the lines (r = 0.6, σx = 2, σy = 3) → Step 1: 1 − r² = 1 − 0.36 = 0.64. pehle 1 − r² nikalo → Step 2: (1 − r²)/r = 0.64/0.6 = 1.0667. r se divide karo → Step 3: σxσy/(σx² + σy²) = (2 × 3)/(4 + 9) = 6/13 = 0.4615. sigma wala hissa nikalo → Step 4: tan θ = 1.0667 × 0.4615 = 0.4923. dono hisse multiply karo → Step 5: θ = tan−1(0.4923) = 26.21°. inverse tan lo → Step 6: Second check — r = 0.8, σx = 4, σy = 5: (1 − r²)/r = (1 − 0.64)/0.8 = 0.36/0.8 = 0.45. pehla hissa nikalo → Step 7: σxσy/(σx² + σy²) = (4 × 5)/(16 + 25) = 20/41 = 0.4878. sigma wala hissa nikalo → Step 8: tan θ = 0.45 × 0.4878 = 0.2195.
dono hisse multiply karo → Step 9: θ = tan−1(0.2195) = 12.38°. Bigger r, smaller angle ✓.
r barha to angle chhota hua
Property
Both lines pass through
o t Master-data proof
Y on X: at X = 5.5, Y = 59.25 ✓ • X on Y: at Y = 59.25, X = 5.5 ✓
(x-bar, y-bar)
r² = b_yx × b_xy
Same sign as r
b_yx × b_xy ≤ 1A i 6.9048 × 0.1446 = 0.9984 = r² ✓ • r = 0.9992
r = +0.9992, b_yx = +6.90, b_xy = +0.1446 — all positive ✓
0.9984 ≤ 1 ✓ (if it were more than 1, the arithmetic would be wrong)
Angle between the lines r = 0.9992 → angle almost 0° — the two lines nearly coincide ✓
✎ Teacher wali tip! Ye paanch properties aik saath yaad rakho — exam mein in par aik poora sawal aata hai! Sab se asan check: line mean point se guzarti hai ya nahi — agar nahi guzarti, to calculation ghalat hai!
FORMULA BOX — tan θ = [(1 − r²) / r] × [σ_x σ_y / (σ_x² + σ_y²)] θ = lines ke darmiyan angle
STEP-BY-STEP — Quick check — Master data ka angle → Step 1: σx = √(Sxx/n) = √(42/8) = 2.29. S ko n se divide kar ke square root lo → Step 2: σy = √(Syy/n) = √(2,005.50/8) = 15.83. S ko n se divide kar ke square root lo → Step 3: (1 − r²)/r = (1 − 0.9984)/0.9992 = 0.0016/0.9992 = 0.0016. pehla hissa nikalo → Step 4: σxσy/(σx² + σy²) = (2.29 × 15.83)/(5.24 + 250.59) = 36.25/255.83 = 0.1417. sigma wala hissa nikalo → Step 5: tan θ = 0.0016 × 0.1417 = 0.000227. dono hisse multiply karo → Step 6: θ = tan−1(0.000227) ≈ 0.01° — dono lines taqreeban coincide karti hain ✓ (r = 0.9992, taqreeban 1). r taqreeban 1 ho to angle taqreeban 0° hota hai
FORMULA BOX — r = √(b_yx × b_xy) product 1 ho to r = 1, angle 0°
STEP-BY-STEP — Quick check — Lines kab coincide karti hain? dono coefficients ko multiply karo
→ Step 1: byx = 2, bxy = 0.5: product = 2 × 0.5 = 1.00.
→ Step 2: r = √1.00 = 1 → θ = 0° — dono lines coincide karti hain! product 1 ho to r = 1 hota hai
→ Step 3: byx = 1, bxy = 1: product = 1 × 1 = 1.00. dono coefficients ko multiply karo
→ Step 4: r = √1.00 = 1 → θ = 0° — dono lines coincide karti hain! product 1 ho to r = 1 hota hai → Step 5: byx = 4, bxy = 0.25: product = 4 × 0.25 = 1.00. dono coefficients ko multiply karo → Step 6: r = √1.00 = 1 → θ = 0° — dono lines coincide karti hain! product 1 ho to r = 1 hota hai
Regression is a prediction machine: put in an X, get out a Y. But not every prediction is equally safe. A prediction inside the range of the data is called interpolation — it is safe, because the line was fitted there. A prediction outside the range is called extrapolation — it is dangerous, because the line may bend, flatten or stop outside the data. Our data covers study hours from 2 to 9 — so predictions between 2 and 9 hours are interpolation, and anything beyond 9 hours is extrapolation. Prediction - safe inside the data, dangerous outside it
7.5 hrs -> 73.06 12 hrs -> 104.13 SAFE (inside) IMPOSSIBLE!
2 4
s 8
7.5 hours is INSIDE the data (2-9 hrs) - prediction 73.06 marks is safe
12 hours is OUTSIDE the data - 104.13 marks is more than the paper's 100!
Figure 6.5 — Interpolation vs extrapolation. The solid line covers the observed range (2–9 hours); the dashed extension beyond 9 hours is a guess, not a measurement.
FORMULA BOX — Y = 21.27 + 6.90 X range 2–9 ke andar = interpolation (safe), bahar = extrapolation (risky)
STEP-BY-STEP — Master data: three predictions → Step 1: X = 7.5 hours (inside 2–9): Y = 21.27 + 6.90 × 7.5 = 73.06 marks. SAFE — interpolation. range ke andar hai, to safe hai → Step 2: X = 10 hours (just outside): Y = 21.27 + 6.90 × 10 = 90.32 marks. RISKY — just outside the data. range se bahar hai, to risky hai → Step 3: X = 12 hours (far outside): Y = 21.27 + 6.90 × 12 = 104.13 marks — IMPOSSIBLE! The paper is out of 100. The line cannot go on for ever. far outside hai, to jawab hi ghalat hai
Why extrapolation fails. (1) Marks cannot pass 100 — the line must flatten near the top, but a straight line never flattens. (2) A student cannot study 12 hours every day and stay fresh — tiredness bends the line down. (3) The relationship itself may change outside the data: more rain helps a crop up to a point, then floods it. The line is only proved true inside the data — outside it, we are guessing.
Prediction with the other line. To predict X from Y we use the X-on-Y line: a student with 90 marks studied X = −3.07 + 0.1446 × 90 = 9.95 hours (just outside the range — risky, but close to the data). A student with 60 marks studied X = −3.07 + 0.1446 × 60 = 5.61 hours (inside the range — safe).
FORMULA BOX — Y = 6.50 + 0.85 X rainfall line (N3) — range 10–50 mm
STEP-BY-STEP — Quick check — Rainfall vs yield: Y = 6.50 + 0.85 X (Section 11, N3) → Step 1: Rainfall X = 25 mm (inside 10–50): Y = 6.50 + 0.85 × 25 = 27.75 maunds. SAFE. range ke andar hai → Step 2: Rainfall X = 60 mm (outside 10–50): Y = 6.50 + 0.85 × 60 = 57.50 maunds. RISKY — heavy rain may flood the field! range se bahar hai
FORMULA BOX — Y = −165.24 + 11.24 X
temperature line (N4) — range 25–40 °C
+ 11.24 X (Section 11, N4)
STEP-BY-STEP — Quick check — Temperature vs electricity: Y = −165.24
range ke andar hai
→ Step 1: Temperature 35 °C (inside 25–40): Y = −165.24 + 11.24 × 35 = 228.10 units. SAFE.
→ Step 2: Temperature 45 °C (outside 25–40): Y = −165.24 + 11.24 × 45 = 340.48 units. RISKY
— the grid may fail in extreme heat! range se bahar hai
✎ Teacher wali tip! Prediction ka sawal aaye to pehle check karo: X data ki range ke andar hai ya bahar? Andar hai to jawab likh do, bahar hai to 'extrapolation — risky' zaroor likho! Examiner ko ye line bohat pasand hai!
!! SAB SE AAM GALTI! Extrapolation ko interpolation mat samjho! 12 hours par 104.13 marks likhna ghalat hai — paper 100 marks ka hai! Aik achha answer hamesha batata hai ke prediction safe hai ya risky — sirf number likhne par poore marks nahi milte!
The regression line predicts well — but how well, exactly? The standard error of estimate (written Se or Sy.x) measures the average size of the misses: it is the standard deviation of the residuals. A small Se means the points hug the line and predictions are trustworthy; a big Se means the points scatter widely and predictions are shaky.
Se = √( SSE / (n - 2) ) = √( Σ(Y - Y-hat)² / (n - 2) ) SSE = sum of squared residuals, n - 2 = degrees of freedom
Why n − 2? We lose two degrees of freedom because the line uses two estimated numbers — the intercept a and the slope byx. (In Chapter 4, the standard deviation divided by n − 1 for the same reason — one number, the mean, was estimated. Here two numbers are estimated, so we divide by n − 2.)
FORMULA BOX — S_e = √( SSE / (n − 2) ) SSE = squared residuals ka sum
STEP-BY-STEP — Master data: standard error of estimate
→ Step 1: SSE = (−0.08)² + (0.01)² + (1.11)² + (−0.80)² + (−0.70)² + (0.39)² + (−0.51)² + (0.58)² = 3.12. har residual ko square kar ke jama karo
→ Step 2: Se = √(3.12 / (8 − 2)) = √(3.12/6) = √0.52 = 0.72 marks. SSE ko (n − 2) se divide kar ke square root lo
→ Step 3: Meaning: a typical prediction is wrong by only about 0.72 marks — an excellent fit! chhota Se = achhi prediction
90 A Standard error of estimate - how far the points sit from the line Se = 0.72 marks band = +- 1.44 marks
2 4 6 8 10
ALL 8 points lie inside the band - the biggest miss is only 1.11 marks small Se = good fit - a big Se would mean the line predicts badly Figure 6.6 — The standard-error band. Two lines, one Se above and one Se below the regression line (the band shown is ± 2 × Se = ± 1.44 marks); all 8 points lie inside it. Using Se to judge a prediction. Roughly 68% of the points lie within ±1 × Se of the line, and roughly 95% within ±2 × Se. For our data, ±2 × Se = ±1.44 marks — so a student who
studies 7.5 hours is predicted to get 73.06 marks, and we can be about 95% sure his real marks will be between 73.06 − 1.44 = 71.62 and 73.06 + 1.44 = 74.50. That is a very tight range — the line predicts almost perfectly. Compare the rainfall data (Se = 1.58 maunds) and the temperature data (Se = 5.21 units): the temperature line is the least accurate of the three, because its residuals are bigger.
FORMULA BOX — S_e = √( SSE / (n − 2) ) chhota S_e = achhi fit
STEP-BY-STEP — Quick check — Compare three standard errors → Step 1: Master (study hours): Se = 0.72 marks — excellent fit, predictions trustworthy. chhota Se = achhi fit → Step 2: Rainfall vs yield: Se = 1.58 maunds — good fit, predictions usable. Se bara hai, fit thori kamzor hai → Step 3: Temperature vs electricity: Se = 5.21 units — the weakest fit of the three.
sab se bara Se = sab se kamzor fit
✎ Teacher wali tip!
S_e ka formula yaad rakhna asan hai: SSE ko (n − 2) se divide kar ke square root lo! Aur
yaad rakho: S_e chhota ho to prediction achhi, S_e bara ho to prediction kamzor!
!! SAB SE AAM GALTI!
n − 2 ki jagah n se divide mat karo! Regression line mein do cheezein estimate hoti hain (a aur b), is liye degrees of freedom n − 2 hoti hain. Agar aap ne n se divide kar diya, to S_e chhota
aayega — aur jawab ghalat hoga!
FORMULA BOX — 95% band = prediction ± 2 × S_e rainfall: S_e = 1.58 maunds
STEP-BY-STEP — Quick check — 95% band for rainfall (S_e = 1.58 maunds) → Step 1: Rainfall 25 mm → yield = 27.75 maunds. line mein X daalo → Step 2: 95% band: 27.75 ± 2 × 1.58 = 27.75 ± 3.16 = 24.59 to 30.91 maunds. prediction ± 2 × Se
A regression coefficient is a rate of change: how much Y changes when X changes by one unit. Its value tells you how fast, and its sign tells you which way. Both matter — and both are asked in the exam. The sign of the slope tells the story - up or down
POSITIVE slope NEGATIVE slope
advertising vs sales price vs demand b_yx = +5.40, r = +0.9973 b_yx = -3.50, r = -0.9923 more ads -> more sales higher price -> lower demand
both regression coefficients always have the SAME sign as r
r-squared = b_yx x b_xy - master data: 6.9048 x 0.1446 = 0.9984 99.84% of the variation in marks is explained by study hours
Figure 6.7 — Positive and negative slopes. Advertising vs sales rises (byx = +5.40); price vs demand
falls (byx = −3.50). The sign of the slope is the sign of r.
Positive coefficients. When X rises, Y rises too. Study hours vs marks: byx = +6.90 marks per hour. Advertising vs sales: byx = +5.40 (Rs 1,000 more advertising → Rs 5,400 more
+0.74 inches per inch.
sales). Rainfall vs yield: byx = +0.85 maunds per mm. Father's height vs son's height: byx =
Negative coefficients. When X rises, Y falls. Price vs demand: byx = −3.50 (price up Rs 1 → demand down 3.50 units); bxy = −0.2813, r = −0.9923. The line falls from left to right, and
both coefficients are negative — exactly as property (3) of Section 5 requires. The two coefficients are linked. byx and bxy are not independent: byx = r × (σy/σx) and bxy = r × (σx/σy). That is why their product is r², and why they always share the sign of r. It also explains why the two coefficients are usually very different in size: byx is in 'Y-units per X-unit' (marks per hour = 6.90) while bxy is in 'X-units per Y-unit' (hours per mark = 0.1446). Comparing them directly is meaningless — they measure different things.
FORMULA BOX — r = √(b_yx × b_xy) sign coefficients wala hota hai
STEP-BY-STEP — Quick check — Find r from the coefficients → Step 1: byx = 0.6, bxy = 1.2: r = √(0.6 × 1.2) = √0.72 = 0.8485 (positive sign). r = √(b_yx × b_xy) → Step 2: byx = 2, bxy = 0.32: r = √(2 × 0.32) = √0.64 = 0.80. r = √(b_yx × b_xy) → Step 3: byx = −0.5, bxy = −1.28: r = −√(0.5 × 1.28) = −√0.64 = −0.80. (Sign negative — both coefficients are negative!) sign coefficients wala lo → Step 4: byx = 0.8, bxy = 0.5: r = √(0.8 × 0.5) = √0.40 = 0.6325. r = √(b_yx × b_xy)
FORMULA BOX — r² = b_yx × b_xy property (2) use karo
STEP-BY-STEP — Quick check — Find the missing coefficient (r = 0.8, b_yx = 1.6)
→ Step 1: r² = byx × bxy → 0.64 = 1.6 × bxy. property (2) use karo → Step 2: bxy = 0.64 / 1.6 = 0.40. divide karo
✎ Teacher wali tip!
Coefficient ka sign dekh kar r ka sign batao — dono hamesha aik jaise hote hain! Aur r
sawal hai!
nikalne ke liye dono coefficients ko multiply kar ke square root lo — ye exam ka sab se asan
!! SAB SE AAM GALTI! b_yx aur b_xy ko compare mat karo! 6.90 bara hai aur 0.1446 chhota hai — lekin ye dono mukhtalif units mein hain (marks per hour vs hours per mark). In ka compare karna aisa hai jaise keelon ko kilo se compare karna!
Uses of regression. (1) Prediction — the main use: predict marks from study hours, sales from advertising, yield from rainfall. (2) Measuring the effect — the slope tells us how much Y changes when X changes by one unit (6.90 marks per hour). (3) Estimating missing values — if a student's marks are lost but his hours are known, the line fills the gap. (4) Planning and policy — a shopkeeper decides how much to spend on advertising; a farmer decides how much water his crop needs. (5) Quality control — a factory predicts the life of a machine part from its operating temperature. Regression in Pakistan. The Pakistan Bureau of Statistics and the State Bank use regression every day: the State Bank predicts inflation from the money supply; the agriculture department predicts wheat yield from rainfall and fertilizer use (our rainfall example, Section 11 N3, is exactly this); the electricity companies (like K-Electric and the DISCOs) predict demand from temperature (Section 11 N4 — a 1 °C rise adds about 11.24 units); schools predict a student's board marks from his test marks. Regression is not a textbook exercise — it runs the country's planning.
Limitations of regression. (1) It only works inside the data — extrapolation is
dangerous (Section 6). (2) It assumes a straight line — if the real relationship curves, the
line is wrong. (3) It does not prove cause and effect — marks and study hours move together, but maybe clever students both study more and score more; the line cannot tell us
which causes which. (4) It needs good data — a few wrong or extreme values (outliers) can pull the whole line. (5) It is only as good as the correlation — if r is near 0, the line
predicts almost nothing (the angle between the two lines is nearly 90°). (6) It uses only two variables — real life has many causes at once; one-variable regression ignores the
rest.
FORMULA BOX — Y = 4.20 + 5.40 X advertising line (N2)
STEP-BY-STEP — Quick check — One-line uses and limitations → Step 1: A shopkeeper spends Rs 4,000 on advertising: predicted sales = 4.20 + 5.40 × 4 = Rs 25.80 thousand. line mein X daalo → Step 2: Marks and study hours ka correlation strong hai — lekin ye prove nahi karta ke parhai hi marks ki wajah hai (maybe clever students zyada parhte hain). correlation = causation nahi!
✎ Teacher wali tip! Uses aur limitations ka sawal aaye to kam se kam 4 uses aur 4 limitations likho — har aik ke saath aik line ki wajah aur aik example. Sirf naam likhne par aadhe marks milte hain, wajah aur example par poore marks milte hain!
FORMULA BOX — Y = −165.24 + 11.24 X • Y = 6.50 + 0.85 X temperature line (N4) • rainfall line (N3)
STEP-BY-STEP — Quick check — Regression in Pakistan → Step 1: K-Electric: temperature 35 °C → electricity = −165.24 + 11.24 × 35 = 228.10 units. line mein X daalo → Step 2: Wheat: rainfall 25 mm → yield = 6.50 + 0.85 × 25 = 27.75 maunds. line mein X daalo
CHAPTER SUMMARY — Aik nazar mein Master line Y on X: Y = 21.27 + 6.90 X (byx = 6.9048 marks/hour). Line X on Y: X = −3.07 + 0.1446 Y (bxy = 0.1446 hours/mark). r: 0.9992, r²: 0.9984 = 6.9048 × 0.1446. Means: x-bar = 5.5, y-bar = 59.25 — both lines pass through (5.5, 59.25). SSE: 3.12, Se: 0.72 marks. Predictions: 7.5 hrs → 73.06 (safe), 10 hrs → 90.32 (risky), 12 hrs →
104.13 (impossible). Angle: r = 0.6, σx = 2, σy = 3 → θ = 26.21°. Sign rule: both coefficients share the sign of r.
All numbers in this section were recomputed in Python before writing — every answer below is verified.
FORMULA BOX — b_yx = S_xy / S_xx • a = y-bar − b_yx x-bar S_xy = ΣXY − ΣXΣY/n, S_xx = ΣX² − (ΣX)²/n
STEP-BY-STEP — N1 — Master data: find the line of Y on X → Step 1: ΣX = 44, ΣY = 474, ΣX² = 284, ΣY² = 30,090, ΣXY = 2,897, n = 8. table se paanchon sums uthao → Step 2: Sxx = 284 − 44²/8 = 42. pehle S_xx nikalo → Step 3: Sxy = 2,897 − (44 × 474)/8 = 290.
phir S_xy nikalo → Step 4: byx = 290/42 = 6.9048. slope = S_xy ÷ S_xx → Step 5: a = 59.25 − 6.9048 × 5.5 = 59.25 − 37.98 = 21.27. intercept mean point se nikalo → Step 6: Line of Y on X: Y = 21.27 + 6.90 X.
line likho
→ Step 7: Check: at X = 5.5, the line gives Y = 59.25 = y-bar ✓. mean point se check karo
FORMULA BOX — b_yx = S_xy / S_xx • b_xy = S_xy / S_yy • r =
A √(b_yx × b_xy) dono lines + r — aik hi dataset se
STEP-BY-STEP — N2 — Advertising (X, Rs 000) vs sales (Y, Rs 000): (1, 10), (2, 15), (3, 20), (4, 25), (5, 32). Find both lines and r. → Step 1: ΣX = 15, ΣY = 102, ΣX² = 55, ΣY² = 2,374, ΣXY = 360, n = 5. x-bar = 3, y-bar = 20.4. table se paanchon sums uthao → Step 2: Sxx = 55 − 15²/5 = 10. pehle S_xx nikalo → Step 3: Syy = 2,374 − 102²/5 = 293.20. phir S_yy nikalo → Step 4: Sxy = 360 − (15 × 102)/5 = 54. phir S_xy nikalo → Step 5: byx = 54/10 = 5.40. pehli line ka slope nikalo → Step 6: a = 20.4 − 5.40 × 3 = 20.4 − 16.20 = 4.20. pehli line ka intercept nikalo → Step 7: Line of Y on X: Y = 4.20 + 5.40 X. pehli line likho → Step 8: bxy = 54/293.20 = 0.1842.
doosri line ka slope nikalo → Step 9: a' = 3 − 0.1842 × 20.4 = 3 − 3.76 = −0.76.
doosri line ka intercept nikalo
→ Step 10: Line of X on Y: X = −0.76 + 0.1842 Y. doosri line likho
r nikalo
→ Step 11: r = √(5.40 × 0.1842) = √0.9945 = 0.9973.
prediction karo
→ Step 12: Advertising Rs 4,000 → sales = 4.20 + 5.40 × 4 = Rs 25.80 thousand.
FORMULA BOX — b_yx = S_xy / S_xx • Y = a + b_yx X line se prediction — range check zaroor karo
STEP-BY-STEP — N3 — Rainfall (X, mm) vs crop yield (Y, maunds): (10, 15), (20, 25), (30, 30), (40, 40), (50, 50). Find the line of Y on X and predict for 25 mm and 60 mm. → Step 1: ΣX = 150, ΣY = 160, ΣX² = 5,500, ΣY² = 5,850, ΣXY = 5,650, n = 5. x-bar = 30, y-bar = 32. table se paanchon sums uthao → Step 2: Sxx = 5,500 − 150²/5 = 1,000. pehle S_xx nikalo → Step 3: Sxy = 5,650 − (150 × 160)/5 = 850. phir S_xy nikalo → Step 4: byx = 850/1,000 = 0.85. slope nikalo → Step 5: a = 32 − 0.85 × 30 = 32 − 25.50 = 6.50. intercept nikalo → Step 6: Line: Y = 6.50 + 0.85 X. line likho
→ Step 7: Rainfall 25 mm: Y = 6.50 + 0.85 × 25 = 27.75 maunds (safe — inside 10–50). range ke andar hai
→ Step 8: Rainfall 60 mm: Y = 6.50 + 0.85 × 60 = 57.50 maunds (risky — extrapolation!). range se bahar hai
FORMULA BOX — b_yx = S_xy / S_xx • S_e = √( SSE / (n − 2) ) line + standard error — dono nikalo
STEP-BY-STEP — N4 — Temperature (X, °C) vs electricity use (Y, units): (25, 120), (28, 150), (31, 180), (34, 210), (37, 250), (40, 290). Find the line of Y on X and S_e. → Step 1: ΣX = 195, ΣY = 1,200, ΣX² = 6,495, ΣY² = 260,000, ΣXY = 40,770, n = 6. x-bar = 32.5, y-bar = 200. table se paanchon sums uthao → Step 2: Sxx = 6,495 − 195²/6 = 157.50. pehle S_xx nikalo → Step 3: Sxy = 40,770 − (195 × 1,200)/6 = 1,770. phir S_xy nikalo → Step 4: byx = 1,770/157.50 = 11.2381. slope nikalo → Step 5: a = 200 − 11.2381 × 32.5 = 200 − 365.24 = −165.24. intercept nikalo → Step 6: Line: Y = −165.24 + 11.24 X. line likho → Step 7: Residuals: 4.29, 0.57, −3.14, −6.86, −0.57, 5.71.
har point ka residual nikalo → Step 8: Squared residuals ka sum: SSE = 108.57. residuals ko square kar ke jama karo → Step 9: Se = √(108.57/4) = √27.14 = 5.21 units. SSE ko (n − 2) se divide kar ke square root lo range ke andar hai
→ Step 10: 35 °C: Y = −165.24 + 11.24 × 35 = 228.10 units (safe).
→ Step 11: 45 °C: Y = −165.24 + 11.24 × 45 = 340.48 units (risky — extrapolation!). range se bahar hai
FORMULA BOX — b_yx = S_xy / S_xx • b_xy = S_xy / S_yy • r = √(b_yx × b_xy) dono coefficients NEGATIVE honge — sign check karo
STEP-BY-STEP — N5 — Price (X, Rs) vs demand (Y, units): (10, 90), (12, 85), (14, 80), (16, 70), (18, 65), (20, 55). Find both lines and r. → Step 1: ΣX = 90, ΣY = 445, ΣX² = 1,420, ΣY² = 33,875, ΣXY = 6,430, n = 6. x-bar = 15, y-bar = 74.17. table se paanchon sums uthao → Step 2: Sxx = 1,420 − 90²/6 = 70. pehle S_xx nikalo → Step 3: Syy = 33,875 − 445²/6 = 870.83. phir S_yy nikalo → Step 4: Sxy = 6,430 − (90 × 445)/6 = −245. phir S_xy nikalo - S_xy NEGATIVE hai! → Step 5: byx = −245/70 = −3.50. pehli line ka slope nikalo → Step 6: a = 74.17 + 3.50 × 15 = 126.67. pehli line ka intercept nikalo → Step 7: Line of Y on X: Y = 126.67 − 3.50 X. pehli line likho
→ Step 8: bxy = −245/870.83 = −0.2813. doosri line ka slope nikalo
→ Step 9: a' = 15 + 0.2813 × 74.17 = 35.87.
doosri line ka intercept nikalo → Step 10: Line of X on Y: X = 35.87 − 0.2813 Y. doosri line likho
→ Step 11: r = −√((−3.50) × (−0.2813)) = −√0.9847 = −0.9923. Both coefficients negative, so r is
negative ✓. r nikalo - sign negative hoga
FORMULA BOX — S_e = √( SSE / (n − 2) ) • 95% band = prediction ± 2 × S_e master data: SSE = 3.12, n = 8
STEP-BY-STEP — N6 — Master data: standard error of estimate and the 95% prediction band → Step 1: Residuals: −0.08, 0.01, 1.11, −0.80, −0.70, 0.39, −0.51, 0.58. Their squares add to SSE = 3.12. residuals ko square kar ke jama karo → Step 2: Se = √(3.12/(8 − 2)) = √0.52 = 0.72 marks. SSE ko (n − 2) se divide kar ke square root lo → Step 3: 7.5 hours → Y = 21.27 + 6.90 × 7.5 = 73.06 marks. line mein X daalo → Step 4: 95% band: 73.06 ± 2 × 0.72 = 73.06 ± 1.44 = 71.62 to 74.50 marks. prediction ± 2 × Se
FORMULA BOX — b_yx = S_xy / S_xx • Y = a + b_yx X father X, son Y — Galton ka data
STEP-BY-STEP — N7 — Father's height (X, inches) vs son's height (Y,
inches): (60, 62), (62, 63), (64, 65), (66, 66), (68, 68), (70, 69), (72, 71), (74, 72). Predict the son's height for a 66-inch and a 76-inch father. → Step 1: ΣX = 536, ΣY = 536, ΣX² = 36,080, ΣY² = 36,004, ΣXY = 36,036, n = 8. x-bar = 67, y-bar = 67. table se paanchon sums uthao
pehle S_xx nikalo
→ Step 2: Sxx = 36,080 − 536²/8 = 168.
→ Step 3: Sxy = 36,036 − (536 × 536)/8 = 124. phir S_xy nikalo
→ Step 4: byx = 124/168 = 0.7381. slope nikalo → Step 5: a = 67 − 0.7381 × 67 = 67 − 49.45 = 17.55. intercept nikalo → Step 6: Line: Y = 17.55 + 0.74 X. line likho → Step 7: Father 66 in: son = 17.55 + 0.74 × 66 = 66.26 inches. pehli prediction karo → Step 8: Father 76 in: son = 17.55 + 0.74 × 76 = 73.64 inches. doosri prediction karo → Step 9: The 76-inch father gets a 73.64-inch son — SHORTER than the father, closer to the average 67. That is Galton's regression towards the mean! Galton ka rule samjho
FORMULA BOX — b_yx = S_xy / S_xx • Y = a + b_yx X height X, weight Y
STEP-BY-STEP — N8 — Height (X, cm) vs weight (Y, kg): (150, 50), (160, 55), (170, 65), (180, 70), (190, 80). Find the line of Y on X and predict the weight of a 175 cm person. → Step 1: ΣX = 850, ΣY = 320, ΣX² = 145,500, ΣY² = 21,050, ΣXY = 55,150, n = 5. x-bar = 170, y-bar = 64. table se paanchon sums uthao → Step 2: Sxx = 145,500 − 850²/5 = 1,000. pehle S_xx nikalo → Step 3: Sxy = 55,150 − (850 × 320)/5 = 750. phir S_xy nikalo → Step 4: byx = 750/1,000 = 0.75. slope nikalo → Step 5: a = 64 − 0.75 × 170 = 64 − 127.50 = −63.50. intercept nikalo → Step 6: Line: Y = −63.50 + 0.75 X. line likho
→ Step 7: 175 cm: Y = −63.50 + 0.75 × 175 = 67.75 kg (safe — inside 150–190). pehli prediction karo → Step 8: 165 cm: Y = −63.50 + 0.75 × 165 = 60.25 kg. doosri prediction karo PRACTICE — Khud hal karo
ANSWERS
(a) Positive (b) Negative (c) Zero (d) One
(a) r (b) r-squared (c) 1/r (d) sigma-x
(a) 0 (b) 0.5 (c) 1 (d) 2
ANSWER KEY
★ MCQ hal karne se pehle khud socho — key baad mein dekho. Jo ghalat ho, us topic ke steps dobara parho!
MCQ EXAM TIPS — Paper mein kaise attempt karein
1. Pehle woh MCQs hal karo jo aap ko pakka aate hain — mushkil walon par time zaya mat karo. 2. 'NOT' aur 'EXCEPT' wale sawal do baar parho — in mein aksar ghalti hoti hai. 3. Do options ke darmiyan phans jao to definition yaad karo, guess mat lagao — aur kabhi bhi koi MCQ khaali mat chhoro. 4. Jo MCQ ghalat ho, us ka topic dobara parho — ghalti ko note karo, dobara mat karo.
LAST-MINUTE DEFINITIONS — Aik line mein Regression: Y ko X se predict karna (line se). byx: Sxy/Sxx — Y on X ka slope. bxy: Sxy/Syy — X on Y ka slope. r²: byx × bxy. Mean point: (x-bar, y-bar) — dono lines is se guzarti hain. Se: √(SSE/(n − 2)). Interpolation: range ke andar prediction. Extrapolation: range se bahar prediction (risky).
QUICK REVISION — 5 one-line answers
(lines coincide). 5. Se mein divide kis se? — (n − 2) se.
Q1. Define regression. How is it different from correlation? Regression is the method of predicting the value of one variable (the dependent variable Y) from the value of another variable (the independent variable X) with a straight line. Correlation measures only the strength and direction of the relationship (r = 0.9992 in our master data). Regression goes further: it gives the amount of change — one extra hour of study adds 6.90 marks. Correlation is symmetric (r(X, Y) = r(Y, X)); regression is not — the line of Y on X is different from the line of X on Y.
Q2. What are dependent and independent variables? Give an example. The dependent variable (Y) is the one we want to predict; the independent variable (X) is the one we use to predict it. In our master data, marks (Y) depend on study hours (X) — so marks are dependent and study hours are independent. Other examples: advertising (X) predicts sales (Y); rainfall (X) predicts crop yield (Y); temperature (X) predicts electricity use (Y). The choice depends on the question: the variable we predict is always Y.
Q3. What is a scatter diagram? What does it tell us?
A scatter diagram plots every pair (X, Y) as one dot, with X on the horizontal axis and Y on the vertical axis. It tells us (1) the direction of the relationship — the dots rise (positive) or
fall (negative); (2) the strength — dots hugging a line mean a strong relationship; (3) the
shape — a straight band means linear regression is the right tool; (4) outliers — a dot far from the rest warns us that one strange value may pull the line. Our master data shows a
tight rising band — a strong positive linear relationship.
Q4. What is the least-squares method?
Least squares is the rule for choosing the best regression line. Every dot sits a little above or
below the line; the vertical gap is its residual (actual Y minus predicted Y). The least-squares line is the line that makes the sum of the squared residuals as small as possible. Squaring stops positive and negative gaps from cancelling each other. For our master data the sum of squared residuals is SSE = 3.12 — any other line through these dots would give a bigger total.
Q5. Write the two regression lines of the master data and interpret their slopes. Line of Y on X: Y = 21.27 + 6.90 X (b_yx = 6.9048). It means one extra hour of study adds about 6.90 marks; the intercept 21.27 is the predicted marks for 0 hours of study. Line of X on Y: X = −3.07 + 0.1446 Y (b_xy = 0.1446). It means one extra mark corresponds to about 0.1446 extra hours of study. Both lines pass through the mean point (5.5, 59.25).
Q6. State and prove the property r-squared = b_yx × b_xy. The product of the two regression coefficients equals the square of the correlation coefficient: r² = b_yx × b_xy. Proof on the master data: b_yx = 6.9048 and b_xy = 0.1446, so b_yx × b_xy = 6.9048 × 0.1446 = 0.9984. And r = 0.9992, so r² = 0.9992² = 0.9984. Both sides agree. So r = ±√(b_yx × b_xy) — the sign is the sign of the coefficients (positive here, because both coefficients are positive).
Q7. What is the standard error of estimate? What does it tell us? The standard error of estimate (S_e) is the standard deviation of the residuals: S_e = √(SSE/(n − 2)). It measures how far the points sit from the regression line, on average. For our master data, S_e = √(3.12/6) = 0.72 marks — a typical prediction is wrong by only about 0.72 marks, so the fit is excellent. A small S_e means trustworthy predictions; a big S_e (like 5.21 units for the temperature data) means shaky predictions. Roughly 95% of the points lie within ±2 × S_e of the line.
Q8. What is the difference between interpolation and extrapolation? Why is extrapolation dangerous? Interpolation is a prediction inside the range of the data; extrapolation is a prediction outside it. Interpolation is safe, because the line was fitted there. Extrapolation is dangerous, because the relationship may change outside the data: our line predicts 104.13 marks for 12 hours of study — impossible, because the paper is out of 100. Marks must flatten near the top, but a straight line never flattens. So a prediction outside the range (2–9 hours) must always be marked 'risky'.
CAVEAT: Statistics ke liye NBF ki koi textbook nahi hai aur exercise ki exact wording online verify nahi ho saki — is liye neeche standard board-pattern (Basic Statistics Part-I, Ch6) ke representative questions diye gaye hain, har aik step-by-step hal ke saath. Pattern aur topics syllabus ke mutabiq hain; baqi questions isi pattern par khud hal karein.
FORMULA BOX — b_yx = S_xy / S_xx • a = y-bar − b_yx x-bar S_xy = ΣXY − ΣXΣY/n, S_xx = ΣX² − (ΣX)²/n
STEP-BY-STEP — EXERCISE 6 (Line of Y on X) — Marks in two subjects (X, Y): (5, 8), (6, 10), (7, 12), (8, 14), (9, 16), (10, 19), (11, 21), (12, 23). Find the line of Y on X. → Step 1: ΣX = 68, ΣY = 123, ΣX² = 620, ΣY² = 2,091, ΣXY = 1,137, n = 8. x-bar = 8.5, y-bar =
15.375. table se paanchon sums uthao → Step 2: Sxx = 620 − 68²/8 = 42. pehle S_xx nikalo
→ Step 3: Sxy = 1,137 − (68 × 123)/8 = 91.50. phir S_xy nikalo
→ Step 4: byx = 91.50/42 = 2.1786. slope nikalo
intercept nikalo
→ Step 5: a = 15.375 − 2.1786 × 8.5 = 15.375 − 18.52 = −3.14.
→ Step 6: Line: Y = −3.14 + 2.18 X. line likho → Step 7: Check: at X = 8.5 (the mean), the line gives Y = 15.375 = y-bar ✓. mean point se check karo
FORMULA BOX — b_yx = S_xy / S_xx • b_xy = S_xy / S_yy • r = √(b_yx × b_xy) dono lines + r — aik hi dataset se
STEP-BY-STEP — EXERCISE 6 (Both lines + r) — 6 points: (1, 2), (2, 4), (3, 5), (4, 7), (5, 8), (6, 10). Find both lines and r. → Step 1: ΣX = 21, ΣY = 36, ΣX² = 91, ΣY² = 258, ΣXY = 153, n = 6. x-bar = 3.5, y-bar = 6. table se paanchon sums uthao → Step 2: Sxx = 91 − 21²/6 = 17.50. pehle S_xx nikalo → Step 3: Syy = 258 − 36²/6 = 42. phir S_yy nikalo → Step 4: Sxy = 153 − (21 × 36)/6 = 27. phir S_xy nikalo → Step 5: byx = 27/17.50 = 1.5429. pehli line ka slope nikalo → Step 6: a = 6 − 1.5429 × 3.5 = 6 − 5.40 = 0.60. pehli line ka intercept nikalo → Step 7: Line of Y on X: Y = 0.60 + 1.54 X. pehli line likho → Step 8: bxy = 27/42 = 0.6429.
doosri line ka slope nikalo → Step 9: a' = 3.5 − 0.6429 × 6 = 3.5 − 3.86 = −0.36.
doosri line ka intercept nikalo
→ Step 10: Line of X on Y: X = −0.36 + 0.6429 Y. doosri line likho
r nikalo
→ Step 11: r = √(1.5429 × 0.6429) = √0.9918 = 0.9959.
FORMULA BOX — r = √(b_yx × b_xy) • r² = b_yx × b_xy property (2) use karo
STEP-BY-STEP — EXERCISE 6 (r from coefficients) — If b_yx = 0.8 and b_xy = 0.5, find r. If r = 0.9 and b_xy = 0.9, find b_yx. → Step 1: r = √(0.8 × 0.5) = √0.40 = 0.6325. r = √(b_yx × b_xy) → Step 2: r² = byx × bxy → 0.81 = byx × 0.9 → byx = 0.81/0.9 = 0.90. property (2) use karo
FORMULA BOX — tan θ = [(1 − r²) / r] × [σ_x σ_y / (σ_x² + σ_y²)] θ = lines ke darmiyan angle
STEP-BY-STEP — EXERCISE 6 (Angle between the lines) — r = 0.5, σx = 2, σy = 4. Find the angle between the two regression lines. → Step 1: (1 − r²)/r = (1 − 0.25)/0.5 = 0.75/0.5 = 1.5. pehla hissa nikalo → Step 2: σxσy/(σx² + σy²) = (2 × 4)/(4 + 16) = 8/20 = 0.4. sigma wala hissa nikalo → Step 3: tan θ = 1.5 × 0.4 = 0.60. dono hisse multiply karo → Step 4: θ = tan−1(0.60) = 30.96°. inverse tan lo
FORMULA BOX — S_e = √( SSE / (n − 2) ) SSE = 0.3429, n = 6
STEP-BY-STEP — EXERCISE 6 (Standard error) — SSE = 0.3429, n = 6. Find S_e.
→ Step 1: Se = √(SSE/(n − 2)) = √(0.3429/4) = √0.0857 = 0.2928. SSE ko (n − 2) se divide kar ke square root lo
FORMULA BOX — Y = 21.27 + 6.90 X
master line — range 2–9 ke andar = safe
STEP-BY-STEP — EXERCISE 6 (Prediction) — Line Y = 21.27 + 6.90 X. Predict marks for 6.5 hours and for 11 hours. Which prediction is safe?
range ke andar hai → Step 1: 6.5 hours: Y = 21.27 + 6.90 × 6.5 = 66.15 marks. SAFE — 6.5 is inside the range 2–9.
→ Step 2: 11 hours: Y = 21.27 + 6.90 × 11 = 97.23 marks. RISKY — 11 is outside the range 2–9 (extrapolation). range se bahar hai
PRACTICE — Khud hal karo
ANSWERS
Topic Must-Remember
Predicting Y from X with a straight line • Y = dependent (predicted), X = What is independent (predictor) • Correlation = strength, regression = amount of regression? change • Regression is NOT symmetric, correlation IS
X = hours: 2, 3, 4, 5, 6, 7, 8, 9 (ΣX = 44, x-bar = 5.5) • Y = marks: 35, 42, Master dataset 50, 55, 62, 70, 76, 84 (ΣY = 474, y-bar = 59.25) • ΣX² = 284, ΣY² = 30,090, ΣXY = 2,897
Sxx = 42 • Syy = 2,005.50 • Sxy = 290 • Sxx = ΣX² − (ΣX)²/n, Sxy = ΣXY − Sums ΣXΣY/n
Y = a + byxX • byx = Sxy/Sxx = 290/42 = 6.9048 marks/hour • a = y-bar − Line Y on X byxx-bar = 21.27 • Line: Y = 21.27 + 6.90 X
Line X on Y
X = a' + bxyY • bxy = Sxy/Syy = 290/2,005.50 = 0.1446 hours/mark • a' = x-bar − bxyy-bar = −3.07 • Line: X = −3.07 + 0.1446 Y
Properties. Both lines pass through (x-bar, y-bar) = (5.5, 59.25) • r² = byx × bxy =
0.9984 • r = 0.9992 • Both coefficients share the sign of r • byx × bxy ≤ 1 • r = 1 → lines coincide, r = 0 → perpendicular
Angle between lines
tan θ = [(1 − r²)/r] × [σxσy/(σx² + σy²)] • r = 0.6, σx = 2, σy = 3 → θ = 26.21°
Prediction
7.5 hrs → 73.06 (SAFE, inside 2–9) • 10 hrs → 90.32 (risky) • 12 hrs → 104.13 (IMPOSSIBLE — paper is 100) • 90 marks → 9.95 hrs (X on Y line!) •
Interpolation = inside, extrapolation = outside
Se = √(SSE/(n − 2)) • Master: SSE = 3.12, Se = √(3.12/6) = 0.72 marks • Standard error 95% band: 73.06 ± 1.44 = 71.62 to 74.50 • Small S = good fit
Advertising: Y = 4.20 + 5.40 X, r = 0.9973, S = 0.73 • Rainfall: Y = 6.50 + 0.85 X, S = 1.58 • Temperature: Y = −165.24 + 11.24 X, S = 5.21 • Price Other datasets e e vs demand: Y = 126.67 − 3.50 X, r = −0.9923 • Father–son: Y = 17.55 + 0.74 X
Sign + r from b = 0.6, b = 1.2 → r = 0.8485 • b = 2, b = 0.32 → r = 0.80 • b = yx xy yx xy yx coefficients −0.5, b = −1.28 → r = −0.80 • r = 0.8, b = 1.6 → b = 0.40 xy yx xy
N1: Y = 21.27 + 6.90 X • N2: Y = 4.20 + 5.40 X, X = −0.76 + 0.1842 Y, r = Key numbers + 0.9973 • N3: Y = 6.50 + 0.85 X • N4: Y = −165.24 + 11.24 X, S = 5.21 • paper N6: S = 0.72 • N7: father 66 in → son 66.26 in • Theory 85 (15 MCQ + 70) + Practical 20
✎ Aakhri yaad-dihani! Y predict karna hai to Y on X, X predict karna hai to X on Y — ye aik line poora chapter hai! r² = b_yx × b_xy, dono lines mean point se guzarti hain, aur extrapolation hamesha risky hoti hai!
QUICK CHECK — Aakhri check (3 sawal)
— End of Chapter 6 — AI NOTES • FBISE Class 11 Statistics • STATISTICS 6/8 • Agla chapter: Correlation
No solved past-paper questions are linked to Regression yet. The MCQs tab above is ready to practise from meanwhile.
Class 11 Statistics (FBISE Islamabad) ke chapter Regression mein hum do ya do se zyada variables ke darmiyan mathematical relationship ko study karte hain. Iska maqsad ek variable ki madad se dusre variable ki value ko estimate ya predict karna hota hai. Jo variable predict karna ho usay Dependent Variable ($Y$) kehte hain, aur jis variable ki madad se prediction ki jaye usay Independent Variable ($X$) kehte hain. Regression analysis correlation se is tarah mukhtalif hai ke yeh directional hota hai (yani isme cause and effect relationship dekhi jati hai).
Bivariate data ke liye hamare paas do regression lines hoti hain: 1) $Y$ on $X$ ki line ($\hat{Y} = a + b_{yx}X$), jo $X$ ki diye gaye value par $Y$ ko find karne ke liye use hoti hai. 2) $X$ on $Y$ ki line ($\hat{X} = a' + b_{xy}Y$), jo $Y$ ke zariye $X$ ko find karne ke liye hoti hai. In lines ke slopes ko Regression Coefficients ($b_{yx}$ aur $b_{xy}$) kaha jata hai. Inhein calculate karne ke liye hum direct formulas ya correlation ($r$) aur standard deviations ($S_x, S_y$) ki values use karte hain.
FBISE board exam ke nuqta-e-nazar se kuch ahem properties yeh hain:
- Dono regression coefficients ($b_{yx}$ aur $b_{xy}$) ka product hamesha 1 se kam ya barabar hota hai, aur inka geometric mean Karl Pearson correlation coefficient ($r$) ke barabar hota hai ($r = \pm\sqrt{b_{yx} \cdot b_{xy}}$).
- Dono regression lines hamesha means ke point $(\bar{X}, \bar{Y})$ par aik dusre ko cut karti hain (intersect karti hain).
- Numerical solve karte waqt hamesha check karein ke sawal mein $Y$ on $X$ pucha gaya hai ya $X$ on $Y$, kyunke formula aur coefficients badal jate hain. Steps mukammal likhein aur calculation mein unit places ka khas khayal rakhein.
Correlation measures the strength and direction of linear association between two variables symmetrically without any cause-and-effect implication. Regression, on the other hand, establishes a mathematical functional relationship to predict the value of a dependent variable based on a known independent variable.
There are two regression lines because regression minimizes the sum of squared errors in a specific direction. The regression line of Y on X minimizes errors parallel to the Y-axis to predict Y from X, while the regression line of X on Y minimizes errors parallel to the X-axis to predict X from Y.
The correlation coefficient 'r' is the geometric mean of the two regression coefficients, expressed mathematically as $r = \pm\sqrt{b_{yx} \cdot b_{xy}}$. The sign of 'r' is identical to the common algebraic sign of both regression coefficients.