Login
📚 Mostly Harmless Statistics
Chapters ▾
⇩ Download ▾

12.11 Multiple Linear Regression

A multiple linear regression line describes how two or more predictor variables affect the response variable y. An equation of a line relating p independent variables to y is of the form for the population as: y=β0+β1x1+β2x2++βpxp+ε, where β1,β2,,βp are the slopes, β0 is the y-intercept and ε is called the error term.

We use sample data to estimate this equation using the predicted value of y as y^ with the regression equation (also called the line of best fit or least squares regression line) as:

y=b0+b1x1+b2x2++bpxp

where b1,b2,,bp are the slopes, and b0 is the y-intercept

For example, if we had two independent variables, we would have a 3-dimensional space as in Figure 12-25 where the red dots represent the sample data points and the equation would be a plane in the space represented by y=b0+b1x1+b2x2.

A three-dimensional coordinate system with axes for x1 and x2 forming the "floor" and the y-axis running vertically, containing a number of data points in red. A diagonal plane represents the "best fit" of these data points, with a vertical line connecting each point to the plane.
Figure 12-25: Multiple linear regression with 2 independent variables. This photo by unknown author is licensed under CC BY-SA-NC.

The calculations use matrix algebra, which is not a prerequisite for this course. We will instead rely on a computer to calculate the multiple regression model.

If all the population slopes were equal to zero, the model y=β0+β1x1+β2x2++βpxp+ε would not be significant and should not be used for prediction. If one or more of the population slopes are not equal to zero then the model will be significant, meaning there is a significant relationship between the independent variables and the dependent variable and we may want to use this model for prediction. There are other statistics to look at to decide if this would be the best model to use. Those methods are discussed in more advanced courses.

The hypotheses will always have an equal sign in the null hypotheses.

The hypotheses are:

H0:β1=β2==βp=0
H1: At least one slope is not zero.

Note that the alternative hypothesis is not written as H1:β1β2βp0. This is because we just want one or more of the independent variables to be significantly different from zero, not necessarily all the slopes unequal to zero.

Use the F-distribution with degrees of freedom for regression = dfR=p, where p = the number of independent variables (predictors), and degrees of freedom for error = dfE=np1, where n is the number of pairs. This is always a right-tailed ANOVA test, since we are testing if the variation in the regression model is larger than the variation in the error.

The test statistic and p-value are the last two values on the right in the ANOVA table. The p-value rule is easiest to use since the p-value is part of the outcome, but a critical value can be found using the invF program on your calculator or in Excel using =F.INV.RT(α,dfR,dfE) We can also single out one independent variable at a time and use a t-test to see if the variable is significant by itself in predicting y.

This would have hypotheses:

H0:βi=0
H1:βi0
where i is a placeholder for whichever independent variable is being tested.

This t-test is found in the same row as the coefficient that you are testing.

Assumptions for Multiple Linear Regression

When doing multiple regression, the following assumptions need to be met:

  1. The residuals of the model are approximately normally distributed.
  2. The residuals of the model are independent (not autocorrelated) and have a constant variance (homoscedasticity).
  3. There is a liner relationship between the dependent variable and each independent variable.
  4. Independent variables are uncorrelated with each other (no multicollinearity).

The following is a schematic for the regression output for Microsoft Excel. Other software usually has a similar output but may have numbers in slightly different places. The blue spaces have the descriptions of the corresponding numbers.

Excel-generated regression statistics table, ANOVA table, and table of coefficients, standard error, t-stat and p-value for the y-intercept, first x variable, second x variable, and third x variable.
Figure 12-26: Excel output for multiple linear regression.

The coefficients column gives the numeric values to find the regression equation y=b0+b1x1+b2x2++bpxp. The p-values for bi should be investigated to see if the variable is statistically significant. One should also be careful that the independent variables are not significantly correlated amongst themselves. Correlated independent variables may give unexpected outcomes in the overall regression model and actually flip the sign on a coefficient.

Adjusted Coefficient of Determination

When we add more predictor variables into the model, this inflates the coefficient of variation, R2. In multiple regression, we adjust for this inflation using the following formula for adjusted coefficient of variation.

Adjusted Coefficient of Determination

R a d j 2 = 1 ( ( 1 R 2 ) ( n 1 ) ( n p 1 ) )

There are more types of regression models and more that should be done for a complete regression analysis. Ideally, you would find several models and pick the one with no outliers, the smallest standard error of estimate, a good residual plot, and the highest adjusted R2 and check the assumptions behind each model before using for prediction. More advanced techniques are discussed in a regression course.

“Well, I was in fact, I was moving backwards in time. Hmmm. Well, I think we've sorted all that out now. If you'd like to know, I can tell you that in your universe you move freely in three dimensions that you call space. You move in a straight line in a fourth, which you call time, and stay rooted to one place in a fifth, which is the first fundamental of probability. After that it gets a bit complicated, and there's all sorts of stuff going on in dimensions 13 to 22 that you really wouldn't want to know about. All you really need to know for the moment is that the universe is a lot more complicated than you might think…”

(Adams, 2002)

Adapted from Mostly Harmless Statistics by Rachel Webb (Portland State University), hosted on LibreTexts (stats.libretexts.org) and licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.