2.7 Practice Problems

Problem 2.7.1. For the data

\(X\) 1 2 3 4 5 6
\(Y\) 6 9 9 12 14 16

(a)
compute \(a\), \(b\), the residuals and \(R^2\);
(b)
compute \(s^2\) and \(\operatorname {se}(b)\), and test \(\beta = 2\) at the \(5\%\) level;
(c)
give a \(95\%\) prediction interval for \(Y\) at \(X = 8\), and explain why it should be treated with caution.

Show solution

Solution. (a) \(\bar X = 3.5\) and \(\bar Y = 11\). The deviations are \(x = (-2.5, -1.5, -0.5, 0.5, 1.5, 2.5)\) and \(y = (-5, -2, -2, 1, 3, 5)\), so \(\sum x_i^2 = 17.5\), \(\sum x_iy_i = 12.5 + 3 + 1 + 0.5 + 4.5 + 12.5 = 34\) and \(\sum y_i^2 = 68\). Hence \(b = 34/17.5 = 1.9429\) and \(a = 11 - 1.9429(3.5) = 4.2\). The fitted values are \(6.143, 8.086, 10.029, 11.971, 13.914, 15.857\), and the residuals are \(-0.143, 0.914, -1.029, 0.029, 0.086, 0.143\), which sum to zero. ESS \(= b\sum x_iy_i = 66.057\), so RSS \(= 68 - 66.057 = 1.943\) and \(R^2 = 66.057/68 = 0.9714\).

(b) \(s^2 = 1.943/4 = 0.4857\), so \(\operatorname {se}(b) = \sqrt {0.4857/17.5} = 0.1666\). Then \(t = (1.9429 - 2)/0.1666 = -0.34\). Since \(|t| < t_{0.025,4} = 2.776\), the hypothesis \(\beta = 2\) is not rejected.

(c) \(\hat Y_0 = 4.2 + 1.9429(8) = 19.743\). The variance factor is \(1 + \frac 16 + (8 - 3.5)^2/17.5 = 2.3238\), so the interval is \(19.743 \pm 2.776\sqrt {0.4857 \times 2.3238} = 19.743 \pm 2.950 = (16.79,\ 22.69)\). \(X = 8\) lies outside the observed range \(1\) to \(6\), so the prediction is an extrapolation. The interval allows for sampling error in \(a\) and \(b\), but it assumes that the straight line continues beyond the data, which nothing in the data can confirm.

Problem 2.7.2. Show that if \(Y\) is measured in kwacha instead of thousands of kwacha, so that every \(Y_i\) is multiplied by \(1000\), then \(a\), \(b\) and their standard errors are multiplied by \(1000\), while the \(t\) ratios and \(R^2\) are unchanged. What happens if instead \(X\) is multiplied by \(1000\)?

Show solution

Solution. With \(Y^* = 1000Y\), the deviations are \(y^* = 1000y\), so \(b^* = \sum x_iy_i^*/\sum x_i^2 = 1000b\) and \(a^* = \bar Y^* - b^*\bar X = 1000a\). The residuals are \(e^* = 1000e\), so \(s^* = 1000s\) and both standard errors scale by \(1000\). Each \(t\) ratio is a ratio of two quantities scaled by \(1000\), so it is unchanged; \(R^2 = 1 - \text {RSS}/\text {TSS}\) is a ratio of two sums each scaled by \(10^6\). If instead \(X^* = 1000X\), then \(x^* = 1000x\) and \(b^* = b/1000\), \(\operatorname {se}(b^*) = s/\sqrt {10^6\sum x_i^2} = \operatorname {se}(b)/1000\). The intercept, its standard error, the residuals, \(s\), the \(t\) ratios and \(R^2\) are all unchanged. Changing units changes the size of a coefficient but never the evidence about it.

Problem 2.7.3. Let \(b_{YX}\) be the slope of the least squares regression of \(Y\) on \(X\), and \(b_{XY}\) that of \(X\) on \(Y\).

(a)
Show that \(b_{YX}b_{XY} = r^2\).
(b)
Deduce that the two fitted lines coincide only if \(|r| = 1\), and explain why regressing \(X\) on \(Y\) and inverting does not give the regression of \(Y\) on \(X\).
(c)
Verify (a) on the data of Example 2.2.5, for which the regression of \(X\) on \(Y\) has slope \(1.3208\).

Show solution

Solution. (a) Since \(b_{YX} = \sum xy/\sum x^2\) and \(b_{XY} = \sum xy/\sum y^2\), \[ b_{YX}b_{XY} = \frac {(\sum xy)^2}{\sum x^2\sum y^2} = r^2 . \]

(b) Both lines pass through \((\bar X, \bar Y)\). In the \((X, Y)\) plane the first has slope \(b_{YX}\) and the second, written as \(Y\) against \(X\), has slope \(1/b_{XY}\). They coincide only if \(b_{YX} = 1/b_{XY}\), that is \(r^2 = 1\). When \(|r| < 1\), \(1/b_{XY} = b_{YX}/r^2\) is steeper than \(b_{YX}\). The two regressions answer different questions, minimising vertical and horizontal distances respectively, and each is the best linear predictor of its own dependent variable.

(c) \(b_{YX}b_{XY} = 0.7 \times 1.3208 = 0.9245\), which is \(R^2\) from Example 2.2.5.

Problem 2.7.4. Regression through the origin. Economic theory sometimes implies \(\alpha = 0\), for example in a proportional consumption function \(C = \beta Y\).

(a)
Show that least squares on \(Y_i = \beta X_i + u_i\) gives \(\tilde b = \sum X_iY_i/\sum X_i^2\), with variance \(\sigma ^2/\sum X_i^2\) under (A1)–(A3).
(b)
Show that the residuals of this regression need not sum to zero, and explain why \(1 - \text {RSS}/\text {TSS}\) can then be negative.
(c)
Compute \(\tilde b\) for the data of Example 2.2.5.

Show solution

Solution. (a) Minimising \(\sum (Y_i - \beta X_i)^2\) gives the single normal equation \(\sum X_i(Y_i - \tilde bX_i) = 0\), so \(\tilde b = \sum X_iY_i/\sum X_i^2\). Substituting the model, \(\tilde b = \beta + \sum X_iu_i/\sum X_i^2\), with variance \(\sigma ^2\sum X_i^2/(\sum X_i^2)^2 = \sigma ^2/\sum X_i^2\).

(b) The only normal equation is \(\sum X_ie_i = 0\). There is no equation \(\sum e_i = 0\), because there is no intercept to estimate. The proof of Theorem 2.2.3 used \(\sum e_i = 0\) to drop a cross term, so TSS \(=\) ESS \(+\) RSS fails, and RSS can exceed \(\sum y_i^2\) when the line through the origin fits worse than a horizontal line at \(\bar Y\). Software therefore reports an “uncentred” \(R^2\), \(1 - \text {RSS}/\sum Y_i^2\), for such regressions, which is not comparable with the usual one.

(c) \(\sum X_iY_i = 6 + 16 + 36 + 48 + 90 = 196\) and \(\sum X_i^2 = 220\), so \(\tilde b = 0.891\). It is larger than \(b = 0.7\) because forcing the line through the origin, when the data suggest a positive intercept, steepens it. Note also that \(\sum X_i^2 = 220 > \sum x_i^2 = 40\), so \(\tilde b\) has a smaller variance than \(b\). That is a gain if \(\alpha \) really is zero; if it is not, \(\tilde b\) is biased.

Problem 2.7.5. Under (A1)–(A4) show that the estimator \(\check \beta = (Y_n - Y_1)/(X_n - X_1)\), the slope through the first and last observations, is linear and unbiased, and find its variance. Verify directly that its variance is at least \(\sigma ^2/\sum x_i^2\) for the \(X\) values of Example 2.2.5.

Show solution

Solution. \(\check \beta = \sum c_iY_i\) with \(c_1 = -1/(X_n - X_1)\), \(c_n = 1/(X_n - X_1)\) and all other \(c_i = 0\). Then \(\sum c_i = 0\) and \(\sum c_iX_i = (X_n - X_1)/(X_n - X_1) = 1\), so it is unbiased by the argument of Theorem 2.3.4. Its variance is \(\sigma ^2\sum c_i^2 = 2\sigma ^2/(X_n - X_1)^2\). With \(X = 2, 4, 6, 8, 10\), this is \(2\sigma ^2/64 = 0.03125\sigma ^2\), against \(\Var (b) = \sigma ^2/40 = 0.025\sigma ^2\). The end-point estimator is unbiased but \(25\%\) more variable, because it throws away the three middle observations.

Problem 2.7.6. In Example 2.3.3, suppose researcher 1 could choose eight new \(x\) values anywhere in the interval \([3, 4]\) to estimate the slope. Which design minimises \(\Var (b)\)? What is the risk of that design, and how would a careful researcher hedge against it?

Show solution

Solution. \(\Var (b) = \sigma ^2/\sum x_i^2\) is minimised by making \(\sum (x_i - \bar x)^2\) as large as possible, which for eight points in \([3, 4]\) means four at \(3\) and four at \(4\). That is exactly the design used, with \(\sum x_i^2 = 2\). Within the interval nothing better is possible; the second researcher did better only by sampling a much wider range. The risk is that a design with only two distinct \(x\) values cannot detect curvature: any function at all can be passed through two points. A careful researcher places a few observations in the middle of the range, accepting a slightly larger \(\Var (b)\) in exchange for being able to check linearity.

Problem 2.7.7. Using R on the LifeCycleSavings data, regress sr on pop75 instead of pop15.

(a)
From the correlation \(0.317\) in Software 1.5.2, predict \(R^2\) and the \(t\) ratio on the slope before running the regression.
(b)
Explain why the positive slope on pop75 should not be read as evidence that old people save.

Show solution

Solution. (a) \(R^2 = r^2 = 0.317^2 = 0.100\), and by Theorem 2.4.2 \[ t = \frac {r\sqrt {n-2}}{\sqrt {1 - r^2}} = \frac {0.317\sqrt {48}}{\sqrt {0.900}} = 2.32 . \] The R command summary(lm(sr ~ pop75, data = LifeCycleSavings)) confirms both, up to rounding of \(r\).

(b) pop75 is correlated \(-0.908\) with pop15. Countries with many elderly people have few children, so the two-variable regression on pop75 picks up the effect of having few young dependants. The omitted variable pop15 sits in the disturbance and is correlated with the regressor, violating (A1). The slope is a correct estimate of the best linear predictor and a biased estimate of any effect of the elderly share. Including both variables, in a multiple regression, is the remedy.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.