Menu Close

Regression analysis: UPSC Statistics Optional PYQ Solutions (1995–2026)

All 31 questions UPSC has asked on regression analysis in the Statistics Optional (Paper I, Linear Inference and Multivariate Analysis) from 1995 to 2026, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Linear Inference and Multivariate Analysis topic-wise PYQs page.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers were worked out again independently in code (Python with NumPy/SciPy) and matched.
  • ✓ Proof checked step by step for “prove that” and “examine whether” questions, every step was checked against the definitions and the standard theorems.
  • ✓ Derivation checked step by step for derivations and approximations, every step was checked, and the result was also tested numerically.
  • ✓ Answer checked step by step for descriptive questions, every point was checked against the standard theory.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2026 · 6c 2025 · 5a 2024 · 6c 2023 · 5c 2022 · 8a 2021 · 5a 2021 · 5c 2021 · 8b 2020 · 5a 2017 · 8b 2015 · 7c 2011 · 6a 2010 · 5d 2010 · 8b 2009 · 6b 2007 · 5a 2006 · 6b 2005 · 5c 2003 · 5b 2002 · 6a 1998 · 9b 1998 · 10c 1997 · 10a 1997 · 10b 1996 · 10a 1996 · 10b 1996 · 11b 1995 · 10a 1995 · 10b 1995 · 10c 1995 · 12b

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Discuss orthogonal polynomial regression on a single variable along with its principal advantages.

2026 · Paper I · Q6c · 15 marks

Solution

The problem with ordinary polynomials. A polynomial regression y=β0+β1x+…+βkxk+ey=\beta_0+\beta_1x+\dots+\beta_kx^k+e is a linear model, but the columns 1,x,x2,…1,x,x^2,\dots are highly correlated. The normal equations are badly conditioned, and every coefficient changes when the degree is raised.

Orthogonal polynomials. Replace the powers of xx by polynomials P0(x)=1,P1(x),…,Pk(x)P_0(x)=1,P_1(x),\dots,P_k(x), where PrP_r has degree rr and, over the observed values x1,…,xnx_1,\dots,x_n, ∑i=1nPr(xi)Ps(xi)=0(r≠s).\sum_{i=1}^nP_r(x_i)P_s(x_i)=0\qquad(r\ne s). The model is yi=α0+α1P1(xi)+…+αkPk(xi)+ei.y_i=\alpha_0+\alpha_1P_1(x_i)+\dots+\alpha_kP_k(x_i)+e_i . It spans exactly the same space as the ordinary polynomial of degree kk, so the fitted values are identical.

Construction. Use the three-term recurrence P0=1,P1(x)=x−x‾,Pr+1(x)=(x−ar+1)Pr(x)−brPr−1(x),P_0=1,\qquad P_1(x)=x-\bar x,\qquad P_{r+1}(x)=(x-a_{r+1})P_r(x)-b_rP_{r-1}(x), ar+1=∑xiPr2(xi)∑Pr2(xi),br=∑Pr2(xi)∑Pr−12(xi).a_{r+1}=\frac{\sum x_iP_r^2(x_i)}{\sum P_r^2(x_i)},\qquad b_r=\frac{\sum P_r^2(x_i)}{\sum P_{r-1}^2(x_i)}. For equally spaced xx the values are tabulated (Fisher and Yates). For example, with x=1,2,3,4,5x=1,2,3,4,5: P1:−2,−1,0,1,2P_1:-2,-1,0,1,2; P2:2,−1,−2,−1,2P_2:2,-1,-2,-1,2; P3:−1,2,0,−2,1P_3:-1,2,0,-2,1.

Estimation. Because X′XX'X is diagonal, each coefficient is estimated on its own: α̂r=∑iyiPr(xi)∑iPr2(xi),V(α̂r)=σ2∑Pr2(xi),\hat\alpha_r=\frac{\sum_iy_iP_r(x_i)}{\sum_iP_r^2(x_i)},\qquad V(\hat\alpha_r)=\frac{\sigma^2}{\sum P_r^2(x_i)}, and the regression sum of squares splits into independent single-df pieces, Sr=α̂r2∑Pr2(xi)=(∑yiPr(xi))2∑Pr2(xi).S_r=\hat\alpha_r^2\sum P_r^2(x_i)=\frac{\big(\sum y_iP_r(x_i)\big)^2}{\sum P_r^2(x_i)} .

Principal advantages.

  1. No re-fitting. Raising the degree from kk to k+1k+1 adds one term; α̂0,…,α̂k\hat\alpha_0,\dots,\hat\alpha_k do not change.
  2. Simple computation. No matrix inversion; the normal equations are diagonal and well conditioned.
  3. Independent estimates. The α̂r\hat\alpha_r are uncorrelated (independent under normality).
  4. Easy choice of degree. Each SrS_r is tested on its own with F=Sr/σ̂2F=S_r/\hat\sigma^2 on (1,ν)(1,\nu) df, so we can see directly whether the linear, quadratic, cubic, … components are needed.
  5. Clear interpretation. Each term measures one component of the trend: linear, quadratic and so on.
  6. Use in experiments. With equally spaced quantitative levels of a treatment, the treatment SS is split into linear, quadratic and higher components.

✓ Answer checked step by step Every step was checked: the construction of orthogonal polynomials by the three-term recurrence and the reasons they make fitting and testing simpler.

↑ Back to the question list

For a two variable linear regression model Yi=a+bXi+ei, where E(ei)=0, Var(ei)=σe2, Cov(ei,ej)=0 for i≠j,(i,j)∈{1,2,…,n}, if â and b̂ are least square estimators of a and b respectively, derive expressions for Var(â), Var(b̂) and Cov(â,b̂).

2025 · Paper I · Q5a · 10 marks

Solution

Estimators. With Sxx=∑(xi−x‾)2S_{xx}=\sum(x_i-\bar x)^2, least squares gives b̂=∑(xi−x‾)(Yi−Y‾)Sxx=∑iciYi,ci=xi−x‾Sxx,\hat b=\frac{\sum(x_i-\bar x)(Y_i-\bar Y)}{S_{xx}}=\sum_ic_iY_i,\qquad c_i=\frac{x_i-\bar x}{S_{xx}}, â=Y‾−b̂x‾.\hat a=\bar Y-\hat b\bar x . The weights satisfy ∑ci=0\sum c_i=0, ∑cixi=1\sum c_ix_i=1 and ∑ci2=1/Sxx\sum c_i^2=1/S_{xx}. The YiY_i are uncorrelated with common variance σe2\sigma_e^2.

V(b̂)V(\hat b). V(b̂)=∑ci2V(Yi)=σe2∑ci2=σe2Sxx.V(\hat b)=\sum c_i^2V(Y_i)=\sigma_e^2\sum c_i^2=\frac{\sigma_e^2}{S_{xx}} .

Cov(Y‾,b̂)\text{Cov}(\bar Y,\hat b). Cov(Y‾,b̂)=Cov(1n∑Yi,∑ciYi)=σe2n∑ci=0.\text{Cov}(\bar Y,\hat b)=\text{Cov}\Big(\frac1n\sum Y_i,\sum c_iY_i\Big)=\frac{\sigma_e^2}n\sum c_i=0 .

V(â)V(\hat a). V(â)=V(Y‾)+x‾2V(b̂)−2x‾Cov(Y‾,b̂)=σe2n+x‾2σe2Sxx=σe2(1n+x‾2Sxx)=σe2∑xi2nSxx.V(\hat a)=V(\bar Y)+\bar x^2V(\hat b)-2\bar x\,\text{Cov}(\bar Y,\hat b)=\frac{\sigma_e^2}n+\frac{\bar x^2\sigma_e^2}{S_{xx}}=\sigma_e^2\Big(\frac1n+\frac{\bar x^2}{S_{xx}}\Big)=\frac{\sigma_e^2\sum x_i^2}{nS_{xx}} .

Cov(â,b̂)\text{Cov}(\hat a,\hat b). Cov(â,b̂)=Cov(Y‾,b̂)−x‾V(b̂)=−x‾σe2Sxx.\text{Cov}(\hat a,\hat b)=\text{Cov}(\bar Y,\hat b)-\bar x\,V(\hat b)=-\frac{\bar x\,\sigma_e^2}{S_{xx}} .

Matrix form (check). With X=[𝟏,x]X=[\mathbf 1,x], σe2(X′X)−1=σe2nSxx(∑xi2−nx‾−nx‾n),\sigma_e^2(X'X)^{-1}=\frac{\sigma_e^2}{nS_{xx}}\begin{pmatrix}\sum x_i^2&-n\bar x\\-n\bar x&n\end{pmatrix}, which gives the same three results. â\hat a and b̂\hat b are uncorrelated only when x‾=0\bar x=0.

✓ Derivation checked step by step Every step was checked: the estimators as linear combinations of the y’s, and their variances and covariance, which match σ²(X′X)⁻¹.

↑ Back to the question list

For the simple linear regression model y=β0+β1x+ε, where β0 and β1 are parameters and ε has zero mean and an unknown variance σ2, find the estimates of β0 and β1 by the principle of least squares as well as the method of maximum likelihood. Examine whether they are identical.

2024 · Paper I · Q6c · 15 marks

Solution

Least squares. Minimise S(β0,β1)=∑i=1n(yi−β0−β1xi)2.S(\beta_0,\beta_1)=\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)^2 . ∂S∂β0=−2∑(yi−β0−β1xi)=0,∂S∂β1=−2∑xi(yi−β0−β1xi)=0.\frac{\partial S}{\partial\beta_0}=-2\sum(y_i-\beta_0-\beta_1x_i)=0,\qquad\frac{\partial S}{\partial\beta_1}=-2\sum x_i(y_i-\beta_0-\beta_1x_i)=0 . Normal equations: ∑yi=nβ0+β1∑xi,∑xiyi=β0∑xi+β1∑xi2.\sum y_i=n\beta_0+\beta_1\sum x_i,\qquad\sum x_iy_i=\beta_0\sum x_i+\beta_1\sum x_i^2 . Solution: β̂1=SxySxx=∑(xi−x‾)(yi−y‾)∑(xi−x‾)2,β̂0=y‾−β̂1x‾.\hat\beta_1=\frac{S_{xy}}{S_{xx}}=\frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sum(x_i-\bar x)^2},\qquad\hat\beta_0=\bar y-\hat\beta_1\bar x . Least squares needs only E(ε)=0E(\varepsilon)=0, a constant variance and uncorrelated errors; it does not estimate σ2\sigma^2 by itself. The usual unbiased estimate is s2=1n−2∑(yi−ŷi)2s^2=\frac{1}{n-2}\sum(y_i-\hat y_i)^2.

Maximum likelihood. This requires a distribution: assume εi∼iidN(0,σ2)\varepsilon_i\stackrel{iid}\sim N(0,\sigma^2). Then logL=−n2log(2πσ2)−12σ2∑(yi−β0−β1xi)2.\log L=-\frac n2\log(2\pi\sigma^2)-\frac1{2\sigma^2}\sum(y_i-\beta_0-\beta_1x_i)^2 . For any fixed σ2\sigma^2, logL\log L is maximised over (β0,β1)(\beta_0,\beta_1) by minimising ∑(yi−β0−β1xi)2\sum(y_i-\beta_0-\beta_1x_i)^2, the least squares criterion. So the likelihood equations for β0,β1\beta_0,\beta_1 are exactly the normal equations, and β̂0,ML=β̂0,LS,β̂1,ML=β̂1,LS.\hat\beta_{0,ML}=\hat\beta_{0,LS},\qquad\hat\beta_{1,ML}=\hat\beta_{1,LS}. Setting ∂logL/∂σ2=0\partial\log L/\partial\sigma^2=0 gives σ̂ML2=1n∑(yi−β̂0−β̂1xi)2.\hat\sigma^2_{ML}=\frac1n\sum(y_i-\hat\beta_0-\hat\beta_1x_i)^2 .

Are they identical?

  • For β0\beta_0 and β1\beta_1: yes, under normal errors the ML and LS estimates coincide.
  • For σ2\sigma^2: no. The ML estimate divides by nn and is biased, E(σ̂ML2)=n−2nσ2E(\hat\sigma^2_{ML})=\frac{n-2}n\sigma^2, while the usual estimate divides by n−2n-2 and is unbiased.
  • If the errors are not normal (for example Laplace or Cauchy), the ML estimates of β0,β1\beta_0,\beta_1 differ from least squares.

✓ Derivation checked step by step Every step was checked: the normal equations, the likelihood equations under normal errors, and the two estimates of σ².

↑ Back to the question list

Let x1,x2,…,xn be n given observations, and suppose that Yi=β0+β1xi+ei;i=1,2,…,n, where β0,β1 are unknown parameters and ei are mutually independent normal random variables with E(ei)=0 and V(ei)=σ2,i=1,2,…,n. Also, σ2 is assumed to be unknown. Test the null hypothesis H0:β0=β1=0.

2023 · Paper I · Q5c · 10 marks

Solution

Hypothesis. H0:β0=β1=0H_0:\beta_0=\beta_1=0, that is, E(Yi)=0E(Y_i)=0 for all ii, against H1H_1: at least one of β0,β1\beta_0,\beta_1 is non-zero.

Unrestricted model. The least squares estimates are β̂1=SxY/Sxx\hat\beta_1=S_{xY}/S_{xx} and β̂0=Y‾−β̂1x‾\hat\beta_0=\bar Y-\hat\beta_1\bar x, and the residual sum of squares is RSS1=∑(Yi−β̂0−β̂1xi)2=SYY−SxY2Sxx,RSS1σ2∼χn−22.\text{RSS}_1=\sum(Y_i-\hat\beta_0-\hat\beta_1x_i)^2=S_{YY}-\frac{S_{xY}^2}{S_{xx}},\qquad\frac{\text{RSS}_1}{\sigma^2}\sim\chi^2_{n-2}.

Restricted model. Under H0H_0 the model is Yi=eiY_i=e_i, with nothing to estimate, so RSS0=∑Yi2.\text{RSS}_0=\sum Y_i^2 .

Sum of squares due to (β0,β1)(\beta_0,\beta_1). RSS0−RSS1=∑Yi2−RSS1=nY‾2+β̂12Sxx=β̂′X′Xβ̂.\text{RSS}_0-\text{RSS}_1=\sum Y_i^2-\text{RSS}_1=n\bar Y^2+\hat\beta_1^2S_{xx}=\hat\beta'X'X\hat\beta . Under H0H_0 this is σ2χ22\sigma^2\chi^2_2, independent of RSS1\text{RSS}_1 (it is a projection of YY onto the column space of XX, while RSS1\text{RSS}_1 lies in its orthogonal complement).

Test statistic. F=(RSS0−RSS1)/2RSS1/(n−2)=(nY‾2+β̂12Sxx)/2s2∼F2,n−2under H0,F=\frac{(\text{RSS}_0-\text{RSS}_1)/2}{\text{RSS}_1/(n-2)}=\frac{\big(n\bar Y^2+\hat\beta_1^2S_{xx}\big)/2}{s^2}\sim F_{2,\,n-2}\quad\text{under }H_0, where s2=RSS1/(n−2)s^2=\text{RSS}_1/(n-2). We reject H0H_0 at level α\alpha if F>Fα(2,n−2)F>F_\alpha(2,n-2).

Source df SS MS F
Regression (β0,β1\beta_0,\beta_1) 2 nY‾2+β̂12Sxxn\bar Y^2+\hat\beta_1^2S_{xx} SS/2 MS/s2s^2
Residual n−2n-2 RSS1\text{RSS}_1 s2s^2
Total (uncorrected) nn ∑Yi2\sum Y_i^2

Equivalently, F=β̂′(X′X)β̂2s2F=\dfrac{\hat\beta'(X'X)\hat\beta}{2s^2}; this is the general linear-hypothesis test for H0:β=0H_0:\beta=0.

✓ Derivation checked step by step Every step was checked: the restricted and unrestricted residual sums of squares and the F statistic on (2, n − 2) df.

↑ Back to the question list

(i) What are orthogonal polynomials? How do you fit an orthogonal polynomial of degree ‘p’? (ii) For the model 𝐘n×1=Xn×k𝛃k×1+𝐮n×1,E(𝐮𝐮′)=σ2In, where Xn×k is a matrix of rank k(k<n), find out the value of E[𝐘′(In−X(X′X)−1X′)𝐘].

2022 · Paper I · Q8a · 20 marks

Solution

(i) Orthogonal polynomials. These are polynomials P0(x)=1,P1(x),…,Pp(x)P_0(x)=1,P_1(x),\dots,P_p(x), with PrP_r of degree rr, that are orthogonal over the observed xx values: ∑i=1nPr(xi)Ps(xi)=0(r≠s).\sum_{i=1}^nP_r(x_i)P_s(x_i)=0\qquad(r\ne s).

Fitting a polynomial of degree pp.

  1. Construct the PrP_r by the recurrence P1=x−x‾,Pr+1=(x−ar+1)Pr−brPr−1,ar+1=∑xPr2∑Pr2,br=∑Pr2∑Pr−12P_1=x-\bar x,\qquad P_{r+1}=(x-a_{r+1})P_r-b_rP_{r-1},\quad a_{r+1}=\frac{\sum xP_r^2}{\sum P_r^2},\ b_r=\frac{\sum P_r^2}{\sum P_{r-1}^2} (or take them from tables when xx is equally spaced).
  2. Fit yi=α0+α1P1(xi)+…+αpPp(xi)+eiy_i=\alpha_0+\alpha_1P_1(x_i)+\dots+\alpha_pP_p(x_i)+e_i. Since the columns are orthogonal, α̂0=y‾,α̂r=∑yiPr(xi)∑Pr2(xi),r=1,…,p.\hat\alpha_0=\bar y,\qquad\hat\alpha_r=\frac{\sum y_iP_r(x_i)}{\sum P_r^2(x_i)},\quad r=1,\dots,p .
  3. The SS due to the rr-th term is α̂r∑yiPr(xi)\hat\alpha_r\sum y_iP_r(x_i) on 1 df, and the residual SS is ∑(y−y‾)2−∑r=1pα̂r∑yPr\sum(y-\bar y)^2-\sum_{r=1}^p\hat\alpha_r\sum yP_r on n−p−1n-p-1 df. Each term can be tested with an FF ratio, and the degree is raised until the added terms become non-significant.
  4. If needed, expand the PrP_r to write the fitted curve in powers of xx.

(ii) Expected residual sum of squares. Let H=X(X′X)−1X′H=X(X'X)^{-1}X' and M=In−HM=I_n-H. Then MM is symmetric and idempotent (M2=MM^2=M), and MX=0MX=0.

Since Y=Xβ+uY=X\beta+u, MY=MXβ+Mu=Mu,Y′MY=u′Mu.MY=MX\beta+Mu=Mu,\qquad Y'MY=u'Mu . Using E(u′Mu)=Etr(Muu′)=tr(ME(uu′))=σ2tr(M)E(u'Mu)=E\,\text{tr}(Muu')=\text{tr}\big(M\,E(uu')\big)=\sigma^2\,\text{tr}(M): tr(M)=tr(In)−tr(X(X′X)−1X′)=n−tr((X′X)−1X′X)=n−tr(Ik)=n−k.\text{tr}(M)=\text{tr}(I_n)-\text{tr}\big(X(X'X)^{-1}X'\big)=n-\text{tr}\big((X'X)^{-1}X'X\big)=n-\text{tr}(I_k)=n-k . Hence E[Y′(In−X(X′X)−1X′)Y]=(n−k)σ2.E\big[Y'(I_n-X(X'X)^{-1}X')Y\big]=(n-k)\sigma^2 . So s2=Y′MY/(n−k)s^2=Y'MY/(n-k), the residual mean square, is an unbiased estimator of σ2\sigma^2. (No normality is needed for this.)

✓ Derivation checked step by step Every step was checked: the construction and use of orthogonal polynomials, and E[Y′(I − H)Y] = (n − k)σ² from the trace of an idempotent matrix.

↑ Back to the question list

For a simple linear regression model Y=β0+β1Xi+εi,i=1,…,n (i) Derive the least square estimators of β0 and β1, clearly stating the conditions assumed. (ii) For ei=Yi−Ŷi where Ŷi is the fitted value, show that 1. ∑i=1nei=0 2. ∑i=1nYi=∑i=1nŶi 3. ∑i=1nXiei=0 4. ∑i=1nŶiei=0 5. The regression line passes through (X‾,Y‾).

2021 · Paper I · Q5a · 10 marks

Solution

(i) Least squares estimators.

Conditions. The model Yi=β0+β1Xi+εiY_i=\beta_0+\beta_1X_i+\varepsilon_i is linear in the parameters; the XiX_i are fixed (non-random) and not all equal; E(εi)=0E(\varepsilon_i)=0, V(εi)=σ2V(\varepsilon_i)=\sigma^2 (constant), and Cov(εi,εj)=0\text{Cov}(\varepsilon_i,\varepsilon_j)=0 for i≠ji\ne j. Normality is needed only for tests and intervals.

Minimise S=∑(Yi−β0−β1Xi)2S=\sum(Y_i-\beta_0-\beta_1X_i)^2. The normal equations are ∑(Yi−β0−β1Xi)=0,∑Xi(Yi−β0−β1Xi)=0,\sum(Y_i-\beta_0-\beta_1X_i)=0,\qquad\sum X_i(Y_i-\beta_0-\beta_1X_i)=0, giving β̂1=∑(Xi−X‾)(Yi−Y‾)∑(Xi−X‾)2,β̂0=Y‾−β̂1X‾.\hat\beta_1=\frac{\sum(X_i-\bar X)(Y_i-\bar Y)}{\sum(X_i-\bar X)^2},\qquad\hat\beta_0=\bar Y-\hat\beta_1\bar X . The second derivatives form the positive definite matrix 2(n∑X∑X∑X2)2\begin{pmatrix}n&\sum X\\\sum X&\sum X^2\end{pmatrix}, so this is a minimum.

(ii) Properties of the residuals ei=Yi−Ŷi=Yi−β̂0−β̂1Xie_i=Y_i-\hat Y_i=Y_i-\hat\beta_0-\hat\beta_1X_i.

  1. ∑ei=0\sum e_i=0: this is the first normal equation at the solution.
  2. ∑Yi=∑Ŷi\sum Y_i=\sum\hat Y_i: since Yi=Ŷi+eiY_i=\hat Y_i+e_i, ∑Yi=∑Ŷi+∑ei=∑Ŷi\sum Y_i=\sum\hat Y_i+\sum e_i=\sum\hat Y_i by 1.
  3. ∑Xiei=0\sum X_ie_i=0: this is the second normal equation at the solution.
  4. ∑Ŷiei=0\sum\hat Y_ie_i=0: ∑Ŷiei=∑(β̂0+β̂1Xi)ei=β̂0∑ei+β̂1∑Xiei=0\sum\hat Y_ie_i=\sum(\hat\beta_0+\hat\beta_1X_i)e_i=\hat\beta_0\sum e_i+\hat\beta_1\sum X_ie_i=0 by 1 and 3.
  5. The line passes through (X‾,Y‾)(\bar X,\bar Y): at X=X‾X=\bar X, β̂0+β̂1X‾=(Y‾−β̂1X‾)+β̂1X‾=Y‾.\hat\beta_0+\hat\beta_1\bar X=(\bar Y-\hat\beta_1\bar X)+\hat\beta_1\bar X=\bar Y .

Geometrically, 1, 3 and 4 say that the residual vector is orthogonal to 𝟏\mathbf 1, to XX, and so to every fitted vector in their span.

✓ Proof checked step by step Every step was checked: the normal equations and each of the five residual properties, which all follow from them.

↑ Back to the question list

For the multiple linear regression model with two predictor variables X1 and X2, show that the estimate of regression coefficient of X1 is unchanged when X2 is added to the regression model, whenever X1 and X2 are uncorrelated.

2021 · Paper I · Q5c · 10 marks

Solution

Models. With variables measured from their means (which only shifts the intercept), consider (a) y=β0+β1x1+e,(b) y=β0+β1x1+β2x2+e.\text{(a) } y=\beta_0+\beta_1x_1+e,\qquad\text{(b) } y=\beta_0+\beta_1x_1+\beta_2x_2+e . Write S11=∑x1i2S_{11}=\sum x_{1i}^2, S22=∑x2i2S_{22}=\sum x_{2i}^2, S12=∑x1ix2iS_{12}=\sum x_{1i}x_{2i}, S1y=∑x1iyiS_{1y}=\sum x_{1i}y_i, S2y=∑x2iyiS_{2y}=\sum x_{2i}y_i.

Model (a). β̂1(a)=S1y/S11\hat\beta_1^{(a)}=S_{1y}/S_{11}.

Model (b). The normal equations for the slopes are (S11S12S12S22)(β1β2)=(S1yS2y),\begin{pmatrix}S_{11}&S_{12}\\S_{12}&S_{22}\end{pmatrix}\begin{pmatrix}\beta_1\\\beta_2\end{pmatrix}=\begin{pmatrix}S_{1y}\\S_{2y}\end{pmatrix}, so β̂1(b)=S22S1y−S12S2yS11S22−S122.\hat\beta_1^{(b)}=\frac{S_{22}S_{1y}-S_{12}S_{2y}}{S_{11}S_{22}-S_{12}^2}.

Uncorrelated predictors. If x1x_1 and x2x_2 are uncorrelated in the sample, r12=0r_{12}=0, so S12=0S_{12}=0. Then β̂1(b)=S22S1yS11S22=S1yS11=β̂1(a).\hat\beta_1^{(b)}=\frac{S_{22}S_{1y}}{S_{11}S_{22}}=\frac{S_{1y}}{S_{11}}=\hat\beta_1^{(a)} . The estimate of the coefficient of X1X_1 is unchanged when X2X_2 is added. ◼\blacksquare

Remarks.

  • In matrix terms, the slope part of X′XX'X is diagonal, so each coefficient is estimated independently of the others. The same holds for any number of mutually uncorrelated predictors (this is the basis of orthogonal designs and orthogonal polynomials).
  • The standard error of β̂1\hat\beta_1 does change, because adding x2x_2 changes the residual variance s2s^2.
  • When S12≠0S_{12}\ne0, β̂1(b)=β̂1(a)−β̂2(b)S12/S11\hat\beta_1^{(b)}=\hat\beta_1^{(a)}-\hat\beta_2^{(b)}\,S_{12}/S_{11}: the coefficient changes by an amount that depends on the correlation (omitted-variable bias).

✓ Proof checked step by step We checked the proof, and checked numerically with x₁ and x₂ made exactly uncorrelated that the coefficient of x₁ is 1.978 in both fits.

↑ Back to the question list

(i) For a second order polynomial model with one predictor variable, derive the least squares normal equations clearly stating the conditions assumed. How will you interpret the parameters in this model? (ii) Describe why it is recommended to work with predictor variables centred around the mean. Comment on fitted values of the response variable in this case. Prove your claim.

2021 · Paper I · Q8b · 15 marks

Solution

(i) Second-order model. Yi=β0+β1Xi+β2Xi2+εi,i=1,…,n.Y_i=\beta_0+\beta_1X_i+\beta_2X_i^2+\varepsilon_i,\qquad i=1,\dots,n . Conditions. The XiX_i are fixed, with at least three distinct values; E(εi)=0E(\varepsilon_i)=0, V(εi)=σ2V(\varepsilon_i)=\sigma^2, the errors are uncorrelated (and normal for inference).

Normal equations. Minimising ∑(Yi−β0−β1Xi−β2Xi2)2\sum(Y_i-\beta_0-\beta_1X_i-\beta_2X_i^2)^2: ∑Yi=nβ0+β1∑Xi+β2∑Xi2,\sum Y_i=n\beta_0+\beta_1\sum X_i+\beta_2\sum X_i^2, ∑XiYi=β0∑Xi+β1∑Xi2+β2∑Xi3,\sum X_iY_i=\beta_0\sum X_i+\beta_1\sum X_i^2+\beta_2\sum X_i^3, ∑Xi2Yi=β0∑Xi2+β1∑Xi3+β2∑Xi4.\sum X_i^2Y_i=\beta_0\sum X_i^2+\beta_1\sum X_i^3+\beta_2\sum X_i^4 . Three distinct XX values make the coefficient matrix non-singular.

Interpretation.

  • β0\beta_0 is the mean response at X=0X=0, which is meaningful only if X=0X=0 is within the range of the data.
  • β1\beta_1 is the slope of the curve at X=0X=0: dE(Y)/dX=β1+2β2XdE(Y)/dX=\beta_1+2\beta_2X.
  • β2\beta_2 measures the curvature: the curve opens upward if β2>0\beta_2>0 and downward if β2<0\beta_2<0, with its turning point at X=−β1/(2β2)X=-\beta_1/(2\beta_2).
  • Unlike in a linear model, β1\beta_1 is not “the change in YY per unit change in XX holding the other variables fixed”, because XX and X2X^2 cannot change independently.

(ii) Centring. Let xi=Xi−X‾x_i=X_i-\bar X and fit Yi=γ0+γ1xi+γ2xi2+εi.Y_i=\gamma_0+\gamma_1x_i+\gamma_2x_i^2+\varepsilon_i .

Why it is recommended.

  1. XX and X2X^2 are often very highly correlated (for XX from 20 to 30 the correlation is close to 1). This multicollinearity makes X′XX'X nearly singular, inflates the variances of β̂1,β̂2\hat\beta_1,\hat\beta_2 and causes rounding errors. After centring, xx and x2x^2 are much less correlated, and exactly uncorrelated when the XX values are symmetric about X‾\bar X, since then ∑xi3=0\sum x_i^3=0.
  2. The coefficients become easier to interpret: γ0\gamma_0 is the mean response at X‾\bar X, and γ1\gamma_1 is the slope at X‾\bar X, the centre of the data.

The fitted values are unchanged. Expand γ0+γ1(X−X‾)+γ2(X−X‾)2=(γ0−γ1X‾+γ2X‾2)+(γ1−2γ2X‾)X+γ2X2.\gamma_0+\gamma_1(X-\bar X)+\gamma_2(X-\bar X)^2=(\gamma_0-\gamma_1\bar X+\gamma_2\bar X^2)+(\gamma_1-2\gamma_2\bar X)X+\gamma_2X^2 . So every centred quadratic is an ordinary quadratic, and conversely. The two design matrices X1=[𝟏,X,X2],X2=[𝟏,X−X‾𝟏,(X−X‾)2]X_1=[\mathbf 1,\ X,\ X^2],\qquad X_2=[\mathbf 1,\ X-\bar X\mathbf 1,\ (X-\bar X)^2] satisfy X2=X1TX_2=X_1T with T=(1−X‾X‾201−2X‾001),|T|=1,T=\begin{pmatrix}1&-\bar X&\bar X^2\\0&1&-2\bar X\\0&0&1\end{pmatrix},\qquad|T|=1, so they have the same column space. The least squares fitted vector is the projection of YY onto this column space, so Ŷ=X1(X1′X1)−1X1′Y=X2(X2′X2)−1X2′Y.\hat Y=X_1(X_1'X_1)^{-1}X_1'Y=X_2(X_2'X_2)^{-1}X_2'Y . The fitted values, residuals, residual SS, R2R^2 and the estimate β̂2=γ̂2\hat\beta_2=\hat\gamma_2 of the curvature are identical; only the meaning (and precision) of the lower-order coefficients changes. ◼\blacksquare

✓ Proof checked step by step Every step was checked: the normal equations of the quadratic model, and the proof that centring leaves the fitted values unchanged while reducing the correlation between x and x².

↑ Back to the question list

A student fits the following linear regression model to a given data: yi=α+βxi+ui,i=1,2,…,n ui’s are iid normal values (N(0,σ2)), where σ2 is unknown. The following information is available: n=7,∑(xi−x‾)2=280000,∑(xi−x‾)(yi−y‾)=16500 95% confidence interval for β is: (0.030,0.088). Calculate what proportion of the total variability of the responses is explained by the model. Given that t0.025,5=2.57.

2020 · Paper I · Q5a · 10 marks

Solution

Slope. β̂=SxySxx=16500280000=0.05893.\hat\beta=\frac{S_{xy}}{S_{xx}}=\frac{16500}{280000}=0.05893 . The centre of the given interval, (0.030+0.088)/2=0.059(0.030+0.088)/2=0.059, agrees.

Standard error from the interval. The 95% interval is β̂±t0.025,5SE(β̂)\hat\beta\pm t_{0.025,5}\,\text{SE}(\hat\beta), so its half-width is 2.57SE(β̂)=0.088−0.0302=0.029,SE(β̂)=0.011284.2.57\,\text{SE}(\hat\beta)=\frac{0.088-0.030}{2}=0.029,\qquad\text{SE}(\hat\beta)=0.011284 .

Residual variance. SE(β̂)2=s2/Sxx\text{SE}(\hat\beta)^2=s^2/S_{xx}, so s2=(0.011284)2×280000=35.65,RSS=(n−2)s2=5×35.65=178.26.s^2=(0.011284)^2\times280000=35.65,\qquad\text{RSS}=(n-2)s^2=5\times35.65=178.26 .

Regression sum of squares. SSR=β̂Sxy=0.05893×16500=972.32.\text{SSR}=\hat\beta\,S_{xy}=0.05893\times16500=972.32 .

Proportion explained. R2=SSRSSR+RSS=972.32972.32+178.26=972.321150.58=0.845.R^2=\frac{\text{SSR}}{\text{SSR}+\text{RSS}}=\frac{972.32}{972.32+178.26}=\frac{972.32}{1150.58}=0.845 . About 84.5% of the total variability of the responses is explained by the model.

(Equivalently, t=β̂/SE=5.22t=\hat\beta/\text{SE}=5.22 and R2=t2/(t2+n−2)=27.27/32.27=0.845R^2=t^2/(t^2+n-2)=27.27/32.27=0.845.)

✓ Checked by computer We checked in Python: β̂ = 0.0589, SE = 0.01128, s² = 35.65, residual SS = 178.3, regression SS = 972.3 and R² = 0.845.

↑ Back to the question list

Consider a simple regression model y=β0+β1x+e based on n observations. Show that the regression sum of squares is β̂12∑i=1n(xi−x‾)2. Suppose the summarized data on 10 observations yield ∑i(yi−ŷi)2=3.267,∑iyi=63.3,∑iyi2=423.49,∑ixi=139,∑ixi2=2239 Estimate β1 assuming positive correlation between X and Y. Also obtain coefficient of determination.

2017 · Paper I · Q8b · 15 marks

Solution

Regression SS. The fitted line is ŷi=y‾+β̂1(xi−x‾)\hat y_i=\bar y+\hat\beta_1(x_i-\bar x), so SSR=∑(ŷi−y‾)2=β̂12∑(xi−x‾)2.\text{SSR}=\sum(\hat y_i-\bar y)^2=\hat\beta_1^2\sum(x_i-\bar x)^2 . (Also SSR=β̂1Sxy\text{SSR}=\hat\beta_1S_{xy}, since β̂1=Sxy/Sxx\hat\beta_1=S_{xy}/S_{xx}.)

Summary quantities (n=10n=10). Sxx=2239−139210=2239−1932.1=306.9,S_{xx}=2239-\frac{139^2}{10}=2239-1932.1=306.9, Syy=423.49−63.3210=423.49−400.689=22.801.S_{yy}=423.49-\frac{63.3^2}{10}=423.49-400.689=22.801 . Since Syy=SSR+RSSS_{yy}=\text{SSR}+\text{RSS}: SSR=22.801−3.267=19.534.\text{SSR}=22.801-3.267=19.534 .

Slope. β̂12Sxx=19.534\hat\beta_1^2S_{xx}=19.534, so β̂12=19.534306.9=0.06365,β̂1=+0.2523,\hat\beta_1^2=\frac{19.534}{306.9}=0.06365,\qquad\hat\beta_1=+0.2523, taking the positive root because the correlation is positive. (The intercept is β̂0=y‾−β̂1x‾=6.33−0.2523×13.9=2.82\hat\beta_0=\bar y-\hat\beta_1\bar x=6.33-0.2523\times13.9=2.82.)

Coefficient of determination. R2=SSRSyy=19.53422.801=0.857.R^2=\frac{\text{SSR}}{S_{yy}}=\frac{19.534}{22.801}=0.857 . So the regression on xx explains about 85.7% of the variation in yy (r=+0.926r=+0.926).

✓ Checked by computer We checked in Python: Sₓₓ = 306.9, Sᵧᵧ = 22.801, regression SS = 19.534, β̂₁ = 0.2523 and R² = 0.857.

↑ Back to the question list

Consider the simple linear regression model yi=β0+β1xi+ei, i=1,2,…,n. Show that if the xis’ are equally spaced (i.e. xi=u+iv for fixed values of u and v), then yi=γ0+γ1i+ei is an equivalent reparametrization (in the sense that both the design matrices have the same column space).

2015 · Paper I · Q7c · 15 marks

Solution

Design matrices. For the original model the design matrix has rows (1,xi)(1,x_i): X=(1x1⋮⋮1xn)=(1u+v1u+2v⋮⋮1u+nv).X=\begin{pmatrix}1&x_1\\\vdots&\vdots\\1&x_n\end{pmatrix}=\begin{pmatrix}1&u+v\\1&u+2v\\\vdots&\vdots\\1&u+nv\end{pmatrix}. For the reparametrised model yi=γ0+γ1i+eiy_i=\gamma_0+\gamma_1i+e_i it has rows (1,i)(1,i): Z=(1112⋮⋮1n).Z=\begin{pmatrix}1&1\\1&2\\\vdots&\vdots\\1&n\end{pmatrix}.

Relation. Since xi=u+vix_i=u+vi, X=Z(1u0v)=ZT.X=Z\begin{pmatrix}1&u\\0&v\end{pmatrix}=ZT . With v≠0v\ne0 (the xx’s are distinct), |T|=v≠0|T|=v\ne0, so TT is invertible and Z=XT−1Z=XT^{-1}.

Same column space. Every column of XX is a linear combination of the columns of ZZ, since X=ZTX=ZT, so 𝒞(X)⊆𝒞(Z)\mathcal C(X)\subseteq\mathcal C(Z). Since Z=XT−1Z=XT^{-1}, also 𝒞(Z)⊆𝒞(X)\mathcal C(Z)\subseteq\mathcal C(X). Hence 𝒞(X)=𝒞(Z),\mathcal C(X)=\mathcal C(Z), and the two models are equivalent reparametrisations. ◼\blacksquare

Consequences. The set of possible mean vectors {Xβ}={Zγ}\{X\beta\}=\{Z\gamma\} is the same, so the fitted values, residuals and residual SS are identical. The parameters are related by Xβ=ZTβ=ZγX\beta=ZT\beta=Z\gamma, so γ=Tβ:γ0=β0+uβ1,γ1=vβ1,\gamma=T\beta:\qquad\gamma_0=\beta_0+u\beta_1,\qquad\gamma_1=v\beta_1, and the least squares estimates satisfy the same relations. Working with i=1,…,ni=1,\dots,n (or the centred i−n+12i-\frac{n+1}2) simplifies the arithmetic when the xx’s are equally spaced.

✓ Proof checked step by step We checked the proof: the two design matrices are related by an invertible 2 × 2 matrix, so they have the same column space.

↑ Back to the question list

Give the outline of the procedure, using ANOVA technique, for testing if the response variable y is dependent on a fixed set of variables x1,x2,…,xk, based on an observed set of data on these variables.

2011 · Paper I · Q6a · 20 marks

Solution

Model. We have nn observations (yi,x1i,…,xki)(y_i,x_{1i},\dots,x_{ki}) and fit yi=β0+β1x1i+…+βkxki+ei,ei∼iidN(0,σ2),y_i=\beta_0+\beta_1x_{1i}+\dots+\beta_kx_{ki}+e_i,\qquad e_i\stackrel{iid}\sim N(0,\sigma^2), or Y=Xβ+eY=X\beta+e with XX of order n×(k+1)n\times(k+1) and full rank.

Hypothesis. “yy does not depend on the xx’s”: H0:β1=β2=…=βk=0againstH1:at least one βj≠0.H_0:\beta_1=\beta_2=\dots=\beta_k=0\qquad\text{against}\qquad H_1:\text{at least one }\beta_j\ne0 .

Procedure.

  1. Fit by least squares: β̂=(X′X)−1X′Y\hat\beta=(X'X)^{-1}X'Y and ŷ=Xβ̂\hat y=X\hat\beta.
  2. Split the total (corrected) sum of squares: ∑(yi−y‾)2⏟TSS=∑(ŷi−y‾)2⏟SSR+∑(yi−ŷi)2⏟SSE.\underbrace{\sum(y_i-\bar y)^2}_{\text{TSS}}=\underbrace{\sum(\hat y_i-\bar y)^2}_{\text{SSR}}+\underbrace{\sum(y_i-\hat y_i)^2}_{\text{SSE}}. In matrix form, SSR=β̂′X′Y−ny‾2\text{SSR}=\hat\beta'X'Y-n\bar y^2 and SSE=Y′Y−β̂′X′Y\text{SSE}=Y'Y-\hat\beta'X'Y.
  3. Distributions: SSE/σ2∼χn−k−12\text{SSE}/\sigma^2\sim\chi^2_{n-k-1} always, and under H0H_0, SSR/σ2∼χk2\text{SSR}/\sigma^2\sim\chi^2_k, independent of SSE.
  4. ANOVA table:
Source df SS MS F
Regression kk SSR MSR = SSR/kk MSR/MSE
Residual n−k−1n-k-1 SSE MSE = SSE/(n−k−1)(n-k-1)
Total n−1n-1 TSS
  1. Under H0H_0, F=MSR/MSE∼Fk,n−k−1F=\text{MSR}/\text{MSE}\sim F_{k,\,n-k-1}. Reject H0H_0 at level α\alpha if F>Fα(k,n−k−1)F>F_\alpha(k,n-k-1): then yy depends on at least one of the xx’s.
  2. In terms of R2=SSR/TSSR^2=\text{SSR}/\text{TSS}: F=R2/k(1−R2)/(n−k−1).F=\frac{R^2/k}{(1-R^2)/(n-k-1)} .
  3. If H0H_0 is rejected, test the individual coefficients with tj=β̂j/SE(β̂j)t_j=\hat\beta_j/\text{SE}(\hat\beta_j) on n−k−1n-k-1 df, or test subsets of variables with the extra sum of squares F=(SSEreduced−SSEfull)/qMSEfullF=\frac{(\text{SSE}_{\text{reduced}}-\text{SSE}_{\text{full}})/q}{\text{MSE}_{\text{full}}}.

✓ Derivation checked step by step Every step was checked: the decomposition of the total sum of squares, the F test on (k, n − k − 1) df and its link with R².

↑ Back to the question list

Consider the mean vector for X=[X1X2] to be μx=[3−2] and for Y to be μy=4. The covariance matrices for X1, X2 and Y are Σxx=[2111],σYY=9 and ΣXY=[31] Fit the equation Y=b0+b1X1+b2X2 and calculate multiple correlation coefficient.

2010 · Paper I · Q5d · 12 marks

Solution

(This question is also listed under 3.4 Multiple and partial correlation. The worked solution is repeated here so that this page is complete.)

Regression coefficients. The population least squares coefficients are (b1b2)=ΣXX−1ΣXY=12−1(1−1−12)(31)=(2−1).\begin{pmatrix}b_1\\b_2\end{pmatrix}=\Sigma_{XX}^{-1}\Sigma_{XY}=\frac1{2-1}\begin{pmatrix}1&-1\\-1&2\end{pmatrix}\begin{pmatrix}3\\1\end{pmatrix}=\begin{pmatrix}2\\-1\end{pmatrix}.

Intercept. b0=μY−b1μX1−b2μX2=4−2(3)−(−1)(−2)=4−6−2=−4.b_0=\mu_Y-b_1\mu_{X_1}-b_2\mu_{X_2}=4-2(3)-(-1)(-2)=4-6-2=-4 .

Fitted equation. Ŷ=−4+2X1−X2.\hat Y=-4+2X_1-X_2 .

Multiple correlation coefficient. R2=ΣYXΣXX−1ΣXYσYY=(3,1)(2−1)9=6−19=59,R^2=\frac{\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}}{\sigma_{YY}}=\frac{(3,1)\begin{pmatrix}2\\-1\end{pmatrix}}9=\frac{6-1}{9}=\frac59, R=5/9=0.745.R=\sqrt{5/9}=0.745 . So the regression explains 55.6% of the variance of YY; the residual variance is 9−5=49-5=4.

✓ Checked by computer We checked in Python: b = (2, −1), b₀ = −4 and R² = 5/9, so R = 0.745.

↑ Back to the question list

Obtain an expression for estimated value of Y for given X=x0 by fitting a curve eXY=a+be2X to n given points (xi,yi), i=1,2,…,n using least-square method.

2010 · Paper I · Q8b · 20 marks

Solution

Linearising. Put U=eXY,V=e2X.U=e^XY,\qquad V=e^{2X}. The curve eXY=a+be2Xe^XY=a+be^{2X} becomes the straight line U=a+bV.U=a+bV .

Least squares. With ui=exiyiu_i=e^{x_i}y_i and vi=e2xiv_i=e^{2x_i}, minimise ∑(ui−a−bvi)2\sum(u_i-a-bv_i)^2. The normal equations are ∑ui=na+b∑vi,∑uivi=a∑vi+b∑vi2,\sum u_i=na+b\sum v_i,\qquad\sum u_iv_i=a\sum v_i+b\sum v_i^2, that is, ∑exiyi=na+b∑e2xi,∑e3xiyi=a∑e2xi+b∑e4xi.\sum e^{x_i}y_i=na+b\sum e^{2x_i},\qquad\sum e^{3x_i}y_i=a\sum e^{2x_i}+b\sum e^{4x_i}. Solving: b̂=n∑e3xiyi−∑e2xi∑exiyin∑e4xi−(∑e2xi)2=∑(vi−v‾)(ui−u‾)∑(vi−v‾)2,â=u‾−b̂v‾,\hat b=\frac{n\sum e^{3x_i}y_i-\sum e^{2x_i}\sum e^{x_i}y_i}{n\sum e^{4x_i}-\big(\sum e^{2x_i}\big)^2}=\frac{\sum(v_i-\bar v)(u_i-\bar u)}{\sum(v_i-\bar v)^2},\qquad\hat a=\bar u-\hat b\bar v, with u‾=1n∑exiyi\bar u=\frac1n\sum e^{x_i}y_i and v‾=1n∑e2xi\bar v=\frac1n\sum e^{2x_i}.

Estimated YY at X=x0X=x_0. From ex0Ŷ=â+b̂e2x0e^{x_0}\hat Y=\hat a+\hat be^{2x_0}: Ŷ0=âe−x0+b̂ex0=e−x0{u‾+b̂(e2x0−v‾)}.\hat Y_0=\hat ae^{-x_0}+\hat be^{x_0}=e^{-x_0}\big\{\bar u+\hat b\,(e^{2x_0}-\bar v)\big\}.

Remark. This minimises the squared errors in U=eXYU=e^XY, as the curve is written. If instead we want to minimise the squared errors in YY itself, we fit Y=ae−X+beXY=ae^{-X}+be^{X} directly, which is also linear in a,ba,b, with normal equations ∑yie−xi=a∑e−2xi+bn,∑yiexi=an+b∑e2xi,\sum y_ie^{-x_i}=a\sum e^{-2x_i}+bn,\qquad\sum y_ie^{x_i}=an+b\sum e^{2x_i}, and the same formula Ŷ0=âe−x0+b̂ex0\hat Y_0=\hat ae^{-x_0}+\hat be^{x_0} with those estimates.

✓ Derivation checked step by step Every step was checked: the transformation to a straight line in U = eˣY and V = e²ˣ, the normal equations, and the back-transformation to the estimate of Y at x₀.

↑ Back to the question list

Based on a set of data (xi,yij), j=1(1)ni, i=1(1)p, discuss how you would use the technique of Analysis of Variance for testing the hypothesis that the regression equation of y on x is linear.

2009 · Paper I · Q6b · 20 marks

Solution

Data. At each of pp distinct values xix_i there are nin_i observations yijy_{ij}, N=∑niN=\sum n_i. Repeated observations at the same xx allow us to estimate the pure error variance without assuming any form for the regression.

Model. yij=μi+eijy_{ij}=\mu_i+e_{ij}, eij∼iidN(0,σ2)e_{ij}\stackrel{iid}\sim N(0,\sigma^2), where μi=E(y∣xi)\mu_i=E(y\mid x_i) is unrestricted. H0:μi=α+βxifor all i(the regression is linear).H_0:\mu_i=\alpha+\beta x_i\ \ \text{for all }i\ \ (\text{the regression is linear}).

Partition of the total sum of squares. With y‾i\bar y_i the mean at xix_i, y‾\bar y the grand mean, and ŷi=α̂+β̂xi\hat y_i=\hat\alpha+\hat\beta x_i the least squares line fitted to all NN points: ∑i∑j(yij−y‾)2=∑i∑j(yij−y‾i)2⏟within (pure error)+∑ini(y‾i−ŷi)2⏟deviation from linearity+∑ini(ŷi−y‾)2⏟linear regression.\sum_i\sum_j(y_{ij}-\bar y)^2=\underbrace{\sum_i\sum_j(y_{ij}-\bar y_i)^2}_{\text{within (pure error)}}+\underbrace{\sum_in_i(\bar y_i-\hat y_i)^2}_{\text{deviation from linearity}}+\underbrace{\sum_in_i(\hat y_i-\bar y)^2}_{\text{linear regression}} . The between-group SS ∑ni(y‾i−y‾)2\sum n_i(\bar y_i-\bar y)^2 splits into the linear regression part, β̂2∑ni(xi−x‾)2\hat\beta^2\sum n_i(x_i-\bar x)^2 on 1 df, and the deviation-from-linearity part on p−2p-2 df.

In terms of correlations, the between-group SS is ηyx2Syy\eta_{yx}^2S_{yy} and the regression SS is r2Syyr^2S_{yy}, where ηyx\eta_{yx} is the correlation ratio.

ANOVA table.

Source df SS MS
Linear regression 1 r2Syyr^2S_{yy}
Deviation from linearity p−2p-2 (η2−r2)Syy(\eta^2-r^2)S_{yy} MDM_D
Within groups (pure error) N−pN-p (1−η2)Syy(1-\eta^2)S_{yy} MEM_E
Total N−1N-1 SyyS_{yy}

Test. Under H0H_0, F=MDME=(η2−r2)/(p−2)(1−η2)/(N−p)∼Fp−2,N−p.F=\frac{M_D}{M_E}=\frac{(\eta^2-r^2)/(p-2)}{(1-\eta^2)/(N-p)}\sim F_{p-2,\,N-p}. We reject linearity at level α\alpha if F>Fα(p−2,N−p)F>F_\alpha(p-2,N-p). If linearity is not rejected, the deviation and within SS can be pooled to test the slope: F=r2Syy/{(1−r2)Syy/(N−2)}F=r^2S_{yy}\big/\{(1-r^2)S_{yy}/(N-2)\} on (1,N−2)(1,N-2) df.

✓ Derivation checked step by step Every step was checked: the split of the total sum of squares into linear regression, deviation from linearity and within-group parts, and the F test for linearity.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

What are outliers in the context of regression analysis? How can you use Cook’s distance to detect outliers?

2007 · Paper I · Q5a · 12 marks

Solution

Outliers in regression. An outlier is an observation whose response is far from the value the fitted model predicts, i.e. it has an unusually large residual compared with the others. Related ideas:

  • A high-leverage point has an unusual value of the regressors (far from the centre of the xx’s). Its leverage hiih_{ii}, the ii-th diagonal element of the hat matrix H=X(X′X)−1X′H=X(X'X)^{-1}X', is large.
  • An influential point is one whose deletion changes the fitted coefficients appreciably. An outlier with high leverage is usually influential.

Outliers may come from recording errors, from a different population, or from a wrong model. They inflate s2s^2 and can distort the fit, so they must be detected, checked and either corrected, down-weighted or explained.

Cook’s distance. For observation ii, with β̂(i)\hat\beta_{(i)} the estimate obtained without it and pp the number of parameters, Di=(β̂(i)−β̂)′X′X(β̂(i)−β̂)ps2=∑j(ŷj−ŷj(i))2ps2.D_i=\frac{(\hat\beta_{(i)}-\hat\beta)'X'X(\hat\beta_{(i)}-\hat\beta)}{p\,s^2}=\frac{\sum_j(\hat y_j-\hat y_{j(i)})^2}{p\,s^2}. It measures how far all the fitted values move when observation ii is deleted. A convenient form, which needs only one fit, is Di=ri2p⋅hii1−hii,ri=eis1−hii(studentised residual).D_i=\frac{r_i^2}{p}\cdot\frac{h_{ii}}{1-h_{ii}},\qquad r_i=\frac{e_i}{s\sqrt{1-h_{ii}}}\ \ (\text{studentised residual}). So DiD_i is large when the residual is large, the leverage is large, or both.

Using it.

  1. Fit the model; compute eie_i, hiih_{ii}, rir_i and DiD_i for every observation.
  2. Compare DiD_i with the median of the Fp,n−pF_{p,\,n-p} distribution (about 1): Di>1D_i>1 marks a highly influential point, since deleting it moves β̂\hat\beta beyond the 50% confidence ellipsoid. Many analysts also examine any Di>4/nD_i>4/n, or points that stand out on an index plot of DiD_i.
  3. Investigate flagged points: check the data, refit without them and compare the conclusions, or use robust regression.

Large studentised residuals (|ri|>2|r_i|>2 or 3) flag outliers in yy; large hiih_{ii} (>2p/n>2p/n) flags unusual xx; Cook’s DiD_i combines both into a single measure of influence.

✓ Answer checked step by step Every step was checked: the definition of Cook’s distance through the leverage and the standardised residual, and the usual cut-off values.

↑ Back to the question list

Describe curvilinear regression. Given that ∑18X=158,∑18X2=5530,∑18logy=13.0312 and ∑18Xlogy=212.1224, fit the exponential curve y=abX [?] applying the method of least squares.

2006 · Paper I · Q6b · 20 marks

Solution

Note on the question. The “[?]” after the curve is a gap in the source. We fit y=abXy=ab^X using common logarithms (the given ∑logy=13.0312\sum\log y=13.0312 for 8 values, about 1.63 each, shows the logarithms are to base 10).

Curvilinear regression. When the scatter of yy against xx is clearly not linear, we fit a curve: a polynomial y=a+bx+cx2+…y=a+bx+cx^2+\dots, or a curve that becomes linear after a transformation, such as the exponential y=abxy=ab^x, the power curve y=axby=ax^b, or the hyperbola 1/y=a+bx1/y=a+bx. Curves that are linear in the parameters are fitted by least squares directly; transformable curves are fitted by least squares on the transformed scale.

Linearising. Taking logarithms, logy=loga+Xlogb,i.e.Y=A+BX,\log y=\log a+X\log b,\qquad\text{i.e.}\qquad Y=A+BX, with Y=log10yY=\log_{10}y, A=log10aA=\log_{10}a, B=log10bB=\log_{10}b.

Normal equations (n=8n=8): ∑Y=nA+B∑X:13.0312=8A+158B,\sum Y=nA+B\sum X:\qquad13.0312=8A+158B, ∑XY=A∑X+B∑X2:212.1224=158A+5530B.\sum XY=A\sum X+B\sum X^2:\qquad212.1224=158A+5530B .

Solution. The determinant is 8(5530)−1582=44240−24964=192768(5530)-158^2=44240-24964=19276. B=8(212.1224)−158(13.0312)19276=1696.979−2058.93019276=−361.95019276=−0.018777,B=\frac{8(212.1224)-158(13.0312)}{19276}=\frac{1696.979-2058.930}{19276}=\frac{-361.950}{19276}=-0.018777, A=13.0312−158B8=13.0312+2.96688=1.99975.A=\frac{13.0312-158B}{8}=\frac{13.0312+2.9668}{8}=1.99975 .

Back-transforming. a=101.99975=99.94≈100,b=10−0.018777=0.9577.a=10^{1.99975}=99.94\approx100,\qquad b=10^{-0.018777}=0.9577 . The fitted curve is y=99.94(0.9577)X≈100(0.958)X,y=99.94\,(0.9577)^X\ \approx\ 100\,(0.958)^X, a decay of about 4.2% for each unit increase in XX.

✓ Checked by computer We checked in Python: the normal equations give log₁₀a = 1.9998 and log₁₀b = −0.01878, so a = 99.94 ≈ 100 and b = 0.9577.

↑ Back to the question list

Derive the Shapiro-Wilk statistic for testing normality of errors in a regression model.

2005 · Paper I · Q5c · 12 marks

Solution

Setting. In the model Y=Xβ+eY=X\beta+e the tests and intervals assume e∼N(0,σ2I)e\sim N(0,\sigma^2I). We check normality with the residuals ei=yi−ŷie_i=y_i-\hat y_i (or the studentised residuals). The Shapiro–Wilk test (1965) is one of the most powerful tests for this.

Idea. If the residuals are normal, their ordered values e(1)≤…≤e(n)e_{(1)}\le\dots\le e_{(n)} should be close to a linear function of the expected order statistics of a standard normal sample. Shapiro and Wilk compare two estimates of σ2\sigma^2:

  • the best linear unbiased estimate of σ\sigma from the ordered sample (from a regression of e(i)e_{(i)} on the normal scores), squared; and
  • the usual estimate from the sum of squares.

Derivation. Let m=(m1,…,mn)′m=(m_1,\dots,m_n)' be the expected values of the order statistics of a N(0,1)N(0,1) sample, and VV their covariance matrix. For a normal sample with mean μ\mu and SD σ\sigma, E(e(i))=μ+σmi,Cov(e(⋅))=σ2V.E(e_{(i)})=\mu+\sigma m_i,\qquad\text{Cov}(e_{(\cdot)})=\sigma^2V . This is a linear model in (μ,σ)(\mu,\sigma) with correlated errors. Its generalised least squares estimate of σ\sigma is σ̂=m′V−1e(⋅)m′V−1m\hat\sigma=\frac{m'V^{-1}e_{(\cdot)}}{m'V^{-1}m} (because mm is symmetric about zero, the estimate of σ\sigma is free of μ\mu). Define the normalised coefficients a′=(a1,…,an)=m′V−1m′V−1V−1m,∑ai2=1.a'=(a_1,\dots,a_n)=\frac{m'V^{-1}}{\sqrt{m'V^{-1}V^{-1}m}},\qquad\sum a_i^2=1 . The Shapiro–Wilk statistic is W=(∑i=1naie(i))2∑i=1n(ei−e‾)2,W=\frac{\Big(\sum_{i=1}^na_ie_{(i)}\Big)^2}{\sum_{i=1}^n(e_i-\bar e)^2}, where e‾=0\bar e=0 for residuals from a model with an intercept.

Properties.

  • WW is location and scale invariant, so its null distribution does not depend on μ\mu or σ\sigma.
  • WW is the squared correlation between the ordered residuals and the coefficients aia_i (essentially the normal scores), so 0<W≤10<W\le1. It is close to 1 when the normal probability plot is a straight line.
  • Small values of WW indicate non-normality. The critical values (or pp-values, via Royston’s approximation) are tabulated for each nn.

In regression.

  1. Fit the model and compute the residuals, preferably studentised.
  2. Order them and compute WW with the tabulated aia_i (by symmetry an+1−i=−aia_{n+1-i}=-a_i, so ∑aie(i)=∑i≤n/2an+1−i(e(n+1−i)−e(i))\sum a_ie_{(i)}=\sum_{i\le n/2}a_{n+1-i}(e_{(n+1-i)}-e_{(i)})).
  3. Reject normality at level α\alpha if W<Wα(n)W<W_\alpha(n). The residuals are slightly correlated, but for moderate nn the test is a good approximation.

✓ Derivation checked step by step Every step was checked: the construction of W from the ordered residuals and the normal-order-statistic weights, and its interpretation as a squared correlation.

↑ Back to the question list

Define regression analysis. Write the form of simple linear regression model. State the various assumptions of the model.

2003 · Paper I · Q5b · 12 marks

Solution

Regression analysis. Regression analysis studies how a response variable YY depends on one or more explanatory (independent) variables XX, by fitting a mathematical relation, usually E(Y∣X=x)=f(x;β)E(Y\mid X=x)=f(x;\beta). It is used to describe the relation, to estimate its parameters, to test hypotheses about them, and to predict YY for given XX. The word “regression” comes from Galton, who found that the heights of sons “regress” towards the mean.

Simple linear regression model. Yi=β0+β1Xi+εi,i=1,2,…,n,Y_i=\beta_0+\beta_1X_i+\varepsilon_i,\qquad i=1,2,\dots,n, where YiY_i is the response, XiX_i the explanatory variable, β0\beta_0 the intercept, β1\beta_1 the slope (the change in mean response per unit change in XX) and εi\varepsilon_i the random error.

Assumptions.

  1. Linearity: E(Yi∣Xi)=β0+β1XiE(Y_i\mid X_i)=\beta_0+\beta_1X_i, i.e. E(εi)=0E(\varepsilon_i)=0.
  2. Fixed regressor: the XiX_i are known constants, measured without error (or the analysis is conditional on them), and not all equal.
  3. Homoscedasticity: V(εi)=σ2V(\varepsilon_i)=\sigma^2, the same for all ii.
  4. No autocorrelation: Cov(εi,εj)=0\text{Cov}(\varepsilon_i,\varepsilon_j)=0 for i≠ji\ne j.
  5. Normality (for tests and confidence intervals): εi∼N(0,σ2)\varepsilon_i\sim N(0,\sigma^2), so the errors are independent.
  6. The parameters β0,β1,σ2\beta_0,\beta_1,\sigma^2 are constants, the same for all observations.

Under 1–4, the least squares estimators are BLUE (Gauss–Markov theorem). Adding 5, they are also the maximum likelihood estimators, and tt and FF tests are exact.

✓ Answer checked step by step Every step was checked: the form of the simple linear regression model and the standard assumptions behind least squares and normal-theory inference.

↑ Back to the question list

Explain the linear regression model. Calculate the least squares estimate of β=[β0β1] for a straight line model Yj=β0+β1Zj1+εj from the data.

Zj 0 1 2 3 4
y 1 4 3 8 9

Solution

The linear regression model. The response is a linear function of the parameters plus a random error: Y=Zβ+ε,E(ε)=0,V(ε)=σ2I,Y=Z\beta+\varepsilon,\qquad E(\varepsilon)=0,\quad V(\varepsilon)=\sigma^2I, where YY is n×1n\times1, ZZ is the n×(r+1)n\times(r+1) design matrix (first column of ones) and β\beta the vector of unknown coefficients. The least squares estimate, which minimises (Y−Zβ)′(Y−Zβ)(Y-Z\beta)'(Y-Z\beta), is β̂=(Z′Z)−1Z′Y,\hat\beta=(Z'Z)^{-1}Z'Y, provided ZZ has full column rank.

Data. n=5n=5: Z=(1011121314),Y=(14389).Z=\begin{pmatrix}1&0\\1&1\\1&2\\1&3\\1&4\end{pmatrix},\qquad Y=\begin{pmatrix}1\\4\\3\\8\\9\end{pmatrix}. Z′Z=(5101030),Z′Y=(2570),(Z′Z)−1=150(30−10−105).Z'Z=\begin{pmatrix}5&10\\10&30\end{pmatrix},\qquad Z'Y=\begin{pmatrix}25\\70\end{pmatrix},\qquad(Z'Z)^{-1}=\frac1{50}\begin{pmatrix}30&-10\\-10&5\end{pmatrix}. β̂=150(30(25)−10(70)−10(25)+5(70))=150(50100)=(12).\hat\beta=\frac1{50}\begin{pmatrix}30(25)-10(70)\\-10(25)+5(70)\end{pmatrix}=\frac1{50}\begin{pmatrix}50\\100\end{pmatrix}=\begin{pmatrix}1\\2\end{pmatrix}.

So the fitted line is ŷ=1+2z.\hat y=1+2z .

Fit. Fitted values 1,3,5,7,91,3,5,7,9; residuals 0,1,−2,1,00,1,-2,1,0 (they sum to zero, as they must). The residual SS is 66, so s2=6/(5−2)=2s^2=6/(5-2)=2.

✓ Checked by computer We checked in Python: β̂ = (1, 2), the residuals are 0, 1, −2, 1, 0, the residual SS is 6 and s² = 2.

2002 · Paper I · Q6a · 20 marks

↑ Back to the question list

Let yi=m+bxi+ei(i=1,2,…,n), find estimate of m and b and express Var(b̂).

1998 · Paper I · Q9b · 20 marks

Solution

Note. “mm” here is the intercept.

Estimation. Minimise S=∑(yi−m−bxi)2S=\sum(y_i-m-bx_i)^2: ∂S∂m=0:∑yi=nm+b∑xi,∂S∂b=0:∑xiyi=m∑xi+b∑xi2.\frac{\partial S}{\partial m}=0:\ \sum y_i=nm+b\sum x_i,\qquad\frac{\partial S}{\partial b}=0:\ \sum x_iy_i=m\sum x_i+b\sum x_i^2 . Solving, b̂=∑(xi−x‾)(yi−y‾)∑(xi−x‾)2=n∑xiyi−∑xi∑yin∑xi2−(∑xi)2,m̂=y‾−b̂x‾.\hat b=\frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sum(x_i-\bar x)^2}=\frac{n\sum x_iy_i-\sum x_i\sum y_i}{n\sum x_i^2-(\sum x_i)^2},\qquad\hat m=\bar y-\hat b\bar x .

Variance of b̂\hat b. Assume E(ei)=0E(e_i)=0, V(ei)=σ2V(e_i)=\sigma^2 and uncorrelated errors. Writing b̂=∑ciyi\hat b=\sum c_iy_i with ci=(xi−x‾)/Sxxc_i=(x_i-\bar x)/S_{xx} and Sxx=∑(xi−x‾)2S_{xx}=\sum(x_i-\bar x)^2: E(b̂)=∑ci(m+bxi)=m∑ci+b∑cixi=b,E(\hat b)=\sum c_i(m+bx_i)=m\sum c_i+b\sum c_ix_i=b, since ∑ci=0\sum c_i=0 and ∑cixi=1\sum c_ix_i=1. So b̂\hat b is unbiased, and V(b̂)=σ2∑ci2=σ2∑(xi−x‾)2.V(\hat b)=\sigma^2\sum c_i^2=\frac{\sigma^2}{\sum(x_i-\bar x)^2} . It is estimated by s2/Sxxs^2/S_{xx}, with s2=1n−2∑(yi−m̂−b̂xi)2s^2=\frac{1}{n-2}\sum(y_i-\hat m-\hat bx_i)^2.

(Similarly V(m̂)=σ2(1n+x‾2Sxx)V(\hat m)=\sigma^2\big(\frac1n+\frac{\bar x^2}{S_{xx}}\big).)

✓ Derivation checked step by step Every step was checked: the normal equations and V(b̂) = σ²/Σ(xᵢ − x̄)².

↑ Back to the question list

In the multiple linear regression model with normality assumption obtain 100(1−α)% confidence interval to find out whether the regression on the regressor variables is significant or not.

1998 · Paper I · Q10c · 15 marks

Solution

Model. Y=Xβ+eY=X\beta+e, e∼Nn(0,σ2I)e\sim N_n(0,\sigma^2I), with X=[𝟏,X1]X=[\mathbf 1,X_1] of order n×pn\times p (p−1p-1 regressors) and full rank. Partition β=(β0,β1′)′\beta=(\beta_0,\beta_1')', where β1\beta_1 holds the p−1p-1 slopes. The question “is the regression significant?” is whether β1=0\beta_1=0.

Distribution of β̂1\hat\beta_1. Let XcX_c be the matrix of regressors centred at their means. Then β̂1=(Xc′Xc)−1Xc′Y∼Np−1(β1,σ2(Xc′Xc)−1),\hat\beta_1=(X_c'X_c)^{-1}X_c'Y\sim N_{p-1}\big(\beta_1,\sigma^2(X_c'X_c)^{-1}\big), so (β̂1−β1)′Xc′Xc(β̂1−β1)σ2∼χp−12.\frac{(\hat\beta_1-\beta_1)'X_c'X_c(\hat\beta_1-\beta_1)}{\sigma^2}\sim\chi^2_{p-1}. This is independent of (n−p)s2/σ2∼χn−p2(n-p)s^2/\sigma^2\sim\chi^2_{n-p}, with s2=SSE/(n−p)s^2=\text{SSE}/(n-p).

Confidence region. Hence (β̂1−β1)′Xc′Xc(β̂1−β1)/(p−1)s2∼Fp−1,n−p,\frac{(\hat\beta_1-\beta_1)'X_c'X_c(\hat\beta_1-\beta_1)/(p-1)}{s^2}\sim F_{p-1,\,n-p}, and the 100(1−α)%100(1-\alpha)\% confidence region for β1\beta_1 is the ellipsoid {β1:(β̂1−β1)′Xc′Xc(β̂1−β1)≤(p−1)s2Fα(p−1,n−p)}.\Big\{\beta_1:(\hat\beta_1-\beta_1)'X_c'X_c(\hat\beta_1-\beta_1)\le(p-1)s^2F_\alpha(p-1,n-p)\Big\}.

Deciding significance. The regression is significant at level α\alpha if and only if the origin β1=0\beta_1=0 lies outside this region, that is, if β̂1′Xc′Xcβ̂1/(p−1)s2=SSR/(p−1)SSE/(n−p)>Fα(p−1,n−p).\frac{\hat\beta_1'X_c'X_c\hat\beta_1/(p-1)}{s^2}=\frac{\text{SSR}/(p-1)}{\text{SSE}/(n-p)}>F_\alpha(p-1,n-p). This is the usual ANOVA FF test, since β̂1′Xc′Xcβ̂1=SSR\hat\beta_1'X_c'X_c\hat\beta_1=\text{SSR}.

Simultaneous intervals. The same region gives Scheffé intervals for every linear combination a′β1a'\beta_1: a′β̂1±(p−1)Fα(p−1,n−p)sa′(Xc′Xc)−1a.a'\hat\beta_1\pm\sqrt{(p-1)F_\alpha(p-1,n-p)}\ s\sqrt{a'(X_c'X_c)^{-1}a}. If any of these intervals excludes zero, the regression is significant; and the regression is significant exactly when at least one of them does.

✓ Derivation checked step by step Every step was checked: the joint confidence region for the regression coefficients from the F distribution and its use to judge whether the regression is significant.

↑ Back to the question list

Using the linear regression model E(Y∣x1,x2,x3)=β0+β1x1+β2x2+β3x3 and n independent sets of observations, derive the tests for the following hypotheses (i) H0:β1=β2=β3 (ii) H0:β1+β2+β3=1 You may make the usual assumptions. In each case state clearly the alternative hypothesis you consider.

1997 · Paper I · Q10a · 30 marks

Solution

Model and assumptions. Y=Xβ+eY=X\beta+e with X=[𝟏,x1,x2,x3]X=[\mathbf 1,x_1,x_2,x_3] (n×4n\times4, rank 4), β=(β0,β1,β2,β3)′\beta=(\beta_0,\beta_1,\beta_2,\beta_3)' and e∼Nn(0,σ2I)e\sim N_n(0,\sigma^2I). Then β̂=(X′X)−1X′Y∼N4(β,σ2(X′X)−1)\hat\beta=(X'X)^{-1}X'Y\sim N_4(\beta,\sigma^2(X'X)^{-1}), and s2=SSE/(n−4)s^2=\text{SSE}/(n-4), with (n−4)s2/σ2∼χn−42(n-4)s^2/\sigma^2\sim\chi^2_{n-4} independent of β̂\hat\beta.

General linear hypothesis. For H0:Cβ=dH_0:C\beta=d, with CC of order q×4q\times4 and rank qq, F=(Cβ̂−d)′{C(X′X)−1C′}−1(Cβ̂−d)/qs2∼Fq,n−4under H0.F=\frac{(C\hat\beta-d)'\{C(X'X)^{-1}C'\}^{-1}(C\hat\beta-d)/q}{s^2}\sim F_{q,\,n-4}\quad\text{under }H_0 . Equivalently, F=(SSE0−SSE)/qSSE/(n−4)F=\dfrac{(\text{SSE}_0-\text{SSE})/q}{\text{SSE}/(n-4)}, where SSE0\text{SSE}_0 is the residual SS when the model is fitted under H0H_0.

(i) H0:β1=β2=β3H_0:\beta_1=\beta_2=\beta_3 against H1H_1: not all three equal.

  • C=(01−10001−1)C=\begin{pmatrix}0&1&-1&0\\0&0&1&-1\end{pmatrix}, d=0d=0, q=2q=2.
  • Reduced model: with common slope γ\gamma, E(Y)=β0+γ(x1+x2+x3)E(Y)=\beta_0+\gamma(x_1+x_2+x_3). Regress YY on z=x1+x2+x3z=x_1+x_2+x_3 to get SSE0\text{SSE}_0 on n−2n-2 df.
  • Test: F=(SSE0−SSE)/2SSE/(n−4)∼F2,n−4.F=\frac{(\text{SSE}_0-\text{SSE})/2}{\text{SSE}/(n-4)}\sim F_{2,\,n-4}. Reject H0H_0 if F>Fα(2,n−4)F>F_\alpha(2,n-4).

(ii) H0:β1+β2+β3=1H_0:\beta_1+\beta_2+\beta_3=1 against H1:β1+β2+β3≠1H_1:\beta_1+\beta_2+\beta_3\ne1 (two-sided).

  • C=(0,1,1,1)=c′C=(0,1,1,1)=c', d=1d=1, q=1q=1.
  • c′β̂=β̂1+β̂2+β̂3c'\hat\beta=\hat\beta_1+\hat\beta_2+\hat\beta_3 has variance σ2c′(X′X)−1c=σ2(v11+v22+v33+2v12+2v13+2v23)\sigma^2c'(X'X)^{-1}c=\sigma^2(v_{11}+v_{22}+v_{33}+2v_{12}+2v_{13}+2v_{23}), where vijv_{ij} are the elements of (X′X)−1(X'X)^{-1} for the slopes.
  • Test: t=β̂1+β̂2+β̂3−1sc′(X′X)−1c∼tn−4under H0;t=\frac{\hat\beta_1+\hat\beta_2+\hat\beta_3-1}{s\sqrt{c'(X'X)^{-1}c}}\sim t_{n-4}\quad\text{under }H_0 ; reject if |t|>tα/2,n−4|t|>t_{\alpha/2,\,n-4}. (t2t^2 is the FF statistic above with q=1q=1.)
  • Reduced-model form: substitute β3=1−β1−β2\beta_3=1-\beta_1-\beta_2 to get Y−x3=β0+β1(x1−x3)+β2(x2−x3)+eY-x_3=\beta_0+\beta_1(x_1-x_3)+\beta_2(x_2-x_3)+e, fit it to get SSE0\text{SSE}_0, and use F=(SSE0−SSE)/s2F=(\text{SSE}_0-\text{SSE})/s^2 on (1,n−4)(1,n-4) df.
  • A one-sided alternative (for example β1+β2+β3>1\beta_1+\beta_2+\beta_3>1, decreasing returns to scale in a Cobb–Douglas production function written in logs) uses the upper tail t>tα,n−4t>t_{\alpha,n-4}.

✓ Derivation checked step by step Every step was checked: each hypothesis written as Cβ = d, the general linear-hypothesis F test, and the reduced-model forms of the two tests.

↑ Back to the question list

Explain how orthogonal polynomials are used in fitting regression curves. Develop an appropriate test for choosing the appropriate degree of orthogonal polynomial using ANOVA table.

1997 · Paper I · Q10b · 30 marks

Solution

Use in fitting. To fit a polynomial of degree kk in xx, write it in terms of orthogonal polynomials Pr(x)P_r(x) of degree rr, with ∑iPr(xi)Ps(xi)=0\sum_iP_r(x_i)P_s(x_i)=0 for r≠sr\ne s: yi=α0+α1P1(xi)+…+αkPk(xi)+ei.y_i=\alpha_0+\alpha_1P_1(x_i)+\dots+\alpha_kP_k(x_i)+e_i .

  • For equally spaced xx the values ξr(xi)\xi_r(x_i) are tabulated (often scaled to integers by constants λr\lambda_r); otherwise they are built by the recurrence Pr+1=(x−ar+1)Pr−brPr−1P_{r+1}=(x-a_{r+1})P_r-b_rP_{r-1}.
  • Since the normal equations are diagonal, α̂0=y‾,α̂r=∑yiPr(xi)∑Pr2(xi),\hat\alpha_0=\bar y,\qquad\hat\alpha_r=\frac{\sum y_iP_r(x_i)}{\sum P_r^2(x_i)}, and the estimates do not change when higher-degree terms are added.
  • The fitted curve can be converted back into powers of xx if required.

Choosing the degree. The sum of squares due to the rr-th degree term is Sr=α̂r2∑Pr2(xi)=(∑yiPr(xi))2∑Pr2(xi)(1 df),S_r=\hat\alpha_r^2\sum P_r^2(x_i)=\frac{\big(\sum y_iP_r(x_i)\big)^2}{\sum P_r^2(x_i)}\qquad(1\text{ df}), and the SrS_r are independent. Fit up to a degree KK larger than is likely to be needed (or use replicates to get a pure error estimate).

Source df SS F
Linear (P1P_1) 1 S1S_1 S1/s2S_1/s^2
Quadratic (P2P_2) 1 S2S_2 S2/s2S_2/s^2
Cubic (P3P_3) 1 S3S_3 S3/s2S_3/s^2
⋮ ⋮ ⋮ ⋮
Degree KK (PKP_K) 1 SKS_K SK/s2S_K/s^2
Residual n−K−1n-K-1 SE=Syy−∑r=1KSrS_E=S_{yy}-\sum_{r=1}^KS_r
Total n−1n-1 Syy=∑(yi−y‾)2S_{yy}=\sum(y_i-\bar y)^2

with s2=SE/(n−K−1)s^2=S_E/(n-K-1).

Test procedure. Under H0:αr=0H_0:\alpha_r=0, Fr=Sr/s2∼F1,n−K−1F_r=S_r/s^2\sim F_{1,\,n-K-1}. We test the terms in turn, starting from the linear term, and choose the degree kk as the highest-degree term that is significant (often after two successive non-significant terms we stop). The terms above kk are then pooled into the residual. Because the components are orthogonal, the tests can be carried out from a single table, without refitting.

✓ Derivation checked step by step Every step was checked: the orthogonal-polynomial fit, the single-degree-of-freedom sums of squares and the sequential F tests in the ANOVA table.

↑ Back to the question list

Given two regression lines Yki=βkXi+eki(k=1,2;i=1,2,…,n) show that the F-statistic for testing H:β1=β2 can be put in the form F=(β̂1−β̂2)22S2(∑1nxi2)−1 Write the expression of S2.

1996 · Paper I · Q10a · 20 marks

Solution

Model. For k=1,2k=1,2 and i=1,…,ni=1,\dots,n, with the same xix_i in both lines, Yki=βkxi+eki,eki∼iidN(0,σ2).Y_{ki}=\beta_kx_i+e_{ki},\qquad e_{ki}\stackrel{iid}\sim N(0,\sigma^2).

Full model. Each line is fitted separately through the origin: β̂k=∑ixiYki∑ixi2,V(β̂k)=σ2∑xi2,\hat\beta_k=\frac{\sum_ix_iY_{ki}}{\sum_ix_i^2},\qquad V(\hat\beta_k)=\frac{\sigma^2}{\sum x_i^2}, and β̂1,β̂2\hat\beta_1,\hat\beta_2 are independent. The residual SS is SSE=∑k∑i(Yki−β̂kxi)2on 2n−2 df,\text{SSE}=\sum_k\sum_i(Y_{ki}-\hat\beta_kx_i)^2\quad\text{on }2n-2\text{ df}, and S2=SSE2(n−1)=12n−2∑k=12{∑iYki2−β̂k2∑ixi2}S^2=\frac{\text{SSE}}{2(n-1)}=\frac{1}{2n-2}\sum_{k=1}^2\Big\{\sum_iY_{ki}^2-\hat\beta_k^2\sum_ix_i^2\Big\} is the pooled unbiased estimate of σ2\sigma^2.

Reduced model (H:β1=β2=βH:\beta_1=\beta_2=\beta). The common estimate is β̂=∑ixi(Y1i+Y2i)2∑xi2=β̂1+β̂22\hat\beta=\frac{\sum_ix_i(Y_{1i}+Y_{2i})}{2\sum x_i^2}=\frac{\hat\beta_1+\hat\beta_2}2, and SSE0−SSE=∑k(β̂k−β̂)2∑xi2=(β̂1−β̂2)22∑xi2(1 df).\text{SSE}_0-\text{SSE}=\sum_k(\hat\beta_k-\hat\beta)^2\sum x_i^2=\frac{(\hat\beta_1-\hat\beta_2)^2}{2}\sum x_i^2\quad(1\text{ df}).

FF statistic. F=SSE0−SSES2=(β̂1−β̂2)2∑xi22S2=(β̂1−β̂2)22S2(∑1nxi2)−1∼F1,2n−2under H.◼F=\frac{\text{SSE}_0-\text{SSE}}{S^2}=\frac{(\hat\beta_1-\hat\beta_2)^2\sum x_i^2}{2S^2}=\frac{(\hat\beta_1-\hat\beta_2)^2}{2S^2\Big(\sum_1^nx_i^2\Big)^{-1}}\sim F_{1,\,2n-2}\quad\text{under }H. \qquad\blacksquare

This is also direct: β̂1−β̂2∼N(0,2σ2∑xi2)\hat\beta_1-\hat\beta_2\sim N\big(0,\frac{2\sigma^2}{\sum x_i^2}\big) under HH, independent of S2S^2, so F=t2F=t^2 where t=(β̂1−β̂2)/S2/∑xi2∼t2n−2t=(\hat\beta_1-\hat\beta_2)\big/S\sqrt{2/\sum x_i^2}\sim t_{2n-2}.

✓ Proof checked step by step We checked the derivation, and checked numerically that the F ratio in the stated form equals the extra-sum-of-squares F for a common slope (2.134 both ways).

↑ Back to the question list

In the multiple linear regression model with (p−1) independent variables, derive a test to find out whether the regression on the regressor variables is significant or not. Show that the test statistic can be expressed in terms of the sample multiple correlation coefficient.

1996 · Paper I · Q10b · 25 marks

Solution

Model. yi=β0+β1x1i+…+βp−1xp−1,i+eiy_i=\beta_0+\beta_1x_{1i}+\dots+\beta_{p-1}x_{p-1,i}+e_i, ei∼iidN(0,σ2)e_i\stackrel{iid}\sim N(0,\sigma^2), or Y=Xβ+eY=X\beta+e with XX of order n×pn\times p and rank pp.

Hypothesis. H0:β1=…=βp−1=0H_0:\beta_1=\dots=\beta_{p-1}=0 (no regression) against H1H_1: some βj≠0\beta_j\ne0.

Derivation. Fit the full model: β̂=(X′X)−1X′Y\hat\beta=(X'X)^{-1}X'Y, SSE=Y′(I−H)Y\text{SSE}=Y'(I-H)Y with H=X(X′X)−1X′H=X(X'X)^{-1}X'. Under H0H_0 the model is yi=β0+eiy_i=\beta_0+e_i, with SSE0=∑(yi−y‾)2=Syy\text{SSE}_0=\sum(y_i-\bar y)^2=S_{yy}. The reduction due to the regressors is SSR=Syy−SSE=∑(ŷi−y‾)2=Y′(H−1nJ)Y.\text{SSR}=S_{yy}-\text{SSE}=\sum(\hat y_i-\bar y)^2=Y'(H-\tfrac1nJ)Y . H−1nJH-\frac1nJ and I−HI-H are symmetric idempotent with ranks p−1p-1 and n−pn-p, and their product is zero. So by Cochran’s theorem, under H0H_0, SSR/σ2∼χp−12\text{SSR}/\sigma^2\sim\chi^2_{p-1} and SSE/σ2∼χn−p2\text{SSE}/\sigma^2\sim\chi^2_{n-p}, independently. (This is also the likelihood ratio test: λ2/n=SSE/Syy\lambda^{2/n}=\text{SSE}/S_{yy}.) Hence F=SSR/(p−1)SSE/(n−p)∼Fp−1,n−punder H0,F=\frac{\text{SSR}/(p-1)}{\text{SSE}/(n-p)}\sim F_{p-1,\,n-p}\quad\text{under }H_0, and we reject H0H_0 if F>Fα(p−1,n−p)F>F_\alpha(p-1,n-p).

In terms of the multiple correlation. The sample multiple correlation coefficient RR between yy and x1,…,xp−1x_1,\dots,x_{p-1} is the correlation between yy and ŷ\hat y, and R2=SSRSyy,1−R2=SSESyy.R^2=\frac{\text{SSR}}{S_{yy}},\qquad1-R^2=\frac{\text{SSE}}{S_{yy}} . Dividing numerator and denominator by SyyS_{yy}: F=R2/(p−1)(1−R2)/(n−p)=n−pp−1⋅R21−R2.◼F=\frac{R^2/(p-1)}{(1-R^2)/(n-p)}=\frac{n-p}{p-1}\cdot\frac{R^2}{1-R^2}. \qquad\blacksquare So the regression is significant when R2R^2 is large compared with what chance alone would produce with p−1p-1 regressors and nn observations. (Under H0H_0, R2R^2 itself has a Beta(p−12,n−p2)\big(\frac{p-1}2,\frac{n-p}2\big) distribution.)

✓ Proof checked step by step Every step was checked: the regression F test, its null distribution, and the identity F = (R²/(p − 1)) / ((1 − R²)/(n − p)).

↑ Back to the question list

Show that under usual normal population regression model the joint distribution of the partial regression coefficients is multivariate normal.

1996 · Paper I · Q11b · 30 marks

Solution

Model. In the usual normal regression model Y=Xβ+e,e∼Nn(0,σ2In),Y=X\beta+e,\qquad e\sim N_n(0,\sigma^2I_n), with XX (n×pn\times p) a fixed matrix of rank pp. So Y∼Nn(Xβ,σ2In)Y\sim N_n(X\beta,\sigma^2I_n).

The estimator. The least squares (and maximum likelihood) estimator of the vector of partial regression coefficients is β̂=(X′X)−1X′Y=AY,A=(X′X)−1X′,\hat\beta=(X'X)^{-1}X'Y=AY,\qquad A=(X'X)^{-1}X', a fixed p×np\times n matrix of rank pp.

Key fact. If Y∼Nn(μ,Σ)Y\sim N_n(\mu,\Sigma) and AA is a fixed p×np\times n matrix of rank pp, then AY∼Np(Aμ,AΣA′)AY\sim N_p(A\mu,A\Sigma A'). (Proof: the characteristic function of AYAY is Eeit′AY=ϕY(A′t)=exp{it′Aμ−12t′AΣA′t}E\,e^{it'AY}=\phi_Y(A't)=\exp\{it'A\mu-\frac12t'A\Sigma A't\}, which is that of Np(Aμ,AΣA′)N_p(A\mu,A\Sigma A').)

Mean. E(β̂)=AXβ=(X′X)−1X′Xβ=β.E(\hat\beta)=AX\beta=(X'X)^{-1}X'X\beta=\beta .

Dispersion. V(β̂)=A(σ2I)A′=σ2(X′X)−1X′X(X′X)−1=σ2(X′X)−1.V(\hat\beta)=A(\sigma^2I)A'=\sigma^2(X'X)^{-1}X'X(X'X)^{-1}=\sigma^2(X'X)^{-1}.

Conclusion. β̂∼Np(β,σ2(X′X)−1).◼\hat\beta\sim N_p\big(\beta,\ \sigma^2(X'X)^{-1}\big). \qquad\blacksquare Each β̂j\hat\beta_j is normal with variance σ2cjj\sigma^2c_{jj}, where cjjc_{jj} is the jj-th diagonal element of (X′X)−1(X'X)^{-1}, and the coefficients are correlated unless X′XX'X is diagonal.

Addendum. β̂\hat\beta is independent of the residual vector (I−H)Y(I-H)Y, because Cov(AY,(I−H)Y)=σ2A(I−H)=0\text{Cov}(AY,(I-H)Y)=\sigma^2A(I-H)=0 and they are jointly normal. Hence β̂\hat\beta is independent of s2s^2, which justifies the tt and FF tests on the coefficients.

(When the regressors are themselves random and jointly normal with YY, the same result holds conditionally on the observed XX; unconditionally the distribution of β̂\hat\beta is no longer normal.)

✓ Proof checked step by step Every step was checked: β̂ is a fixed linear transformation of a multivariate normal vector, with mean β and dispersion σ²(X′X)⁻¹.

↑ Back to the question list

In the multiple linear regression model with k independent variables, βk is the estimated regression coefficient for the kth independent variable βk. Show that the statistic for testing the hypothesis βk=0 is provided by t=β̂kVar̂(β̂k), where Var̂(β̂k) is the estimated variance of β̂k. What is the critical region for the alternatives βk≠0?

1995 · Paper I · Q10a · 30 marks

Solution

Note on the question. “βk\beta_k is the estimated regression coefficient” should read: β̂k\hat\beta_k is the estimate of the regression coefficient βk\beta_k of the kk-th independent variable.

Model. Y=Xβ+eY=X\beta+e, e∼Nn(0,σ2I)e\sim N_n(0,\sigma^2I), where X=[𝟏,x1,…,xk]X=[\mathbf 1,x_1,\dots,x_k] has order n×(k+1)n\times(k+1) and full rank. Let C=(X′X)−1=(cij)C=(X'X)^{-1}=(c_{ij}).

Step 1: distribution of β̂k\hat\beta_k. β̂=CX′Y∼Nk+1(β,σ2C)\hat\beta=CX'Y\sim N_{k+1}(\beta,\sigma^2C), so β̂k∼N(βk,σ2ckk),Z=β̂k−βkσckk∼N(0,1).\hat\beta_k\sim N(\beta_k,\sigma^2c_{kk}),\qquad Z=\frac{\hat\beta_k-\beta_k}{\sigma\sqrt{c_{kk}}}\sim N(0,1).

Step 2: residual SS. SSE=Y′(I−H)Y\text{SSE}=Y'(I-H)Y with H=X(X′X)−1X′H=X(X'X)^{-1}X' idempotent of rank k+1k+1. So SSEσ2∼χn−k−12,s2=SSEn−k−1,E(s2)=σ2.\frac{\text{SSE}}{\sigma^2}\sim\chi^2_{n-k-1},\qquad s^2=\frac{\text{SSE}}{n-k-1},\quad E(s^2)=\sigma^2 .

Step 3: independence. β̂=CX′Y\hat\beta=CX'Y and the residual vector (I−H)Y(I-H)Y are jointly normal with covariance σ2CX′(I−H)=0\sigma^2CX'(I-H)=0, since X′(I−H)=0X'(I-H)=0. So β̂k\hat\beta_k is independent of SSE.

Step 4: the tt statistic. By definition of Student’s tt, t=ZSSE/{σ2(n−k−1)}=β̂k−βksckk∼tn−k−1.t=\frac{Z}{\sqrt{\text{SSE}/\{\sigma^2(n-k-1)\}}}=\frac{\hat\beta_k-\beta_k}{s\sqrt{c_{kk}}}\sim t_{n-k-1}. s2ckks^2c_{kk} is the estimated variance of β̂k\hat\beta_k, Var̂(β̂k)\widehat{\text{Var}}(\hat\beta_k). Under H0:βk=0H_0:\beta_k=0, t=β̂kVar̂(β̂k)∼tn−k−1.◼t=\frac{\hat\beta_k}{\sqrt{\widehat{\text{Var}}(\hat\beta_k)}}\sim t_{n-k-1}. \qquad\blacksquare

Critical region. For H1:βk≠0H_1:\beta_k\ne0 (two-sided), at level α\alpha: |t|>tα/2,n−k−1.|t|>t_{\alpha/2,\,n-k-1}. (For βk>0\beta_k>0 use t>tα,n−k−1t>t_{\alpha,n-k-1}; for βk<0\beta_k<0 use t<−tα,n−k−1t<-t_{\alpha,n-k-1}.) Equivalently, t2t^2 is the extra-sum-of-squares FF for dropping xkx_k, on (1,n−k−1)(1,n-k-1) df.

✓ Proof checked step by step Every step was checked: the normal distribution of β̂ₖ, the independent chi-square for the residual SS, and the resulting t statistic on n − k − 1 df.

↑ Back to the question list

In the multiple linear regression model with usual normality assumptions obtain the 100(1−α)% confidence interval for a regression coefficient βi which is symmetric with respect to β̂i.

1995 · Paper I · Q10b · 15 marks

Solution

Model. Y=Xβ+eY=X\beta+e, e∼Nn(0,σ2I)e\sim N_n(0,\sigma^2I), with XX of order n×pn\times p and rank pp, C=(X′X)−1=(cij)C=(X'X)^{-1}=(c_{ij}) and s2=SSE/(n−p)s^2=\text{SSE}/(n-p).

Pivot. As in Q28, β̂i∼N(βi,σ2cii)\hat\beta_i\sim N(\beta_i,\sigma^2c_{ii}), (n−p)s2/σ2∼χn−p2(n-p)s^2/\sigma^2\sim\chi^2_{n-p}, and the two are independent. Hence T=β̂i−βiscii∼tn−p,T=\frac{\hat\beta_i-\beta_i}{s\sqrt{c_{ii}}}\sim t_{n-p}, whose distribution does not depend on any unknown parameter.

Interval. The tt distribution is symmetric about 0, so P(−tα/2,n−p≤T≤tα/2,n−p)=1−α.P\big(-t_{\alpha/2,n-p}\le T\le t_{\alpha/2,n-p}\big)=1-\alpha . Rearranging the inequality for βi\beta_i: P(β̂i−tα/2,n−pscii≤βi≤β̂i+tα/2,n−pscii)=1−α.P\Big(\hat\beta_i-t_{\alpha/2,n-p}\,s\sqrt{c_{ii}}\ \le\ \beta_i\ \le\ \hat\beta_i+t_{\alpha/2,n-p}\,s\sqrt{c_{ii}}\Big)=1-\alpha .

Result. The 100(1−α)%100(1-\alpha)\% confidence interval for βi\beta_i, symmetric about β̂i\hat\beta_i, is β̂i±tα/2,n−pscii,\hat\beta_i\pm t_{\alpha/2,\,n-p}\ s\sqrt{c_{ii}}, where sciis\sqrt{c_{ii}} is the standard error of β̂i\hat\beta_i. Of all intervals based on TT with coverage 1−α1-\alpha, this equal-tailed one is also the shortest, because the tt density is symmetric and unimodal.

✓ Derivation checked step by step Every step was checked: the pivot (β̂ᵢ − βᵢ)/SE ~ t on n − p df and the resulting equal-tailed interval.

↑ Back to the question list

Indicate, with the help of the ANOVA table, how you will test for the linearity of regression.

1995 · Paper I · Q10c · 15 marks

Solution

Data needed. Several observations of yy at each of pp distinct values xix_i: yijy_{ij}, j=1,…,nij=1,\dots,n_i, N=∑niN=\sum n_i. The replication gives an estimate of error that does not depend on the form of the regression.

Partition. ∑∑(yij−y‾)2⏟Syy=∑ni(ŷi−y‾)2⏟due to linear regression+∑ni(y‾i−ŷi)2⏟deviation from linearity+∑∑(yij−y‾i)2⏟within groups,\underbrace{\sum\sum(y_{ij}-\bar y)^2}_{S_{yy}}=\underbrace{\sum n_i(\hat y_i-\bar y)^2}_{\text{due to linear regression}}+\underbrace{\sum n_i(\bar y_i-\hat y_i)^2}_{\text{deviation from linearity}}+\underbrace{\sum\sum(y_{ij}-\bar y_i)^2}_{\text{within groups}}, where y‾i\bar y_i is the mean of the yy’s at xix_i and ŷi=â+b̂xi\hat y_i=\hat a+\hat bx_i is the fitted straight line. Using the correlation ratio ηyx2=∑ni(y‾i−y‾)2/Syy\eta_{yx}^2=\sum n_i(\bar y_i-\bar y)^2/S_{yy} and the correlation coefficient rr, the three parts are r2Syyr^2S_{yy}, (η2−r2)Syy(\eta^2-r^2)S_{yy} and (1−η2)Syy(1-\eta^2)S_{yy}.

ANOVA table.

Source df SS MS F
Linear regression 1 r2Syyr^2S_{yy} MRM_R
Deviation from linearity p−2p-2 (η2−r2)Syy(\eta^2-r^2)S_{yy} MDM_D MD/MWM_D/M_W
Within groups N−pN-p (1−η2)Syy(1-\eta^2)S_{yy} MWM_W
Total N−1N-1 SyyS_{yy}

Test. The hypothesis of linearity of regression is H0:E(y∣xi)=a+bxiH_0:E(y\mid x_i)=a+bx_i for all ii. Under H0H_0 (and normal errors with constant variance), F=MDMW=(η2−r2)/(p−2)(1−η2)/(N−p)∼Fp−2,N−p.F=\frac{M_D}{M_W}=\frac{(\eta^2-r^2)/(p-2)}{(1-\eta^2)/(N-p)}\sim F_{p-2,\,N-p}. If FF exceeds Fα(p−2,N−p)F_\alpha(p-2,N-p), we reject linearity: η2\eta^2 is significantly larger than r2r^2, and a curve (for example a polynomial of higher degree) should be fitted. Otherwise a straight line is adequate. Note that η2≥r2\eta^2\ge r^2 always, with equality exactly when the group means lie on a straight line.

✓ Derivation checked step by step Every step was checked: the split of the between-groups sum of squares into linear regression and deviation from linearity, and the F ratio against the within-groups mean square.

↑ Back to the question list

What are orthogonal polynomials? State how these are used in fitting regression curves and obtain the LS estimates of the coefficients in the regression equation. Indicate how the technique of ANOVA is used in deciding the appropriate degree of the polynomial to be fitted.

1995 · Paper I · Q12b · 30 marks

Solution

Orthogonal polynomials. Over a given set of points x1,…,xnx_1,\dots,x_n, the polynomials P0(x)=1,P1(x),…,Pk(x)P_0(x)=1,P_1(x),\dots,P_k(x), with PrP_r of exact degree rr, are orthogonal if ∑i=1nPr(xi)Ps(xi)=0(r≠s).\sum_{i=1}^nP_r(x_i)P_s(x_i)=0\qquad(r\ne s). For equally spaced xi=a+ihx_i=a+ih, with u=(x−x‾)/hu=(x-\bar x)/h: P1=u,P2=u2−n2−112,P3=u3−3n2−720u,…P_1=u,\qquad P_2=u^2-\frac{n^2-1}{12},\qquad P_3=u^3-\frac{3n^2-7}{20}u,\ \dots and their values (multiplied by constants λr\lambda_r to make them integers) are tabulated. For general xx they follow from a three-term recurrence.

Use in fitting regression curves. Instead of y=β0+β1x+…+βkxky=\beta_0+\beta_1x+\dots+\beta_kx^k, fit the equivalent model yi=α0+α1P1(xi)+α2P2(xi)+…+αkPk(xi)+ei.y_i=\alpha_0+\alpha_1P_1(x_i)+\alpha_2P_2(x_i)+\dots+\alpha_kP_k(x_i)+e_i . Both have the same fitted values, but the orthogonal form is much easier to compute and to test.

Least squares estimates. Minimise S=∑i(yi−∑rαrPr(xi))2S=\sum_i\big(y_i-\sum_r\alpha_rP_r(x_i)\big)^2: ∂S∂αr=0:∑iyiPr(xi)=∑sαs∑iPs(xi)Pr(xi)=αr∑iPr2(xi),\frac{\partial S}{\partial\alpha_r}=0:\quad\sum_iy_iP_r(x_i)=\sum_s\alpha_s\sum_iP_s(x_i)P_r(x_i)=\alpha_r\sum_iP_r^2(x_i), because all the cross-products vanish. So each normal equation involves only one unknown: α̂0=y‾,α̂r=∑iyiPr(xi)∑iPr2(xi),r=1,…,k,\hat\alpha_0=\bar y,\qquad\hat\alpha_r=\frac{\sum_iy_iP_r(x_i)}{\sum_iP_r^2(x_i)},\quad r=1,\dots,k, V(α̂r)=σ2∑Pr2(xi),Cov(α̂r,α̂s)=0.V(\hat\alpha_r)=\frac{\sigma^2}{\sum P_r^2(x_i)},\qquad\text{Cov}(\hat\alpha_r,\hat\alpha_s)=0 . Adding a term of degree k+1k+1 leaves all the earlier estimates unchanged.

ANOVA for the degree. The SS due to the rr-th degree component is Sr=α̂r∑iyiPr(xi)=(∑yiPr(xi))2∑Pr2(xi)(1 df),S_r=\hat\alpha_r\sum_iy_iP_r(x_i)=\frac{\big(\sum y_iP_r(x_i)\big)^2}{\sum P_r^2(x_i)}\quad(1\text{ df}), and ∑(yi−y‾)2=S1+S2+…+Sk+SE\sum(y_i-\bar y)^2=S_1+S_2+\dots+S_k+S_E.

Source df SS F
Linear 1 S1S_1 S1/s2S_1/s^2
Quadratic 1 S2S_2 S2/s2S_2/s^2
⋮ ⋮ ⋮ ⋮
Degree kk 1 SkS_k Sk/s2S_k/s^2
Residual n−k−1n-k-1 SES_E
Total n−1n-1 ∑(y−y‾)2\sum(y-\bar y)^2

Each Fr=Sr/s2F_r=S_r/s^2 is compared with Fα(1,n−k−1)F_\alpha(1,n-k-1) (or with a pure-error estimate if replicates exist). The degree of the polynomial is taken as the highest degree whose component is significant; the non-significant higher components are pooled with the residual. Finally, the fitted equation may be expressed in powers of xx by substituting the polynomials.

✓ Derivation checked step by step Every step was checked: the orthogonality conditions, the diagonal normal equations, the closed-form estimates, and the ANOVA split into single-degree-of-freedom components.

↑ Back to the question list

More on Linear Inference and Multivariate Analysis

Questions: UPSC Civil Services (Main) Examination, Statistics Paper I, 1995–2026. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted