13.2 Multivariable linear regression¶
Multivariable linear regression extends the simple linear regression model to situations in which we wish to relate two or more independent variables to one outcome. Where there are multiple independent variables, we will refer to them as covariates.
There can be a number of different reasons why we would want to add more covariates in our linear regression model. Recall these two examples of questions we might want to answer using statistical models (given at the beginning of this lesson):
Does taking drug A reduce inflammation more than taking drug B in patients with arthritis?
Can we predict the risk of heart disease for our patients?
In the first example, we could use a statistical model with inflammation as the outcome and drug use as the independent variable of interest, but we may need to control (or adjust) for the confounding effects of other patient characteristics (age, gender, other medication use, etc.). In the second example, there are many different factors that could be associated with risk of heart disease (age, gender, lifestyle choices, etc.) and we may wish to include all such factors in a statistical model to predict heart disease.
Here, we introduce the multivariable linear regression model and describe how to estimate and interpret the parameters in the model using an example from the birthweight data.
Note
A note on notation. There can be some confusion between the terms multivariable models and multivariate models. Multivariate models are those which have more than one outcome variable. Such models are beyond the scope of this module; we focus our attention on univariate models which have only one outcome. Both simple linear regression models and multivariable linear regression models are considered as univariate.
13.2.1 The multivariable linear regression model¶
Suppose we wish to relate an outcome (\(Y\)) to \(p\) predictor variables \((X_1, X_2, ..., X_p)\). The appropriate multivariable linear regression model is a straightforward extension of the simple linear regression model:
where, \(y_i\) is the value of the dependent variable for the ith participant and \(x_{ji}\) is the value of the jth predictor variable for the ith participant.
The parameters in the model are interpreted as follows:
\(\beta_0\) is the intercept. It is the expectation of \(Y\) when all the \(X_j\)’s are zero.
\(\beta_j\) is the expected change in \(Y\) for a 1 unit increase in \(X_j\) with all the other covariates held constant.
The \(\beta_j\)’s are the regression coefficients (otherwise known as partial regression coefficients). Each one measures the effect of one covariate controlled (or adjusted) for all of the others.
13.2.2 The multivariable linear regression model in matrix notation¶
Similarly to the simple linear regression model, the multivariable linear regression model can be expressed using matrix algebra.
In this formulation, \(\mathbf{X}\) is an \(n \times (p+1)\) matrix, \(Y\) and \(\epsilon\) are vectors of length \(n\) whilst \(\mathbf{\beta}\) is a vector of length \((p+1)\).
13.2.3 Estimation of the parameters¶
The regression coefficients in multivariable linear regression can be estimated by minimising the residual sum of squares:
The closed form solution, obtained by solving the \((p+1)\) simultaneous equations that result from setting the partial derivatives of the above equation with respect to each parameter estimate to zero, can be written succinctly using matrix notation:
\(\mathbf{\hat{\beta}}\) is an unbiased estimator of \(\mathbf{\beta}\). Its distribution is as follows:
This expresses the fact that the elements of \(\mathbf{\hat{\beta}}\) follow a multivariate normal distribution whose variances and covariances are given by \(\mathbf{(X'X)^{-1}\sigma^2}\).
It can also be shown that the following is an unbiased estimator for \(\sigma^2\):
While it is useful to know how these parameters are estimated, in practice they are often obtained using statistical software. Next, we demonstrate how to perform multivariable regression in R using the birthweight data and discuss the interpretation of the estimated regression coefficients.