Business Analytics & Data Science

B06 · Intermediate

Regression Analysis

10 lessons

B06 · Module 2, lesson 1 · Lesson 3 of 10

Inference for coefficients

Decide whether a fitted slope is evidence of a real relationship and how precisely it is known: the population model and its conditions, the standard error of a slope, t tests and confidence intervals for slope and intercept, the F test, and the ToolPak’s output. Then the two judgements software can’t make for you: whether a significant slope matters, and whether the rows were independent enough to trust its standard error.

About 80 minutes

Before you start

You will be able to

  • State the population regression model y = β₀ + β₁x + ε and its four conditions, and say which of them each inference relies on.
  • Calculate the standard error of a slope, s ÷ √Sxx, and explain how the residual spread, the number of rows and the spread of x change it.
  • Test H₀: β₁ = 0, or any other value, with t = (b₁ − β₁₀) ÷ SE(b₁) on n − 2 degrees of freedom, and build confidence intervals for the slope and the intercept, by hand and in Excel.
  • Read the ANOVA and coefficient tables of the ToolPak’s Regression output, and show that t² = F when there is one predictor.
  • Assess whether a statistically significant slope is large enough to matter, and explain how rows that share a day or follow a season make standard errors too small.

Review first

  • The least-squares line — The least-squares slope and intercept, and what they mean in context, are what this lesson tests.
  • Residuals and R² — Residuals, SST = SSR + SSE and the residual standard error s are the raw material of every standard error here.
  • Hypothesis testing — Null and alternative hypotheses, p-values, α and the difference between statistical and practical significance are used without re-teaching.
  • Confidence intervals — An interval as estimate ± critical t × standard error, and what 95% confidence means.
  • Testing a correlation — The t test of r, which gives exactly the same t as the test of a slope when there is one predictor.
  • Descriptive statistics and regression in Excel — Running the ToolPak’s Regression tool and LINEST; this lesson explains the columns B03 named.

Fictional case A fictional coffee business founded by Ana Lim. It starts as a catering and barista-training service, opens its own cafés and an online shop for beans, and plans a canned cold brew.

The idea

Fictional case

Ana wants to roster Harbourside’s weekend peak from the weather forecast. She takes the café’s weekend days from 1 July 2027, when its first four months of building up a clientele were over, to 31 December, and sets aside the three harbour-festival days: 49 Saturdays and Sundays. Fitted by least squares, transactions on the day’s high give ŷ = 26.10 + 1.005x: about one more transaction for each degree warmer. Is that slope a real feature of Harbourside’s weekends, or could 49 days of chance have produced it? And if it is real, how precisely does she know it?

A line from a sample

Ana’s 49 days are a sample from all the weekend days the café might trade under similar conditions. Behind them is a population regression model:

y=β0+β1x+εy = \beta_0 + \beta_1 x + \varepsilon

Here β0+β1x\beta_0 + \beta_1 x is the population line, the average number of transactions on all weekend days with a high of x, and ε\varepsilon (epsilon), the error, is how far one day falls from that average for every reason the line leaves out: rain, a coach party, a sporting event on television. The least-squares coefficients b0b_0 and b1b_1 estimate β0\beta_0 and β1\beta_1. A different 49 weekends would give a different line, so b1b_1 has a sampling distribution, and its spread is what inference measures.

The standard error of the slope

The standard deviation of that sampling distribution, estimated from the data, is the standard error of the slope:

SE(b1)=sSxx,Sxx=∑(x−xˉ)2SE(b_1) = \dfrac{s}{\sqrt{S_{xx}}}, \qquad S_{xx} = \sum (x - \bar{x})^2

Here s is the residual standard error from the residuals lesson (the standard error of the regression), 15.24 transactions for Ana’s weekends, and SxxS_{xx} is the sum of squared deviations of the highs from their mean, 64.3°F: 13,529. So SE(b1)=15.24÷13,529=0.131SE(b_1) = 15.24 \div \sqrt{13{,}529} = 0.131 transactions per °F. Three things make a slope precise: small residuals (s), many rows, and a wide spread of x (both of which raise SxxS_{xx}). Ana’s weekends run from 33°F in December to 94°F in August, and that range is what pins the slope down.

Is the slope zero? The t test

If temperature had no linear relation to weekend transactions, β1\beta_1 would be 0. The test of H0:β1=0H_0: \beta_1 = 0 against H1:β1≠0H_1: \beta_1 \ne 0 uses

t=b1−0SE(b1)=1.0050.131=7.67t = \dfrac{b_1 - 0}{SE(b_1)} = \dfrac{1.005}{0.131} = 7.67

on n−2=47n - 2 = 47 degrees of freedom: two coefficients were estimated, and each costs one. The two-sided p-value, =T.DIST.2T(7.671,47), is below 0.001 (the ToolPak prints 7.92E-10). Ana rejects H0H_0: warmer weekend days go with more transactions at Harbourside, and a slope this far from 0 would essentially never arise by chance if there were no linear relationship. This is the same t as the test of the correlation in B05, rn−2/1−r2r\sqrt{n-2}/\sqrt{1-r^2} with r = 0.746: with one predictor the two tests are identical.

How large is it? The confidence interval

A test only says the slope isn’t 0. The confidence interval says how large it plausibly is:

b1±tn−2∗×SE(b1)=1.005±2.012×0.131=0.741 to 1.269b_1 \pm t^{*}_{n-2} \times SE(b_1) = 1.005 \pm 2.012 \times 0.131 = 0.741 \text{ to } 1.269

where 2.012 is =T.INV.2T(0.05,47). Each extra degree goes with between 0.74 and 1.27 more transactions on an average weekend day, holding nothing else fixed because nothing else is in the model; ten degrees warmer, between 7.4 and 12.7. The interval is the number to plan with: it carries the uncertainty that the single figure 1.005 hides. (The case’s data are generated with a known relationship; its planted slope for Harbourside’s weekends is about 0.97 transactions per °F (0.96 with these days’ rain), inside the interval.)

In depth

The conditions

The t distribution of (b₁ − β₁) ÷ SE(b₁) rests on four conditions about the errors, often remembered by Penn State’s STAT 462 course as LINE:

  • Linearity: the average of y really is a straight line in x. If it curves, the slope is an average of different rates and its interval describes the wrong thing.
  • Independence: each error is unrelated to the others. Violations make the standard error wrong, usually too small.
  • Normality: the errors are roughly normal. With dozens of rows the slope’s t test is fairly robust to skewed errors; small samples, and prediction intervals for single cases, depend on it much more.
  • Equal variance: the errors have the same spread at every x. If the spread grows with x, the usual standard error is off, and robust standard errors are the remedy.

OpenStax’s list adds a fifth: the data come from a random sample or a randomised experiment. This lesson names the conditions; assumptions-and-diagnostics checks each one with residual plots and tests. The case’s generator is multiplicative, so its spread in transactions grows with the average; over Ana’s 49 weekends the effect is too small to see (the Breusch–Pagan test that module 4 introduces gives p = 0.42), though across all 306 of Harbourside’s days, weekdays and weekends together, the same test on transactions against the high gives p = 0.006.

Where the standard error comes from

The least-squares slope is a weighted sum of the y values, b1=∑(xi−xˉ) yi÷Sxxb_1 = \sum (x_i - \bar{x})\,y_i \div S_{xx}. If the errors are independent with common variance σ2\sigma^2, the variance of that sum is σ2/Sxx\sigma^2 / S_{xx}. The residual standard error s estimates σ\sigma on n−2n - 2 degrees of freedom, and replacing σ\sigma by s is what turns a normal distribution into a t distribution. Both steps lean on independence: the weights only add up this way if each day’s error is unconnected with the next.

Adding a predictor that accounts for part of the error lowers s and with it every standard error. Rain is the obvious one for a waterfront café: with the day’s rain in the model as well (multiple regression, module 3), s falls from 15.24 to 12.91 transactions and the temperature slope’s standard error from 0.131 to 0.111.

The intercept

The intercept has its own standard error, SE(b0)=s1/n+xˉ2/SxxSE(b_0) = s\sqrt{1/n + \bar{x}^2/S_{xx}}, here 15.24×1/49+64.352/13,529=8.7115.24 \times \sqrt{1/49 + 64.35^2/13{,}529} = 8.71. Its t is 26.10 ÷ 8.71 = 3.00 (p = 0.004) and its 95% interval runs from 8.6 to 43.6 transactions. Software prints this test for every model, but read it only when x = 0 means something. Here it is the average weekend at 0°F, colder than any day in the data (the coldest was 33°F), so the test answers a question nobody asked. The least-squares-line lesson shows the same problem in a starker form: Harbourside’s sales on transactions has an intercept of −$76.58.

Testing a value other than 0

The t statistic works for any hypothesised slope: t=(b1−β1,0)÷SE(b1)t = (b_1 - \beta_{1,0}) \div SE(b_1). The useful question is often not “is there a relationship?” but “is it the size the plan assumes?”. Ana’s budget (a fictional planning figure) assumes each extra transaction at Harbourside brings $6.40 of sales. Across the café’s 306 days, sales on transactions give a slope of $6.641 per transaction with a standard error of $0.0479, so t=(6.641−6.40)÷0.0479=5.03t = (6.641 - 6.40) \div 0.0479 = 5.03 on 304 degrees of freedom, p below 0.001. The worked examples follow it through.

The F test and the ANOVA table

The ToolPak’s ANOVA block splits the total sum of squares as the residuals lesson did, SST = SSR + SSE, and turns the split into a test. Each sum of squares divided by its degrees of freedom is a mean square; the residual mean square is s2s^2. The F statistic is their ratio:

F=MSRMSE=SSR/1SSE/(n−2)F = \dfrac{\text{MSR}}{\text{MSE}} = \dfrac{\text{SSR}/1}{\text{SSE}/(n-2)}
ANOVA: transactions on the day’s high, Harbourside weekends, 1 July – 31 December 2027 (49 days)
dfSSMSFSignificance F
Regression113666.913666.958.84617.92E-10
Residual4710915.7232.248
Total4824582.5

F tests whether all the slopes are 0 at once. With one predictor that is the same hypothesis as the t test, and F is exactly t²: 7.671² = 58.85. Significance F is therefore the same p-value as the slope’s, 7.92E-10. The F test earns its keep in multiple regression, where it tests several slopes together and the t tests no longer add up to it.

Reading the coefficient table

Coefficients: the same fit, as the ToolPak prints them
CoefficientsStandard Errort StatP-valueLower 95%Upper 95%
Intercept26.10188.707372.997660.004336898.5847843.6187
High (°F)1.005080.1310217.671127.92E-100.7414981.26866
  • Coefficients are b₀ and b₁; Standard Error is SE(b₀) and SE(b₁).
  • t Stat is the coefficient divided by its standard error: the test of H₀: β = 0 only. To test another value, subtract it first.
  • P-value is two-sided. E-notation such as 7.92E-10 means 7.92 × 10⁻¹⁰; report it as “below 0.001”.
  • Lower 95% and Upper 95% are the coefficient ± T.INV.2T(0.05, n − 2) × its standard error. The ToolPak’s Confidence Level box adds a second pair at another level.

LINEST gives the same numbers in a different arrangement: =LINEST(C2:C50,B2:B50,TRUE,TRUE) returns the slope and intercept in its first row and their standard errors in its second, so =INDEX(LINEST(C2:C50,B2:B50,TRUE,TRUE),2,1) is SE(b₁). LINEST prints no t or p; divide and use T.DIST.2T.

Statistical and practical significance

A p-value says whether the slope is distinguishable from 0, not whether it matters. At Millbrook, the office-district café, footfall on the day’s high across all 306 days gives a slope of 0.85 people per °F, t = 2.77, p = 0.006: statistically significant. But R² is 0.025, and a day 10°F warmer goes with about 8.5 more people on an average of 226, roughly 4% more. Whether that has practical significance depends on the decision: it is too small to change a roster, whose half-hour steps cover about 3.5 peak transactions: 8.5 more people at Millbrook’s 55% conversion is about 4.7 transactions, 2.6 of them in the peak.

The reverse mistake is as common. Millbrook’s footfall on rain gives a slope of −42.9 people per inch, p = 0.074: not significant at 5%. Its interval, −90.0 to +4.2, still includes losing 90 people on a one-inch day. “Not significant” means the data can’t rule out 0, not that the effect is 0; the interval shows what they can’t rule out on either side.

When rows aren’t independent

Independence is the condition that business data break most often, and the one the output gives no warning about. Two forms appear in Ana’s log.

Days in sequence. Harbourside’s 220 weekdays (festival days left out) give a slope of footfall on the day’s high of 1.36 people per °F, with a formula standard error of 0.094 and t = 14.4. But the high follows the season, with a correlation of 0.93 between one day’s high and the next, and the residuals do too: one weekday’s residual and the next correlate at 0.23. Neighbouring days repeat each other, so the 220 days carry less independent information than 220 separate draws. Newey–West standard errors, which allow for residuals correlated over a chosen number of lags (beyond this course to derive), put the slope’s standard error at 0.121 allowing 5 lags, 0.147 allowing 10 and 0.185 allowing 20: the formula’s figure is up to about half what it should be, and its interval up to about twice too narrow. The weekdays also include the café’s build-up over its first four months, which coincided with the spring’s warming (over the first 120 days, the high and the build-up correlate at 0.79); holding the build-up fixed (multiple regression) moves the slope to 1.15. Ana’s weekend sample avoids both problems: it starts after the build-up, and its residuals in date order correlate at only 0.03. It is not the seasonal x that matters, but whether the errors depend on each other.

Leaving a pattern out can create dependence of its own. All 306 Harbourside days together give residuals that correlate at 0.30 from one day to the next and 0.43 a week apart: that is the weekly pattern of busy weekends, which a line in temperature alone leaves in the residuals. The cure there is to model the weekday pattern (categorical predictors, module 3), not only to adjust the standard error.

Rows that share a day. Pooling both cafés, footfall on rain across 612 rows gives a slope of −62.0 people per inch with a formula standard error of 18.0. But the 612 rows hold only 306 days of weather: each day’s rain is entered twice, and the formula treats the two rows of a day as independent. They aren’t: on the same day the two cafés’ residuals correlate at −0.43, because Harbourside is busy at weekends and Millbrook on weekdays, so one café’s busy day is the other’s quiet one. Here that makes the formula’s standard error too large rather than too small: allowing for the pairing by day (a day-clustered standard error, beyond this course) gives 9.68, about half. Dependence doesn’t only make standard errors too small; it makes them wrong, in a direction that depends on how the rows are related. Rows that resemble each other (two branches in the same town on a sunny day) make the formula too optimistic; rows that offset each other, as here, make it too cautious. Fit each café separately (Harbourside’s slope is −81.1, Millbrook’s −42.9): each café’s 306 rows have one row a day, and the question “what does rain cost this café?” is the one Ana can act on.

Formulas

Population simple regression model

y=β0+β1x+εy = \beta_0 + \beta_1 x + \varepsilon
β0,β1\beta_0, \beta_1
Population intercept and slope, estimated by b₀ and b₁units of y; units of y per unit of x
xx
Predictorits units
yy
Responseits units
ε\varepsilon
Error: how far one case falls from the population lineunits of y

Assumes. Linearity, independent errors, roughly normal errors, equal error variance at every x (LINE).

Checked with residual plots in assumptions-and-diagnostics.

Standard error of the slope

SE(b1)=sSxx,Sxx=∑(xi−xˉ)2SE(b_1) = \dfrac{s}{\sqrt{S_{xx}}}, \qquad S_{xx} = \sum (x_i - \bar{x})^2
ss
Residual standard error, √(SSE ÷ (n − 2)); Excel’s STEYXunits of y
SxxS_{xx}
Sum of squared deviations of x from its mean; Excel’s DEVSQunits of x squared
xi,xˉx_i, \bar{x}
Each value of x and their meanunits of x
SE(b1)SE(b_1)
Estimated standard deviation of the slope’s sampling distributionunits of y per unit of x

Assumes. Independent errors with equal variance.

In Excel: =STEYX(C2:C50,B2:B50)/SQRT(DEVSQ(B2:B50)), or =INDEX(LINEST(C2:C50,B2:B50,TRUE,TRUE),2,1).

t test for a slope

t=b1−β1,0SE(b1),df=n−2t = \dfrac{b_1 - \beta_{1,0}}{SE(b_1)}, \qquad \text{df} = n - 2
b1b_1
Estimated slopeunits of y per unit of x
β1,0\beta_{1,0}
Slope under the null hypothesis, usually 0units of y per unit of x
SE(b1)SE(b_1)
Standard error of the slopeunits of y per unit of x
nn
Number of rows
tt
Test statistic, compared with the t distribution
df\text{df}
Degrees of freedom

Assumes. The LINE conditions; the t distribution is exact for normal errors and approximate otherwise.

Two-sided p-value: =T.DIST.2T(ABS(t),n-2). With one predictor this t equals the t test of r.

Confidence interval for a slope

b1±tn−2∗ SE(b1)b_1 \pm t^{*}_{n-2}\, SE(b_1)
tn−2∗t^{*}_{n-2}
Critical t for the confidence level; for 95%, T.INV.2T(0.05, n − 2)
b1b_1
Estimated slopeunits of y per unit of x
SE(b1)SE(b_1)
Standard error of the slopeunits of y per unit of x

The ToolPak’s Lower 95% and Upper 95%.

Standard error of the intercept

SE(b0)=s1n+xˉ2SxxSE(b_0) = s\sqrt{\dfrac{1}{n} + \dfrac{\bar{x}^2}{S_{xx}}}
SE(b0)SE(b_0)
Standard error of the intercept b₀units of y
ss
Residual standard errorunits of y
nn
Number of rows
xˉ\bar{x}
Mean of xunits of x
SxxS_{xx}
Sum of squared deviations of xunits of x squared

Test and interval as for the slope, on n − 2 df; meaningful only when x = 0 is a sensible value inside or near the data.

F test for a simple regression

F=SSR/1SSE/(n−2)=t2F = \dfrac{\text{SSR}/1}{\text{SSE}/(n - 2)} = t^2
SSR\text{SSR}
Regression sum of squares, SST − SSEunits of y squared
SSE\text{SSE}
Residual sum of squaresunits of y squared
nn
Number of rows
FF
F statistic: the regression mean square over the residual mean square
tt
The slope’s t statistic

Assumes. As for the t test; compared with the F distribution on 1 and n − 2 df.

Significance F: =F.DIST.RT(F,1,n-2). With several predictors F tests all slopes at once (multiple-regression).

Worked examples

A first example: Cones and temperature at a seafront kiosk

Fictional figures

Ferrybridge Ice Cream (fictional), a seafront kiosk, recorded the day’s high and the cones sold on eight days. The least-squares line is ŷ = −65.70 + 2.971x, with residual standard error s = 4.803 cones. Is the slope significantly different from 0 at α = 0.05, and what is its 95% confidence interval?

High (°F)6266707175788288
Cones sold118131140152149170176197
  1. Spread of x: the mean high is xˉ=74\bar{x} = 74°F and Sxx=∑(x−74)2=144+64+16+9+1+16+64+196=510S_{xx} = \sum (x - 74)^2 = 144 + 64 + 16 + 9 + 1 + 16 + 64 + 196 = 510.
  2. Standard error of the slope: SE(b1)=4.803÷510=4.803÷22.58=0.2127SE(b_1) = 4.803 \div \sqrt{510} = 4.803 \div 22.58 = 0.2127 cones per °F.
  3. t test of H0:β1=0H_0: \beta_1 = 0: t=2.971÷0.2127=13.97t = 2.971 \div 0.2127 = 13.97 on 8 − 2 = 6 degrees of freedom. =T.DIST.2T(13.97,6) is about 0.00001, below 0.001: reject H0H_0.
  4. Interval: the critical t is =T.INV.2T(0.05,6) = 2.447, so 2.971±2.447×0.21272.971 \pm 2.447 \times 0.2127 runs from 2.450 to 3.491 cones per °F.

Answer. t = 13.97 on 6 df, p below 0.001; 95% interval for the slope 2.45 to 3.49 cones per °F.

What it means. Even with eight days the slope is clearly not 0, because the residuals are small (about 5 cones) relative to how much sales change across a 26-degree range. The interval is still wide in relative terms: a 10°F warmer day goes with somewhere between 25 and 35 more cones. Eight days from one stretch of summer may not be independent either: look at the residuals in date order before trusting the interval exactly.

A harder example: Is an extra transaction worth the budget’s $6.40?

Fictional figures

Ana’s 2028 budget (a fictional planning figure) assumes each extra transaction at Harbourside brings $6.40 of sales. Across Harbourside’s 306 days in 2027, sales on transactions give b₁ = $6.641 per transaction, SE(b₁) = $0.0479, and an intercept of −$76.58. Test H₀: β₁ = 6.40 at α = 0.05, give the 95% interval, and explain why the slope is well above Harbourside’s average ticket of $5.34.

  1. Hypotheses: H0:β1=6.40H_0: \beta_1 = 6.40 (the budget’s figure), H1:β1≠6.40H_1: \beta_1 \ne 6.40. The ToolPak’s t Stat, 138.6, tests β1=0\beta_1 = 0, which nobody doubts; it is the wrong test here.
  2. Statistic: t=(6.641−6.40)÷0.0479=5.03t = (6.641 - 6.40) \div 0.0479 = 5.03 on 306 − 2 = 304 degrees of freedom; =T.DIST.2T(5.030,304) is about 0.000001, below 0.001. Reject H0H_0.
  3. Interval: 6.641±1.968×0.04796.641 \pm 1.968 \times 0.0479, from $6.547 to $6.735 per transaction. It excludes $6.40, as the test at 5% requires.
  4. Why above the average ticket: the slope is the extra sales that go with one more transaction, not the average sale. In this log the average ticket itself rises on busier days (B05 found footfall and average ticket positively correlated within each café), so each extra transaction comes with slightly bigger tickets on the rest; the line pays for that with its negative intercept.
  5. Dependence: the residuals of this fit correlate at 0.18 from one day to the next, so check them in date order before trusting the standard error exactly. With t = 5.03 the conclusion would survive a standard error a good deal larger.

Answer. t = 5.03 on 304 df, p below 0.001: the slope differs from $6.40. 95% interval $6.55 to $6.74 per extra transaction.

What it means. The budget’s figure is a little low as a marginal value, and the difference is about 24 cents a transaction: on a busy day 50 transactions above normal, about $12. Statistically clear, practically modest. Ana should keep the planning figure honest by quoting the interval, and should not confuse the slope (extra sales per extra transaction on this range of days) with the average ticket ($5.34), which is what each transaction brings on average.

Applied: a business decision: How many more barista hours per 10 degrees?

Fictional figures

Ana rosters Harbourside’s 7–11 a.m. peak to keep peak transactions per barista hour at about 7 or fewer (B05 found waits rise steeply above that load). In the log, peak transactions are 55% of the day’s. Using the weekend model (b₁ = 1.005 transactions per °F, 95% interval 0.741 to 1.269), how many extra barista hours should a weekend forecast 10°F warmer than another add?

  1. Slope to the change: 10°F × 0.741 to 10 × 1.269 = 7.4 to 12.7 more transactions in the day; 10.05 at the estimate.
  2. Peak share: 55% of those fall in the peak, 0.55 × 7.41 = 4.08 to 0.55 × 12.69 = 6.98 peak transactions.
  3. Barista hours at 7 transactions each: 4.08 ÷ 7 = 0.58 to 6.98 ÷ 7 = 1.00 extra barista hour; 0.79 at the estimate.
  4. Check the inputs: the 49 days start after the café’s build-up and leave out festivals, and their residuals in date order correlate at only 0.03, so the interval is believable. It is an interval for the average change, not a promise about a particular Saturday.

Answer. Between about half an hour and one hour of extra barista time for each 10°F; 0.8 hour at the estimate: one extra half hour per 10°F, or a full hour if Ana plans to the interval’s upper end.

What it means. The interval, not the estimate, sets the rule: even its lower end justifies an extra half hour for a 10-degree warmer forecast. How many hours a particular Saturday needs is a different question, about one day rather than the average, and needs the wider prediction interval of the next lesson. Rain, the other big influence on a waterfront café, would sharpen the rule; multiple regression adds it.

Explore

The ToolPak’s Summary Output for Harbourside’s 49 weekend days from July. With High (°F) alone, check SE(b₁) = 0.131, t = 7.67 and the interval 0.741 to 1.269, and that F = t². Then tick Rain as well: s falls from 15.24 to 12.91 and the temperature slope’s standard error with it.

Loading the interactive…

What makes a slope precise? Change the residual standard error, the number of rows and the spread of x, and watch SE(b₁), t and the interval. Doubling the spread of x halves the standard error; doubling n only divides it by about 1.4.

Loading the interactive…

The same 49 days with the whole inference as formulas: SLOPE, STEYX, DEVSQ, the standard error, t, T.DIST.2T and T.INV.2T, and LINEST’s standard error for comparison. Change the confidence level in G9, or a day’s transactions, and everything updates.

Loading the interactive…

Common mistakes

  • “p is below 0.001, so the slope is large.”

    The p-value measures distance from 0 in standard errors. Millbrook’s 0.85 people per °F is significant (p = 0.006) and too small to change a roster. Report the slope with its interval and judge the size in the decision’s units.

  • “The slope isn’t significant, so x has no effect.”

    Failing to reject β₁ = 0 means 0 is among the plausible values, not that it is the true one. Millbrook’s rain slope has p = 0.074 and an interval from −90 to +4 people per inch: a large effect is still possible.

  • Using the printed t Stat to test the value a plan assumes

    The ToolPak’s t Stat and P-value test β = 0 only. To test β₁ = 6.40, compute (b₁ − 6.40) ÷ SE(b₁), or check whether 6.40 lies inside the interval.

  • Reading the intercept’s test when x = 0 is meaningless

    Every output tests the intercept, but at 0°F, or 0 transactions, the line is an extrapolation. Ignore the intercept’s p-value unless x = 0 is a real and observed situation.

  • Trusting standard errors from dependent rows

    Two cafés on the same days, or consecutive days that follow the season, are not independent observations. Consecutive weekdays at Harbourside make the formula’s standard error up to about half what it should be; two cafés with opposite weekly patterns make it about twice too large. Fit groups separately, choose rows whose errors are independent, check residuals in date order, and say so beside the p-value.

  • Using n − 1 degrees of freedom

    A simple regression estimates two coefficients, so its t tests and intervals use n − 2 degrees of freedom: T.INV.2T(0.05, n − 2), T.DIST.2T(|t|, n − 2).

Guided practice

Work through these with hints when you need them. Every hint and every worked solution is there to be used.

Loading four questions…

On your own

No hints this time. Answer, check, and read the feedback; the solution appears once you have answered or if you ask for it. Your first answers count toward mastery.

Loading six questions…

In practice

Fictional case

Ana’s note to Harbourside’s manager reads: “Weekend transactions rise by about 1.0 for each degree of forecast high (95% CI 0.74 to 1.27; 49 weekend days, July to December 2027, festival days excluded; t = 7.7, p < 0.001). Residuals from day to day are essentially independent (r = 0.03), so the interval is a fair guide. For each 10°F warmer forecast, roster an extra half hour of barista time at the peak (0.8 hour at the estimate), or a full hour if we plan to the interval’s upper end. This is an average; for a particular day see the prediction intervals. Don’t use the figure for all 306 days (2.0 people per °F in footfall): it mixes weekdays with weekends and includes the café’s first four months of build-up.”

The note gives the slope in the decision’s units, its interval, the sample and its exclusions, and the condition most likely to fail. It translates the interval into the roster’s half-hour steps, which is where practical significance is decided, and it separates the average change (this lesson) from a single day’s forecast (the next).

Analysts elsewhere make the same moves. An electricity retailer estimating extra demand per degree of cooling weather reports the slope with an interval and knows that consecutive hot days are not independent. A hotel group testing whether its own 6.5% planned uplift per marketing pound is right tests the slope against 6.5%, not against 0. A clinic finding that waiting time falls by a significant 0.2 minutes per extra receptionist hour decides whether 0.2 minutes is worth an hour’s wage; the p-value can’t make that call.

Two cautions travel with every coefficient. It is an association: warm weekends go with more transactions, which is plausible as a cause here, but the regression alone doesn’t show it. And it holds for the range and conditions sampled: Harbourside’s weekends from July, between 33°F and 94°F, after the café was established.

Knowledge check

Six questions, one attempt each, no hints. Score 80% or more to complete the lesson; you can take it again at any time.

Loading six questions…

Summary

  • The population model is y = β₀ + β₁x + ε; b₀ and b₁ estimate β₀ and β₁, and vary from sample to sample.
  • SE(b₁) = s ÷ √Sxx: smaller residuals, more rows and a wider spread of x make the slope more precise.
  • Test H₀: β₁ = β₁₀ with t = (b₁ − β₁₀) ÷ SE(b₁) on n − 2 df; the ToolPak’s t Stat tests 0 only. With one predictor this t equals the t test of r, and F = t².
  • The 95% interval b₁ ± T.INV.2T(0.05, n − 2) × SE(b₁) says how large the slope plausibly is. Plan with it, not with the estimate alone.
  • The conditions are linearity, independence, normality and equal variance (LINE); module 4 checks them. Read the intercept’s test only when x = 0 is meaningful.
  • Significant is not the same as important, and not significant is not the same as no effect: judge both with the interval in the decision’s units.
  • Rows that share a day or follow a season are not independent: standard errors, intervals and p-values are then wrong, usually too small, sometimes too large. Say so wherever they are printed.

Key formulas

Terms introduced

Population regression model
The model y = β₀ + β₁x + ε that a sample regression estimates: a population line giving the average of y at each x, plus an error ε for how far each case falls from it.
LINE conditions
The four conditions behind regression’s t tests and intervals: a linear relationship, independent errors, normally distributed errors and equal error variance at every x.
Standard error of the slope
The estimated standard deviation of a regression slope’s sampling distribution, s ÷ √Sxx in simple regression: how far the slope from one sample typically lies from the population slope.

Sources

  1. Penn State Eberly College of Science. STAT 462: Applied Regression Analysis, lesson 3.1, “Inference for the Population Intercept and Slope”. online.stat.psu.edu/stat462/node/102
  2. Illowsky, B. & Dean, S. (2023). Introductory Statistics 2e, section 12.4, “Testing the Significance of the Correlation Coefficient” (the regression assumptions). OpenStax. openstax.org/books/introductory-statistics-2e/pages/12-4-tes…
  3. NIST/SEMATECH. e-Handbook of Statistical Methods, section 4.1.4.1, “Linear Least Squares Regression”. itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm
  4. Microsoft Support. “LINEST function”. support.microsoft.com/en-US/excel/functions/linest-function
  5. Microsoft Support. “STEYX function”. support.microsoft.com/en-us/excel/functions/steyx-function