Exercises — Multiple regression
4.9.23 · D4· Maths › Probability Theory & Statistics › Multiple regression
Throughout, , the least-squares estimator is , and = number of observations, = number of predictors (so has columns including the leading 1-column).
Level 1 — Recognition
Kya tum parts ko naam de sakte ho aur model padh sakte ho?
Exercise 1.1
Fitted model diya gaya hai; batao (a) intercept kya hai, (b) ka partial slope kya hai, (c) hone par predicted kya hoga.
Recall Solution 1.1
(a) Intercept constant term hai: (predicted jab dono predictors hon). (b) ka partial slope uska multiplier hai: . Matlab mein 1-unit badhne par, fixed rakhte hue, 4 se girti hai. (c) Values daalo — model ek weighted sum hai:
Exercise 1.2
observations aur predictors wale dataset ke liye, , , aur ke dimensions (rows columns) kya honge?
Recall Solution 1.2
- mein har observation ke liye ek row hoti hai aur columns hote hain (1-column + + ): .
- hai (square, ek row/col har coefficient ke liye).
- hai (ek column, ke saath match karta hua).
Square kyun? Square hona inverse ke baare mein baat karne ki zaroori condition hai — lekin kaafi nahi. invertible tab hoga jab uska determinant nonzero ho, jo exactly tab hota hai jab ki full column rank ho (linearly independent columns, Ex 5.1 mein prove kiya). Square lekin rank-deficient matrix ka hota hai aur uska koi inverse nahi (Matrix Inverse).
Level 2 — Application
Machinery mein values daalo aur handle ghuma do.
Exercise 2.1
Is chhote system ko haath se solve karo. (simple case, ek predictor) ko in data par fit karo:
| 1 | 0 | 1 |
| 2 | 1 | 3 |
| 3 | 2 | 4 |
banao, aur form karo, aur solve karo.
Recall Solution 2.1
Step 1 — banao (pehle 1-column, phir column): Step 2 — form karo. Ones ki row khud ; ones ; : Step 3 — form karo. ; : Step 4 — ko invert karo. Yeh formula kyun kaam karta hai: ek matrix ka inverse hota hai . Scalar woh (signed) area measure karta hai jo matrix ke columns span karte hain; isse divide karna scaling ko undo karta hai. Rearranged matrix (diagonal swap karo, off-diagonal negate karo) adjugate hai — tum check kar sakte ho ki direct multiplication se, isi liye se divide karne par milta hai. Yahan (to inverse exist karta hai): Step 5 — solve karo: To aur . (Yeh exactly Ordinary Least Squares hai ek predictor par — same machinery, matrix-shaped.)
Exercise 2.2
Ek fit deta hai . Study hours ko hours mein measure kiya gaya tha. Ab tum ise minutes mein re-measure karte ho lekin aur unchanged rakhte ho, aur refit karte ho. Minutes-variable par naya coefficient kya hoga? Explain karo.
Recall Solution 2.2
Ek hour minutes, to minutes ki value hours ki value ki hai: . Har prediction identical rakhne ke liye, coefficient ko same factor se shrink karna hoga: Naya coefficient . Fit unchanged raha — sirf woh number badla jo same slope ko relabel karta hai.
Level 3 — Analysis
Kisi number ke peeche ka "kyun" explain karo.
Exercise 3.1
observations aur predictors wale model mein aur hai. aur adjusted compute karo. Phir ek useless (random) predictor add karo jo ko sirf tak reduce karta hai; adjusted recompute karo (ab ). Kya hua, aur kyun?
Recall Solution 3.1
Original (): Junk predictor add karne ke baad (, ): Kya hua: plain badh gaya () even though predictor kaam ka nahi tha — R² kabhi nahi gir sakta jab tum ek column add karo. Lekin adjusted gir gaya () kyunki denominator se ho gaya, jo waste kiye gaye degree of freedom ko penalise karta hai. Adjusted ne sahi se junk ko flag kiya.
Exercise 3.2
Do predictors highly correlated hain. ka use karke explain karo ki unke estimated coefficients itne wildly unstable kyun ho jaate hain. Figure s01 refer karo.

Recall Solution 3.2
Jab aur nearly parallel hote hain (figure ka left panel), ke columns lagbhag ek line par lie karte hain, to near-singular ho jaata hai: uska determinant ke karib hota hai. Inverse compute hota hai ke roop mein, jahan adjugate hai (cofactors ki matrix, transposed). Cofactor entries ordinary size ki rehti hain, lekin sab divided hoti hain ek determinant se jo ki taraf ja raha hai — isliye inverse ki entries blow up ho jaati hain. Yeh clean scalar proportionality nahi hai; baat yeh hai ki shared factor har entry ko magnify karta hai. Isliye data mein tiny changes mein huge swings produce karti hain. Geometrically (right panel), fitted plane ko ke along steeply "up" aur ke along equally steeply "down" tilt karne se surface wahan barely move karti hai jahan data hai, to data do slopes ko pin nahi kar sakta: bahut saare wildly different lagbhag equally well fit karte hain.
Yeh multicollinearity hai. Isko VIF (variance inflation factor) se quantify kiya jaata hai: predictor ke liye, jahan woh hai jo ko baaki saare predictors par regress karne se milta hai. Agar aur nearly parallel hain, to har ek doosre ko almost perfectly explain karta hai, isliye aur — woh factor jis se ka variance no-collinearity case ke relative inflate hota hai. Ek common rule of thumb ko flag karta hai.
Level 4 — Synthesis
Kai ideas ko ek argument mein combine karo.
Exercise 4.1
Prove karo ki residual vector , ke har column ke saath orthogonal hai, aur isliye residuals tab zero sum karte hain jab model mein intercept ho. Isko Figure s02 se connect karo.

Recall Solution 4.1
Orthogonality. Normal equations se shuru karo. Sab kuch ek side le aao: literally kehta hai ki ke har column ka ke saath dot product zero hai — matlab har predictor direction ke perpendicular hai. Yeh orthogonal projection hai: column space par ki shadow hai, perpendicular drop hai (Figure s02, red arrow). Residuals zero sum karte hain. Intercept ke saath, ka pehla column sab ones ka hai, . ki uss row mein: To positive aur negative vertical gaps exactly cancel ho jaate hain — 1-column include karne ka seedha consequence.
Exercise 4.2
Dikhao ki SST = SSR + SSE decomposition (jo mein use hoti hai) actually projection ke liye Pythagorean theorem hai. centering use karo. (Yaad raho = sum of squares due to regression, page ke top par define ki gayi hai.)
Recall Solution 4.2
Sab kuch subtract karke center karo. Likho:
- total vector (length = ),
- explained vector (length = ),
- residual vector (length = ). Yeh add hote hain: . Squared length lo: Cross term vanish ho jaata hai: column space of mein rehta hai (dono aur , ke columns ke combinations hain), aur us poore space ke Ex 4.1 se. To , deta hai: Yeh exactly hai ek right triangle ke liye jiska right angle par hai — same right angle Figure s02 se.
Level 5 — Mastery
Kuch general prove karo, ya koi degenerate case handle karo.
Exercise 5.1
Prove karo ki hamesha positive semidefinite hota hai, aur yeh positive definite (aur isliye invertible) hota hai iff ke columns linearly independent hain. Explain karo ki "perfect multicollinearity" iske saath kya karta hai.
Recall Solution 5.1
PSD. Kisi bhi vector ke liye: Squared length kabhi negative nahi hoti, isliye positive semidefinite hai. Hamesha. Positive definite iff full column rank. force karta hai .
- Agar columns linearly independent hain, to sirf hi deta hai. To har ke liye → positive definite → invertible → unique .
- Agar columns dependent hain (perfect collinearity), koi deta hai, to with → sirf semidefinite, , invertible nahi. Formula exist nahi karta; infinitely many minimize karte hain.
Exercise 5.2
Ex 5.1 use karke dikhao ki jab invertible hota hai, least-squares solution sirf ek stationary point nahi balki ka unique global minimum hai.
Recall Solution 5.2
Objective hai , ek quadratic jiska Hessian (second derivatives ki matrix) hai . Ex 5.1 se yeh positive definite hai jab columns independent hain. Positive-definite Hessian wala quadratic strictly convex hota hai: yeh har direction mein upar curve karta hai, isliye iska exactly ek lowest point hai aur koi doosra stationary point nahi. Woh single point woh hai jahan gradient vanish hota hai — matlab normal equations — unique deta hai. Gauss–Markov Theorem ko "the" estimator ki baat karne ke liye exactly yahi chahiye. Simple Linear Regression se compare karo, jahan same convexity ek best line deti hai.
Recall Quick self-check
Jaane se pehle ek-line answers. Ex 2.1 mein aur kya hain? ::: aur . Ex 3.1 mein, adjusted kyun girta hai jab plain badhta hai? ::: Degrees-of-freedom penalty useless predictor ke liye ke girne se zyada tezi se shrink karti hai. Kaunsi ek equation prove karti hai ki residual ke har column ke saath hai? ::: (normal equations rearranged). positive definite (sirf PSD nahi) kab hota hai? ::: Exactly jab ke linearly independent columns hon (full column rank).