From the least-squares derivation to hypothesis tests, rank correlation, and a carefully audited economic example.
OLS regression turns paired observations into a fitted relationship that you can estimate, test, and interpret. However, a convincing analysis requires more than a slope and a high R². This guide solves 26 exercises, numbered 6.5 through 6.30 in the supplied material, while explaining the assumptions and calculations behind every major result.
Along the way, you will calculate a consumption equation, test its coefficients, build confidence intervals, and analyze income across 15 Latin American countries. In addition, you will see how rounding, tied ranks, and a single inconsistent data entry can change an answer. Every numerical table below uses calculations from the supplied observations unless its caption explicitly says otherwise.
Source and scope: The exercise numbering and datasets come from the uploaded chapter pages, headed “Simple Regression Analysis.” The images do not establish the book’s complete bibliographic details, so this guide does not invent an author or edition. Explanations and solutions use original wording, and the external links support the statistical methods. Only fragments of exercises 6.31 and 6.32 appear; their complete questions are unavailable, so the solved sequence ends at 6.30.
OLS regression notation and assumptions
A simple regression relates one outcome, Y, to one explanatory variable, X. For example, Y might represent consumption, while X represents disposable income. The model separates a systematic relationship from an unobserved disturbance.
Ŷi = b0 + b1Xi
ei = Yi − Ŷi
Here, β denotes a population parameter, while b denotes its sample estimate. The photographed chapter uses hats on estimated b coefficients; this article uses β and b to make the distinction easier to read. Therefore, b₀ and b₁ below correspond to the chapter’s estimated intercept and slope.
| Symbol | Meaning | Practical interpretation |
|---|---|---|
| n | Number of observations | 12 for consumption; 15 for the country exercise |
| X̄, Ȳ | Sample means | The fitted line passes through this pair when it includes an intercept |
| xᵢ = Xᵢ − X̄ | Centered explanatory variable | Distance from the sample mean of X |
| yᵢ = Yᵢ − Ȳ | Centered outcome | Distance from the sample mean of Y |
| Sxx = Σxᵢ² | Variation in X | Must exceed zero to identify a slope |
| Sxy = Σxᵢyᵢ | Cross-product sum | Determines the slope’s direction |
| Syy = Σyᵢ² | Total centered variation in Y | Also called SST in this article |
| SSE = Σeᵢ² | Residual sum of squares | Unexplained variation |
| SSR = Σ(Ŷᵢ − Ȳ)² | Regression sum of squares | Variation accounted for by the fitted line |
Which assumptions support which conclusions?
| Goal | Conditions used here | What can go wrong |
|---|---|---|
| Calculate a unique fitted line | An intercept and Sxx > 0 | Identical X values prevent separate slope identification |
| Show unbiasedness | Correct linear conditional mean; E(u | X) = 0 | Omitted confounders or simultaneity can bias the slope |
| Use conventional standard errors | Var(u | X) = σ²I | Unequal variances or correlated errors invalidate the usual variance formulas |
| Claim BLUE | Full rank, zero conditional mean, constant variance, uncorrelated errors | OLS need not remain the most efficient linear unbiased estimator |
| Use exact small-sample t tests | Conditional normality in addition to the classical error assumptions | Without normality, small-sample reference distributions need not be exact |
| Give a causal interpretation | A credible identification strategy beyond a fitted line | Association alone does not establish an intervention effect |
Importantly, normality does not determine whether you can calculate OLS coefficients. Instead, it supports exact finite-sample inference under the classical model. StatLect’s Gauss–Markov discussion explains the narrower meaning of “best”: lowest variance within the class of linear unbiased estimators under the stated assumptions.
Exercises 6.5–6.8: derive and understand OLS regression
Exercise 6.5: why minimize squared vertical residuals?
OLS chooses the intercept and slope that minimize the sum of squared vertical gaps between observed and fitted Y values. Because the model predicts Y conditional on X, each gap measures an error in the outcome’s units. In contrast, a horizontal gap corresponds to predicting X from Y, which answers a different question.
For example, residuals of +4 and −4 sum to zero despite substantial errors. Squaring produces 16 + 16 = 32, so opposite signs no longer cancel. Moreover, doubling a residual multiplies its contribution to the objective by four.
Minimizing the raw sum of residuals is not a meaningful alternative: increasing the intercept can drive that signed sum toward negative infinity. At an OLS optimum with an intercept, the sum equals zero because of a normal equation. However, many other lines can also have a zero residual sum, so zero alone cannot identify the best fit.
Absolute residuals also avoid cancellation. Indeed, least absolute deviations offers a legitimate alternative that targets a conditional median under appropriate conditions. OLS uses a smooth quadratic objective and targets the conditional mean under the stated model; the choice should reflect the research goal, not a claim that squaring is universally superior.
For a concise institutional explanation of the least-squares objective, see NIST’s linear least-squares overview.
Exercise 6.6: derive the two normal equations
First, differentiate Q with respect to the intercept. Next, set the derivative equal to zero and rearrange the result.
ΣYi = nb0 + b1ΣXi
Similarly, differentiation with respect to the slope weights each residual by X. Therefore, the second normal equation requires the weighted residual sum to vanish.
ΣXiYi = b0ΣXi + b1ΣXi²
Together, these equations imply Σeᵢ = 0 and ΣXᵢeᵢ = 0. Furthermore, Q is a convex quadratic. Its Hessian has determinant 4nSxx, so Sxx > 0 makes the stationary point the unique minimum rather than a maximum or saddle point.
Exercise 6.7: solve for the slope and intercept
Multiply the slope normal equation by n. Then multiply the intercept normal equation by ΣXᵢ and subtract the second result from the first. The intercept term cancels, leaving an equation with only b₁.
= b1[nΣXi² − (ΣXi)²]
= Sxy / Sxx
b0 = Ȳ − b1X̄
As a useful check, substitute X̄ into the fitted equation. You obtain b₀ + b₁X̄ = Ȳ, which confirms that the line passes through the sample means. NIST’s least-squares derivation presents the same coefficient formulas.
Exercise 6.8: distinguish parameters, estimates, errors, and residuals
Population coefficients describe the unknown relationship you want to learn. Sample estimates change when you draw a different sample. Likewise, the disturbance uᵢ refers to the population equation, whereas the residual eᵢ uses the fitted sample equation.
| Object | Equation | Interpretation |
|---|---|---|
| Population relationship | Yᵢ = β₀ + β₁Xᵢ + uᵢ | Observed outcome includes the unknown disturbance |
| Population regression function | E(Yᵢ | Xᵢ) = β₀ + β₁Xᵢ | Requires E(uᵢ | Xᵢ) = 0 |
| Sample fitted line | Ŷᵢ = b₀ + b₁Xᵢ | Estimated conditional mean |
| Sample decomposition | Yᵢ = b₀ + b₁Xᵢ + eᵢ | An exact accounting identity after fitting |
Consequently, zero sample correlation between X and OLS residuals does not prove zero population correlation between X and the disturbance. The algorithm enforces the first statement; a research design must justify the second.
Exercises 6.9–6.12: consumption and disposable income
Exercise 6.9: estimate the consumption equation
The first numerical example contains 12 observations. In the supplied explanation, both consumption and disposable income use billions of dollars. Therefore, a one-unit change in either variable means one billion dollars, not one household dollar.
| i | Income X | Consumption Y | XY | X² | Fitted Ŷ | Residual e |
|---|---|---|---|---|---|---|
| 1 | 114 | 102 | 11628 | 12996 | 100.3034 | 1.6966 |
| 2 | 118 | 106 | 12508 | 13924 | 103.7481 | 2.2519 |
| 3 | 126 | 108 | 13608 | 15876 | 110.6376 | -2.6376 |
| 4 | 130 | 110 | 14300 | 16900 | 114.0823 | -4.0823 |
| 5 | 136 | 122 | 16592 | 18496 | 119.2494 | 2.7506 |
| 6 | 140 | 124 | 17360 | 19600 | 122.6941 | 1.3059 |
| 7 | 148 | 128 | 18944 | 21904 | 129.5835 | -1.5835 |
| 8 | 156 | 130 | 20280 | 24336 | 136.4730 | -6.4730 |
| 9 | 160 | 142 | 22720 | 25600 | 139.9177 | 2.0823 |
| 10 | 164 | 148 | 24272 | 26896 | 143.3624 | 4.6376 |
| 11 | 170 | 150 | 25500 | 28900 | 148.5295 | 1.4705 |
| 12 | 178 | 154 | 27412 | 31684 | 155.4190 | -1.4190 |
First, compute the raw totals: ΣX = 1,740, ΣY = 1,524, ΣXY = 225,124, and ΣX² = 257,112. These imply X̄ = 145 and Ȳ = 127. Next, substitute the totals into the slope formula.
= 49,728 / 57,744 = 0.8611803824
b0 = 127 − 0.8611803824(145) = 2.1288445553
The photographed solution rounds the slope to 0.86 before calculating the intercept, producing 2.30. Although that line offers a close approximation, the exact intercept rounds to 2.13. Therefore, retain the full slope internally and round only the final reported results.
Exercise 6.10: derive the centered-data formulas
Centering replaces each variable with its deviation from the sample mean. As a result, Σxᵢ = Σyᵢ = 0. Substituting these identities into the raw-sum slope formula removes the mean terms.
b0, centered = 0 − b1(0) = 0
However, a zero intercept in centered coordinates does not mean the original relationship has a zero intercept. It means you moved the origin to (X̄, Ȳ). Therefore, translate back before interpreting autonomous consumption or another original-scale intercept.
Exercise 6.11: repeat the calculation with deviations
| i | x = X − 145 | y = Y − 127 | xy | x² |
|---|---|---|---|---|
| 1 | -31 | -25 | 775 | 961 |
| 2 | -27 | -21 | 567 | 729 |
| 3 | -19 | -19 | 361 | 361 |
| 4 | -15 | -17 | 255 | 225 |
| 5 | -9 | -5 | 45 | 81 |
| 6 | -5 | -3 | 15 | 25 |
| 7 | 3 | 1 | 3 | 9 |
| 8 | 11 | 3 | 33 | 121 |
| 9 | 15 | 15 | 225 | 225 |
| 10 | 19 | 21 | 399 | 361 |
| 11 | 25 | 23 | 575 | 625 |
| 12 | 33 | 27 | 891 | 1089 |
ŷ = 0.8611803824x
The centered line passes through (0, 0). For example, income 10 units above its mean predicts consumption about 8.612 units above its mean. Adding the means back gives the original-scale point (155, 135.6118).
Thus, centering changes the coordinate labels but leaves fitted values, residuals, the slope, and R² unchanged. This equivalence also gives you an independent way to check a spreadsheet calculation.
Exercise 6.12: interpret the intercept, slope, and elasticity
The intercept predicts consumption of approximately 2.129 billion dollars when disposable income equals zero. However, zero income lies far outside the observed range of 114–178. Consequently, this estimate offers a model extrapolation rather than direct evidence about actual zero-income behavior.
The slope indicates that one additional billion dollars of disposable income corresponds to approximately 0.861 billion dollars of fitted consumption. In a consumption-function interpretation, analysts call this the estimated marginal propensity to consume. A causal interpretation would still require assumptions beyond the sample association.
Elasticity at the sample means = 0.8611803824 × 145 / 127 = 0.983237
Therefore, a 1% income increase near the sample mean corresponds to roughly a 0.983% increase in fitted consumption. Unlike the constant slope, elasticity changes along a level-level line. In particular, a positive intercept makes b₁X/Ŷ less than one when both the slope and X are positive.
Exercises 6.13–6.18: uncertainty and statistical tests
Exercise 6.13: define the variance and standard-error formulas
The population error variance σ² describes dispersion around the population regression function. Because that function is unknown, we estimate its variance using sample residuals. With an intercept and one slope, two fitted coefficients leave n − 2 residual degrees of freedom.
Estimated Var(b1) = s² / Sxx
Estimated Var(b0) = s²[1/n + X̄²/Sxx]
Next, take square roots to obtain standard errors. The residual standard deviation s measures typical outcome scatter, whereas SE(b₁) measures uncertainty about the estimated slope. Therefore, these two quantities answer different questions and carry different units.
SE(b0) = s√[1/n + X̄²/Sxx]
These formulas assume homoskedastic, uncorrelated disturbances conditional on X. Otherwise, suitable robust or dependence-adjusted standard errors may differ even though the OLS coefficients remain numerically unchanged.
Exercise 6.14: prove unbiasedness and coefficient variances
Define cᵢ = xᵢ/Sxx. Then Σcᵢ = 0, ΣcᵢXᵢ = 1, and Σcᵢ² = 1/Sxx. Substituting the population model into b₁ = ΣcᵢYᵢ gives a particularly useful identity.
Under E(uᵢ | X) = 0, the weighted disturbance term has conditional expectation zero. Therefore, E(b₁ | X) = β₁. With conditional error variance σ² and zero conditional cross-error covariances, the variance follows directly.
For the intercept, substitute the slope identity into b₀ = Ȳ − b₁X̄. This yields b₀ = β₀ + ū − X̄Σcᵢuᵢ. Consequently, E(b₀ | X) = β₀.
= σ²[1/n + X̄²/Sxx]
= σ²ΣXi² / (nSxx)
The cross term vanishes because Cov(ū, Σcᵢuᵢ | X) = (σ²/n)Σcᵢ = 0. Notice that the proof needs an exogeneity condition, not merely an observed zero residual sum. Therefore, an algebraically correct fit can still produce a biased population estimate when the underlying research assumptions fail.
Exercise 6.15: calculate the consumption standard errors
Using the unrounded fitted line, SSE equals 115.268495. The sample has 12 observations, so the residual variance uses 10 degrees of freedom. Next, insert Sxx = 4,812 and X̄ = 145 into the coefficient variance formulas.
s = √11.526850 = 3.395121
Estimated Var(b1) = 11.526850 / 4,812 = 0.00239544
SE(b1) = 0.0489432
Estimated Var(b0) = 51.324663
SE(b0) = 7.164123
The slope has a small standard error relative to its estimate. In contrast, the intercept has a large standard error relative to 2.128845. This difference makes sense because the observations cluster far from X = 0, where the original intercept describes the regression function.
Exercise 6.16: choose hypotheses, a distribution, and degrees of freedom
For each coefficient, the standard two-sided significance test uses H₀: βⱼ = 0 against H₁: βⱼ ≠ 0. However, zero is only one possible null value. An economic theory may instead imply β₁ = 1 or another benchmark.
Under the classical normal-error model: tj ∼ tn−2 under H0
Therefore, the consumption tests use 10 degrees of freedom. At a 5% two-sided significance level, the critical value is approximately 2.22814. Normality supports this exact small-sample t distribution; a sample size below 30 does not, by itself, create the justification.
Exercise 6.17: test the intercept and slope
| Coefficient | Estimate | Standard error | t statistic | Two-sided p-value | 5% decision |
|---|---|---|---|---|---|
| Intercept | 2.128845 | 7.164123 | 0.297154 | 0.772430 | Do not reject β₀ = 0 |
| Income slope | 0.861180 | 0.048943 | 17.595501 | 7.48 × 10⁻⁹ | Reject β₁ = 0 |
The intercept test does not provide evidence against zero at the 5% level. Nevertheless, that outcome does not prove the intercept equals zero or justify automatically removing it. A model without an intercept imposes a substantive restriction and changes several familiar regression identities.
Meanwhile, the slope test provides strong evidence of a positive linear association under the model assumptions. However, statistical significance does not establish causation or tell you whether the predictive errors are acceptable for a particular decision.
Exercise 6.18: construct 95% coefficient confidence intervals
| Coefficient | Calculation | 95% confidence interval |
|---|---|---|
| Intercept | 2.128845 ± 2.228139 × 7.164123 | [−13.833817, 18.091506] |
| Slope | 0.861180 ± 2.228139 × 0.048943 | [0.752128, 0.970233] |
As expected, the intercept interval includes zero, while the slope interval excludes it. Moreover, the slope interval also excludes one under the classical assumptions. Therefore, these data distinguish the estimated marginal propensity to consume from both zero and one at the 5% two-sided level.
A frequentist 95% interval describes the long-run coverage of the interval procedure. It does not assign a 95% probability to the fixed population coefficient after observing this particular interval. In practice, communicate both the plausible numerical range and the assumptions behind it.
Exercises 6.19–6.24: goodness of fit and correlation
Exercise 6.19: derive R² from the sum-of-squares decomposition
Start with Yᵢ − Ȳ = (Ŷᵢ − Ȳ) + eᵢ. Squaring and summing gives two sums of squares plus a cross term. Because OLS residuals are orthogonal to the fitted values and sum to zero, that cross term vanishes.
Σ(Yi − Ȳ)² = Σ(Ŷi − Ȳ)² + Σei²
R² = SSR/SST = 1 − SSE/SST
For an in-sample OLS fit with an intercept and positive outcome variation, R² lies between zero and one. However, this familiar bound does not automatically apply to every out-of-sample score or every regression without an intercept. Always check which definition your software uses.
Exercise 6.20: what does correlation measure?
Pearson’s r measures the strength and direction of a linear association. Its sign identifies whether higher X values tend to accompany higher or lower Y values. Because r divides by both variables’ standard deviations, it has no measurement units.
A correlation of zero does not rule out a curved relationship. For example, symmetric X values and Y = X² can produce zero covariance despite a deterministic relationship. Likewise, a high correlation can reflect a common trend or a shared third variable rather than a causal effect.
Regression and correlation also differ in directionality. Correlation treats X and Y symmetrically, but regression of Y on X predicts one designated outcome. Therefore, reversing the regression generally produces a different line rather than the algebraic inverse of the first line.
Exercise 6.21: derive the relationship between r and the slope
Using the same divisor in the sample covariance and both sample variances causes those divisors to cancel. Thus, the usual correlation reduces to Sxy/√(SxxSyy). Next, substitute Sxy = b₁Sxx.
b1 = r√(Syy/Sxx) = r(sY/sX)
Consequently, the slope and Pearson correlation share a sign in simple regression. The slope, however, also reflects the ratio of measurement scales. For example, changing income from dollars to thousands of dollars changes the numerical slope while preserving r.
Exercise 6.22: calculate the consumption R² in two ways
R² = 3,568.731505 / 3,684 = 0.968711
R² = 1 − 115.268495 / 3,684 = 0.968711
Both methods give 96.8711%. Therefore, the fitted line accounts for about 96.87% of the sample’s centered consumption variation. This statement describes in-sample fit; it does not mean the model predicts every consumption observation with 96.87% accuracy.
Using an early-rounded slope in SSR while using a separately rounded residual table in SSE can make the two calculations disagree. Instead, preserve precision throughout and check that SSR + SSE equals SST before rounding the displayed totals.
Exercise 6.23: calculate the consumption correlation in three ways
r = 4,144 / √(4,812 × 3,684) = 0.984231197
r = 0.8611803824√(4,812/3,684) = 0.984231197
The positive sign comes from the positive slope. For a negative slope, the square-root method requires the negative root. Consequently, reporting only √R² would erase the direction of a negative relationship.
A useful cross-check follows: in simple OLS with an intercept, R² = r². This identity does not extend to the square of one individual predictor’s correlation in a general multiple-regression model.
Exercise 6.24: compute rank correlation with a tied grade
The grade example contains ten students and one tie: two students scored 84. First, rank higher grades with smaller rank numbers to match the supplied IQ ranking. Next, assign both tied grades the average of ranks 4 and 5, which equals 4.5.
| Student | Grade | Grade rank | IQ rank | Difference D | D² |
|---|---|---|---|---|---|
| 1 | 77 | 7 | 7 | 0 | 0 |
| 2 | 78 | 6 | 6 | 0 | 0 |
| 3 | 65 | 10 | 8 | 2 | 4 |
| 4 | 84 | 4.5 | 5 | -0.5 | 0.25 |
| 5 | 84 | 4.5 | 4 | 0.5 | 0.25 |
| 6 | 88 | 3 | 3 | 0 | 0 |
| 7 | 67 | 9 | 9 | 0 | 0 |
| 8 | 92 | 2 | 1 | 1 | 1 |
| 9 | 68 | 8 | 10 | -2 | 4 |
| 10 | 96 | 1 | 2 | -1 | 1 |
The familiar shortcut gives 1 − 6(10.5)/[10(10² − 1)] = 0.936364. However, its simplest form assumes no ties. The exact conventional Spearman coefficient instead equals Pearson correlation between the two sets of average ranks.
Σ(Rgrade − 5.5)² = 82
Σ(RIQ − 5.5)² = 82.5
Σ(Rgrade − 5.5)(RIQ − 5.5) = 77
ρs = 77 / √(82 × 82.5) = 0.936174537
Both approaches round to 0.94, so the textbook’s broad interpretation remains unchanged. Nevertheless, distinguishing the exact tied-rank result from the shortcut prevents discrepancies when you compare hand calculations with software. The coefficient indicates a strong positive association between the two rankings.
Rank correlation works well when an ordered scale or a monotonic relationship matters more than raw distances. However, arbitrary numerical labels for unordered categories do not create meaningful ranks. SciPy’s official Spearman documentation also recommends considering permutation inference for small samples instead of relying on a large-sample p-value approximation.
Exercises 6.25–6.29: properties of OLS estimators
Exercise 6.25: define unbiasedness and bias
An estimator is unbiased when its expected value equals the population parameter across repeated samples. In symbols, E(b) = β. Therefore, its bias equals E(b) − β, which is zero for an unbiased estimator.
Unbiasedness does not require one observed estimate to equal the truth. For example, an unbiased slope estimator can produce a value above β in one sample and below β in another. The property concerns its repeated-sampling center, not the accuracy of every single realization.
Exercise 6.26: explain efficiency
Among unbiased estimators of the same parameter, an efficient estimator has the smallest variance within the comparison class. Therefore, its sampling distribution concentrates more closely around the true value. A narrower distribution generally yields more precise estimates, although any particular sample can still produce a large error.
The comparison class matters. For example, “best linear unbiased” compares only estimators that are both linear in the observed outcomes and unbiased. It does not automatically compare every nonlinear or deliberately biased estimator.
Exercise 6.27: why is OLS widely used, and is it always superior?
OLS combines transparent formulas, accessible computation, and a strong theoretical result under classical assumptions. Specifically, the Gauss–Markov theorem makes OLS BLUE when the design has full rank and the conditional disturbance mean is zero with spherical error covariance. Therefore, no other linear unbiased estimator has a smaller variance under those conditions.
However, BLUE does not mean universally best. Heteroskedasticity, correlated disturbances, or a different loss function can motivate another approach. Likewise, a biased estimator may reduce total mean squared error through a sufficiently large reduction in variance.
The word “linear” refers to the estimator’s linear dependence on observed Y values conditional on X. It does not mean every fitted relationship must be a straight line in the original predictor. For example, a model with X and X² remains linear in its coefficients, as NIST explains in its discussion of statistically linear models.
Exercise 6.28: derive the bias–variance decomposition
Mean squared error measures the expected squared distance between an estimator and the true parameter. First, add and subtract E(b) inside that distance. Then expand the square and take expectations.
= E[{b − E(b) + E(b) − β}²]
= E[(b − E(b))²] + [E(b) − β]²
+ 2[E(b) − β]E[b − E(b)]
MSE(b) = Var(b) + Bias(b)²
The last cross term equals zero because E[b − E(b)] = 0. Consequently, an unbiased estimator has MSE equal to its variance. A biased estimator can nevertheless perform better under squared-error loss if its variance falls enough.
For example, suppose estimator A has variance 4 and bias 0, while estimator B has variance 1 and bias 1. Then MSE(A) = 4 and MSE(B) = 2. Therefore, the biased estimator wins under this particular loss function, even though it fails the unbiasedness criterion.
Exercise 6.29: define consistency correctly
Consistency means an estimator converges in probability to the true parameter as sample size grows. In practical terms, the probability of an estimation error larger than any fixed positive tolerance approaches zero. A. Colin Cameron’s UC Davis notes on convergence and consistency use this probability-limit formulation.
P(|bn − β| > ε) → 0 as n → ∞
A common sufficient route combines bias approaching zero with variance approaching zero. By the bias–variance identity, MSE then approaches zero, which implies convergence in probability. However, these moment conditions are sufficient rather than a universally necessary definition of consistency.
Likewise, the sampling density does not converge to a regular curve with height one. Instead, the limiting distribution places all probability mass at the true parameter. Figure 2 illustrates increasing concentration without confusing density height with probability.
Finally, more observations do not automatically remove a systematic endogeneity problem. If the explanatory variable remains related to the disturbance, the estimate may concentrate around the wrong limit. Therefore, consistency requires assumptions about the data-generating process as well as increasing sample size.
Exercise 6.30: income and agriculture across 15 countries
The final exercise relates per-capita income, Y, to agriculture’s share of the economy, X. The supplied source describes these observations as World Development Indicators data for 1999 and expresses income in hundreds of dollars. Therefore, Y = 76 represents approximately $7,600, not $76.
| Country | Agriculture X (%) | Income Y ($100 units) | Fitted Ŷ | Residual e |
|---|---|---|---|---|
| Argentina | 6 | 76 | 43.5311 | 32.4689 |
| Bolivia | 16 | 10 | 17.5356 | -7.5356 |
| Brazil | 9 | 44 | 35.7324 | 8.2676 |
| Chile | 8 | 47 | 38.3320 | 8.6680 |
| Colombia | 14 | 23 | 22.7347 | 0.2653 |
| Dominican Republic | 11 | 19 | 30.5333 | -11.5333 |
| Ecuador | 12 | 13 | 27.9338 | -14.9338 |
| El Salvador | 10 | 19 | 33.1329 | -14.1329 |
| Honduras | 18 | 8 | 12.3365 | -4.3365 |
| Mexico | 5 | 44 | 46.1306 | -2.1306 |
| Nicaragua | 26 | 4 | -8.4599 | 12.4599 |
| Panama | 8 | 31 | 38.3320 | -7.3320 |
| Peru | 8 | 24 | 38.3320 | -14.3320 |
| Uruguay | 9 | 59 | 35.7324 | 23.2676 |
| Venezuela | 5 | 37 | 46.1306 | -9.1306 |
For a modern replication, identify the precise income series before downloading data. The World Bank maintains separate GNI per-capita Atlas-method and agriculture, forestry, and fishing value-added share pages. However, the photographed caption does not provide enough metadata to certify that those current series exactly reproduce the historical exercise.
Part (a): estimate the equation
First, the original data give ΣX = 165 and ΣY = 458. Therefore, X̄ = 11 and Ȳ = 30.533333. The centered totals are Sxx = 442, Sxy = −1,149, and Syy = 5,859.733333.
b0 = 30.533333 − (−2.5995475113)(11)
= 59.1283559578
Ŷ = 59.128356 − 2.599548X
A one-percentage-point increase in agriculture’s share corresponds to approximately 2.59955 fewer units of fitted income. Since each income unit represents $100, the fitted difference equals about −$259.95 per person. Importantly, a percentage point differs from a 1% relative increase in the agriculture share.
This cross-country relationship does not demonstrate that reducing agriculture’s share would cause income to rise. Productivity, industrial structure, education, institutions, and other differences may influence both variables. Consequently, treat the slope as a sample association unless a separate identification strategy supports causality.
Part (b): test both coefficients at the 5% level
The residual sum of squares equals 2,872.853243. With 15 observations and two fitted coefficients, the residual degrees of freedom equal 13. Therefore, the residual variance equals 2,872.853243/13 = 220.988711.
SE(b1) = √0.499974 = 0.707089
Estimated Var(b0) = 75.229490
SE(b0) = 8.673494
The photographed solution prints a slope variance near 0.050, but its standard error near 0.71 implies a variance near 0.50. Therefore, the variance contains a factor-of-ten decimal error. The corrected value restores consistency between the variance and its square root.
| Coefficient | Estimate | Standard error | t statistic | Two-sided p-value | 95% interval |
|---|---|---|---|---|---|
| Intercept | 59.128356 | 8.673494 | 6.817133 | 0.0000123 | [40.390412, 77.866300] |
| Agriculture share | −2.599548 | 0.707089 | −3.676409 | 0.002793 | [−4.127120, −1.071975] |
The 5% two-sided critical value for 13 degrees of freedom is 2.16037. Both absolute t statistics exceed that threshold, so both tests reject a zero coefficient. Nevertheless, the intercept describes X = 0, which lies outside the observed agriculture-share range of 5–26%.
Part (c): calculate the coefficient of determination
r = −√R² = −0.713954
Thus, the fitted line accounts for approximately 50.97% of the sample’s centered income variation. The negative correlation reflects the slope’s direction. Compared with the consumption example, this relationship leaves substantially more variation unexplained.
Part (d): report the results in standard summary form
Standard errors: (8.67349) (0.70709)
t statistics: (6.81713) (−3.67641)
n = 15 | R² = 0.509730 | Residual SD = 14.865689
Always label what the parentheses contain. Some reports show standard errors, while others show t statistics. Consequently, an unlabeled parenthetical number can cause a reader to confuse precision with a test statistic.
In dollar units, the residual standard deviation equals approximately $1,486.57. This gives the reader a more concrete sense of unexplained dispersion than R² alone. However, it does not represent the same interval width for every country or every new prediction.
Beyond the exercises: insights that improve a real analysis
A high R² can coexist with a weakly estimated intercept
The consumption model has R² near 0.969 but an intercept p-value near 0.772. These results do not conflict. Most observed X values lie close to 145 and far from zero, so the sample strongly identifies changes around its center while providing little information about the zero-income intercept.
To see this directly, center only the predictor. The model becomes Ŷ = 127 + 0.861180(X − 145). Its intercept now estimates mean consumption at mean income, with standard error s/√n ≈ 0.980087 rather than 7.164123.
Therefore, centering can greatly improve the interpretability and precision of the intercept without changing a single fitted value. This is a parameterization change, not new information. The original intercept remains uncertain because it answers a different question.
Mean-response confidence intervals differ from prediction intervals
A confidence interval for the mean response describes uncertainty about the regression function at X₀. In contrast, a prediction interval must also allow for a new observation’s individual disturbance. Consequently, the prediction interval is wider.
New-observation SE = s√[1 + 1/n + (X0 − X̄)²/Sxx]
Interval = fitted value ± t0.975,n−2 × appropriate SE
| Income X₀ | Fitted consumption | 95% mean-response CI | 95% prediction interval |
|---|---|---|---|
| 145 | 127.0000 | [124.8162, 129.1838] | [119.1263, 134.8737] |
| 170 | 148.5295 | [145.0364, 152.0226] | [140.1972, 156.8618] |
Notice that the mean-response interval is narrowest at X̄ = 145. As you move away from the mean, the squared distance term increases both interval widths. Penn State’s regression estimation and prediction lesson explains this distinction and the n − 2 degrees of freedom.
The country model produces an impossible fitted value inside the sample
At Nicaragua’s X = 26, the fitted income equals −8.459879 hundred-dollar units, or approximately −$845.99. However, X = 26 is an observed value, so this issue does not result from extrapolating beyond the predictor range. It reveals a limitation of the unrestricted linear mean function for this particular positive outcome.
A log-income specification could guarantee positive fitted values after exponentiation, although it would change the interpretation and introduce retransformation considerations. Alternatively, a richer economic specification might describe the relationship better. The negative fitted value is a reason to investigate the model, not a reason to quietly replace it with zero.
Residual plots reveal information that a fitted line hides
The consumption residual at X = 156 is approximately −6.473, while the residual at X = 164 is approximately +4.638. Meanwhile, Argentina and Uruguay sit far above the country model’s fitted line. These observations deserve attention because large residuals and unusual predictor values can affect model assessment in different ways.
For example, curvature can suggest a misspecified mean function, while a widening residual spread can suggest heteroskedasticity. A residual sequence plotted in time order may reveal dependence that a scatterplot misses. NIST’s model-validation guidance treats graphical checking as a central part of regression analysis.
Leverage and residual size answer different questions
Leverage measures how unusual an observation’s predictor value is relative to the design. A large residual instead measures how far its outcome lies from the fitted line. Therefore, an observation can have high leverage without having the largest residual.
For Nicaragua, hᵢᵢ = 1/15 + 15²/442 ≈ 0.575716. That value is large relative to average leverage 2/15 ≈ 0.133333. Consequently, its agriculture share gives it considerable potential to influence the fitted slope, even though Argentina has a much larger raw residual.
This calculation does not justify deleting Nicaragua. Instead, verify the observation, inspect influence, and compare substantively justified models. Removing inconvenient countries merely to raise R² would distort the analysis.
An extra consistency check: the slope t test and regression F test agree
With one predictor and an intercept, the classical overall regression F test has the same null hypothesis as the two-sided slope t test. Therefore, its statistic equals the square of the slope t statistic. This gives you another useful numerical check.
| Dataset | Slope t | Overall F | Degrees of freedom |
|---|---|---|---|
| Consumption | 17.595501 | 309.601638 | 1 and 10 |
| Country income | −3.676409 | 13.515985 | 1 and 13 |
The country example illustrates why the sign disappears in the overall F test. The squared statistic measures evidence against a zero slope, while the coefficient itself preserves the direction. Thus, always report the estimated slope alongside significance statistics.
Numerical audit: corrections and precision choices
This section separates harmless rounding differences from substantive inconsistencies. All recalculated results use the original observation tables and full internal precision. Therefore, readers can reproduce the calculations without mixing rounded intermediate values.
| Issue in the supplied pages | Checked result | Why it matters |
|---|---|---|
| Consumption intercept of 2.30 after rounding slope to 0.86 | Full-precision intercept = 2.128845 | Rounding the slope early shifts the intercept |
| Consumption SSE = 115.2752 from the rounded line | Exact OLS SSE = 115.268495 | Small differences propagate into standard errors and R² |
| Different routes give slightly different consumption r values | Every exact route gives r = 0.984231197 | Equivalent formulas agree when precision is consistent |
| No-tie rank shortcut applied despite two grades of 84 | Average-rank Pearson correlation = 0.936174537 | The shortcut is approximate here, though both round to 0.94 |
| El Salvador X = 10 in Table 6.10 but 11 in Table 6.11 | Use X = 10; worksheet’s derived entries and total support it | Literal use of 11 changes the regression |
| A worksheet cross-product for Chile shows an inconsistent sign | x = −3 and y ≈ 16.4667 imply xy = −49.4 | The total needs the negative contribution |
| A worksheet cross-product for Uruguay shows an inconsistent sign | x = −2 and y ≈ 28.4667 imply xy = −56.9333 | The correct product is negative |
| Country slope variance printed near 0.050 | Estimated variance = 0.499974 | SE ≈ 0.707 requires variance near 0.50 |
| Country slope t around −3.66 from rounded inputs | Full-precision t = −3.676409 | The 5% decision remains unchanged |
| An intercept t formula visually shows a squared SE in the denominator | Use SE, not estimated variance | A t statistic divides by a standard error |
| Consistency described through a density of height one | Convergence in probability to the true parameter | Density height is not probability mass |
What happens if you literally use the worksheet’s X = 11?
To measure the effect of the inconsistent row, change only El Salvador’s agriculture share from 10 to 11. Keep every income value and all other predictor values unchanged. The following comparison isolates the numerical consequence of that single change.
| Statistic | Original table: X = 10 | Literal worksheet: X = 11 |
|---|---|---|
| Mean X | 11.000000 | 11.066667 |
| Sxx | 442.000000 | 440.933333 |
| Sxy | -1149.000000 | -1160.533333 |
| Intercept | 59.128356 | 59.660720 |
| Slope | -2.599548 | -2.631993 |
| Residual SSE | 2872.853243 | 2805.218022 |
| R² | 0.509730 | 0.521272 |
The original table produces R² = 0.509730, while the changed entry produces R² = 0.521272. However, neither result authorizes choosing whichever version looks better. The data source and internal arithmetic determine the appropriate reconstruction, which is why this guide uses X = 10.
Three quick checks before trusting a regression worksheet
- Verify the raw totals. Sum X and Y directly from the observation rows before using a printed total.
- Check the OLS identities. With an intercept, Σe should be approximately zero, ΣXe should be approximately zero, and the line should pass through the means.
- Check compatible quantities. A standard error squared must equal its estimated variance, and SSR + SSE must equal SST up to numerical precision.
Frequently asked questions about OLS regression
Does OLS regression require normally distributed X or Y?
No. You can calculate OLS without assuming either variable has a normal marginal distribution. For exact classical small-sample tests, the relevant normality assumption concerns the disturbance conditional on X, together with the other model assumptions.
Can I compare the two R² values to decide which economic theory is better?
Not directly. The models use different outcomes, samples, and research questions. Although R² describes in-sample fit in each case, it does not provide a universal ranking of economic theories or practical predictive usefulness.
Should I remove an insignificant intercept?
Only when a defensible model restriction supports doing so. A large intercept p-value does not prove the population intercept equals zero. Moreover, removing the intercept changes the fitting problem and can invalidate familiar centered R² and residual-sum identities.
Why do two calculators produce different answers?
First, check whether they use identical observations and include an intercept. Then compare rounding rules, standard-error assumptions, and rank-tie handling. In these exercises, early rounding and one inconsistent predictor value explain several apparent disagreements.
What information should a complete OLS report include?
Report the equation, variable definitions, units, sample size, coefficient standard errors, and the model’s fit. In addition, state the assumptions behind inference and show relevant diagnostic evidence. A practical report should distinguish sample association, prediction, and causal interpretation.
Conclusion: calculate carefully, then interpret the evidence
OLS regression becomes far more useful when you connect the algebra to the data. The consumption example gives a precisely estimated positive slope and R² near 0.969. By comparison, the historical country example gives a negative slope and R² near 0.510, alongside an impossible negative fitted income that warrants further investigation.
Across the 26 exercises, the central habit remains the same: preserve numerical precision, verify identities, and match each interpretation to its assumptions. In addition, check the original data whenever a printed solution disagrees with its own arithmetic. A reliable regression analysis explains both what the fitted line shows and how confidently the evidence supports that conclusion.
References and source notes
The uploaded textbook pages supply the exercise data and numbering. The resources below support definitions, methods, and extensions; they do not independently verify the historical table’s exact series or data vintage. All hyperlinks were checked or located during preparation on October 21, 2026.
- NIST/SEMATECH. Linear Least Squares Regression.
https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm - NIST/SEMATECH. Least Squares: coefficient derivation.
https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm - Taboga, Marco. Gauss Markov theorem. StatLect.
https://www.statlect.com/fundamentals-of-statistics/Gauss-Markov-theorem - SciPy. scipy.stats.spearmanr official documentation.
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.spearmanr.html - Penn State. STAT 501, Lesson 3: SLR Estimation & Prediction.
https://online.stat.psu.edu/stat501/Lesson03 - NIST/SEMATECH. How can I tell if a model fits my data?
https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm - Cameron, A. Colin. Asymptotic theory notes: convergence in probability and consistency. UC Davis.
https://cameron.econ.ucdavis.edu/slides/bgpev2_asymptotic.pdf - World Bank. GNI per capita, Atlas method (current US$).
https://data.worldbank.org/indicator/NY.GNP.PCAP.CD - World Bank. Agriculture, forestry, and fishing, value added (% of GDP).
https://data.worldbank.org/indicator/NV.AGR.TOTL.ZS
