Concepts

  • The fitted coefficients describe the sample at hand, but inference means making a statement about the true, unknown population relationship.
    • To do that, we need an estimate of the error variance, standard errors for the estimators, a reference distribution, and a way to measure how much variation the regression actually explains.
    • The goal of this whole note is to move fluently among coefficient inference, , and ANOVA — they all come from the same handful of ingredients below, not three unrelated topics.
  • The first ingredient is an estimate of the error variance , since every standard error below needs it and itself is never known.
    • Recall is the sum of squared residuals.
    • Fitting two parameters ( and ) costs two degrees of freedom out of , so the unbiased estimate divides by instead of : .
    • The residual standard error is just the square root: .
  • Inference for the slope asks whether the true could plausibly equal some specific value.
    • Its standard error, from Regression Estimator Properties, is .
    • To test against , the test statistic is , compared against a distribution.
    • The most common null is (is there any linear relationship at all?), but shows up too (e.g. testing whether two measurements are on a 1-to-1 scale) — same formula, just a different number subtracted in the numerator.
    • Reject for a large , which is the same thing as a small two-sided -value.
  • A confidence interval for the slope is built from the same standard error.
    • The interval is , where is the critical value for the chosen confidence level.
    • Test–CI connection: a two-sided level- test rejects exactly when falls outside this interval — so you can read off a test’s conclusion directly from the CI.
  • Inference for the intercept works the same way, with its own standard error from the same earlier note: .
    • The -test and CI machinery is identical to the slope’s, just with this standard error substituted in.
    • Interpretation warning: the intercept is the expected response at , which can be scientifically meaningless if sits far outside the range of data you actually observed.
  • A confidence interval for the mean response at some new answers “where does the true regression line sit at ?”
    • The fitted mean response there is .
    • Its standard error is , and the interval is .
    • This interval is narrowest when , since is smallest there — the fitted line is best pinned down near the center of the data, and gets less certain the further you move from it.
  • A prediction interval for one new observation at answers a different question: “where will one actual new data point land?”
    • A single new response carries two separate sources of uncertainty: the uncertainty in where the mean line itself sits, and that one observation’s own random error around the line.
    • Its standard error adds an extra to account for that second source: , giving the interval .
    • Because of that extra under the root, a prediction interval is always wider than the confidence interval for the mean response at the same .
  • falls directly out of the sum-of-squares decomposition covered in the earlier proofs note.
    • Recall .
    • Dividing through by gives .
    • Read it as ” of the total sample variability in is explained by the fitted regression on .”
    • In simple linear regression with an intercept, is also exactly the squared correlation coefficient: .
    • What does not tell you: it doesn’t prove causation, and it doesn’t verify linearity, normality, independence, or constant variance — a high can still coexist with a badly misspecified model.
  • The ANOVA table is just the same three sum-of-squares quantities organized into rows, with degrees of freedom and averages attached.
    • The regression row has SS , df (one predictor), and MS .
    • The residual row has SS , df , and MS .
    • The total row has SS , df .
    • The statistic compares the two mean squares: .
  • Reconstructing a partially blank ANOVA table is mostly a matter of knowing which quantities determine which others.
    • The degrees of freedom tell you : total df is , residual df is .
    • lets you fill in whichever SS is missing once the other two are known.
    • and convert sums of squares into mean squares.
    • connects the two mean squares.
    • If is given instead of an SS value, use or to back it out.
  • In simple linear regression, the overall -test and the slope’s two-sided -test are secretly the same test — this is worth deriving once so it’s not just a memorized fact.
    • Since , the fitted deviation from the mean simplifies to .
    • Squaring and summing that gives .
    • Since the regression row has only degree of freedom, .
    • Dividing by : .
    • The expression in parentheses is exactly the slope’s -statistic under , so .
    • In other words: with only one predictor, “does the model explain anything” (the -test) and “is the slope nonzero” (the -test) are the same question asked two different ways.

Practice Problems

  • Problem 1 (HW1 Q8 — airfares: Fare ~ Distance, ). Fitted line . Test ; give a 95% CI for ; report and interpret and the residual standard error; predict the fare for a 500-mile flight with a 95% prediction interval, checking first whether 500 lies in the observed range.

    • Solution.
      • on df, — reject , strong evidence of a positive linear association
      • 95% CI for : , using — is far outside it, same conclusion as the test
      • : distance explains about 99.4% of the variation in fare
      • residual standard error on df: typical miss of about $10.41
      • observed distances run 90 to 1828 miles, so is inside the range (interpolation, reliable)
      • fitted value at : — about $158.82
      • 95% prediction interval — about $135.79 to $181.85
  • Problem 2 (HW1 Q6 — mtcars: mpg ~ wt, ). Fitted line . Interpret the slope and intercept; report and interpret .

    • Solution.
      • slope : each additional 1000 lbs of weight is associated with about fewer mpg, on average
      • intercept : predicted mpg at , not meaningful since no real car weighs nothing and all observed weights are well above zero
      • : weight explains about 75.3% of the variation in mpg
      • residual standard error on df
      • on df,
  • Problem 3 (Case Study A — test2 ~ test1, , a non-zero null). Test both (no bias) and (perfect agreement), and report .

    • Solution.
      • intercept test (against by default): , — no evidence of a constant offset
      • slope test against (not the default , since the question is whether the relationship is proportional): on df, — fail to reject, no evidence the tests drift apart
      • 95% CI for the slope , which contains
      • : test1 explains about 84% of the variation in test2
  • Problem 4 — reconstruct a full ANOVA table and compare the two kinds of interval (Production data: RunTime ~ RunSize, ). The SLR slides quote only the slope test (, , , ) for this dataset. Fill in the full ANOVA table, and find both a 95% CI for the mean response and a 95% prediction interval at .

    • Solution.
      • on df (matches above)
      • regression: SS , df , MS
      • residual: SS , df , MS
      • total: SS , df
      • at : fitted value
      • 95% CI for the mean response
      • 95% prediction interval for one new run — visibly wider, exactly because it carries the extra under the square root for the new observation’s own error