University of Southampton · FACULTY OF STATISTICS

STAT6135 Chap.1 Linear Regression, Dummy Variables and Interactions

- one subject, every graph, every model, every mark
7 Chapters3-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 1 of 9 · STAT6135

Linear Regression, Dummy Variables and Interactions

Linear Regression, Dummy Variables and Interactions revises the model that every generalised linear model extends. A regression model describes a characteristic of the conditional distribution of a response given its explanatory variables, usually the mean, and the module distinguishes two aims for building one: explaining a relationship and predicting new values.

Least squares chooses the coefficients that minimise the sum of squared vertical residuals; in matrix form the estimator is the inverse of X transpose X times X transpose Y, and its variance is the error variance times that inverse.

Under linearity, fixed predictors and uncorrelated errors with constant variance, least squares is the best linear unbiased estimator, and with normal errors it is also the maximum likelihood estimator. Categorical predictors enter through dummy variables: with an intercept a factor with k levels needs k minus 1 dummies, and the omitted level is the reference for every contrast.

Interactions let the slope of one predictor depend on another, so two groups can have different intercepts and different slopes. The chapter closes with the interpretation rules the lectures stress: name the unit, the reference and any interaction before reading a coefficient.

In this chapter

What this chapter covers

  • 01

    Explanation and prediction as modelling aims

  • 02

    Conditional mean as the target of regression

  • 03

    Least squares estimator in scalar and matrix form

  • 04

    Standard assumptions and the Gauss-Markov theorem

  • 05

    Dummy variables, reference categories and group means

  • 06

    Interaction effects and differing slopes

  • 07

    Interpreting coefficients under coding and interactions

Worked example · free

Fit a simple regression from summary statistics

Q [5 marks]. For ten observations, the sum of cross-products about the means is 84.0, the sum of squares of x about its mean is 40.0, the mean of x is 6.0 and the mean of y is 21.5. Find the least squares line, interpret the slope and predict y at x = 8. The marks shown are an AskSia practice allocation, not a published university marking scheme.
Least squares chooses the line 2.17 + 1.09x for eight practice points because it makes the sum of the squared vertical gaps (the dashed residuals) as small as pLeast squares chooses the line 2.17 + 1.09x for eight practice points because it makes the sum of the squared vertical gaps (the dashed residuals) as small as possible; horizontal distance plays no part.fitted line 2.17 + 1.09xexplanatory variable xresponse ydashed = residual eᵢ
Least squares chooses the line 2.17 + 1.09x for eight practice points because it makes the sum of the squared vertical gaps (the dashed residuals) as small as possible; horizontal distance plays no part.
  • 2The slope is the cross-product sum divided by the x sum of squares: 84.0 / 40.0 = 2.1.
  • 1The intercept is the mean of y minus the slope times the mean of x: 21.5 − 2.1 × 6.0 = 8.9.
  • 1Interpretation: each one-unit increase in x is associated with an increase of 2.1 in the mean of y.
  • 1Prediction at x = 8: 8.9 + 2.1 × 8 = 25.7.
The fitted line is 8.9 + 2.1x, and the predicted mean at x = 8 is 25.7. The weighting shown is an AskSia practice allocation only.
Sia tip — The least squares line always passes through the point of means, so check that 8.9 + 2.1 × 6.0 returns 21.5 before predicting.
Glossary

Key terms

Ordinary least squares
The estimation method that chooses coefficients to minimise the sum of squared residuals.
Dummy variable
A binary indicator that marks membership of one category of a factor and carries no measurement scale.
Reference category
The level of a factor left out of the dummy coding, against which every dummy coefficient is a contrast.
Interaction effect
A product term that allows the relationship between the response and one predictor to change with another predictor.
FAQ

Linear Regression, Dummy Variables and Interactions FAQ

Why does a model with an intercept use only k minus 1 dummies?

Including a dummy for every level as well as an intercept makes the columns of the design matrix linearly dependent, so the coefficients cannot be estimated uniquely. Dropping one level removes that dependence and turns the dropped level into the baseline for comparison.

What does linear mean in linear regression?

It means linear in the parameters. Predictors may be squared, logged or otherwise transformed, and the model is still linear as long as the mean is a weighted sum of those terms with unknown coefficients. A coefficient inside an exponential would make it non-linear.

Should main effects stay when an interaction is significant?

The lectures give the standard practice: keep the main effects that make up a significant interaction even when those main effects are not significant themselves. Removing them changes what the interaction coefficient measures and makes the model hard to interpret.

Is least squares the same as maximum likelihood?

Only when the errors are assumed normal. Under the Gauss-Markov conditions least squares is the best linear unbiased estimator without any distributional assumption, and adding normality makes it the maximum likelihood estimator too. That link is what Part 2 generalises to other response distributions.

Study strategy

Exam move

Rebuild the least squares formulas from the definition of the residual sum of squares once, so that the matrix form is familiar before Part 2 replaces it with weighted least squares. Then practise dummy coding by writing the fitted mean for every group in a small factor model and checking that it returns the group sample means. For interactions, draw the two fitted lines and mark where they cross.

Redo the linear regression computer worksheet from a blank script, and for each coefficient in the output write one sentence naming its unit and its reference category. Finally, take one fitted model with an interaction and rewrite it as two separate equations, one per group; if the two equations do not reproduce the fitted values in the output, the interpretation is wrong somewhere.

Working through Linear Regression, Dummy Variables and Interactions in STAT6135? Sia is AskSia’s AI Statistics tutor — ask any STAT6135 Linear Regression, Dummy Variables and Interactions question and get a clear, step-by-step explanation grounded in how STAT6135 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 8 of your subjects at University of Southampton, plus 1,000+ more Bibles across the AskSia library.
Sia - your STAT6135 tutor, unlimited, worked the way the exam marks it
The full 3-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works