Paths Subjects Questions Quizzes Pricing Search
Intermediate Open Free

Fit and Test a Simple Regression by Hand

A marketing analyst has four quarters of data on discount depth x (percentage points) and units sold y (thousands):

x:  0    10   20   30
y:  10   14   15   21
  1. Compute the OLS slope and intercept by hand and write the fitted line.
  2. Compute the residuals, RSS, TSS and R².
  3. Compute the residual variance, the standard error of the slope and the t-statistic. With only 2 residual degrees of freedom the two-sided 5% critical value is 4.303 — is the slope statistically significant at 5%? What does that tell you about small-sample regressions?
Solution

1. Slope and intercept

\bar x = 15, \bar y = 15.

x - x̄:        -15   -5    5   15      → S_xx = 225+25+25+225 = 500
y - ȳ:         -5   -1    0    6
(x-x̄)(y-ȳ):    75    5    0   90      → S_xy = 170

\hat\beta_1 = 170/500 = 0.34, \hat\beta_0 = 15 - 0.34 \times 15 = 9.9.

Fitted line: \hat y = 9.9 + 0.34x — each extra percentage point of discount is associated with 340 more units.

2. Residuals and R²

ŷ:      9.9   13.3   16.7   20.1
e:      0.1    0.7   -1.7    0.9        (sums to 0)
e²:    0.01   0.49   2.89   0.81        → RSS = 4.2

\text{TSS} = 25 + 1 + 0 + 36 = 62, so R^2 = 1 - 4.2/62 = 0.932.

3. Inference

\hat\sigma^2 = \text{RSS}/(n-2) = 4.2/2 = 2.1.

\text{SE}(\hat\beta_1) = \sqrt{\hat\sigma^2 / S_{xx}} = \sqrt{2.1/500} = \sqrt{0.0042} = 0.0648.

t = 0.34 / 0.0648 = 5.25 > 4.303, so the slope is significant at 5% even with 2 degrees of freedom. The 95% CI is 0.34 \pm 4.303 \times 0.0648 = (0.061, 0.619).

The lesson: significance here rests on an R^2 of 0.93 with n = 4. The confidence interval spans a factor of ten — the effect could be 0.06 or 0.62 units per point — so "significant" says almost nothing about the size of the effect. With tiny samples the critical value balloons (4.303 vs the ~2 you would use with large n), and a single additional quarter with a bad residual could push t below the threshold. Report the CI, not the star, and be explicit that four points cannot support a pricing decision on their own.

Share this question

← Back to Linear Regression practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.