Regression Analysis 3 of 6
On this page

Regression Analysis

4.2 Multiple Linear Regression

Chapter 2 of 5 44 min read

Multiple regression is a collection of statistical techniques for building models that reasonably describe relationships between several explanatory variables of a given process. The difference between simple and multiple linear regression is that in multiple regression two or more explanatory variables are treated.

We present the theory for analyzing and validating Multiple Linear Regression Models (MRLM), focusing on the following topics:

  1. Statistical model;

  2. Parameter estimation;

  3. Properties of estimators;

  4. Hypothesis tests and confidence intervals for model parameters;

  5. Model diagnostic analysis;

  6. Applications.

Motivation 2

The gain of a transistor consists of the difference between the emitter and the collector. The variable Gain (in hFE) can be controlled in the ion deposition process through the variables Emission time (in minutes) and Ion dose ($\times 10^{14}$). The data can be found in Table 4.2.1.

Note Time (min) Gain (hFe) Ion dose ($\times10^{14}$)
1 195 1004 4
2 255 1636 4
3 195 852 4,6
4 255 1506 4,6
5 225 1272 4,2
6 225 1270 4,1
7 225 1269 4,6
8 195 903 4,3
9 255 1555 4,3
10 225 1260 4
11 225 1146 4,7
12 225 1276 4,3
13 225 1225 4,72
14 230 1321 4,3

Table 4.2.1: Gain data on a set of pistons at different emission and collection levels.

Model Illustration

Figura 4.2.1

Figure 4.2.1: Gain vs Time vs Dose.

Graphical analysis (Figure 4.2.1) shows us that there is a relationship between the transmitter gain and the two input variables (Time and Dose). Therefore, it is reasonable to assume a linear relationship between the Gain variable and the Time and Dose variables.

4.2.1 Statistical Model

As seen in “Motivation 2”, suppose the construction of a model to relate the variable gain (in ions) with the explanatory variables time sender and dose emitter is reasonable. Thus, we define the multiple linear regression model given by

$$Y=\beta_0+\beta_1x_1+\beta_2x_2+\varepsilon \tag{2.1}$$

in which $Y$ represents the response variable (the gain in ions), $x_1$ and $x_2$ represent the explanatory variables (the time emitter and the dose emitter, respectively) and $\varepsilon$ represents the experimental error. This is a multiple linear regression model with two independent or explanatory variables ($x_1$ and $x_2$). The linear term is used because equation (2.1) is a linear function of unknown parameters $\beta_0,\beta_1$ and $\beta_2,$ called regression coefficients.

Interpretation of model parameters

  • The parameter $\beta_0$ corresponds to the intercept of the plane with the z axis. Se $x=(x1,x2)=(0,0)$ the parameter $\beta_0$ gives the average response at that point. Otherwise, it is not possible to interpret the parameter $\beta_0$.
  • The parameter $\beta_1$ indicates a change in the average response with each unit change in $x1$, when the other variables are kept fixed.
  • In a similar way is the interpretation for the parameter $\beta_2$, which indicates a change in the average response with each unit change in $x2$, when $x1$ is kept constant.

Figura4.2.2

Figure 4.2.2: Model illustration

Assuming $E(\varepsilon)=0$, we have $E(Y|x)=\beta_0+\beta_1x_1+\beta_2x_2, $ which describes a two-dimensional plane, called the response surface.

In general, the response variable $Y$ can be related to a number $p$ of input variables. The multiple linear regression model (MRLM) with $p$ explanatory variables is given by

$$Y_i=\beta_{0}+\beta_{1}x_{i1}+\beta_{2}x_{i2}+…+\beta_{p}x_{ip}+\epsilon_i, \qquad i=1,…,n \tag{2.2}$$

in which

  • $x_{i1},x_{i2},…,x_{ip}$ are values of explanatory variables, known constants;
  • $\beta_{0},\beta_{1},\beta_{2},…,\beta_{p}$ are regression parameters or coefficients;
  • $\epsilon_i$ are independent random errors.

This model describes a p-dimensional hyperplane referring to the explanatory variables.

Effect of interactions

Models more complex than “Model 2.2” are also analyzed using multiple linear regression techniques. Let us consider the multiple linear regression model with two regressor variables, $x_1$ and $x_2$, given by

$$ Y=\beta_0+\beta_1 x_{1}+\beta_2 x_{2}+\beta_{3}\underbrace{x_{1} x_{2}}_{\hbox{interação}} + \varepsilon$$

In this case, $x_1x_2$ represents the interaction between the variables $x_1$ and $x_2$. If the interaction is present and significant, the effect of $x_{1}$ on average response depends on the level of $x_{2}$ and similarly the effect of $x_{2}$ on average response depends on the level of $x_{1}.$

Knowing that $E(\varepsilon)=0$, we have to

$$E(Y|x)=\beta_0+\beta_1x_1+\beta_2x_2+\beta_3x_1x_2$$

The interpretation for the parameters $\beta_1$ and $\beta_2,$ in the model with interaction, it is not the same as seen previously.

Assumptions for the model

The assumptions required for the Multiple Linear Regression Model are:

i) The error has zero mean and variance $\sigma^2$, unknown;

ii) Errors are uncorrelated;

iii) Errors have normal distribution;

iv) The regressor variables $x_{1}, x_{2}, \ldots, x_{p}$ assume fixed values.

Assumptions (i)-(iii), symbolically, can be represented by

$$\varepsilon_{i} \overset{\hbox{iid}}{\sim} N(0, \sigma^2)$$

If the MRLM assumptions hold, then the variable $Y$ has a normal distribution with variance $\sigma^2$ and average

$$E(Y\mid x)=\beta_0+\beta_1 x_{1}+\beta_2 x_{2}+\ldots+\beta_p x_{p}$$

In this case, the parameters $\beta_j,$ $j=1,\dots,p$ represent the expected (average) variation in the response variable ($Y$) when the variable $x_j$ undergoes a unit increase, while all other variables $x_i \quad (i\neq j)$ are kept constant. For this reason the $\beta_j$ are called partial coefficients.

If the values of $x_j$ include the values $x_j=0,j=1,\dots,p$ then $\beta_0$ is the average of $Y$ when $x_j=0.$ Otherwise there is no practical interpretation.

4.2.2 Estimation of Model Parameters

Suppose we have $n$ observations $(n> p)$ of the response variable and the $p$ explanatory variables. So, $y_i$ is the value of the response variable in the ith observation while $x_{ij}$ is the value of the variable $x_j$ in the ith observation, $j=1,\dots,p.$ Data from an MRLM can be represented as follows:

$y$ $x_1$ $x_2$ $\ldots$ $x_p$
$y_1$ $x_{11}$ $x_{12}$ $\ldots$ $x_{1p}$
$y_2$ $x_{21}$ $x_{22}$ $\ldots$ $x_{2p}$
$\vdots$ $\vdots$ $\vdots$ $\vdots$ $\vdots$
$y_n$ $x_{n1}$ $x_{n2}$ $\ldots$ $x_{np}$

Table 4.2.2: Data representation.

where each observation satisfies $$\begin{equation*}Y_i=\beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} + \ldots + \beta_p x_{ip} + \varepsilon_i, \quad i=1,\ldots, n.\end{equation*}$$

4.2.2.1 Least Squares Method

The objective is to minimize the function $$L=\sum_{i=1}^n\varepsilon_i^2=\sum_{i=1}^n\left(Y_i-\beta_0-\beta_1 x_{i1}-\beta_2 x_{i2}-\ldots -\beta_px_{ip}\right)^2.$$

Deriving L as a function of $\beta$’s we get $$\dfrac{\partial L}{\partial \beta_0}=-2\sum_{i=1}^n[Y_i-\beta_0-\beta_1x_{i1}-\beta_2x_{i2}-\dots-\beta_px_{ip}],$$

$$\dfrac{\partial L}{\partial \beta_j}=-2\sum_{i=1}^n[Y_i-\beta_0-\beta_1x_{i1}-\beta_2x_{i2}-\dots-\beta_px_{ip}]x_{ji},\quad j=1,2,\dots,p.$$

Equating the partial derivatives to zero and substituting $\beta_0,\beta_1,\dots,\beta_p$ by $\widehat{\beta} _0,\widehat{\beta} _1,\dots,\widehat{\beta} _p$, we have the system of equations

$$ \begin{cases} n \widehat{\beta} _{0} + \widehat{\beta} _{1} \displaystyle\sum_{i=1}^n x_{i1} + \widehat{\beta} _{2} \displaystyle\sum_{i=1}^n x_{i2} + \ldots + \widehat{\beta} _{p} \displaystyle\sum_{i=1}^n x_{ip} = \displaystyle\sum_{i=1}^n Y_i \cr \cr \widehat{\beta} _{0} \displaystyle\sum_{i=1}^n x_{i1} + \widehat{\beta} _{1} \displaystyle\sum_{i=1}^n x_{i1}^2 + \widehat{\beta} _{2} \displaystyle\sum_{i=1}^n x_{i1}x_{i2} + \ldots + \widehat{\beta} _{p} \displaystyle\sum_{i=1}^n x_{i1}x_{ip} = \displaystyle\sum_{i=1}^n x_{i1}Y_i \cr \cr \qquad \vdots \qquad \qquad \qquad \vdots \cr \cr \widehat{\beta} _{0} \displaystyle\sum_{i=1}^n x_{ip} + \widehat{\beta}_{1} \displaystyle\sum_{i=1}^n x_{ip}x_{i1} + \widehat{\beta} _{2} \displaystyle\sum_{i=1}^n x_{ip}x_{i2} + \ldots + \widehat{\beta} _{p} \displaystyle\sum_{i=1}^n x_{ip}^2 = \displaystyle\sum_{i=1}^n x_{ip} Y_i \end{cases} $$

Solving this system, we obtain the least squares estimators $\widehat{\beta} _0,\dots,\widehat{\beta}_p$ of the parameters of the model in question.

4.2.2.2 MRLM matrix representation

Note that the least squares estimators of the parameters of “Model 2.2” can be easily found considering the matrix notation of the data, which is easy to manipulate. Thus, considering the data input presented in Table 2.2.1, the Multiple Linear Regression model can be written as $$\begin{equation*}Y=X\beta+\varepsilon,\end{equation*}$$

with

$$Y=\begin{bmatrix} Y_1 \cr Y_2 \cr \vdots \cr Y_n \end{bmatrix} \quad , \quad X=\begin{bmatrix} \ x_{11} \ x_{12}~\ldots~x_{1p} \cr 1~x_{21}~x_{22}~\ldots~x_{2p} \cr \quad ~\vdots \quad ~\vdots \quad \ddots \ \vdots \cr 1~x_{n1}~x_{n2}~\ldots~x_{np} \end{bmatrix} \quad , \quad \beta =\begin{bmatrix} \beta_0 \cr \beta_1 \cr \vdots \cr \beta_p \end{bmatrix} \hbox{e} \quad \varepsilon= \begin{bmatrix}\varepsilon_1 \cr \varepsilon_2 \cr \vdots \cr \varepsilon_n \end{bmatrix} ,$$

in which

  • $Y$ is a vector $n\times 1$ whose components correspond to the n responses;

  • $X$ is a dimension matrix $n\times (p+1)$ called model matrix;

  • $\varepsilon$ is a vector of dimension $n\times 1$ whose components are errors and

  • $\beta$ is a vector $(p+1)\times 1$ whose elements are the regression coefficients.

The least squares method aims to find the vector $\widehat{\beta}$ that minimizes

$$L=\sum_{i=1}^n\varepsilon_i^2=\varepsilon^\prime \varepsilon= (Y-X\beta)^\prime (Y-X\beta)=$$

$$=Y^\prime Y-Y^\prime X\beta-\beta^\prime X^\prime Y+\beta^\prime X^\prime X\beta=Y^\prime Y-2\beta^\prime X^\prime Y+\beta^\prime X^\prime X\beta,$$

being that $Y^\prime X\beta=\beta^\prime X^\prime Y$ because the product results in a scalar. The notation $X^\prime $ represents the transpose of the matrix $X$ while $Y^\prime$ and $\beta^\prime$ represent the transposes of vectors $Y$ and $\beta$, respectively. Using the derivation technique (in matrix terms) we obtain

$$\dfrac{\partial L}{\partial\beta}=-2X^\prime Y+2X^\prime X\beta.$$

Equating to zero and substituting the vector $\beta$ by vector $\widehat{\beta}$, we have

$$(X^\prime X)\widehat{\beta}=X^\prime Y.$$

In general, the matrix $(X^\prime X)$ it is non-singular, that is, it has a non-zero determinant, and therefore it is invertible. In this way, it is concluded that the estimators for the parameters $\beta_j,\quad j=0,\dots,p$ are given by the vector

$$\begin{equation*}\widehat{\beta}=(X^\prime X)^{-1} X^\prime Y.\end{equation*}$$

Therefore, the fitted linear regression model and the residual vector are respectively

$$\begin{equation*}\widehat{Y}=X\widehat{\beta}\quad {e}\quad e=Y-\widehat{Y}=Y - \widehat{Y}.\end{equation*}$$

By substituting the least squares estimators, we obtain that $\widehat{Y} = HY$ in which $H=X(X^\prime X)^{-1} X^\prime$ is the hat matrix, or response vector projection matrix $Y$ in the adjusted response vector $\widehat{Y}$.

Example 2.2.1

With the data from the example in “Motivation 2”, obtain the parameter estimates of “Model 2.2”.

Solution:

Let the response variable be Gain (Y) and the explanatory variables Time ($x_1$) and Dose ($x_2$).

We have to $n=14,$ $\quad \sum\limits_{i=1}^{14}Y_i= 17.495$; $\quad\sum\limits_{i=1}^{14}x_{i1}= 3.155$ and $\quad \sum\limits_{i=1}^{14} x_{i2}= 60,72.$ Furthermore,

$\sum\limits_{i=1}^{14} x_{i1}^2= 716.425$; $\quad\sum\limits_{i=1}^{14}x_{i2}^2= 264,2584$; $\quad \sum\limits_{i=1}^{14} x_{i1} x_{i2}= 13.683,50$; $\quad \sum\limits_{i=1}^{14} x_{i1} Y_i= 4.001.120$ and $\quad \sum\limits_{i=1}^{14} x_{i2}Y_i= 75.738,30.$

The normal equations will be

$$\left\lbrace \begin{array}{c} n \widehat{\beta} _0+\widehat{\beta} _1 \displaystyle\sum_{i=1}^n x_{i1}+\widehat{\beta} _2\displaystyle\sum_{i=1}^n x_{i2}=\displaystyle\sum_{i=1}^n Y_i \cr \cr \widehat{\beta} _0 \displaystyle\sum_{i=1}^n x_{i1}+\widehat{\beta} _1 \displaystyle\sum_{i=1}^n x_{i1}^2 +\widehat{\beta} _2\displaystyle\sum_{i=1}^n x_{i1} x_{i2}=\displaystyle\sum_{i=1}^n x_{i1} Y_i \cr \cr \widehat{\beta} _0 \displaystyle\sum_{i=1}^n x_{i2}+\widehat{\beta} _1 \displaystyle\sum_{i=1}^n x_{i1} x_{i2}+\widehat{\beta} _2\displaystyle\sum_{i=1}^n x_{i2}^2=\sum_{i=1}^n x_{i2} Y_i\end{array}\right.$$

Substituting the values for this example, we have

$$\left\lbrace \begin{array}{c}14 \widehat{\beta} _0 + 3.155 \widehat{\beta} _1 + 60,72 \widehat{\beta}_2 = 17.495 \cr 3.155 \widehat{\beta} _0 + 716.425 \widehat{\beta} _1 + 13.683,50 \widehat{\beta}_2 = 4.001.120 \cr 60,72 \widehat{\beta} _0 + 13.683,50 \widehat{\beta} _1 + 264,2584 \widehat{\beta} _2 = 75.738,30\end{array}\right.$$

Solving the system, we obtain

$\widehat{\beta} _0= -520,08,$ $\widehat{\beta} _1 = 10,78 $ and $\widehat{\beta} _2= -152,15.$

In the matrix representation we have

$$ (X’X)= \begin{bmatrix} 14,00 & 3.155,00 & 60,72 \cr 3.155,00 & 716.425,00 & 13.683,50\cr 60,72 & 13.683,50 & 264,26 \end{bmatrix} \quad\Rightarrow\quad (X’X)^{-1}= \begin{bmatrix} 30,24760 & -0,04172 & -4,78994 \cr -0,04172 & 0,00018 & 0,00004 \cr -4,78994 & 0,00004 & 1,10244 \end{bmatrix} $$

$$ X’y = \begin{bmatrix} 17.495,0 \cr 4.001.120,0\cr 75.738,3 \end{bmatrix} $$

Therefore, the estimates $\widehat{\beta}$ are given by

$$ \widehat{\beta} = (X´X)^{-1} X’y = \begin{bmatrix} -520,08 \cr 10,78 \cr -152,15 \end{bmatrix} $$

and therefore, $\widehat{y} = -520,08 + 10,78 x_1 -152,15 x_2.$

We cannot say that the variable $x_1$ increases the gain, as the variables $x_1$ and $x_2$ are in different units. In example 2.2.3 below, the variables were transformed so that they are in the same unit.

Example 2.2.2

Interpret the results of “Example 2.2.1”.

Solution:

With the data from the example in “Motivation 2”, we obtain the model

$$E(Y\mid x)= -520,08 - 152,15 \hbox{Dose} + 10,78 \ \hbox{Tempo}.$$

If the $\hbox{Tempo} = 225$ (constant), then $$E(Y\mid x)= 1.905,42 - 152,15 \ \hbox{Dose}.$$

So,

$\beta_1=-152,15$ indicates that for each increase of one unit in the $Dose$ the average response will decrease $152,15$ units;

$\beta_2=10,78$ indicates an increase in the average response of $10,78$ units for each increase of one unit in the variable $\hbox{Dose}$.

4.2.2.3 Data transformation

In certain situations, it is common to transform the explanatory variables of the original data so that they remain in the same unit (scale), facilitating the interpretation of the results. Suppose $\xi_{1},\xi_{2},\dots,\xi_{p}$ are the original explanatory variables of the model. The expression to transform the explanatory variables $\xi$ is given by

$$x_{ij}=\dfrac{\xi_{ij}-\dfrac{[max(\xi_{ij})+min(\xi_{ij})]}{2}}{\dfrac{[max(\xi_{ij})-min(\xi_{ij})]}{2}},$$

where j indicates the variable being transformed, $j=1,\dots,p$. In this way, we have that the values of the transformed explanatory variables are all between -1 and 1.

Note that the parameter estimates values of the multiple linear regression model are not the same considering the original variables and the transformed variables.

Example 2.2.3

Considering the data from Example 2.2.1, transform the explanatory variables so that they remain in the same unit (scale). Then, fit the multiple linear regression model to the transformed data.

Considering that $\xi_{1}$ and $\xi_{2}$ are the explanatory variables in the original data set, we have the transformed explanatory variables, denoted by $x_1$ and $x_2$ are given by

  • For $x_{i1}$:

$$x_{i1}=\dfrac{\xi_{i1} - 225}{30}.$$

  • For $x_{i2}$:

$$x_{i2}=\frac{\xi_{i2} -4,36}{0,36}.$$

Note Time (min) $(\xi_{1})$ Ion dose $10^{14}$ $(\xi_{2})$ $x_1$ $x_2$ Gain (y)
1 195 4 -1 -1 1.004
2 255 4 1 -1 1.636
3 195 4,6 -1 0,6667 852
4 255 4,6 1 0,6667 1.506
5 225 4,2 0 -0,4444 1.272
6 225 4,1 0 -0,7222 1.270
7 225 4,6 0 0,6667 1.269
8 195 4,3 -1 -0,1667 903
9 255 4,3 1 -0,1667 1.555
10 225 4 0 -1 1.260
11 225 4,7 0 0,9444 1.146
12 225 4,3 0 -0,1667 1.276
13 225 4,72 0 1 1.225
14 230 4,3 0,1667 -0,1667 1.321

Table 4.2.3: Transformed Data.

Considering the transformed data, we have that the matrix $X$ and the vector $y$ are given respectively by

$$ X = \begin{bmatrix} 1 & -1 & -1 \cr 1 & 1 & -1 \cr 1 & -1 & 0,6667 \cr 1 & 1 & 0,6667 \cr 1 & 0 & -0,4444 \cr 1 & 0 & -0,7222 \cr 1 & 0 & 0,6667 \cr 1 & -1 & -0,1667 \cr 1 & 1 & -0,1667 \cr 1 & 0 & -1 \cr 1 & 0 & 0,9444 \cr 1 & 0 & -0,1667 \cr 1 & 0 & 1 \cr 1 & 0,1667 & -0,1667 \end{bmatrix}, \quad y = \begin{bmatrix} 1004 \cr 1636 \cr 852 \cr 1506 \cr 1272 \cr 1270 \cr 1269 \cr 903 \cr 1555 \cr 1260 \cr 1146 \cr 1276 \cr 1225 \cr 1321 \end{bmatrix}. $$

Thus, the matrix $X^\prime X$ is

$$(X’X) = \begin{bmatrix} 14 & 0,1667 & -0,8889 \cr 0,1667 & 6,0278 & -0,0278 \cr -0,8889 & -0,0278 & 7,0556 \end{bmatrix} \Rightarrow (X’X)^{-1} = \begin{bmatrix} 0,0720 & -0,0019 & 0,0091 \cr -0,0019 & 0,1660 & 0,0004 \cr 0,0091 & 0,0004 & 0,1429 \end{bmatrix}$$

$$\hbox{e} \qquad X’y = \begin{bmatrix} 17495 \cr 2158,167 \cr -1499,722 \end{bmatrix}. $$

Therefore, estimates $\widehat{\beta}$ are

$$ \widehat{\beta} = (X´X)^{-1} X’y = \begin{bmatrix} 1242,31 \cr 323,43 \cr 54,77 \end{bmatrix} $$

Thus, the regression equation is given by

$$\widehat{y}= 1.242,31 + 323,43~x_1 - 54,77~x_2.$$

Using the Action software we have the following results:

  • Considering the original scale of the data
Estimate Standard Deviation Stat.t P-value
Intercept -520.0766769 192.1070916 -2.7072227 0.0203918
Time 10.7811579 0.4743196 22.7297315 0
Ion dose -152.1488747 36.675439 -4.1485223 0.0016205

Table 4.2.4: Coefficients with the original scale

  • Considering the transformation
Estimate Standard Deviation Stat.t P-value
Intercept 1242.3139816 9.3744517 132.5212414 0
x1 323.4344987 14.2295393 22.7297942 0
x2 -54.7730076 13.2031035 -4.1484949 0.0016206

Table 4.2.5: Coefficients with transformation

4.2.3 Properties of Estimators

4.2.3.1 Properties of least squares estimators and the estimator for $\sigma^2$

Let us consider “Model 2.2” in matrix form. By the Gauss-Markov Theorem we have that the least squares estimator $\widehat{\beta}$ is unbiased and has minimum variance among all unbiased estimators that are linear combinations of the $Y_i$. So,

1. Expected value (average) of $\widehat{\beta}$:

$$E(\widehat{\beta})= E[(X^\prime X)^{-1}X^\prime Y]=E[(X^\prime X)^{-1}X^\prime (X\beta+\varepsilon)]=E[(X^\prime X)^{-1}X^\prime X\beta+(X^\prime X)^{-1}X^\prime \varepsilon]$$ $$=E[I\beta]+E[(X^\prime X)^{-1}X^\prime \varepsilon]=\beta+(X^\prime X)^{-1}X^\prime E[\varepsilon]=\beta,$$

in which $E[\varepsilon]=0$ and $(X^\prime X)^{-1}X^\prime X=I$ (identity matrix).

2. Covariance matrix $\widehat{\beta}$:

To calculate the variance of $\widehat{\beta},$ Let us first highlight the definition of variance in the matrix case, that is, if $W$ is a vector of random variables, then the covariance matrix of W is given by $$Cov(W)= E \left[ W W^\prime\right] - E[W] E(W)^\prime,$$

which in matrix form is written as

$$Cov[W] = \begin{bmatrix} Cov[W_1,W_1] \quad Cov[W_1,W_2] \quad Cov[W_1,W_3] \quad \ldots \quad Cov[W_1,W_n] \cr Cov[W_2,W_1] \quad Cov[W_2,W_2] \quad Cov[W_2,W_3] \quad \ldots \quad Cov[W_2,W_n] \cr Cov[W_3,W_1] \quad Cov[W_3,W_2] \quad Cov[W_3,W_3] \quad \ldots \quad Cov[W_3,W_n] \cr \qquad \vdots \qquad \qquad \qquad \vdots \quad \quad \quad \quad \quad \quad \vdots \quad \quad \ddots \quad \quad \quad \quad \vdots \cr Cov[W_n,W_1] \quad Cov[W_n,W_2] \quad Cov[W_n,W_3] \quad \ldots \quad Cov[W_n,W_n] \end{bmatrix}$$

As a result, the covariance matrix $\widehat{\beta}$ is

$$Cov(\widehat{\beta})= E \left[\widehat{\beta}\widehat{\beta}^\prime \right] - E[\widehat{\beta}] E(\widehat{\beta})^\prime = E \left\lbrace \left[(X^\prime X)^{-1} X^\prime Y\right] \ \left[(X^\prime X)^{-1} X^\prime Y\right]^\prime \right\rbrace - \beta \beta^\prime$$

$$ = (X’X)^{-1} X' E(YY') X (X’X)^{-1} - \beta \beta' = (X’X)^{-1} X' \left[ \operatorname{Cov}(Y) + E(Y)E(Y)' \right] X (X’X)^{-1} - \beta \beta'$$

$$=(X^\prime X)^{-1} X^\prime ~ Cov(Y) ~ X(X^\prime X)^{-1} + (X^\prime X)^{-1}X^\prime ~ E(Y)E(Y)^\prime X(X^\prime X)^{-1} - \beta \beta^\prime.$$

Doing $Cov(Y)=\sigma^2~I$ and also that $E(Y)=X \beta$

$$Cov(\widehat{\beta})=\sigma^2 (X^\prime X)^{-1}\overbrace{ X^\prime I X(X^\prime X)^{-1}}^{=~I} + (X^\prime X)^{-1}X^\prime(X\beta)(X\beta)^\prime X(X^\prime X)^{-1} - \beta \beta^\prime$$

$$ = \sigma^2 (X^\prime X)^{-1} + \overbrace{(X^\prime X)^{-1}X^\prime X}^{=~I}\beta ~ \beta^\prime \overbrace{X^\prime X(X^\prime X)^{-1}}^{=~I} ~ - ~ \beta \beta^\prime$$

$$ = \sigma^2 (X^\prime X)^{-1} + \beta \beta^\prime - \beta \beta^\prime =\sigma^2(X^\prime X)^{-1}.$$

3. Unbiased estimator for $\sigma^2$

Let us consider the sum of squares of the residuals given by​ Anchor$$SQE= \sum_{i=1}^n e^2_i = e^\prime e = (Y-\widehat{Y})^\prime (Y-\widehat{Y})= (Y-X\widehat{\beta})^\prime (Y-X\widehat{\beta})$$

$$= Y^\prime Y - Y^\prime X\widehat{\beta} - \widehat{\beta}^\prime X^\prime Y + \widehat{\beta}^\prime X^\prime X\widehat{\beta}= Y^\prime Y - 2\widehat{\beta}^\prime X^\prime Y + \widehat{\beta}^\prime X^\prime X\widehat{\beta}.$$

Since $X^\prime X\widehat{\beta}=X^\prime Y,$ it follows that

$$SQE = Y^\prime Y - 2\widehat{\beta}^\prime X^\prime Y + \widehat{\beta}^\prime X^\prime Y = Y^\prime Y - \widehat{\beta}^\prime X^\prime Y \quad \hbox{ou ainda,}$$

$$= Y^\prime Y - Y^\prime X (X^\prime X)^{-1}X^\prime Y = Y^\prime (I - X(X^\prime X)^{-1}X^\prime)Y.$$

Therefore, $$SQE = Y^\prime(I - X(X^\prime X)^{-1}X^\prime)Y.$$

We will look at SQE in more detail in “Analysis of Variance”.

Theorem - Distribution in quadratic form: Se $Y \sim N_p(\mu;\Sigma)$, then, $Y^\prime AY \sim \chi^2_{r(A),\delta}$ (Non-central chi-square) if and only if $A\Sigma$ is idempotent, where

  • r(A): represents the rank of matrix A, that is, the number of linearly independent columns of matrix A.

  • $\delta=\dfrac{1}{2}\mu^\prime A \mu$: represents the non-centrality parameter.

  • Idempotent: $A\Sigma \times A\Sigma = A\Sigma$

Since we assume that the error vector $\varepsilon~\sim~N_p(0;\sigma^2I_p)$, it follows that $Y\sim N_p(X\beta;\sigma^2I_p)$ and then, $$\dfrac{Y}{\sigma}\sim N_p\left(\dfrac{X\beta}{\sigma};I_p\right).$$

In this way, using the theorem we obtain that

$$\dfrac{SQE}{\sigma^2}=\dfrac{Y^\prime }{\sigma} [I - X (X^\prime X)^{-1}X^\prime]\dfrac{Y}{\sigma}\sim\chi^{2}_{r[I -X(X^\prime X)^{-1}X^\prime ];\delta}$$

since the matrix $(I - X (X^\prime X)^{-1}X^\prime )$ is idempotent. How $$\delta=\dfrac{1}{2}\dfrac{\beta^\prime X^\prime (I-X(X^\prime X)^{-1}X^\prime )X\beta}{\sigma^2}=0 \quad {e}$$ $$r(I-X(X^\prime X)^{-1}X^\prime )=n-(p+1),$$

then $$\dfrac{SQE}{\sigma^2}\sim\chi^{2}_{n-(p+1)}.$$

Therefore, an unbiased estimator for $\sigma^2$ is given by

$$\widehat{\sigma}^2=QME=\dfrac{SQE}{n-p-1}.$$

4. Estimated covariance matrix of $\widehat{\beta}$:

$$ \widehat{\hbox{Cov}}(\widehat{\beta}) = \hat{\sigma}^2 (X^\prime X)^{-1} = \begin{bmatrix} \hat{\sigma}^2(\hat{\beta}_0) & \widehat{\hbox{Cov}}(\hat{\beta}_0,\hat{\beta}_1) & \widehat{\hbox{Cov}}(\hat{\beta}_0,\hat{\beta}_2) & \ldots & \widehat{\hbox{Cov}}(\hat{\beta}_0,\hat{\beta}_p) \cr \widehat{\hbox{Cov}}(\hat{\beta}_1,\hat{\beta}_0) & \hat{\sigma}^2(\hat{\beta}_1) & \widehat{\hbox{Cov}}(\hat{\beta}_1,\hat{\beta}_2) & \ldots & \widehat{\hbox{Cov}}(\hat{\beta}_1,\hat{\beta}_p) \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr \widehat{\hbox{Cov}}(\hat{\beta}_p,\hat{\beta}_0) & \widehat{\hbox{Cov}}(\hat{\beta}_p,\hat{\beta}_1) & \widehat{\hbox{Cov}}(\hat{\beta}_p,\hat{\beta}_2) & \ldots & \hat{\sigma}^2(\hat{\beta}_p) \end{bmatrix} $$

in which $\widehat{Cov}(\bf{\widehat{\beta}})$ is a matrix $(p+1)\times (p+1)$, being $p$ the number of explanatory variables in the model.

Being $C$ the diagonal of the matrix ${(X^\prime X)}^{-1}$, that is

$$C=\begin{bmatrix}C_{00} \quad \quad \quad \quad \quad \quad \quad ~ \cr \quad \quad ~C_{11} \quad \quad \quad \quad \quad \cr \quad \quad \quad \quad \quad \ddots \quad \quad ~ \cr \quad \quad \quad \quad \quad \quad \quad ~C_{pp}\end{bmatrix},$$

We can write the estimated variance of $\widehat{\beta}_{j}$ how

$$\widehat{\sigma}^{2}(\widehat{\beta_j})=\widehat{\sigma}^2C_{jj},\quad j=0,1,\dots,p.$$

Example 2.3.1

Calculate the estimated covariance matrix considering the transformed data from “Example 2.2.3”.

The matrix ${(X^\prime X)}$ in this case it is given by

$$ (X^\prime X) = \begin{bmatrix} 14,00 & 0,17 & -0,89 \cr 0,17 & 6,03 & -0,03 \cr -0,89 & -0,03 & 7,06 \end{bmatrix} \Rightarrow (X^\prime X)^{-1} = \begin{bmatrix} 0,0720 & -0,0019 & 0,0091 \cr -0,0019 & 0,1660 & 0,0004 \cr 0,0091 & 0,0004 & 0,1429 \end{bmatrix} $$

We also have to

$$ \hat{\sigma}^2 = QME = \frac{SQE}{n-p-1} = \frac{y^\prime y - \hat{\beta}^\prime X^\prime y}{14 - 2 - 1} = \frac{22.527.889 - 22.514.467,9}{11} = \frac{13.421,2}{11} = 1.220,1. $$

Then,

$$ \widehat{\text{Cov}}(\widehat{\beta}) = \hat{\sigma}^2 (X^\prime X)^{-1} = \begin{bmatrix} 87,881 & -2,379 & 11,062 \cr -2,379 & 202,481 & 0,497 \cr 11,062 & 0,497 & 174,323 \end{bmatrix}. $$

We can also use the matrix $C$, given by

$$C=\begin{bmatrix} 0,0720 \quad \quad \quad \quad \quad \quad \quad ~ \cr \quad \quad 0,1660 \quad \quad \quad \quad \quad \cr \quad \quad \quad \quad \quad \ddots \quad \quad ~ \cr \quad \quad \quad \quad \quad \quad \quad 0,1429\end{bmatrix},$$

In this case, the estimated variance of the estimators $\widehat{\beta}_{j}\quad j=0,1,2$ is

$$\widehat{\sigma}^{2}(\widehat{\beta_{0}})=\widehat{\sigma}^{2}C_{00}=1.220,1(0,0720)=87,881.$$

$$\widehat{\sigma}^{2}(\widehat{\beta_{1}})=\widehat{\sigma}^{2}C_{11}=1.220,1(0,1660)=202,481.$$

$$\widehat{\sigma}^{2}(\widehat{\beta_{2}})=\widehat{\sigma}^{2}C_{22}=1.220,1(0,1429)=174,323.$$

The standard deviation of the estimators is

$$\widehat{\sigma}(\widehat{\beta_{0}})=\sqrt{87,881}=9,374.$$

$$\widehat{\sigma}(\widehat{\beta_{1}})=\sqrt{202,481}=14,230.$$

$$\widehat{\sigma}(\widehat{\beta_{2}})=\sqrt{174,323}=13,203.$$

Using the Action software we have the following results:

Estimate Standard Deviation Stat.t P-value
Intercept 1242.3139816 9.3744517 132.5212414 0
x1 323.4344987 14.2295393 22.7297942 0
x2 -54.7730076 13.2031035 -4.1484949 0.0016206

Table 4.2.6: Estimates of transformed coefficients

4.2.4 Analysis of Variance (F Test) - Association Measures

4.2.4.1 Matrix Notation of Sums of Squares

As seen in the “Analysis of Variance” in the Simple Linear Regression Model, we can decompose the total variability into the model variability plus the error variability.

The total sum of squares (SQT), considering the matrix notation of model 2.2, is given by

$$SQT=\displaystyle\sum\limits_{i=1}^n(Y_i-\overline{Y})^2=Y^\prime Y-\dfrac{Y^\prime J Y}{n}=Y^\prime\left(I-\dfrac{J}{n}\right)Y,$$

in which

$$J =\begin{bmatrix}1 \quad 1 \quad \ldots \quad 1 \cr 1 \quad 1 \quad \ldots \quad 1 \cr \vdots \quad \vdots \quad \ddots \quad \vdots \cr 1 \quad 1 \quad \ldots \quad 1 \cr \end{bmatrix}_{n \times n}$$

Furthermore, from “Properties of Estimators” we have that the sum of squares of the errors (of the residuals) is given by

$$SQE=Y^\prime Y-\widehat{\beta}^\prime X^\prime Y=Y^\prime (I-X (X^\prime X )^{-1}X^\prime )Y=Y^\prime(I-H)Y.$$

The matrix $I$ is the identity matrix with dimension n x n and the matrix $H=X [X^\prime X]^{-1}X^\prime$ is called hat matrix which transforms the response vector Y into the vector of adjusted values $\widehat{Y}$, because

$$\widehat{Y}=X\widehat{\beta}=X[X^\prime X]^{-1}X^\prime Y=HY.$$

In this way, we obtain that the sum of squares of the regression is given by

$$SQR=SQT-SQE=\left(Y^\prime Y-\dfrac{Y^\prime JY}{n}\right)-(Y^\prime Y-\widehat{\beta}^\prime X^\prime Y)=\widehat{\beta}^\prime X^\prime Y-\dfrac{Y^\prime JY}{n}$$ $$=Y^\prime X(X^\prime X)^{-1}X^\prime Y-\dfrac{Y^\prime JY}{n}=Y^\prime \left(X(X^\prime X)^{-1}X^\prime -\dfrac{J}{n}\right)Y=Y^\prime \left(H-\dfrac{J}{n}\right)Y.$$

Note that the sums of squares of the Analysis of Variance in the case of MRLM are represented in quadratic form $Y’AY$, in which $A$ is a symmetric matrix.

It is worth highlighting that

  • $H$ is square in size $n$ x $n$ and only involves $X$ (the independent variables assumed as constants).

  • $H$ is idempotent, that is, $HH=H$.

  • The matrices $\left(I-\dfrac{J}{n}\right)$, $\left(H-\dfrac{J}{n}\right)$ and $(I-H)$ are idempotent.

With the values ​​of the sums of squares, we can obtain the Anova Table.

Source Sum of squares GL Medium Square
Regression $SQR$ $p$ $\dfrac{SQR}{p}$
Error (Residue) $SQE$ $n-p-1$ $\dfrac{SQE}{n-p-1}$
Total $SQT$ $n-1$

Table 4.2.7: ANOVA table

4.2.4.2 F-Test

In multiple linear regression problems, certain hypothesis tests about model parameters are useful to check the “fitness” of the model.

2.4.2.1 Test for regression significance

The test for regression significance is a test to determine whether there is a linear relationship between the response variable $Y$ and some of the regressor variables $x_1,x_2,\dots,x_p$. Let us consider the hypotheses

$$\begin{cases}H_0 : \quad \beta_1=\beta_2=\ldots=\beta_p=0 \cr H_1: \quad \beta_j\neq 0 \quad \hbox{ para qualquer}~j~=~1, \cdots, p \cr \end{cases}$$

If we reject $H_0$, we have at least one explanatory variable $x_1,x_2,\dots,x_p$ contributes significantly to the model.

Under $H_0,$ we have from the “Theorem - Distribution of quadratic form” that

$$\dfrac{SQR}{\sigma^2} \sim \chi^2_{(p)} \quad \quad {e~que} \quad \quad \dfrac{SQE}{\sigma^2} \sim \chi^2_{(n-p-1)}.$$

Furthermore, we have to $SQR$ and $SQE$ are independent. Therefore, we conclude under $H_0$ that

$$F_0=\dfrac{\dfrac{SQR}{p}}{\dfrac{SQE}{n-p-1}}= \dfrac{QMR}{QME}~\sim ~F_{(p ; n-p-1)}.$$

Therefore, we reject $H_0$ if $F_0 > F_{(1-\alpha ; p ; n-p-1)}$ and if $p-valor=P[F_{p;n-p-1} > F_0]<\alpha,$ in which $\alpha$ is the level of significance considered. We generally adopt $\alpha=5$ %.

The Anova Table with the F statistic is given by

Source Sum of squares GL Medium Square $F_0$
Regression $SQR$ $p$ $QMR=\dfrac{SQR}{p}$ $F_0=\dfrac{QMR}{QME}$
Error (Residue) $SQE$ $n-p-1$ $QME=\dfrac{SQE}{n-p-1}$
Total $SQT$ $n-1$

Table 2.4.8: ANOVA table and statistics $F_0$

Example 2.4.1

Build the ANOVA table considering the data transformed in “Example 2.2.3”.

Solution:

We have the hypotheses:

$$\begin{cases}H_0: \quad \beta_1=\beta_2=0 \cr H_1: \quad \beta_j\neq 0 \quad\hbox{para qualquer}~j~=~1, \cdots, p\end{cases}$$

The sums of squares are

$$SQT=y^\prime y-\dfrac{\left( \displaystyle\sum\limits_{i=1}^{14} y_i\right)^2}{14}=22.527.889 - \dfrac{(17.495)^2}{14}$$

$$= 665.387,2.$$

$$SQR= \widehat{\beta}^\prime X^\prime y - \dfrac{\left(\displaystyle\sum\limits_{i=1}^{14}y_i\right)^2}{14} = 22.514.467,9 - 21.862.501,8$$

$$= 651.966,1.$$

$$SQE= SQT-SQR = 665.387,2 - 651.966,1$$

$$= 13.421,1.$$

Briefly we have,

Source Sum of squares GL Medium Square $F_0$ $P-Valor$
Regression $651.966,1$ $~2~$ $\dfrac{651.966,1}{2}=325.983,0$ $267,18$ $0,00$
Error (Residue) $13.421,2$ $~11~$ $\dfrac{13.421,2}{11}=1.220,1$
Total $655.387,2$ $~13~$

Table 4.2.9: ANOVA Table for Example 2.2.3

For $\alpha=0,05$, we have to $F_0 = 267,18 > F_{0,95;2;11}=3,98$. Analyzing the p-value, we have that p_value $= P[F_{2;11} > F_0] = 0,000$. Therefore, we reject $H_0$ with a 95% confidence level.

4.2.4.3 Association Measures

2.4.3.1 Multiple Coefficient of Determination - $R^2$

The multiple coefficient of determination is given by $$R^2 = \frac{SQR}{SQT} = 1-\frac{SQE}{SQT}.$$

It represents the proportion of Y’s variability explained by the regressor variables. Thus, the closer $R^2$ is 1, the greater the explanation of the response variable by the adjusted model.

2.4.3.2 Adjusted Coefficient of Determination - $R^2_a$

The adjusted coefficient of determination is defined as $$R^2_a=1-\left(\frac{n-1}{n-p}\right)(1-R^2).$$

This adjusted coefficient may be smaller when another variable X enters the model, as the decrease in SQE may be compensated by the loss of 1 degree of freedom in the n-p denominator.

Example 2.4.2

Considering the example in “Motivation 2”, calculate the coefficient of determination $(R^2)$ and the adjusted coefficient of determination $(R^2_{a})$.

Solution:

$$R^2 = \frac{SQR}{SQT} = \frac{651.966,1}{665.387,2}=0,9798$$

$$R^2_{a}=1-\left(\frac{13}{11}\right)(1-0,9798)= 0,9762.$$

Using the Action software we have the following results:

G.L. Sum of Squares Medium Square Stat.t P-value
x1 1 630968.32383546 630968.32383546 517.146904974 0
x2 1 20997.846071104 20997.846071104 17.210009911 0.001620574
Waste 11 13421.04437915 1220.094943559

Table 4.2.10: ANOVA table

Standard Deviation of Residues Degrees of Freedom R^2 Adjusted R^2
34.92985748 11 0.979829723 0.9761624

Table 4.2.11: Descriptive Measure of Quality of Fit

Action builds the ANOVA table differently from the one calculated in example 2.4.1. To obtain the same results as in example 2.4.1, simply proceed as follows:

  • Regression sum of squares: $SQR=SQ_{x_1}+SQ_{x_2}=630976,866+20998,23=651966,17$

  • Degrees of freedom: $GL=1+1=2$

  • Mean square of the regression: $QMR=\frac{SQR}{2}=\frac{651966,1}{2}=325983$

  • F-statistic: $F_0=\frac{QMR}{QME}=\frac{325983}{1220,1}=267,18$

4.2.5 Individual Tests and Confidence Intervals for Parameters

4.2.5.1 Individual tests for regression coefficients

Testing individual hypotheses for the regression coefficients is essential to determine whether each explanatory variable is important for the regression model. For example, the model may be made more effective by including or excluding new variables.

Adding a variable to the regression model always causes an increase in the regression sum of squares and a decrease in the error sum of squares. However, the addition of regressor variables also increases the variance of the adjusted value $\widehat{Y}$. Therefore, we must be careful to only include regressor variables that truly explain the response variable.

The hypotheses for testing the significance of any regression coefficient individually are given by,

$$\begin{cases}H_0:\beta_j =0 \cr H_1:\beta_j \neq0 \cr \end{cases} \quad j = 0, 1, \ldots, p.$$

Se $H_0$ ($\beta_j =0$) is not rejected, so we can remove $x_j$ of the model since this variable does not influence the response significantly.

We know that $Y\sim N_p(X\beta;\sigma^2I_p)$ and that $\widehat{\beta}=(X^\prime X)^{-1}X^\prime Y$. How $\widehat{\beta}$ is a linear combination of normal distributions, it follows that $\widehat{\beta}$ is also normal, that is

$$\widehat{\beta}\sim N_p(\beta;\sigma^2C),$$

in which $C=(X^\prime X)^{-1}$. So, we have to $\widehat{\beta} _j \sim N(\beta_j;\sigma^2C_{jj})$ with $C_{jj}$ being the $j$-th element of the diagonal of $(X^\prime X)^{-1}$, $j=0,1,\dots,p$. Therefore, we get

$$N_0=\dfrac{\widehat{\beta} _ j-\beta_j}{\sqrt{\sigma^2 C_{jj}}} \sim N(0,1).$$

We also have to $$\dfrac{(n-p-1)\widehat{\sigma}^2}{\sigma^2} \sim \chi ^2_{(n-p-1)},$$

independent of $N_0$. Then, under $H_0$ we have that the test statistic is given by

$$t_0= \dfrac{\dfrac{\widehat{\beta_j}}{\sqrt{\sigma^2 C_{jj}}}}{\sqrt{\dfrac{(n-p-1)\widehat{\sigma}^2}{\sigma^2}}}=\dfrac{\widehat{\beta}_j}{\sqrt{\widehat{\sigma}^2C_{jj}}} \sim t_{(n-p-1)}, \tag{2.5.1.1}$$

The null hypothesis $H_0:\beta_j =0$ is rejected if

$$\mid t_0\mid > t_{(1-\frac{\alpha}{2}, n-p-1)}.$$

Considering the p-value, given through the expression

$$2*P\left( t_{n-p-1}> \mid t_0 \mid \right),$$

we reject $H_0$ if p_value $<~\alpha$.

The denominator is often called the standard error of $\widehat{\beta}_j$ and denoted by

$$se_{(\widehat{\beta}_j)}=\sqrt{\widehat{\sigma}^2C_{jj}}.$$

4.2.5.2 Confidence interval for regression coefficients

Considering the statistics given in (2.5.1.1), an interval with $100(1-\alpha)\char37$ confidence for the regression coefficients $\beta_j, \quad ~ j=0,1,2,\ldots,p,$ is given by

$$\left[\widehat{\beta}_j-t_{\left(\frac{\alpha}{2},n-p-1\right)}{\sqrt{\widehat{\sigma}^2 C_{jj}}} ; \widehat{\beta}_j+t_{\left(\frac{\alpha}{2},n-p-1\right)}{\sqrt{\widehat{\sigma}^2 C_{jj}}} \right].$$

4.2.5.3 Partial tests for regression coefficients (Partial F Test)

In some situations we are interested in knowing whether a subset of explanatory variables are important for the regression model. Consider the model written in matrix form with k covariates

$$y=X\beta + \varepsilon$$

where, given $p=k+1$

  • $y$ is a vector representing the response variable with dimension $n\times 1$;
  • $X$ is a matrix with dimension $n \times p$
  • $\beta$ is the vector of parameters with dimension $n \times 1$;
  • $\varepsilon$ is a vector with the errors of the dimension model $n \times 1$

We want to determine whether a subset of covariates are significant to the regression model. To do this, consider the following partition of the parameter vector $\beta$:

$$\beta = \begin{bmatrix} \beta_1 \cr - \cr \beta_2 \cr \end{bmatrix} $$

in which $\beta_1$ is a vector of parameters with dimension $(p-r)\times 1$ and $\beta_2$ is the complement of $\beta_1$, that is, a vector of parameters with dimension $r \times 1$. Therefore, we are interested in testing

$$\begin{cases} H_0: \beta_2 = 0 \cr H_1: \beta_2 \neq 0 \end{cases} $$

Using the partition $\beta$ we can rewrite the model

$$Y= X\beta + \varepsilon = X_1\beta_1 + X_2\beta_2 + \varepsilon, \tag{2.5.3.1}$$

in which $X_1$ is a matrix with dimension $n\times (p-r)$ which represents the columns of $X$ associated with the vector parameters $\beta_1$ and $X_2$ is a matrix with dimension $n \times r$ which represents the columns of the matrix $X$ associated with the vector $\beta_2$. We call model 2.5.3.1 the complete model.

For the complete model, we have

$$SQR(\beta)=\widehat{\beta}^{\prime} X^{\prime} y-\dfrac{Y^{\prime}JY}{n}$$

and

$$QME=\dfrac{y^{\prime} y - \widehat{\beta}^{\prime} X^{\prime} y}{n-p}$$

The model under the null hypothesis $H_0:\beta_2 = 0$ true is given by

$$Y = X_1\beta_1 + \varepsilon, \tag{2.5.3.2} $$

We call model 2.5.3.2 the reduced model. Therefore we have

$$SQR(\beta_1)=\widehat{\beta} _1^{\prime} X_1^{\prime} y-\dfrac{Y^{\prime}JY}{n}$$

In this way, the sum of the squares of the regression referring to $\beta_2$ given that $\beta_1$ already in the model can be determined by

$$SQR(\beta_2|\beta_1) = SQR(\beta) - SQR(\beta_1)$$

in which $SQR(\beta_2|\beta_1)$ owns $p-(p-r)=r$ degrees of freedom. This partial regression sum of squares represents the additional amount we would have in the regression sum of squares when adding $r$ covariates in the reduced model. So we can test the null hypothesis $H_0:\beta_2=0$ using statistics

$$F_0 = \dfrac{SQR(\beta_2|\beta_1)/r}{QME} \sim F_{r, (n-p)} \tag{2.5.3.3}$$

Therefore if $F_0 > F_{\alpha, r, (n-p)}$ we reject the null hypothesis at the level of significance $\alpha$ and we conclude that at least one of the parameters contained in the vector $\beta_2$ is non-zero. In the literature, test 2.5.3.3 is known as the Partial F Test.

Example 2.5.1

To illustrate the use of statistics $t$, we again use the transformed data in “Example 2.2.3”. Let’s now build the statistics $t$ for the hypotheses: $H_0:\beta_0=0$, $H_0:\beta_1=0$ and $H_0:\beta_2=0$.

Solution:

From “Example 2.2.3” we have that

$$ (X’X)= \begin{bmatrix} 14,00 & 0,17 & -0,89 \cr 0,17 & 6,03 & -0,03 \cr -0,89 & -0,03 & 7,06 \end{bmatrix} \quad\Rightarrow\quad (X’X)^{-1}= \begin{bmatrix} 0,0720 & -0,0019 & 0,0091 \cr -0,0019 & 0,1660 & 0,00004 \cr 0,0091 & 0,0004 & 0,1429 \end{bmatrix} $$

So, we have to $C_{00}=0,0720$, $C_{11}=0,1660$ and $C_{22}=0,1429$. Furthermore, from “Example 2.3.1” it follows that $\widehat{\sigma}^2=1.220,10$. Therefore, the statistics $t$ are given by

For $H_0:\beta_0=0,$ $$t_0=\dfrac{\widehat{\beta} _0}{\sqrt{\widehat{\sigma}^2~C_{00}}}$$

$$=\dfrac{1.242,31}{\sqrt{(1.220,1)(0,0720)}}=\dfrac{1.242,31}{9,3745}=132,521.$$

For $H_0:\beta_1=0,$ $$t_0=\dfrac{\widehat{\beta} _1}{\sqrt{\widehat{\sigma}^2~C_{11}}}$$

$$=\dfrac{323,43}{\sqrt{(1.220,1)(0,1660)}}=\dfrac{323,43}{14,2296}=22,730.$$

For $H_0:\beta_2=0,$ $$t_0=\dfrac{\widehat{\beta_2}}{\sqrt{\widehat{\sigma}^2~C_{22}}}$$

$$=\dfrac{-54,77}{\sqrt{(1.220,1)(0,1429)}}=\dfrac{-54,77}{13,203}=-4,149.$$

Since all absolute values of these statistics are greater than the critical value $t_{(0,975;11)}=2,201,$ the hypotheses $H_0$ are rejected in all three cases. In this way, the time and ion dose variables contribute significantly to the model.

Analyzing the P-value, we have

For $H_0:\beta_0=0$, $$2*P\left( t_{(11)}>\mid 132,521 \mid \right)=0,000.$$

For $H_0:\beta_1=0$, $$2*P\left( t_{(11)}>\mid 22,730 \mid \right)=0,000.$$

For $H_0:\beta_2=0$, $$2*P\left( t_{(11)}>\mid -4,149 \mid \right)=0,00162.$$

Therefore, we reject $H_0$ for $\beta_0$, $\beta_1$ and $\beta_2$ because the respective p-values are smaller than $\alpha$.

Example 2.5.2

Build a confidence interval with $95\char37$ for the parameter $\beta_1$, considering the data from “Example 2.2.3”.

Solution:

We remember that $\widehat{\beta} _1=323,43$, $\widehat{\sigma}^2=1.220,1$ and that $C_{11}=0,1660$. Thus, the 95\char37 confidence interval for $\beta_1$ is given by

$$\left[\widehat{\beta} _1-t_{(0,025;11)}\sqrt{\widehat{\sigma}^2 C_{11}} ; \widehat{\beta} _1+t_{(0,025;11)}\sqrt{\widehat{\sigma}^2C_{11}}\right]$$

$$\left[323,43-2,201\sqrt{(1.220,1)(0,1660)} ; 323,43 + 2,201\sqrt{(1.220,1)(0,1660)}\right]$$

$$\left[323,43-2,201(14,23) ; 323,43+2,201(14,23)\right]$$ $$\left[292,10 ; 354,75\right]$$

Therefore, $292,10 \leq \beta_1 \leq 354,75.$

Using the ActionStat software we have the following results:

G.L. Sum of Squares Medium Square Stat.t P-value
x1 1 630968.32383546 630968.32383546 517.146904974 0
x2 1 20997.846071104 20997.846071104 17.210009911 0.001620574
Waste 11 13421.04437915 1220.094943559

Table 4.2.12: ANOVA table

Minimum 1Q Median Average 3Q Maximum
-44.58635322 -26.348187101 -3.263076957 0 26.003395891 63.203182565

Table 4.2.13: Exploratory Analysis (residues)

Estimate Standard Deviation Stat.t P-value
Intercept 1242.313981613 9.374451738 132.521241389 0
x1 323.434498746 14.229539255 22.729794195 0
x2 -54.773007617 13.203103529 -4.148494897 0.001620574

Table 4.2.14: Coefficients

Standard Deviation of Residues Degrees of Freedom $R^2$ $R^2$ Adjusted
34.92985748 11 0.979829723 0.9761624

Table 4.2.15: Descriptive Measure of Quality of Fit

Confidence interval for the parameters 2.5 % 97.5 %
Intercept 1221.680952455 1262.947010772
x1 292.115494011 354.75350348
x2 -83.832842553 -25.713172682

Table 4.2.16: Confidence interval for parameters

4.2.6 Confidence Interval for Mean Response and Prediction

4.2.6.1 Confidence Interval for Prediction

We can obtain the confidence interval for the mean response at a particular point in the sample. Let the vector $x_0^\prime =[1, x_{01}, x_{02}, \ldots, x_{0p}]^\prime $ a sample point.

The average answer to this point is

$$E(Y\mid x_0)=\mu_{Y\mid x_0}=\beta_0+\beta_1x_{01}+\beta_2x_{02}+\ldots+\beta_px_{0p}=x^\prime _0\beta.$$

The mean estimator at this point is

$$\widehat{\mu}_{Y\mid x_0}=\widehat{Y}_0=x^\prime _0\widehat{\beta}.$$

Note that the mean response estimator is unbiased. In fact,

$$E(\widehat{\mu}_{Y \mid x_0})= E(x^\prime_0 \widehat{\beta}) = x ^\prime _0 \beta=\mu _{Y\mid x_0} \quad \hbox{(não viciado)}.$$

Furthermore, we have that the variance of $\widehat{\mu}_{Y\mid x_0}$ is given by

$$Var(\widehat{\mu}_{Y\mid x_0})=\sigma^2 x^\prime _0(X^\prime X)^{-1}x_0.$$

So, we have to

$$\dfrac{\widehat{\mu} _{Y\mid x_0}-\mu_{Y\mid x_0}}{\sqrt{\sigma^2 x^\prime _0 (X^\prime X)^{-1} x_0}}\sim N(0,1) \quad \hbox{e que}$$

$$\dfrac{(n-p-1)\widehat{\sigma}^2}{\sigma^2}\sim\chi^2_{(n-p-1)} \quad \hbox{independentes entre si}.$$

Therefore, it follows that

$$\dfrac{\widehat{\mu}_{Y\mid x_0}-\mu_{Y\mid x_0}}{\sqrt{\widehat{\sigma}^2x^\prime _0(X^\prime X)^{-1}x_0}}\sim t_{(n-p-1)}.$$

Therefore, the confidence interval of $100(1-\alpha)\char37$ for the average response ($\mu_{Y\mid x_0}$) at the point $x_{0}$ is given by

$$\left[\widehat{\mu}_{Y\mid x_0}-t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2 x^\prime _0(X^\prime X)^{-1}x_0} \quad ; \quad \widehat{\mu}_{Y\mid x_0}+t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2 x^\prime _0(X^\prime X)^{-1}x_0}\right].$$

Example 2.6.1

Determine a confidence interval for the mean response at the point $x_{01}=225$ me and $x_{02}=4,36 \times10^{14}$ ions.

Solution:

In terms of the coded variables, we have $x_{01}=0$ and $x_{02}=0$, in which $x_{01}$ is the time variable and $x_{02}$ is the dose variable. In this way, be the point $x^\prime_0=[1,0,0].$ The estimate of the average response at this point is

$$\widehat{\mu}_{y\mid x_0}=x_0^\prime\widehat{\beta}=[1~0~0]\left[\begin{array}{c}1.242,31 \cr 323,43 \cr -54,77 \cr \end{array}\right]=1.242,31.$$

We also have to

$\hbox{Var}(\widehat{\mu}_{y\mid x_0}) = \sigma^2 x^\prime_0 (X^\prime X)^{-1} x_0 $

$ \qquad \qquad = \sigma^2 [1~0~0] \begin{bmatrix} 0.0720 & -0.0019 & 0.0091 \cr -0.0019 & 0.1660 & 0.0004 \cr 0.0091 & 0.0004 & 0.1429 \cr \end{bmatrix} \begin{bmatrix} 1 \cr 0 \cr 0 \end{bmatrix}$

$ \qquad \qquad = \sigma^2 (0,072)$

We also know that the estimator of $\sigma^2$ is $\widehat{\sigma}^2=QME =1.220,1.$

Therefore, we have that the confidence interval is given by

$$\left[\widehat{\mu}_{y\mid x_0}-t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\sigma^2 x^\prime _0(X^\prime X)^{-1}x_0} ; \widehat{\mu}_{y\mid x_0}+t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\sigma^2 x^\prime _0(X^\prime X)^{-1}x_0}\right]$$

$$\left[1.242,31-2,201\sqrt{1.220,1 \times 0,072} ; 1.242,31+2,201 \sqrt{1.220,1\times0,072}\right]$$

$$\left[1.242,31-20,63 ; 1.242,31+20,63\right]$$ $$\left[1.221,68 ; 1.262,94\right]$$

Therefore, $1.221,68\leq\mu_{y\mid x_0}\leq 1.262,94.$

4.2.6.2 Predictions for new observations

The regression model can be used to predict future observations on the response variable $Y$ corresponding to particular values of the explanatory variables $x_{01},x_{02},\dots,x_{0p}$. Here we assume that the values of $x_{01},x_{02,\dots,x_{0p}}$ are unobserved. Se $x^\prime _0=[1,x_{01},x_{02},\ldots,x_{0p}]$, the predicted value for the new observation is given by

$$\widehat{y}(x_0)=x^\prime _0\widehat{\beta}$$

A forecast range $100(1-\alpha)\char37$ for future observations ($\mu_{y\mid x_0}$) is

$$\left[\widehat{y}(x_0)-t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2(1+x^\prime _0(X^\prime X)^{-1}x_0)} \quad ; \quad \widehat{y}(x_0)+t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2(1+x^\prime _0(X^\prime X)^{-1}x_0)}\right].$$

Care must be taken to estimate the response variable for points that are beyond the sample region. It is very likely that a model fitted within the data region may no longer be fitted when we use observations outside this region. In multiple regression it is easy to extrapolate new data but to do so we must make sure that the levels of the variables define a joint region that contains the data.

As an example, consider Figure 4.2.3, which illustrates the region mentioned for a two-variable model.

Figura 4.2.3

Figure 4.2.3: An example of extrapolation in multiple regression.

Example 2.6.2

Finding a prediction interval with $95\char37$ reliable for the gain of the transistor, at the point of $x_{01}=225$ me and $x_{02}= 4,36 \times 10^{14}$ ions.

Solution:

With the variables encoded, these points become $x_{01}=0$ and $x_{02}=0$, being $x_{01}$ the time variable and $x_{02}$ the dose variable. Thus, the predicted value for the gain at the point $x^\prime _0=[1,0,0]$ is given by

$$\widehat{y}(x_0)=x_0^\prime \widehat{\beta}=[1, 0, 0] \left[\begin{array}{c}1.242,31 \cr 323,43 \cr -54,77 \cr \end{array}\right]=1.242,31.$$

From “Example 2.6.1” we have $$x_0^\prime (X^\prime X)^{-1}x_0 = 0,072.$$

Then the prediction interval will be

$$\left[\widehat{y}(x_0)-t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2(1+x^\prime _0(X^\prime X)^{-1}x_0)} ; \widehat{y}(x_0)+t_{(\frac{\alpha}{2},n-p-1)}\sqrt{\widehat{\sigma}^2(1+x^\prime _0(X^\prime X)^{-1}x_0)}\right]$$

$$\left[1.242,31-2,201 \sqrt{1.220,1(1 + 0,072)} \quad ; \quad 1.242,31+2,201 \sqrt{1.220,1 (1 + 0,072)}\right]$$

$$\left[1.242,31-79,60 \quad ; \quad 1.242,31+79,60\right]$$

$$\left[1.162,71 ; 1.321,91\right]$$

Therefore, $1.162,71 \leq \mu_{y\mid x_0} \leq 1.321,91.$

Note that if we compare the prediction interval with the confidence interval for the average response at the same point for both examples, we can see that the prediction interval is much wider. This reflects the fact that there is difficulty in predicting future individual value.

Using the Action software we have the following results:

Gain x1 x2 Adjusted Value Lower Limit Upper Limit Standard Deviation
1 1004 -1 -1 973.652490485 927.050213313 1020.254767657
2 1636 1 -1 1620.521487976 1574.521246208 1666.521729744
3 852 -1 0.6667 882.362318689 839.081201282 925.643436097
4 1506 1 0.6667 1529.231316181 1486.410999704 1572.051632657
5 1272 0 -0.4444 1266.655106199 1243.312698635 1289.997513762
6 1270 0 -0.7222 1281.871047715 1253.785960402 1309.956135027
7 1269 0 0.6667 1205.796817435 1176.258075823 1235.335559047
8 903 -1 -0.1667 928.010143238 890.114775471 965.905511004
9 1555 1 -0.1667 1574.879140729 1537.618630694 1612.139650764
10 1260 0 -1 1297.086989231 1262.983951497 1331.190026964
11 1146 0 0.9444 1190.58635322 1154.807580996 1226.365125444
12 1276 0 -0.1667 1251.444641983 1230.676344134 1272.212939833
13 1225 0 1 1187.540973996 1150.427976073 1224.653971919
14 1321 0.1667 -0.1667 1305.361172924 1284.039755034 1326.682590814

Table 4.2.17: Prediction interval for observations with 95% confidence

4.2.7 Variable Selection

In multiple regression models, it is necessary to determine a subset of independent variables that best explains the response variable, that is, among all the explanatory variables available, we must find a subset of important variables for the model.

Building a model that includes only a subset of explanatory variables involves two conflicting objectives:

  1. Obtain the maximum amount of information through a model with as many independent variables as possible;

  2. Reduce the variance of the estimate and the cost of collection through a model with as few variables as possible.

Therefore, achieving a balance between these two commitments is of interest. To do this, we use a technique called variable selection.

There are two main strategies in the variable selection process:

  • All possible models: considers all possible subsets of explanatory variables, and considering evaluation criteria, selects the best of them.
  • Automatic Selection: searches for the best subset of explanatory variables without considering all possible subsets.

In practice, we assume that the correct functional specification of the explanatory variables is known (e.g. $1/x_1$, $ln~x_2$) and that there are no outliers or influential points and then we apply the variable selection technique. However, the ideal would be initially,

  • Identify outliers and influential points,
  • Identify possible collinearity and heteroscedasticity,
  • Carry out any necessary transformations,

and then, apply variable selection.

Below we present in detail the strategies All possible models and Automatic Selection.

4.2.7.1 Selection of All Possible Models

Consider the multiple linear regression model

$$Y=\beta_0+\beta_1 x_1+\beta_2 x_2+…+\beta_p x_p+\epsilon$$

and your assumptions. The method of all possible models makes it possible to analyze the fit of all submodels composed of possible subsets of the p variables and identifies the best of these subsets, according to evaluation criteria.

Example 2.7.1

Consider the example in “Motivation 2”.

We have two explanatory variables and therefore the models considering all possible combinations are:

Model 1: $\hbox{Ganho}=\beta_0+\beta_2\hbox{Tempo}.$

Model 2: $\hbox{Ganho}=\beta_0+\beta_1\hbox{Dose}.$

Model 3: $\hbox{Ganho}=\beta_0+\beta_1\hbox{Dose}+\beta_2\hbox{Tempo}.$

Some criteria for evaluating the models are: $R_p^2$, $R_a^2$, $QME$ (Mean Square of Error), $C_p$ of Mallows, $AIC$, $BIC$ and $PRESS_p$. Below is an approach to each of them.

4.2.7.1.1 Multiple Determination Coefficient

Be $R_p^2$ the notation of the coefficient of multiple determination of a model with p explanatory variables, that is, p coefficients and the intercept $\beta_0$.

$$R^2_p= \frac{SQR}{SQT}=1-\frac{SQE}{SQT},$$

where SQR, SQE and SQT are the sum of squares of the model, sum of squares of residuals (errors) and total sum of squares, respectively.

The criterion used in this method is that if we add an insignificant variable we will have a minimum (small) increase in $R_p^2$. Thus, it is more used to judge when to stop adding variables than to find the best model since $R_p^2$ never decreases when $p$ increases.

Example 2.7.1.1

For the example in “Motivation 2”, we have the values of the coefficient of multiple determination for each possible model:

  • Model 1:

Model 1, as described in “Example 2.7.1”, has only the explanatory variable Time.

With the model fit, the sums of squares are:

$SQR=630.968$, $SQE=34.419$, $SQT=665.387$.

$$R^2_p= \frac{630.968}{665.387}=1-\frac{34.419}{665.387}=0,948.$$

  • Model 2:

Model 2 only has Ion Dose as an explanatory variable.

The sums of squares of the model fit are:

$SQR=21.612$, $SQE=643.775$, $SQT=665.387$.

$$R^2_p= \frac{21.612}{665.387}=1-\frac{643.775}{665.387}=0,032.$$

  • Model 3:

Model 3 has Time and Ion Dose as explanatory variables.

The model sums of squares are:

$SQR=651.966$, $SQE=13.421$, $SQT=665.387$.

$$R^2_p= \frac{651.966}{665.387}=1-\frac{13.421}{665.387}=0,9798.$$

Using the Action software we have the following results:

Variables R² CP Adjusted R² AIC BIC PRESS QME
Model 1 Time 0.948 18.21 0.944 155.033 156.95 51545.126 2868.27911315993
Model 2 Ion dose 0.032 517.641 -0.048 196.035 197.952 875529.652 53647.9286674226
Model 3 Time + Ion Dose 0.98 3 0.976 143.848 146.404 22225.01 1220.101393825

Table 4.2.18: Model and metrics selection table

4.2.7.1.2 Adjusted Coefficient of Determination

To avoid difficulties in interpreting $R^2$, some statisticians prefer to use the $R_a^2$ ($R^2$ adjusted), defined for an equation with $p+1$ coefficients like

$$R^2_a=1-\left(\frac{n-1}{n-(p+1)}\right)(1-R^2_p).$$

O $R_a^2$ does not necessarily increase with the addition of parameters to the model. In fact if $s$ explanatory variables are included in the model (model with $p+s$ variables), the $R_a^2$ of this model will exceed $R_a^2$ of the model with p variables only if the partial F statistic to test the significance of additional $s$ coefficients exceed 1 (Seber[1977]). Consequently, one criterion for selecting an optimal model is to choose the model that has the $R_a^2$ maximum.

Example 2.7.1.2

For the example in “Motivation 2” we have the following coefficients of determination adjusted for each of the possible models, considering the multiple coefficients of determination in “Example 2.7.1.1”.

  • Model 1

$$R^2_a=1-\left(\frac{14-1}{14-2}\right)(1-0,948)=0,944.$$

  • Model 2

$$R^2_a=1-\left(\frac{14-1}{14-2}\right)(1-0,032)=-0,04.$$

  • Model 3

$$R^2_a=1-\left(\frac{14-1}{14-3}\right)(1-0,9798)=0,976.$$

Using the Actio softwareWe have the following results:

Variables Adjusted R² CP R² AIC BIC PRESS QME
Model 1 Time 0.944 18.21 0.948 155.033 156.95 51545.126 2868.27911315993
Model 2 Ion dose -0.048 517.641 0.032 196.035 197.952 875529.652 53647.9286674226
Model 3 Time + Ion Dose 0.976 3 0.98 143.848 146.404 22225.01 1220.101393825

Table 4.2.19: Model and metrics selection table

4.2.7.1.3 Mean Square of Waste

The mean square of the residuals of a regression model is obtained through

$$QME=SQE/(n-p-1), \tag{2.7.1.3}$$

where SQE is the sum of the squares of the residuals. The QME always decreases as p increases. The mean square error initially decreases, stabilizes and eventually may increase. This eventual increase occurs when the reduction in QME by adding a coefficient to the model is not enough to compensate for the loss in degrees of freedom in the denominator of (2.7.1.3).

The model that minimizes QME will also maximize $R_a^2$. To understand this, we note that

$$R_a^2=1-\left(\frac{n-1}{n-p}\right)(1-R_p^2)$$

$$=1-\left(\frac{n-1}{n-p}\right)\left(\frac{SQE}{SQT}\right)$$

$$=1-\left(\frac{n-1}{SQT}\right)\left(\frac{SQE}{n-p}\right)$$

$$=1-\left(\frac{n-1}{SQT}\right)QME.$$

Thus, minimize QME and maximize $R_a^2$ are equivalent.

Example 2.7.1.3

Using the example in “Motivation 2”, we have the mean squares of the errors for each possible model:

  • Model 1

$$QME=34.419/(14-1-1)=2.868.$$

  • Model 2

$$QME=643.775/(14-1-1)=53.648.$$

  • Model 3

$$QME=13.421/(14-2-1)=1.220.$$

Using the SoftwareAction we have the following results:

Variables QME CP R² Adjusted R² AIC BIC PRESS
Model 1 Time 2868.2791 18.21 0.948 0.944 155.033 156.95 51545.126
Model 2 Ion dose 53647.9287 517.641 0.032 -0.048 196.035 197.952 875529.652
Model 3 Time + Ion Dose 1220.1014 3 0.98 0.976 143.848 146.404 22225.01

Table 4.2.20: Model and metrics selection table

4.2.7.1.4 Cp of Mallows

The criteria $C_p$ de Mallows is based on the concept of the mean squared error (MSE) of the fitted values. The mean squared error of the forecast is

$$EQM=E(\hat{y}_i-E(y_i))^2=E(\hat{y}_i-E(\hat{y}_i)+E(E(\hat{y}_i)-E(y_i)))^2$$

$$=E(\hat{y}_i-E(\hat{y}_i))^2+(E(\hat{y}_i)-E(y_i))^2=\hbox{Var}(\hat{y}_i)+\hbox{vício}^2(\hat{y}_i),$$

in which $E(\hat{y}_i)-E(y_i)$ It’s the addiction. Thus, the NDE is the sum of the variance of $\hat{y}_i$ and vice squared. The NDE considering the n sample values is

$$\sum{E(\hat{y}_i-y_i)^2}= \sum{Var(\hat{y}_i)}+\sum{(E(\hat{y}_i)-E(y_i))^2}.$$

The criteria $\Gamma_p$ is the mean squared error divided by the error variance $\sigma^2$.

$$\Gamma_p=\left(\frac{1}{\sigma^2}\right)[\sum{Var(\hat{y}_i)}+\sum{(E(\hat{y}_i)-E(y_i))^2}], \tag{2.7.1.4}$$

in which $\sum{Var(\hat{y}_i)}=(p+1)\sigma^2$ and the expected value of the sum of the squares of the errors is: $$E(SQE)=(E(\hat{y}_i)-E(y_i))^2+(n-(p+1))\sigma^2.$$

Substituting these values into (2.7.1.4), we obtain

$$\Gamma_p=\left(\frac{1}{\sigma^2}\right)[E(SQE)-(n-(p+1))\sigma^2+(p+1)\sigma^2]$$

$$=\frac{E(SQE)}{\sigma^2}-n+2(p+1).$$

How $\sigma^2$ is unknown, assuming that the model that includes all explanatory variables is such that the QME is an unbiased estimator of $\sigma^2$ and replacing E(SQE) with the observed value SQE, $\Gamma_p$ can be estimated by

$$C_p=\frac{SQE(p)}{QME}-n+2(p+1),$$

where SQE(p) is the sum of squares of the submodel errors and QME is the mean square of the model with all explanatory variables.

It can also be shown that when there is no bias in the model estimation with the p variables, $E(SQE)=(n-(p+1))\sigma^2$ and then,

$$E[C_p|Vicio=0]=\frac{(n-(p+1))\sigma^2}{\sigma^2}-n+2(p+1)=p+1,$$

in which $p+1$ is the number of parameters in the model since p is the number of explanatory variables plus the intercept.

The strategy used to select models with the criteria $C_p$ is to identify models with $C_p$ close to the number of parameters $(p+1)$.

Example 2.7.1.4

Let’s calculate the $C_p$ for all possible models from the example in “Motivation 2”.

  • Model 1

The sum of squares of the model errors with only Time as the explanatory variable is 34,419. The mean square of the full model is 1.220. Thus, the $C_p$ is given by:

$$C_p=\frac{34.419}{1.220}-14+2\times 2=18,21.$$

  • Model 2

The sum of squares of the errors of the model with only Ion Dose as an explanatory variable is 643,775 and the mean square of the complete model is 1,220. O $C_p$ of model 2 is:

$$C_p=\frac{643.775}{1.220}-14+2\times 2=517,6.$$

  • Model 3

The sum of squares of the errors for the full model is 13,421 and the mean square is 1,220.

$$C_p=\frac{13.421}{1.220}-14+2\times 3=3.$$

Using the SoftwareAction we have the following results:

Variables CP R² Adjusted R² AIC BIC PRESS QME
Model 1 Time 18.21 0.948 0.944 155.033 156.95 51545.126 2868.27911315993
Model 2 Ion dose 517.641 0.032 -0.048 196.035 197.952 875529.652 53647.9286674226
Model 3 Time + Ion Dose 3 0.98 0.976 143.848 146.404 22225.01 1220.101393825

Table 4.2.21: Model and metrics selection table

4.2.7.1.5 AIC and BIC

The Akaike Information Criterion (AIC) is defined as

$$AIC_p=-2log(L_p)+2[(p+1)+1],$$

in which $L_p$ is the maximum likelihood function of the model and p is the number of explanatory variables considered in the model.

The Bayesian Information Criterion (BIC) is defined as

$$BIC_p=-2log(L_p)+[(p+1)+1]log(n).$$

Both AIC and BIC increase as SQE increases. Furthermore, both criteria penalize models with many variables, with lower AIC and BIC values ​​being preferable.

As models with more variables tend to produce lower SQE but use more parameters, the best choice is to balance the adjustment with the number of variables.

Example 2.7.1.5

Let’s calculate the AIC and BIC for all possible models from the example in “Motivation 2”.

  • Model 1

O $log(L_p)$ of the model considering only Time as an explanatory variable is -74.51. Thus, the AIC and BIC is given by

$$AIC_p=-2(-74,51)+2(3)=155,02.$$

$$BIC_p=-2(-74,51)+(3)log(14)=156,94.$$

  • Model 2

O $log(L_p)$ of the model considering only Ion Dose as an explanatory variable is -95.01. Thus, the AIC and BIC is given by

$$AIC_p=-2(-95,01)+2(3)=196,02.$$

$$BIC_p=-2(-95,01)+(3)log(14)=197,94.$$

  • Model 3

O $log(L_p)$ of the model considering Time and Ion Dose as explanatory variables is -67.92. Thus, the AIC and BIC is given by

$$AIC_p=-2(-67,92)+2(4)=143,84.$$

$$BIC_p=-2(-67,92)+(4)log(14)=146,39.$$

Using the Action software we have the following results:

Variables CP R² Adjusted R² AIC BIC PRESS QME
Model 1 Time 18.21 0.948 0.944 155.033 156.95 51545.126 2868.27911315993
Model 2 Ion dose 517.641 0.032 -0.048 196.035 197.952 875529.652 53647.9286674226
Model 3 Time + Ion Dose 3 0.98 0.976 143.848 146.404 22225.01 1220.101393825

Table 4.2.22: Model and metrics selection table

4.2.7.1.6 PRESS Criterion

The criteria $PRESS_p$ (Prediction Error Sum of Squares) is defined by

$$PRESS_p=\sum_{i=1}^{n}(Y_i-\hat{Y}_{(i)})^2,$$

in which $\hat{Y}_{(i)}$ is the predicted value of the regression without the ith observation.

We can write PRESS as

$$PRESS_p=\sum_{i=1}^{n}\left(\frac{Y_i-\hat{Y}_i}{1-h_{ii}}\right)^2,$$

in which the $h_{ii}$ is the ith value of the diagonal of the matrix H.

When using this criterion, a model with lower $PRESS_p$ is preferable.

Example 2.7.1.6

In the example in “Motivation 2” we will calculate the PRESS criterion for all possible models.

  • Model 1 (only Time as an explanatory variable):

In Table 2.7.1.6.1 we have the values of the Gain response variable, its values adjusted through model 1 and also the diagonal of the H matrix.

Gain (Y) Adjusted Values $(\hat{Y})$ $h_{ii}$
1004 922,2 0,241
1636 1569,4 0,233
852 922,2 0,241
1506 1569,4 0,233
1272 1245,8 0,071
1270 1245,8 0,071
1269 1245,8 0,071
903 922,2 0,24
1555 1569,4 0,23
1260 1245,8 0,071
1146 1245,8 0,071
1276 1245,8 0,071
1225 1245,8 0,071
1321 1299,7 0,075

Table 4.2.23: Measures for calculating the PRESS of model 1

$$PRESS_p=\sum_{i=1}^{14}\left(\frac{Y_i-\hat{Y}_i}{1-h_{ii}}\right)^2=51.545.$$

  • Model 2 (only ion dose as explanatory variable):

In Table 2.7.1.6.2 we have the values of the Gain response variable, its values adjusted through model 2 and also the diagonal of the H matrix.

Gain (Y) Adjusted Values $(\hat{Y})$ $h_{ii}$
1004 1301,683 0,197
1636 1301,683 0,197
852 1209,069 0,147
1506 1209,069 0,147
1272 1270,812 0,092
1270 1286,247 0,133
1269 1209,069 0,147
903 1255,376 0,073
1555 1255,376 0,073
1260 1301,683 0,197
1146 1193,634 0,216
1276 1255,376 0,073
1225 1190,546 0,233
1321 1255,376 0,073

Table 4.2.24: Measures for calculating the PRESS of Model 2

$$PRESS_p=\sum_{i=1}^{14}\left(\frac{Y_i-\hat{Y}_i}{1-h_{ii}}\right)^2=875.529,6.$$

  • Model 3 (model with Time and Ion Dose as explanatory variables):

In Table 2.7.1.6.3 we have the values of the Gain response variable, its values adjusted through model 3 and also the diagonal of the H matrix.

Gain (Y) Adjusted Values $(\hat{Y})$ $h_{ii}$
1004 973,6 0,367
1636 1620,5 0,358
852 882,4 0,317
1506 1529,2 0,31
1272 1266,6 0,092
1270 1281,9 0,133
1269 1205,8 0,148
903 928 0,243
1555 1574,9 0,235
1260 1297,1 0,197
1146 1190,6 0,216
1276 1251,4 0,073
1225 1187,5 0,233
1321 1305,3 0,077

Table 2.4.25: Measures for calculating the PRESS of Model 3

$$PRESS_p=\sum_{i=1}^{14}\left(\frac{Y_i-\hat{Y}_i}{1-h_{ii}}\right)^2=22.225.$$

Using the Action software we have the following results:

Variables PRESS CP R² Adjusted R² AIC BIC QME
Model 1 Time 51545.126 18.21 0.948 0.944 155.033 156.95 2868.27911315993
Model 2 Ion dose 875529.652 517.641 0.032 -0.048 196.035 197.952 53647.9286674226
Model 3 Time + Ion Dose 22225.01 3 0.98 0.976 143.848 146.404 1220.101393825

Table 4.2.26: Model and metrics selection table

4.2.7.2 Automatic Selection

As selecting all possible regressions requires considerable computational effort, other methods have been developed to select the best subset of variables sequentially, adding or removing variables at each step.

The criteria for adding or removing covariates is generally based on the F statistic, comparing models with and without the variables in question. The AIC, as well as other criteria, can also be used in the decision to insert and remove variables. There are three automatic procedures: (1) Forward Method, (2) Backward Method and (3) Stepwise Method.

4.2.7.2.1 Forward Selection

This procedure assumes that there is no variable in the model, only the intercept. The idea of ​​the method is to add one variable at a time. The first variable selected is the one with the highest correlation with the response.

Procedure:

  • We adjusted the model with the variable with the highest sample correlation with the response variable.

Assuming that this variable is $x_1$, we calculate the F statistic to test whether it is truly significant for the model. The variable enters the model if the F statistic is greater than the critical point, called $F_{in}$ or F for input. Let us note that $F_{in}$ is calculated for a given $\alpha$ critical.

  • Considering that $x_1$ was selected for the model, the next step is to find a variable with the highest correlation with the response considering the presence of the first variable in the model. This is called partial correlation and is the correlation of the model residuals $\hat{y}=\hat{\beta_0}+\hat{\beta_1}x_1$ with the model residuals $\hat{x_j}=\hat{\alpha_{0j}}+\hat{\alpha_{1j}}x_1$, j=2,3,…,p.

Let’s assume that the largest partial correlation with y is $x_2$. This implies that the largest statistic $F$ partial is:

$$F=\frac{SQR(x_2|x_1)}{QME(x_1,x_2)}.$$

If the value of the statistic is greater than $F_{in}$, $x_2$ is selected for the model.

  • The process is repeated, that is, the variable with the highest partial correlation with y is added to the model if its statistic $F$ partial is greater than $F_{in}$, until no further explanatory variables are included in the model.

4.2.7.2.2 Backward Selection

While the Forward method starts without any variables in the model and adds variables at each step, the Backward method takes the opposite path; it initially incorporates all variables and then, in stages, each one may or may not be eliminated.

The decision to remove the variable is made based on partial F tests, which are calculated for each variable as if it were the last one to enter the model.

Procedure:

  • For each explanatory variable, the statistic is calculated $F$. For the variable $x_k$, for example,

$$F=\frac{SQR(x_k|x_1,…,x_{k-1})}{QME}.$$

The lowest value of statistics $F$ calculated partials is then compared with the $F$ critical, $F_{out}$, calculated for a given value $\alpha$ critical. If the lowest value found is less than $F_{out}$, the covariate responsible for the lowest value of the statistic is eliminated from the model $F$ partial.

  • The model is adjusted again, now with the $p-1$ variables. The statistics $F$ partials are calculated for this model and the process is repeated.

  • The elimination algorithm ends when the lowest statistic $F$ partial is not less than $F_{out}$.

4.2.7.2.3 Stepwise Selection

Stepwise is a modification of Forward selection in which at each step all model variables are previously checked for their statistics $F$ partial. A variable added to the model in the previous step may be redundant to the model because of its relationship with the other variables and its statistical $F$ partial is less than $F_{out}$, it is removed from the model.

Procedure:

  • We start with a variable: the one that has the highest correlation with the response variable.
  • At each forward step, after including a variable, backward is applied to see if any variables will be discarded.
  • We continue the process until we do not include or exclude any variables.

Thus, Stepwise regression requires two cutoff values: $F_{in}$ and $F_{out}$. Some authors prefer to choose $F_{in}=F_{out}$ but this is not necessary. Se $F_{in}< F_{out}$: more difficult to remove than to add; if $F_{in}> F_{out}$: more difficult to add than to remove.

4.2.7.3 Some Considerations

Variable selection is a means to arrive at a model, but it is not the final step. The objective is to build a model that is good at obtaining predictions or that explains the relationships between data well.

Automatic selection methods have the advantage of not requiring a large computational effort. But they do not indicate the best model respecting any criteria (they do not return a set of models from which the researcher has the power to choose).

The method of all possible models identifies models that are best respecting the criterion that the researcher wants.

It is therefore recommended to use step-by-step methods combined with other criteria.

If there happens to be a large number of variables, it is recommended to use automatic selection methods to eliminate those with insignificant effects. And the reduced set of variables can then be investigated by the method of all possible models.

Choosing the final model is not an easy task. In addition to the formal criteria, we must answer the following questions:

  • Does the model make sense?
  • Is the model useful for its intended purpose? If, for example, the cost of collecting data for a variable is exorbitant and impossible to obtain, this will result in a useless model.
  • Are all coefficients reasonable, that is, do the signs and magnitude of the values ​​make sense and are the standard errors relatively small?
  • Is the suitability of the model satisfactory? No outliers, does it have constant variance, normality and are the data independent?

One principle to be taken into consideration is the “principle of parsimony”: simpler models should be chosen over more complex ones, as long as the quality of the fit is similar.

4.2.8 Analysis of Residuals in Multiple Linear Regression

As with Simple Linear Regression, the model assumptions described in Section 4.4.2.1 need to be verified for the results obtained to actually be valid. To this end, Residue Analysis is carried out in which a set of techniques are evaluated to investigate the suitability of the model. In Section 3 some of these techniques are described.

Furthermore, when we are dealing with more than one regressor variable, we need to diagnose collinearity or multicollinearity between them. Therefore, in Section 4.3.6 we have techniques to detect correlated variables that can make the results unreliable.

↑