Data Science · Intermediate level

Intermediate level · Module 4: Relationships and Regression for Analysis · Lesson 2 of 3

Multiple Regression for Explanation

Estimate the association of several factors with an outcome at once and interpret regression output.

In this lesson you will

  • Fit multiple regression with statsmodels
  • Interpret coefficients, intervals and dummy variables

Key concepts

statsmodels OLScoefficient and confidence intervaldummy variablesholding other factors constant

The lesson

Multiple regression estimates each factor's association with the outcome while holding the others constant: the coefficient on school feeding compares schools with and without feeding that have similar distance and teacher ratios.

statsmodels produces a table of coefficients with standard errors, confidence intervals and p-values. Interpret coefficients in real units: 'each additional kilometre is associated with 1.8 points lower attendance'.

Categorical factors enter as dummy variables compared with a reference category. Check diagnostics: residual plots for patterns and very influential points.

Step by step

  1. Fit a regression of attendance on three factors.
  2. Interpret each coefficient and interval.
  3. Add school type as a dummy variable.
  4. Check residual plots.

Practice activity

Complete the attendance regression from the practical activity.

Expected result: A fitted model with correct interpretations and diagnostic checks.

Check your understanding

  1. What does 'holding other factors constant' mean?

    Show answer

    Comparing cases that are similar in the other variables in the model.

  2. How is a categorical factor included in regression?

    Show answer

    As dummy variables compared with a reference category.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.