On this page
4.1 Simple Linear Regression
Motivation 1
In heat treatment problems, it is desired to establish a relationship between the oven temperature and a quality characteristic (hardness, for example) of a part. In this way, the aim is to determine the temperature values in °C that “optimize” the performance of the heat treatment process in relation to the metallographic structure of the material, evaluated in relation to hardness in HB.
Consider that in an experiment, the hardness of pistons was measured at different temperature levels chosen according to interest (T1 = 220ºC, T2 = 225ºC, T3 = 230ºC and T4 = 235ºC). For each temperature point, 5 pistons were subjected to heat treatment. The observed data are presented in Table 4.1.1 and the objective is to establish a relationship between the input variable (temperature) and the output variable (hardness).
| Note | Hardness (HB) | Temperature (ºC) | Note | Hardness (HB) | Temperature (ºC) |
|---|---|---|---|---|---|
| 1 | 137 | 220 | 11 | 128 | 230 |
| 2 | 137 | 220 | 12 | 124 | 230 |
| 3 | 137 | 220 | 13 | 126 | 230 |
| 4 | 136 | 220 | 14 | 129 | 230 |
| 5 | 135 | 220 | 15 | 126 | 230 |
| 6 | 135 | 225 | 16 | 122 | 235 |
| 7 | 133 | 225 | 17 | 122 | 235 |
| 8 | 132 | 225 | 18 | 122 | 235 |
| 9 | 133 | 225 | 19 | 119 | 235 |
| 10 | 133 | 225 | 20 | 122 | 235 |
Table 4.1.1: Hardness data on a set of pistons at different temperature levels.
Most of the time, the real relationship between the variables of interest is not known at first. Thus, a preliminary graphical analysis is carried out by constructing the scatter plot between the variables in question. This graph is important in any regression analysis as through it it is possible to get a sense of the type of relationship existing between the variables (linear, quadratic relationship). This relationship is most often not perfect, that is, the points are not arranged perfectly on the function that relates the two variables, but these points are desired to be close. Furthermore, the scatter plot gives indications about the variability associated with the variables in question and about atypical or discrepant points. For the data set in Table 4.1, the scatterplot is given by
Figure 4.1.1: Oven Temperature vs Piston Hardness.
by Figure 4.1.1, it is observed that as the temperature level increases, the hardness of the pistons decreases. Therefore, assuming a linear relationship between the variables temperature and hardness, for temperature values between 220ºC and 235ºC is reasonable.
4.1.1 Statistical Model
As seen in Figure 4.1.1 referring to Motivation 1, it is reasonable to assume that the relationship between the variables piston hardness, denoted by Y and temperature levels, denoted by X, is linear. In this way, we define the following simple linear regression model between Y (response variable) and X (regressor variable).
Definition 1.1.1
Let us consider two variables X and Y. Data $n$ pairs $(X_1,Y_1),(X_2,Y_2),…,(X_n,Y_n)$, if Y is a linear function of X, a simple linear regression can be established whose statistical model is:
$$Y_i= \beta_0 + \beta_1 x_i+\varepsilon_i, \quad \hbox{para} \ i=1,\ldots,n, \tag{1.1.1}$$
in which we replace $X_i$ by $x_i$ since $X_i$ is a deterministic variable (known constant).
In this model,
-
$Y_i$ is a random variable and represents the value of the response variable (dependent variable) in the ith observation;
-
$x_i$ represents the value of the explanatory variable (independent variable, regressor variable) in the ith observation;
-
$\epsilon_i$ is a random variable that represents the experimental error;
-
$\beta_0$ and $\beta_1$ are the model parameters, which will be estimated, and which define the regression line and $n$ is the sample size.
4.1.1.1 Interpretation of model parameters
The parameter $\beta_0$ is called the intercept or linear coefficient and represents the point at which the regressing line crosses the axis of $y$’s, when $x=0$. The parameter $\beta_1$ represents the slope of the regressing line and is called the regression coefficient or angular coefficient. Furthermore, we have that for an increase of one unit in the variable $x$, the value $E(Y|x)$ increases $\beta_1$ units. The geometric interpretation of the parameters $\beta_0$ and $\beta_1$ can be seen in Figure 4.1.2.
Figure 4.1.2: Regressive Line
A negative point in Definition 1.1.1 is that the simple linear regression model does not accommodate the impacts of experimental errors (variation in raw materials), measurement errors, among countless other sources of variability, making it inappropriate in these cases.
4.1.1.2 Assumptions for the model
When establishing model 1.1.1 for the data, we assume that:
i) The mathematical relationship between $Y$ and $X$ is linear;
ii) The values of $x$ are fixed (or controlled), that is, $x$ is not a random variable;
iii) The mean error is zero, that is, $E(\epsilon_i)=0$. In this way, it follows that
$$E(Y_{i})=E(\beta_{0}+\beta_{1}x_{i}+\epsilon_{i})=\beta_{0}+\beta_{1}x_{i}+E(\epsilon_{i})=\beta_{0}+\beta_{1}x_i$$
and therefore, the regression function for model 1.1.1 is given by:
$$E[Y\mid x]=\beta_{0}+\beta_{1}x$$
Note that the observed value of $Y_i$ is around the value of the regression function with experimental error $\epsilon_i$.
iv) For a given value of $x$, the variance of $\epsilon_i$ is always $\sigma^2$, that is,
$$Var(\varepsilon_i)= E(\varepsilon_i^2) - [E(\varepsilon_i)]^2 = E(\varepsilon_i^2) = \sigma^2, $$
this implies:
$$Var(Y_i)= E[Y_i - E(Y_i|x_i)]^2 = E(\varepsilon_i^2) = \sigma^2.$$
In this case, we say that the error is homoscedastic (has constant variance);
v) The error of one observation is uncorrelated with the error of another observation, i.e.
$$Cov(\varepsilon_i, \varepsilon_j)-E(\varepsilon_i)E(\varepsilon_j)=E(\varepsilon_i, \varepsilon_j)=0, \quad para \quad i\neq0$$
This hypothesis does not imply that the errors are independent. If the distribution of errors is normal, this hypothesis is equivalent to independence of errors.
vi) We often assume that errors have a Normal distribution.
In this way, combining (iii), (iv) and (vi) we have $\varepsilon_i \sim N(0 \ , \ \sigma^2)$. How $Y_i$ is the sum of a constant term, $\beta_{0}+\beta_{1}x_{i}$, with a random term, $\epsilon_{i}$, it follows that $Y_i \sim N(\beta_0 + \beta_1 x_i \ ,\ \sigma^2).$ Furthermore, by (v) and (vi) we have that $Y_i$ and $Y_j$ are independent. The assumption of normality is necessary to prepare hypothesis tests and obtain confidence intervals.
4.1.2 Estimation of Model Parameters
Assuming that the linear relationship between the variables $Y$ and $X$ is satisfactory, we can estimate the regression line and solve some inference problems. The problem of estimating parameters $\beta_{0}$ and $\beta_{1}$ it is the same as fitting the best straight line in a scatterplot, as in Figure 4.1.3. The Least Squares Method is an efficient strategy for estimating regression parameters and its application is not limited to linear relationships.
Figure 4.1.3: Representation of the Regression Line
4.1.2.1 Least Squares Method
The first step in regression analysis is to obtain the estimates $\widehat{\beta_0}$ and $\widehat{\beta_1}$ of the model parameters. The values of these estimates will be obtained from a sample of $n$ value pairs $(X_i,Y_i)$, $i=1,…,n$ that correspond to $n$ points on a graph, as in Figure 1.2.1. In the Least Squares method, it is not necessary to know the shape of the error distribution.
Suppose an arbitrary line is drawn $\beta_0 + \beta_1 x$ passing through these points. In value $x_i$ of the explanatory variable, the value predicted by this line is $\beta_0 + \beta_{1} x_i$, while the observed value is $Y_i$. The deviations (errors) between these two values are $\varepsilon_i=Y_i-[\beta_0+\beta_1 x_i]$, which corresponds to the vertical distance from the point to the arbitrary line.
The objective is to estimate the parameters $\beta_0$ and $\beta_1$ so that the deviations ($\varepsilon_i$) between the observed and estimated values are minimum. This is equivalent to minimizing the length of the error vector, $\varepsilon=(\varepsilon_1,\varepsilon_2,\ldots,\varepsilon_n)^{\prime}$.
One way to obtain these estimates is the Least Squares Method. This method consists of minimizing the sum of squares of L deviations, as in the expression below
$$L=\displaystyle\sum^n_{i=1}\varepsilon_i^2=\sum^n_{i=1}[Y_i-\beta_0-\beta_1 x_i]^2. \tag{1.2.1.1}$$
Obviously, we could calculate the distance between the straight line and the observed values in different ways. For example, we could use modulus instead of square, or any appropriate distance function. The choice of the square lies in the simplicity of the calculations involved
To find estimates for the parameters, we will minimize (1.2.1.1) with respect to the parameters $\beta_0$ and $\beta_1$. To do this, we derive in relation to the parameters $\beta_0$ and $\beta_1$. So,
$$\frac{\partial L(\beta_0,\beta_1)}{\partial \beta_0}=-2\sum^n_{i=1}(Y_i-\beta_0-\beta_1 x_i)$$
$$\hbox{e\ }\frac{\partial L(\beta_0,\beta_1)}{\partial\beta_1}=-2\sum^n_{i=1}(Y_i-\beta_0-\beta_1 x_i)x_i.$$
Replacing $\beta_0$ and $\beta_1$ by $\widehat{\beta_0}$ and $\widehat{\beta_1}$, to indicate particular values of the parameters that minimize L, and equating the partial derivatives to zero, we obtain
$$-2\sum^n_{i=1}(Y_i-\widehat{\beta_0}-\widehat{\beta_1} x_i)=0$$
$$\hbox{e\ }-2\sum^n_{i=1}(Y_i-\widehat{\beta_0}-\widehat{\beta_1} x_i)x_i=0.$$
Simplifying, we obtain equations called Normal Least Squares Equations.
$$ \begin{cases} n \widehat{\beta_0}+\widehat{\beta_1}\sum\limits^n_{i=1}x_i=\sum\limits^n_{i=1}Y_i \cr \widehat{\beta_0}\sum\limits^n_{i=1}x_i+\widehat{\beta_1}\sum\limits^n_{i=1} x_i^2 = \sum\limits_{i=1}^n x_i Y_i \quad \tag{1.2.1.2} \end{cases} $$
To find the values of $\widehat\beta_{0}$ and $\widehat\beta_{1}$ that minimize L, we solve the system of equations given in (1.2.1.2). Considering the first equation of (1.2.1.2) we obtain that,
$$ \widehat{\beta_0}=\frac{\sum\limits_{i=1}^n Y_i}{n}-\frac{\widehat{\beta_1}\sum\limits_{i=1}^n x_i}{n}, $$
i.e.
$$\widehat{\beta_0}=\bar{Y}-\widehat{\beta_1}\bar{x}, \tag{1.2.1.3}$$
in which $\bar{x}=\dfrac{1}{n}\sum\limits^n_{i=1}x_i\quad\hbox{e}\quad\bar{Y}=\dfrac{1}{n}\sum\limits^n_{i=1} Y_i$ are the means of x and the variable Y, respectively.
Thus, substituting (1.2.1.3) in the second equation of (1.2.1.2) we have that,
$$\widehat{\beta_1}\displaystyle\sum_{i=1}^n x_i^2=\displaystyle\sum_{i=1}^n x_i Y_i-\widehat{\beta_0}\displaystyle\sum_{i=1}^n x_i$$
$$=\displaystyle\sum_{i=1}^n x_i Y_i-\left(\bar{Y}-\widehat{\beta_1}\bar{x}\right)\displaystyle\sum_{i=1}^n x_i$$
$$=\displaystyle\sum_{i=1}^n x_i Y_i-\bar{Y}\displaystyle\sum_{i=1}^n x_i-\widehat{\beta_1}\bar{x}\displaystyle\sum_{i=1}^n x_i$$
$$=\displaystyle\sum_{i=1}^n x_i Y_i-n\bar{x}\bar{Y}+n\widehat{\beta_1}\bar{x}^2.$$
So,
$$\widehat{\beta_1}\left(\displaystyle\sum_{i=1}^n x_i^2-n\bar{x}^2 \right)=\sum_{i=1}^n x_i Y_i-n\bar{x}\bar{Y}$$
and therefore, we conclude that
$$\widehat{\beta_1}=\dfrac{\displaystyle\sum\limits_{i=1}^n x_i Y_i-n\bar{x}\bar{Y}}{\displaystyle\sum\limits_{i=1}^n x_i^2-n\bar{x}^2}.$$
We can also write
$$\widehat{\beta_1}=\dfrac{\displaystyle\sum\limits_{i=1}^n(x_i - \bar{x})(Y_i - \bar{Y})}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}=\dfrac{\displaystyle\sum\limits_{i=1}^n(x_i - \bar{x})Y_i}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})x_i}=\dfrac{\displaystyle\sum\limits_{i=1}^n x_i Y_i-n\bar{x}\bar{Y}}{\displaystyle\sum\limits_{i=1}^n x_i^2-n\bar{x}^2}.$$
The values of $\widehat{\beta_0}$ and $\widehat{\beta_1}$ Thus determined, they are called Least Squares Estimators (EMQ).
The fitted simple linear regression model is then
$$\widehat{Y}=\widehat{\beta_0}+\widehat{\beta_1}x, \tag{1.2.1.4}$$
being that $\widehat{Y}$ is a point estimator of the mean of variable Y for a value of $x$, that is,
$$\widehat{E(Y|x_i)}=\widehat{\beta_0}+\widehat{\beta_1} x_{i},\quad i=1,\dots,n.$$
Notation
Considering n pairs of observed values $(x_1,y_1),…,(x_n,y_n)$,
$$\bar{x}=\frac{1}{n}\sum^n_{i=1}x_i,\quad\bar{y}=\frac{1}{n}\sum^n_{i=1} y_i, \tag{1.2.1.5}$$
$$S _{xx}=\sum^n_{i=1}(x_i-\bar{x})^2=\sum^n_{i=1}(x_i-\bar{x})x_i=\sum^n_{i=1}x_i^2-n\bar{x}^2=\sum^n_{i=1}x_i^2-\frac{\left(\sum\limits_{i=1}^n x_i\right)^2}{n}, \quad \tag{1.2.1.6}$$
$$S_{yy}=\sum^n_{i=1}(y_i-\bar{y})^2=\sum^n_{i=1}(y_i-\bar{y})y_i=\sum^n_{i=1}y_i^2- n \bar{y}^2=\sum^n_{i=1}y_i^2-\frac{\left(\sum\limits_{i=1}^n y_i\right)^2}{n} \quad \tag{1.2.1.7}$$
$$\hbox{e\ }S_{xy}=\sum_{i=1}^n (x_i-\bar{x})(y_i-\bar{y})=\sum^n_{i=1}(x_i-\bar{x})y_i=\sum^n_{i=1}x_i y_i-n\bar{x}\bar{y}. \quad \tag{1.2.1.8}$$
The quantities $\bar{x}$ and $\bar{y}$ are the sample means of x and y. The quantities $S _{xx}$ and $S_{yy}$ are the sums of the squares of the deviations from the means and $S_{xy}$ is the sum of the cross products of the deviations of x and y.
In this way, least squares estimates of $\beta_0$ and $\beta_1$, in terms of this notation are:
$$\widehat{\beta_1}=\frac{S_{xy}}{S _{xx}}\quad\hbox{e}\quad\widehat{\beta_0}=\bar {Y}-\widehat{\beta_1}\bar{x}.$$
Example 1.2.1
Returning to Motivation 1, in which we wanted to determine the temperature values in $^{\circ}\mathrm{C}$ that optimize the hardness of the material, we find the parameter estimates $\beta_{0}$ and $\beta_{1}$ by the Least Squares Method.
Solution:
The sample means of the temperature variables $(X)$ and hardness $(Y)$ are, respectively,
$$\bar{x}=\dfrac{1}{20}\sum_{i=1}^{20}x_i=(220+220+\ldots+235+235)/20=227,5$$
$$\hbox{e\ }\bar{y}=\dfrac{1}{20}\sum_{i=1}^{20} y_i = 137+137+\ldots+119+122=129,4.$$
Furthermore, in Table 1.2.1, we present the values of $x^2, y^2$ and $xy$ for each observation $i$, $i=1,…,20$.
| Note | Temperature (x) | Hardness (y) | $x^2$ | $y^2$ | $x* y$ |
|---|---|---|---|---|---|
| 1 | 220 | 137 | 48.400 | 18.769 | 30.140 |
| 2 | 220 | 137 | 48.400 | 18.769 | 30.140 |
| 3 | 220 | 137 | 48.400 | 18.769 | 30.140 |
| 4 | 220 | 136 | 48.400 | 18.496 | 29.920 |
| 5 | 220 | 135 | 48.400 | 18.225 | 29.700 |
| 6 | 225 | 135 | 50.625 | 18.225 | 30.375 |
| 7 | 225 | 133 | 50.625 | 17.689 | 29.925 |
| 8 | 225 | 132 | 50.625 | 17.424 | 29.700 |
| 9 | 225 | 133 | 50.625 | 17.689 | 29.925 |
| 10 | 225 | 133 | 50.625 | 17.689 | 29.925 |
| 11 | 230 | 128 | 52.900 | 16.384 | 29.440 |
| 12 | 230 | 124 | 52.900 | 15.376 | 28.520 |
| 13 | 230 | 126 | 52.900 | 15.876 | 28.980 |
| 14 | 230 | 129 | 52.900 | 16.641 | 29.670 |
| 15 | 230 | 126 | 52.900 | 15.876 | 28.980 |
| 16 | 235 | 122 | 55.225 | 14.884 | 28.670 |
| 17 | 235 | 122 | 55.225 | 14.884 | 28.670 |
| 18 | 235 | 122 | 55.225 | 14.884 | 28.670 |
| 19 | 235 | 119 | 55.225 | 14.161 | 27.965 |
| 20 | 235 | 122 | 55.225 | 14.884 | 28.670 |
| Sum | 4.550 | 2.588 | 1.035.750 | 335.594 | 588.125 |
| Average | 227,5 | 129,4 |
Table 4.1.2: Motivation 1 Data
Thus, we find the sums of squares
$$S _{xx}=\sum^n_{i=1}x_i^2-n\bar{x}^2=1035.750-20\times 227,50^2=625,$$
$$S_{yy}=\sum^n_{i=1}y_i^2-n\bar{y}^2= 335.594 - 20 \times 129,40^2=706,80$$
$$\hbox{e\ }S_{xy}=\sum^n_{i=1}x_i y_i-n\bar{x}\bar{y}=588.125 - 20 \times 227,50 \times 129,40=-645.$$
Therefore, the parameter estimates $\beta_{1}$ and $\beta_{0}$ are, respectively
$$\widehat\beta_1=\dfrac{-645}{625}=-1,032$$
$$\hbox{e\ }\widehat\beta_0=129,4-(-1,032)227,5=364,18.$$
Therefore, the adjusted model is given by
$$\hbox{Dureza} = 364,18-1,032 \ \hbox{Temperatura}.$$
Based on the estimated values, we have that with each increase in Temperature, we have a decrease of 1.032 in Hardness.
4.1.2.2 Waste
The difference between the observed value $Y_{i}$ and the corresponding adjusted value $\widehat{Y}_{i}$, given by the expression (1.2.1.4), is called residue and is denoted by
$$e_{i}=Y_{i}-\widehat{Y}_{i}=Y_{i}-(\widehat\beta_{0}+\widehat\beta_{1}x_{i}), \tag{1.2.2.1}$$
This measurement is important as we use it to check the fit of the model.
4.1.2.2.1 Some properties of the least squares adjustment
(i) The sum of the residuals is always zero.
$$\sum\limits_{i=1}^{n}e_{i}=\sum\limits_{i=1}^{n}(Y_{i}-\widehat{Y}_{i})=0 $$
In reality, we just need to substitute the least squares estimators $$\sum\limits_{i=1}^{n}e_{i}=\sum_{i=1}^nY_i-n\hat{\beta_0}-\hat{\beta_1}\sum_{i=1}^nx_i=\sum_{i=1}^nY_i-n\bar{Y}+n\hat{\beta_1}\bar{x}-\hat{\beta_1}\sum_{i=1}^nx_i=0$$
(ii) The sum of observed values $Y_{i}$ is equal to the sum of the adjusted values $\widehat{Y}_{i}$.
$$\sum\limits_{i=1}^{n}Y_{i}=\sum\limits_{i=1}^{n}\widehat{Y}_{i}$$
(iii) The least squares regression line passes through the point $(\bar{x},\bar{Y})$. In fact,
$$Y_i=\beta_0+\beta_1x_1+\varepsilon_i=\beta_0+\beta_1(x_i-\bar{x})+\beta_1\bar{x}+\varepsilon_i=(\beta_0+\beta_1\bar{x})+\beta_1(x_i-\bar{x})+\varepsilon_i=$$ $$=\beta_0^{*}+\beta_1(x_i-\bar{x})+\varepsilon_i$$
with $\beta_0^{*}=\beta_0+\beta_1\bar{x}$. Thus, the adjusted regression line is given by
$$\widehat{Y}=\widehat{\beta_0}^{*}+\widehat{\beta_1}(x_i-\bar{x})=\widehat{\beta_0}+\widehat{\beta_1}\bar{x}+\widehat{\beta_1}(x_i-\bar{x})=(\bar{Y}-\widehat{\beta_1}\bar{x})+\widehat{\beta_1}\bar{x}+\widehat{\beta_1}(x_i-\bar{x})=$$ $$=\bar{Y}+\widehat{\beta_1}(x_i-\bar{x})$$
Then, at the point $x_i=\bar{x}$ we have to $$\widehat{Y}=\bar{Y}+\widehat{\beta}_{1}(\bar{x}-\bar{x})=\bar{Y}.$$ Therefore, we have that the fitted line passes through $(\bar{x},\bar{Y})$.
(iv) The sum of the residuals weighted by the corresponding value of the regressor variable is always zero.
$$\sum\limits_{i=1}^{n}x_{i}e_{i}=0$$
(v) The sum of the residuals weighted by the corresponding adjusted value is always zero.
$$\sum\limits_{i=1}^{n}\widehat{Y}_{i}e_{i}=0$$
4.1.2.3 Residual variance estimator
Just like the parameters $\beta_{0}$ and $\beta_{1}$, the variance $\sigma^2$ of the terms of the error $\epsilon_i$ needs to be estimated. This is necessary since inferences about the regression function and the prediction of $Y$ require an estimate of $\sigma^2$. Let us consider the waste $e_{i}$ given in (1.2.2.1). In this way, we define the Sum of Squares of the Residuals (Errors),
$$SQE = \sum\limits_{i=1}^n e_i^{2} = \sum\limits_{i=1}^n (Y_i-\widehat{Y}_i)^{2}=\sum\limits_{i=1}^n(Y_i-(\widehat{\beta_0}+\widehat{\beta_1}x_i))^{2}.$$
It will be demonstrated below in 1.3 Properties of Estimators that SQE is a biased estimator of $\sigma^2$, that is,
$$E(SQE)= \sigma^2(n-2).$$
In this way, an unbiased estimator for $\sigma^2$ is given by
$$\widehat{\sigma}^2=QME=\dfrac{SQE}{n-2},$$
where QME is the Mean Square of Errors (Residuals).
Considering $n$ observed value pairs $(x_1,y_1),…,(x_n,y_n)$, we can write
$$SQE=S_{yy}-\widehat{\beta}_{1}S_{xy},$$
will be seen below in 1.3 Properties of Estimators that $S_{yy}$ and $S_{xy}$ are given respectively by the expressions (1.2.1.6) and (1.2.1.7). Therefore,
$$QME=\dfrac{SQE}{n-2}=\dfrac{S_{yy}-\widehat{\beta}_{1}S_{xy}}{n-2}.$$
We will give more details for the Sum of Squares of Errors (SQE) and the Mean Square of Errors (QME) in section 4.1.5 Analysis of Variance.
Example 1.2.2
Obtain an unbiased estimator for the residual variance from the Motivation 1 example.
Solution:
We have to
$$SQE=S_{yy}-\widehat{\beta_1}S_{xy}.$$
We have already seen that $S_{yy}=706,8,$ $\widehat{\beta_1} = -1,032$ and $S_{xy}=-645,$ then
$$SQE=706,8 -(-1,032)(-645) = 706,8 - 665,64 = 41,16$$
$$\widehat{\sigma}^2=QME=\frac{SQE}{n-2} ~ = ~\frac{41,16}{18} ~ = ~2,2866.$$
Using the SoftwareAction we obtain the following results:
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Temperature | 1 | 665.64 | 665.64 | 291.0962 | 0 |
| Waste | 18 | 41.16 | 2.2867 |
Table 4.1.3: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -2.82 | -0.82 | 0.18 | 0 | 1.02 | 3.02 |
Table 4.1.4: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | 364.18 | 13.7649 | 26.4571 | 0 |
| Temperature | -1.032 | 0.0605 | -17.0615 |
Table 4.1.5: Coefficients
4.1.3 Properties of Estimators
Least squares estimators $\widehat\beta_{0}$ and $\widehat\beta_{1}$ have important properties: they are unbiased and have minimum variance among all unbiased estimators that are linear combinations of the $Y_i$ (Gauss-Markov theorem). In this way, least squares estimators are often said to be “best unbiased linear estimators”.
1. Expected value (average) of $\widehat{\beta}_{1}$
Defining
$$C_i=\dfrac{x_i-\bar{x}}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}\ \ i=1,\dots,n,$$
it follows that,
$$\widehat{\beta_1}=\dfrac{\displaystyle\sum\limits_{i=1}^n(x_i - \bar{x})Y_i}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=\sum\limits_{i=1}^n C_i Y_i.$$
So, $\widehat{\beta_1}$ is a linear combination of $Y$. In this way,
$$E(\widehat{\beta_1})=E(\sum\limits_{i=1}^n C_i Y_i)=\sum\limits_{i=1}^n C_i E(Y_i)=\sum\limits_{i=1}^n C_i (\beta_0 + \beta_1 x_i)=\beta_0 \sum\limits_{i=1}^n C_i + \beta_1 \sum\limits_{i=1}^n C_i x_i.$$
How
$$\sum\limits_{i=1}^n C_i = \dfrac{\displaystyle\sum\limits_{i=1}^n(x_i -\bar{x})}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}= \dfrac{\displaystyle\sum\limits_{i=1}^n x_i -n\bar{x}}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}= \dfrac{\displaystyle\sum\limits_{i=1}^n x_i -\sum\limits_{i=1}^n x_i}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}=0$$
$$\hbox{e\ } \sum\limits_{i=1}^n C_i x_i= \dfrac{\displaystyle\sum\limits_{i=1}^n(x_i -\bar{x})x_i}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}= \dfrac{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n (x_i -\bar{x})^2} = 1,$$
we conclude that $E(\widehat{\beta_1})=\beta_{1}$ (unbiased estimator).
2. Variance of $\widehat{\beta}_{1}$
From (1) we have that
$$Var(\widehat{\beta_1})=Var \left(\sum\limits_{i=1}^n C_i Y_i \right).$$
How $Y_i$, $i=1,…,n$ are independent variables, it follows that
$$Var(\widehat{\beta_1})=\sum\limits_{i=1}^n C_i^2 Var(Y_i) = \displaystyle\sum\limits_{i=1}^n \left(\dfrac{(x_i - \bar{x})}{ \displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right)^2\sigma^2=\dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}.$$
Considering n pairs of observed values $(x_1,y_1),…,(x_n,y_n)$, we can write
$$Var(\widehat{\beta_1})=\dfrac{\sigma^2}{S _{xx}}.$$
3. Expected value (average) of $\widehat{\beta}_{0}$
$$E(\widehat{\beta_0})=E\left[\bar{Y}-\widehat{\beta_1}\bar{x}\right]=E(\bar{Y})-\bar{x}E(\widehat{\beta_1})=E\left(\sum\limits_{i=1}^n\dfrac{Y_i}{n}\right)-\bar{x}\beta_1= \sum\limits_{i=1}^n\dfrac{E(Y_i)}{n}-\bar{x}\beta_1.$$
How $E(Y_i)=(\beta_0+\beta_1x_i)$, it follows that
$$E(\widehat{\beta_0})= \dfrac{1}{n}\sum\limits_{i=1}^n(\beta_0+\beta_1x_i)-\bar{x}\beta_1= \beta_0+\beta_1 \dfrac{\displaystyle\sum\limits_{i=1}^n x_i}{n}-\bar{x}\beta_1= \beta_0.$$
(unbiased estimator).
4. Variance of $\widehat{\beta}_{0}$
$$Var(\widehat{\beta_0})=Var \left(\bar{Y}-\widehat{\beta_1} \bar{x}\right) = Var(\bar{Y}) + Var(\widehat{\beta_1} \bar{x})-2 Cov(\bar{Y},\widehat{\beta_1}\bar{x}).$$
Let us note that
$$Cov(\bar{Y},\widehat{\beta_1}\bar{x})=E(\bar{Y}\widehat{\beta_1}\bar{x})-E(\bar{Y})E(\widehat{\beta_1}\bar{x})=E(\bar{x}\bar{Y}\widehat{\beta_1})-E\left( \sum_{i=1}^n\dfrac{Y_i}{n}\right)\bar{x}\beta_1$$
$$=E\left(\bar{x}\dfrac{\displaystyle\sum\limits_{i=1}^n(\beta_0+\beta_1x_i+\varepsilon_i)}{n}\widehat{\beta_1}\right)-\dfrac{\bar{x}\beta_1}{n}\sum\limits_{i=1}^n(\beta_0+\beta_1x_i)=\dfrac{\bar{x}}{n}\sum\limits_{i=1}^n \left[ \beta_0\beta_1 + x_i\beta_1^2+E(\varepsilon_i \widehat{\beta_1})\right]$$
$$-\dfrac{\bar{x}~\beta_1}{n}\sum_{i=1}^n(\beta_0+\beta_1x_i)=\dfrac{\bar{x}~\beta_1}{n}\sum_{i=1}^n(\beta_0+\beta_1x_i)+\dfrac{\bar{x}}{n}\sum_{i=1}^nE(\varepsilon_i\widehat{\beta_1})-\dfrac{\bar{x}~\beta_1}{n}\sum_{i=1}^n(\beta_0+\beta_1x_i)=$$ $$=\dfrac{\bar{x}}{n}\sum_{i=1}^nE(\varepsilon_i\widehat{\beta_1}).$$
How
$$ E(\varepsilon_i\widehat{\beta_1})=E\left[\varepsilon_i\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})Y_j}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right]=\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})E\left[\varepsilon_iY_j\right]}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})E\left[\varepsilon_i(\beta_0+\beta_1x_j+\varepsilon_j)\right]}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2} $$
$$ =\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})[\beta_0 E(\varepsilon_i)+\beta_1x_jE(\varepsilon_i)+E(\varepsilon_j\varepsilon_i)]}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})E(\varepsilon_j\varepsilon_i)}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=0,$$
since for $i\neq j$,
$$E(\varepsilon_j\varepsilon_i)=0\Rightarrow E(\varepsilon_i\widehat{\beta_1})=0.$$
and for $i=j$,
$$E(\varepsilon_j\varepsilon_i)=\sigma^2\Rightarrow E(\varepsilon_i\widehat{\beta_1})=\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=\sigma^2\dfrac{\displaystyle\sum\limits_{j=1}^k(x_j-\bar{x})}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=0;$$
it follows that
$$Cov(\bar{Y},\widehat{\beta_1}\bar{x})=0.$$
In this way,
$$Var(\widehat{\beta_0})=Var(\bar{Y})+ Var(\widehat{\beta_1} \bar{x})=Var\left(\sum_{i=1}^n \frac{Y_i}{n}\right)+ \bar{x}^2 Var(\widehat{\beta_1}).$$
How $Y_i$, $i=1,…,n$ are independent, it follows that
$$Var(\widehat{\beta_0})=\dfrac{1}{n^2}\sum\limits_{i=1}^n Var(Y_i)+ \bar{x}^2 \dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=\dfrac{n \sigma^2}{n^2}+ \bar{x}^2 \dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}=$$ $$=\sigma^2 \left( \dfrac{1}{n} + \dfrac{\bar{x}^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right).$$
Again, given n pairs of values $(x_1,y_1),…,(x_n,y_n)$ we write
$$Var(\widehat{\beta_0})=\sigma^2\left(\dfrac{1}{n}+\dfrac{\bar{x}^2}{S _{xx}}\right).$$
5. Covariance between $\widehat{\beta_{0}}$ and $\widehat{\beta_{1}}$
$$Cov(\widehat{\beta_0}, \widehat{\beta_1})=E(\widehat{\beta_0}\widehat{\beta_1})-E(\widehat{\beta_0})E(\widehat{\beta_1})=E[(\bar{Y}-\widehat{\beta_1}\bar{x})\widehat{\beta_1}]-\beta_0\beta_1=E[\bar{Y}\widehat{\beta_1}-\bar{x}\widehat{\beta_1}^2]-\beta_0\beta_1=$$ $$ =E(\bar{Y}\widehat{\beta_1})$$
$$-\bar{x}E(\widehat{\beta_1}^2)-\beta_0\beta_1= E\left[\dfrac{1}{n}\sum\limits_{i=1}^n Y_i\widehat{\beta_1}\right]-\bar{x}[Var(\widehat{\beta_1})+ (E(\widehat{\beta_1}))^2]-\beta_0\beta_1=\dfrac{1}{n}\sum\limits_{i=1}^n E[(\beta_0+\beta_1x_i+\varepsilon_i)\widehat{\beta_1}]$$
$$-\bar{x}\left[ \dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}+\beta_1^2\right] -\beta_0\beta_1=\dfrac{1}{n}\sum\limits_{i=1}^n E[\beta_0\widehat{\beta_1} + \beta_1\widehat{\beta_1}x_i+\varepsilon_i\widehat{\beta_1}]-\dfrac{\bar{x} , \sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2} - \bar{x} \beta_1^2 - \beta_0 \beta_1$$
$$= \dfrac{1}{n} \sum\limits_{i=1}^n \left[\beta_0 \beta_1 + \beta_1^2 x_i + E(\varepsilon_i \widehat{\beta_1}) \right] - \dfrac{\bar{x} , \sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2} - \bar{x} \beta_1^2 - \beta_0 \beta_1$$
$$= \beta_0 \beta_1 + \beta_1^2 \bar{x} + \dfrac{1}{n} \sum\limits_{i=1}^n E(\varepsilon_i \widehat{\beta_1})-\dfrac{\bar{x} , \sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2} - \bar{x} \beta_1^2 - \beta_0 \beta_1=\dfrac{1}{n} \sum\limits_{i=1}^n E(\varepsilon_i \widehat{\beta_1})-\dfrac{\bar{x} , \sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}.$$
From (4) we have that
$$E(\varepsilon_i \widehat{\beta_1})=0$$
and therefore,
$$Cov(\widehat{\beta_0},\widehat{\beta_1})=-\dfrac{\bar{x}\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}.$$
6. Sampling distribution for $\widehat{\beta}_{1}$
In (1), we define
$$\widehat{\beta_1}=\sum\limits_{i=1}^n C_i Y_i.$$
How $\widehat{\beta_1}$ is a linear combination of independent normals (linear combination of $Y_i$), it follows that $\widehat{\beta_1}$ also has a normal distribution with mean and variance given respectively in (1) and (2) and therefore,
$$\widehat{\beta_1} \sim N \left(\beta_1,\frac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right).$$
7. Sampling distribution for $\widehat{\beta}_{0}$
As in (6), $\widehat{\beta_0}$ is also a linear combination of independent normals $Y_i$, and therefore, it also has a normal distribution. The mean and variance of $\widehat{\beta}_{0}$ are presented in (3) (4) respectively. This way
$$\widehat{\beta_0} \sim N \left[\beta_0, \sigma^2 \left(\frac{1}{n} \frac{x^{-2}}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right)\right]. $$
8. Expected value (average) of QME
$$QME=\dfrac{SQE}{n-2}$$
So,
$$E(QME)=E\left(\dfrac{SQE}{n-2}\right)=\dfrac{E(SQE)}{n-2}.$$
We know that
$$SQE = \sum e_i^{2}=\sum_{i=1}^n (Y_i-\widehat{Y}_i)^{2}=\sum_{i=1}^n(Y_i-(\widehat{\beta_0}+\widehat{\beta_1}x_i))^{2}=\sum_{i=1}^n[Y_i^{2}-2 Y_i(\widehat{\beta_0} +\widehat{\beta_1} x_i) + (\widehat{\beta_0} +\widehat{\beta_1} x_i)^{2}]$$
$$=\sum_{i=1}^n[Y_i^{2}-2 Y_i(\bar{Y} - \widehat{\beta_1} \bar{x} + \widehat{\beta_1} x_i) + (\bar{Y} - \widehat{\beta_1} \bar{x} +\widehat{\beta_1} x_i)^{2}]=\sum_{i=1}^n[Y_i^{2}-2 Y_i\bar{Y} +2Y_i\bar{x}\widehat{\beta_1} - 2Y_ix_i \widehat{\beta_1}+ [\bar{Y} - \widehat{\beta_1} (\bar{x} - x_i)^{2}]]$$
$$=\sum_{i=1}^n[Y_i^{2}-2 Y_i\bar{Y} +2 Y_i\bar{x}\widehat{\beta_1}- 2Y_ix_i \widehat{\beta_1}+ \bar{Y}^2 - 2 \bar{Y} \widehat{\beta_1} (\bar{x} - x_i) + \widehat{\beta_1}^2 (\bar{x} - x_i)^2$$
$$=\sum_{i=1}^n[(Y_i -\bar{Y})^2 - 2 \widehat{\beta_1} (x_iY_i -\bar{x} Y_i + \bar{Y}\bar{x} - \bar{Y}x_i) + \widehat{\beta_1}^2 (\bar{x} - x_i)^2]$$
$$= \sum_{i=1}^n(Y_{i}-\bar{Y})^2- 2\widehat{\beta_1} \sum_{i=1}^n[(\bar{x}-x_i)(\bar{Y}-Y_i)]+\widehat{\beta_1}^{2} \sum_{i=1}^n(x_i-\bar{x})^2$$
$$=\sum_{i=1}^n(Y_i-\bar{Y})^{2}-2\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_{i}+\widehat{\beta_1}^{2}(\sum_{i=1}^n x_i^{2}-n\bar{x}^{2})= \sum_{i=1}^n(Y_i -\bar{Y})^2-2\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_i+\widehat{\beta_1}^{2} \sum_{i=1}^n(x_i-\bar{x})^2$$
$$=\sum_{i=1}^n(Y_i-\bar{Y})^2 - 2\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_i+\widehat{\beta_1}^{2} \dfrac{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i}{\widehat{\beta_1}}=\sum_{i=1}^n(Y_i-\bar{Y})^2 -\widehat{\beta_1}\sum_{i=1}^{n}(x_i-\bar{x})Y_i.=S_{yy}-\widehat{\beta_1}S_{xy}.$$
In this way,
$$E(SQE)=E\left(\sum_{i=1}^{n}(Y_{i}-\bar{Y})^2 - \widehat{\beta}_{1}\sum_{i=1}^{n}(x_{i}-\bar{x})Y_{i}\right)$$
$$=E\left(\sum\limits_{i=1}^{n}(Y_{i}-\bar{Y})^2\right)-E\left(\dfrac{\displaystyle\sum\limits_{i=1}^{n}(x_{i}-\bar{x})Y_{i}}{\displaystyle\sum_{i=1}^n(x_{i}-\bar{x})^2}\sum_{i=1}^n(x_i-\bar{x})Y_{i}\right)$$
$$=\sum_{i=1}^nE(Y_{i}^2)-nE(\bar{Y}^2)-\dfrac{1}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}E\left[\left(\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\right)^2\right]$$
$$=\sum_{i=1}^n[Var(Y_i)+E^2(Y_i)]-n[Var(\bar{Y})+E^2(\bar{Y})]$$
$$-\dfrac{1}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\left[Var\left(\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\right)+E^2\left(\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\right)\right].$$
How
$$E\left(\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\right)=\sum_{i=1}^n(x_i-\bar{x})E(Y_i)=\sum_{i=1}^n(x_i-\bar{x})(\beta_0+\beta_1x_i)$$
and
$$Var\left(\sum_{i=1}^n(x_i-\bar{x})Y_i\right)=\sum_{i=1}^n(x_i-\bar{x})^2Var(Y_i)=\sum_{i=1}^n(x_i-\bar{x})^2\sigma^2.$$
It follows that
$$E(SQE)=\left(\sum_{i=1}^n\sigma^2+(\beta_0+\beta_1x_i)^2\right)-n\left(\dfrac{\sigma^2}{n}+(\beta_0+\beta_1\bar{x})^2\right)$$
$$-\dfrac{1}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\sum_{i=1}^n(x_i-\bar{x})^2\sigma^2-\dfrac{1}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\left[\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})(\beta_0+\beta_1x_i)\right]^2$$
$$=n\sigma^2+\sum_{i=1}^n(\beta_0+\beta_1x_i)^2-\sigma^2-n(\beta_0+\beta_1\bar{x})^2-\sigma^2-\dfrac{1}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\left[\beta_0\sum_{i=1}^n(x_i-\bar{x})+\beta_1\sum_{i=1}^n(x_i-\bar{x})x_i\right]^2$$
$$=\sigma^2(n-2)+\sum_{i=1}^n(\beta_0+\beta_1x_i)^2-n(\beta_0+\beta_1\bar{x})^2-\beta_1^2\sum_{i=1}^n(x_i-\bar{x})^2=\sigma^2(n-2).$$
Therefore,
$$E(QME)=\dfrac{\sigma^2(n-2)}{n-2}=\sigma^2.$$
(unbiased estimator).
Example 1.3.1
For the Motivation 1 example data, obtain estimates for the variance of the estimators $\widehat{\beta_0}$ and $\widehat{\beta_0}$. The QME value was calculated in Example 1.2.2. The values of $\bar{x}²$ and $S _{xx}$ were calculated in Example 1.2.1.
Solution:
$$ \widehat{\hbox{Var}}(\hat{\beta_0}) = \hat{\sigma}^2 \left[ \frac{1}{n} + \frac{\bar{x}^2}{S _{xx}} \right] = QME \left[ \frac{1}{n} + \frac{\bar{x}^2}{S _{xx}} \right] =$$ $$= 2,2866 \left[ \frac{1}{20} + \frac{51756,25}{625} \right] = 189,4732.$$
$$ \widehat{\hbox{Var}}(\hat{\beta_1}) = \frac{\hat{\sigma}^2}{S _{xx}} = \frac{QME}{S _{xx}} = \frac{2,2866}{625} = 0,003658. $$
Using the SoftwareAction we obtain the following results:
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | 364.18 | 13.7649 | 26.4571 | 0 |
| Temperature | -1.032 | 0.0605 | -17.0615 |
Table 4.1.6: Estimates for the variance of the estimators $\widehat{\beta_0}$ and $\widehat{\beta_0}$ (Table of Coefficients)
4.1.4 Tests and Confidence Intervals for Parameters
In linear regression it is important to assess whether there is a good “correlation” between the response and the explanatory variable. For example, increasing the temperature of a part in the oven by five degrees will result in a significant change in the hardness value of the part. To answer this question, we used hypothesis tests and confidence intervals for the parameters. In all these cases, the assumption is made that the errors are independent and identically distributed $N(0,\sigma^2)$. In this way, observations $Y_i$ have distribution $N(\beta_0+\beta_1x_i,\sigma^2)$.
4.1.4.1 Inference for $\bf\beta_0$
It is not often that we make inferences about $\beta_{0}$. This only occurs when the variable x can assume the value $x=0$.
Suppose we wish to test the hypothesis that the intercept is equal to a certain value, denoted by $\beta_{00}$. In this way, the hypotheses
$$ \begin{cases} H_0 : \beta_0 = \beta_{00}, \cr H_1 : \beta_0 \neq \beta_{00}, \end{cases} $$
As seen in “Properties of Estimators”,
$$\hat{\beta_0} \sim N \left( \beta_0 , \sigma^2 \left[ \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^{n} (x_i - \bar{x})^2} \right] \right)$$
So, under $H_0$ we have to
$$N_0=\frac{\widehat{\beta_0} - \beta_{00}}{\sqrt{Var(\widehat{\beta_0})}} \sim N(0,1)$$
Furthermore, be
$$\chi =\dfrac{(n-2)QME}{\sigma^2}~~\sim \chi_{(n-2)}^2.$$
How do random variables $N_0$ and $\chi$ are independent, it follows that
$$ T = \frac{N_0}{\sqrt{\frac{\chi}{n-2}}} = \frac{\hat{\beta_0} - \beta_{00}} {\sqrt{\sigma^2 \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)}} = \frac{\hat{\beta_0} - \beta_{00}} {\sqrt{\frac{(n-2)QME}{\frac{\sigma^2}{n-2}}}} =$$ $$ \frac{\hat{\beta_0} - \beta_{00}} {\sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)}} \sim t_{(n-2)}. $$
i.e. $T$ has Student’s t distribution with n-1 degrees of freedom. Therefore, confidence intervals and tests regarding $\beta_0$ can be done using the t distribution.
In model 1.1, we want to test the hypotheses
$$ \begin{cases} H_0 : \beta_0 = 0 \cr H_1 : \beta_0 \neq 0, \end{cases} $$
Thus, the test statistic is given by
$$ T_0 = \frac{\hat{\beta_0}} {\sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)}} \sim t_{(n-2)}. $$
in which we reject $H_0$ with a confidence level of $(1-\alpha)100\char37$ if $|T_0| > t_{(1-\alpha/2; n-2)}$. The p-value associated with the test is given by
$$P-valor = 2*P(t_{(n-2)} > |T_0|)$$
We reject ${H}_0$ if the p-value is less than the significance level $\alpha$ considered. We generally adopt $\alpha=0,05$.
When we don’t reject ${H}_0$, we can use the Regression Model without Intercept.
The confidence interval for $\beta_0$ with $(1-\alpha)100 \char37$ is given by
$$ IC [\beta_0, (1-\alpha)] = \left[ \hat{\beta_0} - t_{\left(1 - \frac{\alpha}{2};n-2\right)} \sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)} , \hat{\beta_0} + t_{\left(1 - \frac{\alpha}{2};n-2\right)} \sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)} \right] $$
4.1.4.2 Inference for $\bf\beta_1$
Inference about $\beta_1$ is more frequent since through this parameter we have an indication of the existence or not of a linear association between the variables involved.
Similarly to the parameter $\beta_0$, let us consider the hypotheses
$$ \begin{cases} H_0 : \beta_1 = \beta_{10} \cr H_1 : \beta_1 \neq \beta_{10} \end{cases}. $$
in which $\beta_{10}$ is a constant. In general, we consider $\beta_{10}=0$.
Per section 4.4.1.3 Properties of Estimators.
$$\widehat{\beta_1} \sim N \left(\beta_1,\frac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i - \bar{x})^2}\right).$$
So, under $H_0$ it follows that
$$N_1 = \frac{\widehat{\beta_1} - \beta_{10}}{\sqrt{Var(\widehat{\beta_1})}} \sim N(0,1)$$
Again, considering that
$$\chi =\dfrac{(n-2)QME}{\sigma^2} ~~\sim \chi_{(n-2)}^2$$
and that $N_1$ and $\chi$ are independent, we get
$$T = \frac{N_1}{\sqrt{\frac{\chi}{n-2}}} = \frac{\hat{\beta_1} - \beta_{10}} {\sqrt{\frac{\sigma^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}}} = \frac{\hat{\beta_1} - \beta_{10}} {\sqrt{\frac{(n-2)QME}{\frac{\sigma^2}{n-2}}}} =$$ $$\frac{\hat{\beta_1} - \beta_{10}} {\sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}}} \sim t_{(n-2)}.$$
i.e. $T$ has Student’s t distribution with n-2 degrees of freedom. Therefore, confidence intervals and tests regarding $\beta_1$ can be performed using the t distribution.
In the model in question, we want to test the following hypotheses
$$ \begin{cases} H_0 : \beta_1 = 0 \cr H_1 : \beta_1 \neq 0 \end{cases} $$
In this case, the test statistic is $$ T_0 = \frac{\hat{\beta_1}} {\sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}}} \sim t_{(n-2)}. $$
Therefore, we reject $H_0$ with a level of trust $(1 - \alpha)100\char37$ if $|T_0| > t_{(1 - \alpha/2, , n-2)}$.
The p-value associated with the test is given by
$$P-valor=2*P\left( t_{(n-2)}> \mid T_0 \mid \right).$$
We reject $ {H}_0$ if the P-value is less than $\alpha.$
The confidence interval for $\beta_1$ with $(1-\alpha)100\char37$ is given by
$$ IC[\beta_1,(1-\alpha)] = \left[ \hat{\beta_1} - t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}}, \hat{\beta_1} + t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}} \right] $$
Example 1.4.1
Apply hypothesis tests and construct confidence intervals for the parameters ($\beta_0, \ldots ,\beta_1$), using the data from the example in Motivation 1. As seen in Example 1.2.1, the parameter estimates are $\widehat{\beta_0}=364,18$ and $\widehat{\beta_1}= -1,032$.
Solution:
For $\beta_0$, we want to test the hypotheses $$ \begin{cases} H_0 : \beta_0 = 0, \cr H_1 : \beta_0 \neq 0, \end{cases} $$
From Examples 1.2.2 and 1.3.1, we have that
$$QME = 2,2866~~~{ e }~~~\widehat{Var}(\widehat{\beta_0}) = 189,47.$$
In this way, the test statistic is given by
$$ T_0 = \frac{\hat{\beta_0}} {\sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)}} = \frac{364,18}{\sqrt{189,4732}} = 26,46. $$
For $\alpha = 0,05$ we have $t_{(1-0,05/2;18)}=2,101$.
How $T_0=26,46> 2,101 = t_{(1-0,05/2;18)}$, and
$P-valor =2*P\left( t_{(n-2)}> \mid T_0 \mid\right)= 0,000,$ we reject $ {H}_0.$
For $\alpha= 0,05,$ we get that $t_{(1-0,05/2;18)}=2,101$.
The confidence interval, CI (95%), for $\beta_1$ is given by
$$ \left[ \hat{\beta_0} - t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)} ; \hat{\beta_0} + t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{QME \left( \frac{1}{n} + \frac{\bar{x}^2}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2} \right)} \right] $$
$$ [364,18 - 2,101 \sqrt{189,4732} \ ; 364,18 + 2,101 \sqrt{189,4732}] $$
$$ [364,18 - 2,101 \times 13,7649 \ ; 364,18 + 2,101 \times 13,7649] $$
$$ [364,18 - 28,9190 \ ; 364,18 + 28,9190] $$
$$ [335,2609 \ ; 393,0990] $$
For $\beta_1$, we want to test the hypotheses
$$ \begin{cases} H_0 : \beta_1 = 0, \cr H_1 : \beta_1 \neq 0, \end{cases}. $$
Again, from Examples 1.2.2 and 1.3.1, we have
$$ QME = 2,2866 \quad \hbox{e} \quad \widehat{\hbox{Var}}(\hat{\beta_1}) = 0,003658 $$
The test statistics, under (H_0), is given by
$$ T_0 = \frac{\hat{\beta_1}}{\sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}}} = \frac{-1,032}{\sqrt{0,003658}} = \frac{-1,032}{0,0605} = -17,06. $$
For $\alpha = 0,05$, we obtain that $t_{(1 - 0,05/2; 18)} = 2,101$.
How $T_0 = 17,06 > 2,101 = t_{(1 - 0,05/2; 18)}$ and
$$ 2 \times P\left(t_{(n-2)} > |T_0|\right) = 0,000, $$
we reject $H_0$.
The confidence interval, $IC(95\char37)$, for $\beta_1$ is given by
$$ \left[ \hat{\beta_1} - t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}} ; \hat{\beta_1} + t_{\left(1 - \frac{\alpha}{2};, n-2\right)} \sqrt{\frac{QME}{\displaystyle \sum_{i=1}^n (x_i - \bar{x})^2}} \right] $$
$$ [-1,032 - 2,101 \times \sqrt{0,003658} \ ; -1,032 + 2,101 \times \sqrt{0,003658}] $$
$$ [-1,032 - 0,127 \ ; -1,032 + 0,127] $$
$$ [-1,159 \ ; -0,905] $$
Using Software Action we have the following results:
| 2.5 % | 97.5 % | |
|---|---|---|
| Intercept | 335.261 | 393.099 |
| Temperature | -1.1591 | -0.9049 |
Table 4.1.7: Confidence interval for parameters
4.1.5 Variance Analysis
In the case of a simple linear model, in which we have only one explanatory variable, testing the significance of the model corresponds to the following hypothesis test
$$ \begin{cases} H_{0}:\beta_1=0\cr H_{1}:\beta_1 \neq 0. \end{cases}. $$
In the section on testing the model parameters, we use the t-student statistic to perform this hypothesis test. Here, we will introduce analysis of variance (ANOVA) to test the hypothesis ${H}_0$. Furthermore, we will show that the two tests are the same. We assume the “Simple Linear Regression Model” with the assumption that the errors have a Normal distribution.
Analysis of variance is based on the sum of squares decomposition. In other words, the deviation of an observation from the mean can be decomposed as the deviation of the observation from the regression-fitted value plus the deviation of the fitted value from the mean, that is, we can write $(Y_i-\bar{Y})$ how
$$(Y_i-\bar{Y})=(Y_i-\bar{Y}+\widehat{Y}_i-\widehat{Y}_i)=(\widehat{Y}_i-\bar{Y})+(Y_i-\widehat{Y}_i) \tag{1.3.1}.$$
4.1.5.1 Sum of Squares
Squaring each component of (1.3.1) and summing over the entire set of observations, we obtain
$$\sum_{i=1}^n(Y_i-\bar{Y})^{2} = \sum_{i=1}^n(\widehat{Y}_i - \bar{Y})^2 + \sum_{i=1}^n(Y_i-\widehat{Y}_i)^{2},$$
in which
$$\sum_{i=1}^n(Y_i-\bar{Y})^{2}=SQT \qquad \hbox{(é a Soma de Quadrados Total)};$$
$$\sum_{i=1}^n(\widehat{Y}_i-\bar{Y})^2=SQR \qquad \hbox{(é a Soma de Quadrados da Regressão) e}$$
$$\sum_{i=1}^n(Y_i-\widehat{Y}_i)^2=SQE \qquad \hbox{(é a Soma de Quadrados dos Erros (dos Resíduos))}.$$
In this way, we write
$$SQT=SQR+SQE,$$
in which we decompose the Total Sum of Squares into Regression Sum of Squares and Error Sum of Squares.
Proof
$$SQT=\sum_{i=1}^n(Y_i-\bar{Y})^{2}=\sum_{i=1}^n(Y_i-\bar{Y}+\widehat{Y}_i-\widehat{Y}_i)^{2}=\sum_{i=1}^n((Y_i-\widehat{Y}_i)+(\widehat{Y}_i-\bar{Y}))^{2}$$
$$=\sum_{i=1}^n(\widehat{Y}_i-\bar{Y})^{2}+\sum_{i=1}^n2(Y_i-\widehat{Y}_i)(\widehat{Y}_i-\bar{Y})+\sum_{i=1}^n(Y_i-\widehat{Y}_i)^{2}.$$
Let us note that
$$\sum_{i=1}^n2(Y_i-\widehat{Y}_i)(\widehat{Y}_i-\bar{Y})=\sum_{i=1}^n2(Y_i\widehat{Y}_i-Y_i\bar{Y}-\widehat{Y}_i^2+\widehat{Y}_i\bar{Y}).$$
As seen in 1.1.2 Some properties of the least squares fit,
$$\sum_{i=1}^n e_i=\sum_{i=1}^n(Y_i-\widehat{Y}_i)=0\Rightarrow\sum_{i=1}^n Y_i=\sum_{i=1}^n \widehat{Y}_i$$
and
$$\sum_{i=1}^n(\widehat{Y}_ie_i)=\sum_{i=1}^n\widehat{Y}_i(Y_i-\widehat{Y}_i)=0\Rightarrow\sum_{i=1}^n(\widehat{Y}_iY_i)=\sum_{i=1}^n(\widehat{Y}_i^2).$$
In this way,
$$\sum_{i=1}^n2(Y_i\widehat{Y}_i-Y_i\bar{Y}-\widehat{Y}_i^2+\widehat{Y}_i\bar{Y})=2(\sum_{i=1}^n\widehat{Y}_i^2-\bar{Y}\sum_{i=1}^nY_i-\sum_{i=1}^n\widehat{Y}_i^2+\bar{Y}\sum_{i=1}^n\widehat{Y}_i)=$$
$$=2(-\bar{Y}\sum_{i=1}^nY_i+\bar{Y}\sum_{i=1}^n\widehat{Y}_i)=2(-\bar{Y}\sum_{i=1}^nY_i+\bar{Y}\sum_{i=1}^nY_i)=0.$$
and therefore,
$$SQT=\sum_{i=1}^n(Y_i-\bar{Y})^{2}=\sum_{i=1}^n(\widehat{Y}_i-\bar{Y})^{2}+\sum_{i=1}^n(Y_i-\widehat{Y}_i)^{2}=SQR+SQE$$
As we demonstrated in the property of estimators section, when we take the pairs $\lbrace(x_i,y_i):i=1,\cdots ,n\rbrace$, we have to $SQT=S_{yy}$ and $SQE=S_{yy}-\hat{\beta_1}S_{xy}$. Therefore, we conclude that $SQR=\hat{\beta_1}S_{xy}$.
4.1.5.2 Partition of Degrees of Freedom
Just as we have the total sum of squares decomposition, we will derive a decomposition for the degrees of freedom. It is important to emphasize that degrees of freedom are defined as the constant that multiplies $\sigma^2$ to define the expected value of the sum of squares. As demonstrated in the estimator properties section, we have that $\mathbb{E} [SQE]=(n-2)\sigma^2$. Thus, the degrees of freedom related to the $SQE$ is given by $n-2$.
Now, under ${H}_0: \beta_1=0$, we have to $Y_1, \cdots , Y_n$ is a simple random sample from a population with mean $\beta_0$ and variance $\sigma^2$. As demonstrated in the inference module on general properties of estimators, we have $\mathbb{E} [SQT]=(n-1)\sigma^2$. Then, as the total sum of squares was decomposed into the sum of squares of the errors plus the sum of squares of the regression, we conclude that under ${H}_0$, $$\mathbb{E}[SQR]=\mathbb{E}[SQT]-\mathbb{E}[SQE]=(n-1)\sigma^2+(n-2)\sigma^2=\sigma^2.$$ With this, we conclude that the $SQR$ has a degree of freedom. So, under ${H}_0$, we obtain the following decomposition of degrees of freedom:
(1) $SQT$ has $n-1$ degrees of freedom;
(2) $SQR$ has $1$ degree of freedom;
(3) $SQE$ has $n-2$ degrees of freedom.
In general, not necessarily under ${H}_0$, we can also easily calculate the expected value of the total sum of squares. For this, we have to
$$SQT=\sum_{i=1}^n(Y_i-\bar{Y})^2=\sum_{i=1}^nY_{i}^2-n(\bar{Y})^2$$
From the definition of variance of a random variable, we conclude that
$$\mathbb{E}(Y_{i}^2) = Var(Y_{i}) + (\mathbb{E}(Y_{i}))^2 = \sigma ^2 + (\beta_0 + \beta_1 x_{i})^2$$
In the same way, we have to $$\mathbb{E}(\bar{Y^2}) = Var(\bar{Y}) + (\mathbb{E}(\bar{Y}))^2 = \frac{\sigma^2}{n} + (\beta_0 + \beta_1\bar{x})^2$$
Therefore, we obtain that $$\mathbb{E}(SQT) = (n-1)\sigma^2 + \sum_{i=1}^{n}(\beta_0 + \beta_1 x_{i})^2 - n (\beta_0 + \beta_1 \bar{x})^2$$
Note that under ${H}_0$, we obtain that $\mathbb{E}[SQT]=(n-1)\sigma^2$. On the other hand, the expected value of the mean square of the regression is given by
$$\mathbb{E}(SQR) = (n-1)\sigma^2 + \sum_{i=1}^{n}(\beta_0 + \beta_1 x_{i})^2 - n (\beta_0 + \beta_1 \bar{x})^2-(n-2)\sigma^2 =$$
$$\sigma^2 + \sum_{i=1}^{n}(\beta_0 + \beta_1 x_{i})^2 - n (\beta_0 + \beta_1 \bar{x})^2 =$$
$$ \sigma^2 + \beta_1^2 S _{xx}$$
4.1.5.3 Mean Square
The basic idea of the mean square is to make the sums of squares comparable. We know that under ${H}_0$, the degrees of freedom are constants that have been multiplying the $\sigma^2$ in calculating the expected value of the sum of squares. From the partition of degrees of freedom obtained in the previous section, moment estimators for $\sigma^2$ are given by dividing the sum of squares by their respective degree of freedom. With this, we arrive at the definition of mean squares:
$$QMR=\dfrac{SQR}{1}=SQR=\sum_{i=1}^n(\widehat{Y}_i-\bar{Y})^2 \qquad \hbox{(é o Quadrado Médio da Regressão) e}$$
$$QME=\dfrac{SQE}{n-2}=\dfrac{\displaystyle\sum\limits_{i=1}^n(Y_i-\widehat{Y}_i)^2}{n-2} \qquad \hbox{(é o Quadrado Médio dos Erros (dos Resíduos))}$$
Under $H_0$, both the mean square of errors (QME) and the mean square of regression (QMR) are moment estimators for $\sigma^2$. Therefore, they are comparable. Below, we present some simplified ways to calculate the sums of squares. As seen in 1.3 Properties of Estimators,
$$SQE=\sum_{i=1}^n(Y_i-\bar{Y})^2-\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_i=S_{YY}-\widehat{\beta_1}S_{xY}$$
Furthermore,
$$SQT=\sum_{i=1}^n(Y_i-\bar{Y})^2=S_{YY}$$
In this way,
$$SQR=SQT-SQE=\sum_{i=1}^n(Y_i-\bar{Y})^2-\left(\sum_{i=1}^n(Y_i-\bar{Y})^2-\widehat{\beta}_ 1\sum_{i=1}^n(x_i-\bar{x})Y_i\right)=\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_i=\widehat{\beta_1}S_{xY}$$
and therefore,
$$QMR=\widehat{\beta_1}\sum_{i=1}^n(x_i-\bar{x})Y_i~~{e}$$
$$QME=\dfrac{\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2-\widehat{\beta_1}\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i}{n-2}$$
4.1.5.4 F-Test
Considering the Simple Linear Regression Model, the significance of the linear model can be assessed through the following hypothesis test
$$ \begin{cases} H_{0}:\beta_1=0\cr H_{1}:\beta_1 \neq 0 \end{cases}. $$
If we don’t reject $H_0$, we conclude that there is no significant linear relationship between the explanatory variables ($x$) and dependent ($Y$). The strategy for testing the hypothesis $H_0$ consists of comparing the mean square of the regression with the mean square of the errors, since under $H_0$, both mean squares are moment estimators for the parameter $\sigma^2$. For this we need Cochran’s theorem.
Cochran’s theorem
Be $Z_1, Z_2,…,Z_n$ independent random variables with distribution $N(0,1)$. According to the demonstration in the section on the Chi Square distribution, we know that $\sum_{(i=1)}^p Z_{i}^{2}$ and has distribution $\chi_{(p)}^{2}$.
If we have
$$\sum_{i=1}^{p}Z_{i}^{2}=Q_1 + Q_2 + … + Q_q$$
in which $Q_i~,~i = 1, 2,…,q~~(q \leq p)$ are sums of squares, each with $p_i$ degrees of freedom, such that
$$p=\sum^{q}_{i=1}p_i$$
then we obtain that $Q_i\sim \sigma^2\chi^{2}_{(p_i)}$ and are independent of any $i=1, 2,…, q$.
Under ${H}_0,$ we have to $Y_1,\cdots ,Y_n$ is a simple random sample from $N(\beta_0,\sigma^2)$. With this, we obtain from the section that addresses the properties of the mean and variance estimators of a normal population, which
$$\chi_T=\dfrac{SQT}{\sigma^2}\sim\chi_{(n-1)}^2$$
Thus, using Cochran’s theorem, we conclude that
$$\chi_E=\dfrac{SQE}{\sigma^2}\sim\chi_{(n-2)}^2, { e}$$
$$\chi_R=\dfrac{SQR}{\sigma^2}\sim\chi_{(1)}^2$$
has a chi-square distribution with $n-2$ and $1$ degrees of freedom, respectively. Furthermore, we have to $\chi_E$ and $\chi_R$ are independent. In this way, we propose the test statistic
$$F_0=\dfrac{\dfrac{\chi_R}{1}}{\dfrac{\chi_E}{n-2}}=\dfrac{\dfrac{SQR}{\sigma^2}}{\dfrac{SQE}{(n-2)\sigma^2}} = \dfrac{QMR}{QME}$$
How $F_0$ is the division of two chi-square variables, each divided by its degrees of freedom and are independent, it follows that $F_0$ has an F distribution with $1$ degree of freedom in the numerator and $n-2$ degrees of freedom in the denominator, denoted by $F_{(1,n-2)}$. Through the partition of the degrees of freedom obtained in section 4.1.5.2, we obtain that
$$\mathbb{E}[QME]=\sigma^2 \quad {e} \quad \mathbb{E}[QMR]=\sigma^2+\beta^2_1S _{xx}$$
These expected values suggest that large values of $F_0$ tell us that $\beta_1$ must be nonzero, that is, we must reject $H_0$. Therefore, we reject $H_0$ with a level of significance $\alpha$ if $F_0 > F_{(1-\alpha,1,n-2)}$, in which $F_{(1-\alpha,1,n-2)}$ represents the quantile $(1-\alpha)$ of distribution $F(1,n-1)$. Another way is to analyze the p_value. In this case, we reject $H_0$ if $\hbox{p-valor}=P[F_{(1;n-2)} > F_0]<\alpha$, in which $\alpha$ is the significance level established for the test.
In Table 4.1.8 below we present the ANOVA table with the F Test Statistics.
| Source | GL | Sum of Squares | Medium Square | $F_0$ |
|---|---|---|---|---|
| Regression | 1 | $SQR=\widehat{\beta_1}\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i$ | $QMR=SQR$ | $F_0=\dfrac{QMR}{QME}$ |
| Waste | $n−2$ | $SQE=\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2 - \widehat{\beta_1} \displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i$ | $QME=\displaystyle{\dfrac{SQE}{(n-2)}}$ | |
| Total | $n−1$ | $SQT=\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2$ |
Table 4.1.8: Significance analysis using ANOVA
Example 1.5.1
Build the ANOVA table for the example given in Motivation 1.
Solution:
$$SQT=S_{yy}=706,80$$
$$SQE= S_{yy}-\widehat{\beta_1} S_{xy}=41,16 \quad e$$
$$SQR= SQT - SQE = 706,80 - 41,16 = 665,64$$ So,
$$F_0=\dfrac{QMR}{QME}=\dfrac{\dfrac{665,64}{1}}{\dfrac{41,16}{18}}=\dfrac{665,64}{2,29}=291,10.$$
The ANOVA table is then given by
| Source | GL | Sum of Squares | Medium Square | $F_{0}$ |
|---|---|---|---|---|
| Regression | 1 | 665,64 | $\dfrac{665,64}{1}=665,64$ | $\dfrac{665,64}{2,29}=291,10$ |
| Waste | 18 | 41,16 | $\dfrac{41,16}{18}=2,29$ | |
| Total | 19 | 706,80 |
Table 4.1.9: Significance analysis using ANOVA
For $\alpha=0,05$, we obtain that $F_{(0,95;1;18)}=4,4138.$
Then,
$$F_0=291,1> 4,4138=F_{(0,95;1;18)}$$
Furthermore,
$${P_valor}=P[F_{1;18}> F_0]=0,000< 0,05=\alpha.$$
Therefore, we reject ${H}_0$ with a confidence level of 95% and we conclude that the explanatory variable is correlated with the response variable.
Interpretation of P-value
When the p-value is approximately zero it means that if the null hypothesis $(\hbox{H}_0)$ is true, the chance of $F$ exceed the observed value $(\hbox{F}_0)$ is practically zero. This is very strong evidence against $\hbox{H}_0.$ A small p-value provides evidence against $\hbox{H}_0.$ For example, if we set a significance level ($\alpha$), then we can say that a null hypothesis is rejected at this level, when the p-value is smaller than this $\alpha$.
4.1.6 Coefficient of Determination
One of the ways to evaluate the quality of the model fit is through the coefficient of determination. Basically, this coefficient indicates how much the model was able to explain the data collected. The coefficient of determination is given by the expression
$$R^2=\dfrac{SQR}{SQT}=1-\dfrac{SQE}{SQT}=\dfrac{\widehat\beta_1\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i}{\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2},$$
that is, it is the ratio between the regression sum of squares and the total sum of squares. In the intercept model, we can write
$$ R^2=\dfrac{\widehat{\beta_1}\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i}{\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2}=\dfrac{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2}=\dfrac{\left(\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})Y_i\right)^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2\displaystyle\sum\limits_{i=1}^n(Y_i-\bar{Y})^2}. $$
Let us note that
$$0 \leq R^2 \leq 1$$
O $R^2$ it is, therefore, a descriptive measure of the quality of the fit obtained. In general we refer to the $R^2$ as the amount of variability in the data that is explained by the fitted regression model. However, the value of the coefficient of determination depends on the number of observations $(n)$, tending to grow when $n$ decreases. Se $n = 2$, there is always $R^2 = 1.$
O $R^2$ should be used with caution, as it is always possible to make it larger by adding a sufficient number of terms to the model. Thus, if, for example, there is no repeated data (more than one value $y$ for the same $x$) a polynomial of degree $(n - 1)$ will give a perfect fit $(R^2 = 1)$ for $n$ data. When there are repeated values, the $R^2$ will never be equal to 1, as the model will not be able to explain the variability due to pure error.
Although $R^2$ increases with the addition of terms to the model, this does not necessarily mean that the new model is superior to the previous one. Unless the new model’s residual sum of squares is reduced by an amount equal to the original mean square residual, the new model will have a larger mean square residual than the original, due to the loss of 1 degree of freedom. In reality, this new model could be worse than the previous one.
The magnitude of $R^2$, also, depends on the amplitude of variation of the regressor variable ($x$). Generally, $R^2$ will increase with greater amplitude of variation of $x$’s and will decrease otherwise. It can be shown that
$$E[R^2]\cong \dfrac{\widehat{\beta}^2_1 \displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}{\widehat{\beta_1}^2\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2+\sigma^2}.$$
Thus, a large value of $R^2$ may be great simply because $x$ varied over a very large range. On the other hand $R^2$ may be small because the amplitude of the $x$’s was too small to allow a relationship with $y$ was detected. In general, too, $R^2$ does not measure the magnitude of the slope of the line. A large value of $R^2$ does not mean a steeper straight line. Furthermore, it does not take into account the lack of model fit; it could be big, even if $y$ and $x$ are non-linearly related. In this way, it is seen that $R^2$ It should not be considered alone, but always combined with other diagnoses of the model.
Example 1.6.1
Let’s calculate the coefficient of determination $R^2$ with the data from the example in Motivation 1.
Solution:
$$R^2=\dfrac{(S_{xy})^2}{S _{xx}S_{yy}}=\dfrac{(-645)^2}{625*706,8}=\dfrac{416025}{441750}=0,9417.$$
4.1.6.1 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 2 coefficients as
$$R^2_a=1-\left(\frac{n-1}{n-2}\right)(1-R^2).$$
Just like the Coefficient of Determination $R^2$, the greater $R_a^2$, but the response variable is explained by the regressor $X$.
Example 1.6.1.1
Now let’s calculate the coefficient of determination $R^2_a$ with the data from the example in Motivation 1.
Solution:
$$R_a^2=1-\left(\dfrac{19}{18}\right)(1-0,9417)=0,93846.$$
Using the Action software we have the following results:
| Standard Deviation of Residues | Degrees of Freedom | $R^2$ | $R^2$ Adjusted |
|---|---|---|---|
| 1.5122 | 18 | 0.9418 | 0.9385 |
Table 4.1.10: Descriptive Measure of Quality of Fit
4.1.7 Confidence Interval for Mean Response and Prediction
4.1.7.1 Confidence interval for the mean response
Estimating a confidence interval for $E\left(Y \mid X=x_0 \right)=\mu _{Y \mid x_0}= \beta_0+\beta_1 x_0$ is of great interest.
A point estimator of $\mu _{Y \mid x_0}$ can be obtained from the fitted model, i.e.
$$\widehat{\mu} _{Y \mid x_0}=\widehat{\beta_0}+\widehat{\beta_1} x_0=\widehat{Y}(x_0).$$
Let us note that $\widehat{\mu} _{Y \mid x_0}$ is a normally distributed random variable as it is a linear combination of observations $Y_i$. Furthermore, we have to
$$ E(\widehat{\mu} _{Y \mid x_0}) = \beta_0+\beta_1 x_0 = \mu _{Y \mid x_0} \ \hbox{ , e}$$
$$ \hbox{Var}(\widehat{\mu} _{Y\mid x_0}) = \hbox{Var}[\bar{Y}+\widehat{\beta_1}(x_0-\bar{x})]= \hbox{Var}[\bar{Y}] + \hbox{Var}[\widehat{\beta} _1 (x_0-\bar{x})]=\dfrac{\sigma^2}{n}+(x_0-\bar{x})^2 \dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n (x_i-\bar{x})^2}$$
$$=\sigma^2\left[\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right]$$
i.e. $\widehat{\mu} _{Y \mid x_0}$ is an unbiased estimator for $E\left( Y \mid X=x_0 \right).$
So, we have to
$$\dfrac{\widehat{Y}(x_0)-\mu _{Y \mid x_0}}{\sqrt{\sigma^2\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}}\sim N(0,1)$$
We also have to
$$\dfrac{(n-2)QME}{\sigma^2}\sim \chi_{(n-2)}^2$$
Then,
$$t=\dfrac{N(0,1)}{\sqrt{\dfrac{\chi_{(n-2)}^2}{(n-2)}}}=\dfrac{\dfrac{\widehat{Y}(x_0)-\mu _{Y \mid x_0}}{\sqrt{\sigma^2\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}}}{\sqrt{\dfrac{\dfrac{(n-2)QME}{\sigma^2}}{(n-2)}}}=\dfrac{\left[\widehat{Y}(x_0)-\mu _{Y \mid x_0}\right]}{{\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}}}~~\sim t_{(n-2)}$$
Therefore, the confidence interval for $\mu _{Y \mid x_0}=E[Y \mid X=x_0]$ is given by
$$IC [\mu _{Y \mid x_0} , 1 - \alpha] = \left[\widehat{Y}(x_0)-t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}\right.~;$$
$$\left.\widehat{Y}(x_0)+t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}\right]$$
in which $\widehat{Y}(x_0)$ is the estimated average response for the level $x=x_0.$
Considering various values for $x_0$ Within the range of realization of the data, we will find several values for $\widehat{Y}(x_0).$ Therefore, when calculating the confidence interval for each of the $\widehat{Y}(x_0)$, we have a set of confidence intervals that represent the confidence bands for the regression line.
Example 1.7.1
Calculate the confidence interval for the regression line using, again, the data from the example in Motivation 1.
Solution:
Let us adopt $x_0=220,$ that is, a value belonging to the sample. In this case,
$$ \hbox{Limite Inferior:}\left[ \widehat{\beta_0}+\widehat{\beta_1} x_0 - t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}\right]$$
$$\left[364,18(-1,032*220)-t_{\left(0,975;18\right)}*\sqrt{2,29\left(\dfrac{1}{20}+\dfrac{(220-227,5)^2}{625}\right)}\right]$$
$$\left[364,18 (-227,04)-2,101*\sqrt{2,29(0,14)}\right]$$
$$\left[137,14-2,101*0,5658 \right]$$
$$\left[137,14-1,1887\right]$$
$$\left[135,9513\right]$$
$$\hbox{Limite Superior:}\left[\widehat{\beta_0}+\widehat{\beta_1} x_0+t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}\right]$$
$$\left[364,18(-1,032*220)+t_{(0,975;18)}*\sqrt{2,29\left(\dfrac{1}{20}+\dfrac{(220-227,5)^2}{625}\right)}\right]$$
$$\left[364,18(-227,04)+2,101*\sqrt{2,29(0,14)}\right]$$
$$\left[137,14+2,101*0,5658\right]$$
$$\left[137,14+1,1887\right]$$
$$\left[138,3287\right]$$
Therefore the confidence interval for the mean response is
$$IC [\mu _{Y \mid x_0} , 95\char37] = [135,9513; 138,3287]$$
4.1.7.2 Prediction interval
A regression model can be used to predict the response variable, corresponding to values of the explanatory variable not considered in the experiment. We call prediction the obtaining of a value of $Y$ for one $x$ which does not belong to the data, but belongs to the range of variation studied. In situations where the value of $x$ does not belong to the studied range, we call it extrapolation.
Be $x_h$ a given value of the explanatory variable $x$ that does not belong to the sample. So,
$$\widehat{Y_h} = \widehat{\beta_0} + \widehat{\beta_1} x_h,$$
is an unbiased estimator for $Y_h = E [Y \mid x_h]=\beta_0+\beta_1 x_h,$ because $E(Y_h-\widehat{Y_h})=0$.
We call the difference in prediction error $(Y_h-\widehat{Y_h}),$ whose variance is given by
$$ Var (Y_h - \widehat{Y_h}) = Var(Y_h) + Var( \widehat{Y_h} ) - 2 Cov (Y_h , \widehat{Y_h}) = $$
$$ \sigma^2 + \sigma^2\left(\dfrac{1}{n} + \dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2} \right) = \sigma^2\left(1+\dfrac{1}{n}+\dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)$$
In a similar way to that performed in Confidence interval for the mean response, we can demonstrate that
$$T = \dfrac{Y_h - \widehat{Y_h}}{\sqrt{QME \left( 1 + \dfrac{1}{n} + \dfrac{(x_h - \overline{x})^2}{\displaystyle\sum\limits_{i=1}^n (x_i-\bar{x})^2} \right)}} \sim t_{(n-2)}.$$
Therefore, the prediction interval for $Y_h$ is,
$$ IP[Y_h, 1-\alpha] = \left[\widehat{Y_h}-t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(1+\dfrac{1}{n}+\dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)} \right.~;$$ $$\left. \widehat{Y_h}+t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(1+\dfrac{1}{n}+\dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)} \right].$$
Example 1.7.2
Calculate the confidence interval for a new observation applying the same example as Motivation 1.
Solution:
Let’s use $x_h=217,5,$ that is, a value that does not belong to the sample but that belongs to the range of variation studied.
We have from Example 1.2.1 that $\widehat{\beta_0}=364,18$ and $\widehat{\beta_1}=-1,032.$ So,
$$\widehat{Y}(x_h) = 364,18-1,032*217,5 = 139,72.$$
Therefore, the prediction interval is
$$\left[\widehat{Y_h}-t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(1+\dfrac{1}{n}+\dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)} \ ; \ \widehat{Y_h}+t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(1+\dfrac{1}{n}+\dfrac{(x_h-\bar{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\bar{x})^2}\right)}\right]$$
$$\left[139,72-t_{(0,975;18)}\sqrt{2,29*\left(1+\dfrac{1}{20}+\dfrac{(217,5-227,5)^2}{625}\right)} \ ; \ 139,72 + t_{(0,975;18)}\sqrt{2,29*\left(1+\dfrac{1}{20}+\dfrac{(217,5-227,5)^2}{625}\right)}\right]$$
$$\left[139,72-2,101*\sqrt{2,29*(1+0,05+0,16)} \ ; \ 139,72+2,101*\sqrt{2,29*(1+0,05+0,16)}\right]$$
$$ [139,72-2,101*\sqrt{2,7668} \ ; \ 139,72+2,101*\sqrt{2,7668}] $$
$$\left[139,72-3,4946 \ ; \ 139,72+3,4946\right]$$
So,
$$IP[Y_h, 95\char37] = \left[136,2253 \ ; \ 143,2147\right]$$
Using the Action software we have the following results:
- Prediction 95% confidence interval:
| Hardness | Temperature | Adjusted Value | Lower Limit | Upper Limit | Standard Deviation | |
|---|---|---|---|---|---|---|
| 1 | 137 | 220 | 137.14 | 135.9513 | 138.3287 | 0.5658 |
| 2 | 137 | 220 | 137.14 | 135.9513 | 138.3287 | 0.5658 |
| 3 | 137 | 220 | 137.14 | 135.9513 | 138.3287 | 0.5658 |
| 4 | 136 | 220 | 137.14 | 135.9513 | 138.3287 | 0.5658 |
| 5 | 135 | 220 | 137.14 | 135.9513 | 138.3287 | 0.5658 |
| 6 | 135 | 225 | 131.98 | 131.2018 | 132.7582 | 0.3704 |
| 7 | 133 | 225 | 131.98 | 131.2018 | 132.7582 | 0.3704 |
| 8 | 132 | 225 | 131.98 | 131.2018 | 132.7582 | 0.3704 |
| 9 | 133 | 225 | 131.98 | 131.2018 | 132.7582 | 0.3704 |
| 10 | 133 | 225 | 131.98 | 131.2018 | 132.7582 | 0.3704 |
| 11 | 128 | 230 | 126.82 | 126.0418 | 127.5982 | 0.3704 |
| 12 | 124 | 230 | 126.82 | 126.0418 | 127.5982 | 0.3704 |
| 13 | 126 | 230 | 126.82 | 126.0418 | 127.5982 | 0.3704 |
| 14 | 129 | 230 | 126.82 | 126.0418 | 127.5982 | 0.3704 |
| 15 | 126 | 230 | 126.82 | 126.0418 | 127.5982 | 0.3704 |
| 16 | 122 | 235 | 121.66 | 120.4713 | 122.8487 | 0.5658 |
| 17 | 122 | 235 | 121.66 | 120.4713 | 122.8487 | 0.5658 |
| 18 | 122 | 235 | 121.66 | 120.4713 | 122.8487 | 0.5658 |
| 19 | 119 | 235 | 121.66 | 120.4713 | 122.8487 | 0.5658 |
| 20 | 122 | 235 | 121.66 | 120.4713 | 122.8487 | 0.5658 |
Table 4.1.11: Prediction Interval Result
4.1.8 Regression Model without Intercept
Suppose we have $n$ pairs of observations $(x_i, y_i),$ $i=1,\ldots,n.$ The simple linear regression model, without intercept, is defined by
$$Y_i =\beta_1 x_i + \varepsilon_i, \quad i=1,\ldots, n.$$
In this case, the least squares function is
$$L=\sum_{i=1}^n\varepsilon^2_i=\sum_{i=1}^n(Y_i-\beta_1x_i)^2$$
which deriving with respect to $\beta_1$ results in
$$\dfrac{\partial L(\beta_1)}{\partial \beta_1}=2\sum_{i=1}^n(Y_i-\beta_1 x_i)(-x_i)$$
Replacing $\beta_1$ by $\widehat\beta_1$ and equating it to zero, we obtain
$$\sum_{i=1}^n(Y_i -\widehat{\beta_1}x_i)(x_i)=\sum_{i=1}^n x_iY_i -\widehat{\beta_1}\sum_{i=1}^n x_i^2=0$$
that resolving in relation to $\widehat{\beta_1}$ results in
$$\widehat{\beta_1} = \dfrac{\sum\limits_{i=1}^n x_i Y_i}{\sum\limits_{i=1}^n x_i^2}$$
We can show that
$$E(\widehat{\beta_1})=\beta_1 $$ and that $$ Var(\widehat{\beta_1})=\dfrac{\sigma^2}{\sum\limits_{i=1}^n x_i^2} $$
Being $\varepsilon_i \sim N(0, \sigma^2),$ we have to
i) $\dfrac{\widehat{\beta_1} - \beta_1}{\sqrt{\dfrac{\sigma^2}{\sum\limits_{i=1}^n x_i^2}}} \sim N(0, 1);$
ii) An unbiased estimator for $\sigma^2$ is given by
$$\widehat{\sigma}^2 = \frac{SQE}{n - 1};$$
iii) $\dfrac{(n-1)\widehat{\sigma}^2}{\sigma^2} \sim \chi_{(n-1)}^2;$
iv) $T = \dfrac{\widehat{\beta_1} - \beta_1}{\sqrt{\dfrac{\widehat{\sigma}^2}{\sum\limits_{i=1}^n x_i^2}}} \sim t_{(n-1)}.$
A range of $100(1-\alpha)\char37$ trustworthy for $\beta_1$ is given by
$$IC[\beta_1, 1-\alpha] = \left[\widehat{\beta}_1 - t_{\left(\frac{\alpha}{2}, n - 1\right)} \sqrt{\dfrac{\widehat{\sigma}^2}{\sum\limits_{i=1}^n x_i^2}}~~;~~\widehat{\beta}_1 + t_{\left(\frac{\alpha}{2}, n - 1\right)}\sqrt{\dfrac{\widehat{\sigma}^2}{\sum\limits_{i=1}^n x_i^2}}\right]$$
A range of $100(1-\alpha)\char37$ confidence for the average response in $X=x_0$ is given by
$$IC[\mu _{Y\mid x_0}, 1-\alpha] = \left[ \widehat{\mu} _{Y\mid x_0} - t_{\left(\frac{\alpha}{2},n-1\right)}\sqrt{\dfrac{\widehat{\sigma}^2 x_0^2}{\sum\limits_{i=1}^n x_i^2}} \ ; \ \widehat{\mu} _{Y\mid x_0} + t_{\left(\frac{\alpha}{2},n-1\right)}\sqrt{\dfrac{\widehat{\sigma}^2 x_0^2}{\sum\limits_{i=1}^n x_i^2}} \right] ,$$
in which $\widehat{\mu}_{Y\mid x_0} = \widehat{\beta_1}x_0.$
A range of $100(1-\alpha)\char37$ reliable for predicting $Y_h$ given $X=x_h$ is
$$IC[Y_h, 1-\alpha] = \left[\widehat{Y} _{h}-t_{\left(\frac{\alpha}{2},n-1\right)}\sqrt{\widehat{\sigma}^2+\dfrac{\widehat{\sigma}^2 x_0}{\sum\limits_{i=1}^n x_i^2}} \ ; \ \widehat{Y} _{h}+t_{\left(\frac{\alpha}{2},n-1\right)}\sqrt{\widehat{\sigma}^2+\dfrac{\widehat{\sigma}^2 x_0}{\sum\limits_{i=1}^n x_i^2}}\right],$$
in which $\widehat{Y}_{h} = \widehat{\beta_1} x_h.$
Example 1.8.1
Returning to Motivation 1, in which we wanted to determine the temperature values in $^{\circ}\mathrm{C}$ that optimize the hardness of the material, let us calculate the estimated $\beta_1$ considering the model without intercept.
We have to estimate $\beta_1$ of the model without intercept is
$$\widehat{\beta_1} = \dfrac{\sum\limits_{i=1}^n x_i Y_i}{\sum\limits_{i=1}^n x_i^2}=\dfrac{588125}{1035750}=0,567$$
Using the SoftwareAction we have the following results:
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Temperature | 1 | 333952.2236 | 333952.2236 | 3864.7726 | 0 |
| Waste | 19 | 1641.7764 | 86.4093 |
Table 4.1.12: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -14.4389 | -10.2292 | 1.3198 | 0.2198 | 9.3687 | 12.0784 |
Table 4.1.13: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Temperature | 0.5678 | 0.0091 | 62.1673 |
Table 4.1.14: Coefficients
| Standard Deviation of Residues | Degrees of Freedom | $R^2$ | $R^2$ Adjusted |
|---|---|---|---|
| 9.2957 | 19 | 0.9961 | 0.9949 |
Table 4.1.15: Descriptive Measure of Quality of Fit
4.1.9 Analysis of Residuals in Simple Linear Regression
Residual Analysis consists of a set of techniques to investigate the suitability of the model based on residuals
$$e_i=\widehat{\epsilon_i}=Y_i-\widehat{Y}_i.$$
The basic idea is that if the simple linear model is appropriate, the residuals must reflect the assumptions described in Section 4.4.1.1, such as independence, constant variance for different levels of X, and Normal distribution.
In Section 3 are the main techniques used to verify the residual assumptions, which must be analyzed so that the adjusted model really makes sense.
4.1.10 Calibration Curve
Calibration is a comparison process, for example in metrology, the comparison of equipment that we wish to calibrate with a standard, which can be another equipment (standard) or some standard material. In the chemical area, comparison can be made using measurements obtained from a material called Certified Reference Material (MRC), as an example we can mention international certified materials (ISO GUIDE). We consider that each amount of reference material used is the same, at least with respect to the properties of the analyte.
The calibration curve is a functional relationship of the observed signal (y) given a certain amount of analyte. In general, we use simple linear regression (for more details see the content simple linear regression) to estimate the uncertainty due to the calibration curve (for more details on what uncertainty is see the content 18. Measurement uncertainty).
According to INMETRO’s method validation guidance document (DOQ-CGCRE-008), the method is more sensitive when small variations in concentration result in greater variation in response (angular coefficient $\beta_1$). In general, several concentration levels (at least five) are necessary to construct the calibration curve and the number of replicates at each concentration level should be as close as possible to that used in laboratory routine. Every working range determination experiment is initiated by choosing a preliminary range, in which the working range must cover the application range for which the test will be used. The guidance according to DOQ-CGCRE-008 is that the most expected concentration of the sample should, whenever possible, be located in the center of the working range. At the lower limit of the concentration range, the limiting factor is the value of the quantification limit, while at the upper limit, the limiting factors depend on the response system of the measuring equipment.
Most applications of the calibration curve are that in practice, we are interested in predicting the value of (X) given an observation (Y), to illustrate the problem observe the following application.
Motivation 2
Consider the calibration curve of a chemical compound carried out by equipment called an Optical Emission Spectrometer (ICP). Below we present the data set:
| Concentration | Area |
|---|---|
| 0,05 | 0,00000405 |
| 0,05 | 0,00000312 |
| 0,05 | 0,00000211 |
| 0,1 | 0,0000286 |
| 0,1 | 0,0000238 |
| 0,1 | 0,0000308 |
| 0,5 | 0,0001913 |
| 0,5 | 0,0001936 |
| 0,5 | 0,0002006 |
| 1 | 0,0004883 |
| 1 | 0,0004761 |
| 1 | 0,0004851 |
| 2 | 0,0009072 |
| 2 | 0,0009246 |
| 2 | 0,0009008 |
Table 4.1.16: Motivation 2 dataset
We noticed through this application that in practice we are interested in predicting the concentration value (X) given an observation in area (Y). In this case, we are dealing with an inverse regression problem, in which we predict inversely. The main difference from the classic linear regression model is in the prediction of concentration $x_0$ and in calculating the variance $(Var[x_0])$. Furthermore, we have specific standards for dealing with calibration curves.
The Ministry of Agriculture, Livestock and Supply (MAPA) published in the Official Gazette of the Union on 07/22/2009 the normative instruction for dealing with calibration curves. Annex II section 7.1 presents the minimum procedures required as objective evidence of validation of the analytical method, they are:
7.1.1.1. The calibration/response curve must be obtained from 5 concentration levels, equidistantly distributed (0.0 - 0.5 - 1.0 - 1.5 - 2.0 times the maximum residue limit [MRL] / minimum required performance limit [LMDR]).
7.1.1.2. Each point on the curve must be tested in at least six replicates.
7.1.1.3. Three types of calibration/response curves must be prepared:
i. Calibration standards in solution.
ii. White matrix fortified with calibration standards.
iii. White matrix extract fortified with calibration standards.
7.1.1.4. Replicates at each concentration level must be independent or genuine repeats, not just read repeats.
7.1.1.5. Measurements must be taken in random order, taking due care to avoid cross-contamination.
7.1.1.6. Calibration curves must not be forced through the origin.
7.1.1.7. Profile suggesting heteroskedasticity means that the calibration data is better if treated by weighted regression.
7.1.1.8. The acceptance ranges of the curve parameters, linear working range, must include the LMR or LMDR values.
7.1.1.9. When determining other validation parameters (repeatability, reproducibility), as well as in analytical routines, the 5 points of the response curve must be tested in at least three replicates each.
The item 7.1.1.10 deals with the assessment of linearity and this assessment is described in the content simple linear regression. From subitem ii onwards, the content is described in the waste analysis section. In the other sections of this content we will apply the concepts of simple linear regression and perform a diagnostic analysis through residual analysis.
4.1.10.1 Statistical Model for Calibration Curve
In this section we will describe the statistical model for motivation, for this it is reasonable to assume that the relationship between the variable Area (Y) and levels of Concentration (X) is linear. In this way, we define the following simple linear regression model between Y (response variable) and X (regressor variable).
We consider two variables Concentration and Area, in this case, we can establish a simple linear regression whose statistical model is
$$Y_{ij}=\beta_0+\beta_1~x_{i}+\varepsilon_{ij}\quad i=1,\cdots, n;$$
in which,
-
$Y_{ij}$: represents the j-th area measurement referring to the ith concentration;
-
$X_{i}$: represents the i-th concentration;
-
$\beta_0$: represents the linear coefficient or intercept;
-
$\beta_1$: represents the angular coefficient;
-
$\varepsilon_{ij}$: represents the jth error made when measuring the ith area. We consider that the $\varepsilon_{ij}$ are independent and identically distributed with distribution $N(0,\sigma^2)$ .
Using the least squares method, we obtain
$$\hat{\beta_1}=\frac{S_{xy}}{S _{xx}}\quad e\quad\hat{\beta_0}=\overline{y}-\hat{\beta_1}\overline{x}$$
in which,
-
$S _{xx}=\displaystyle\sum^n_{i=1}(x_i-\overline{x})^2=\sum^n_{i=1}x_i^2-2\overline{x}\sum^n_{i=1}x_i+n\overline{x}^2 = \sum^n_{i=1} x_i^2-n\overline{x}^2;$
-
$S_{xy}=\displaystyle\sum^n_{i=1}(x_i-\overline{x})(y_i-\overline{y})=\sum^n_{i=1}(x_i-\overline{x})y_i;$
-
$\overline{y}=\frac{1}{n}\displaystyle\sum^n_{i=1}(y_i)$ represents the average of area readings;
-
$\overline{x}=\frac{1}{n}\displaystyle\sum^n_{i=1}(x_i)$ represents the average of concentration readings.
for more details see estimation of model parameters.
Example 1.10.1.1
Returning to Motivation 2, let’s calculate the parameter estimates $\beta_{0}$ and $\beta_{1}$ by the Least Squares Method.
| n | Concentration | Area | Conc² | Area² | Conc x Area |
|---|---|---|---|---|---|
| 1 | 0,05 | 0,00000405 | 0,0025 | 1.64E-11 | 2.02E-07 |
| 2 | 0,05 | 0,00000312 | 0,0025 | 9.74E-12 | 1.56E-07 |
| 3 | 0,05 | 0,00000211 | 0,0025 | 4.43E-12 | 1.05E-07 |
| 4 | 0,1 | 0,0000286 | 0,01 | 8.21E-10 | 2.86E-06 |
| 5 | 0,1 | 0,0000238 | 0,01 | 5.67E-10 | 2.38E-06 |
| 6 | 0,1 | 0,0000308 | 0,01 | 9.48E-10 | 3.08E-06 |
| 7 | 0,5 | 0,0001913 | 0,25 | 3.66E-08 | 9.56E-05 |
| 8 | 0,5 | 0,0001936 | 0,25 | 3.75E-08 | 9.68E-05 |
| 9 | 0,5 | 0,0002006 | 0,25 | 4.03E-08 | 1.00E-04 |
| 10 | 1 | 0,0004883 | 1 | 2.38E-07 | 4.88E-04 |
| 11 | 1 | 0,0004761 | 1 | 2.27E-07 | 4.76E-04 |
| 12 | 1 | 0,0004851 | 1 | 2.35E-07 | 4.85E-04 |
| 13 | 2 | 0,0009072 | 4 | 8.23E-07 | 1.81E-03 |
| 14 | 2 | 0,0009246 | 4 | 8.55E-07 | 1.85E-03 |
| 15 | 2 | 0,0009008 | 4 | 8.12E-07 | 1.80E-03 |
| Sum | 10,95 | 0,005 | 15,788 | 0,00000331 | 0,007 |
| Average | 0,73 | 0,0003 |
Table 4.1.17: Calculated sample statistics
Solution:
The sample means of the variables Concentration (X) and Area (Y) are, respectively,
$$\overline{x}=\dfrac{1}{15}\sum_{i=1}^{15}x_i=0,73\quad\hbox{e}\quad\overline{y}=\dfrac{1}{15}\sum_{i=1}^{15} y_i=0,039.$$
Furthermore, in the Table we present the values of $x^2$, $y^2$ and $xy$ for each observation $i=1,\ldots,15$.
From the table we calculate the sums of squares as follows:
$$S _{xx}=\sum^n_{i=1}x_i^2-n\overline{x}^2=15,788-15\times 0,73^2=7,794$$
$$S_{yy}=\sum^n_{i=1}y_i^2-n\overline{y}^2= 0,00000331 - 15 \times 0,73^2=1,73\times 10^{-6}$$
$$S_{xy}=\sum^n_{i=1}x_i y_i-n\overline{x}\overline{y}=0,007 - 15 \times 0,73 \times 0,0003=0,0036.$$
Therefore, the parameter estimates $\beta_{1}$ and $\beta_{0}$ are, respectively
$$\widehat\beta_1=\dfrac{0,0036}{7,794}=0,00047\quad\hbox{e }\quad\widehat\beta_0=0,0003-(0,00047)\times 0,73=-1,95\times 10^{-5}.$$
Therefore, the adjusted model is given by
$$\hbox{Área}=-1,95 \times 10^{-5} + 0,00047 \times \hbox{Concentração}$$
See below the results obtained by the Action software.
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Temperature | 1 | 0.00000173 | 0.00000173 | 4337.62484141 | 0 |
| Waste | 13 | 1e-18 | 0 |
Table 4.1.18: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -0.00002445 | -0.00001515 | -8.3e-7 | 0 | 0.00000331 | 0.00003721 |
Table 4.1.19: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | -0.00001958 | 0.00000733 | -2.67080989 | 0.01923463 |
| Concentration | 0.00047067 | 0.00000715 | 65.86064714 |
Table 4.1.20: Coefficients
| Standard Deviation of Residues | Degrees of Freedom | $R^2$ | $R^2$ Adjusted |
|---|---|---|---|
| 0.00001995 | 13 | 0.99701192 | 0.99678207 |
Table 4.1.21: Descriptive Measure of Quality of Fit
Figure 4.1.4: Scatter diagram of Motivation 2 data
From the variance analysis section we obtain that
$$QME=\dfrac{\displaystyle\sum\limits_{i=1}^n(Y_i-\overline{Y})^2-\widehat{\beta_1}\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})Y_i}{n-2}.$$
Substituting the values we obtain that
$$QME=3,98\times 10^{-10}$$
With this, we can calculate the variances of the parameters
$$\widehat{\hbox{Var}}(\hat{\beta_0})=QME\left(\frac{1}{n}+\frac{\overline{x}^2}{S _{xx}}\right)=5,38\times 10^{-11}$$
$$\widehat{\hbox{Var}}(\hat{\beta_1})=\frac{QME}{S _{xx}}=5,11\times 10^{-11}$$
O $R^2$ is a descriptive measure of the quality of the fit obtained. How do we get a $R^2$ of 0.99, so the amount of variability in the data is well explained by the adjusted regression model. As previously stated, in practice we are interested in predicting the concentration value (X) given an observation in area (Y). So, given $y_0$ observed, we take it as an estimate (inverting the linear function)
$$\hat{x_0} = \frac{y_0 -\hat{\beta_0} }{\hat{\beta_1}}\quad \hbox{que é equivalente a}\quad \widehat{\hbox{Concentração}}_0=\dfrac{\hbox{Área}_0-\hat{\beta_0}}{\hat{\beta_1}}$$
Therefore, the variance of the estimate $\hat{x_0}$ is given by (See Brown [13], 1993, pg. 26)
$$\widehat{Var(\hat{x_0})}=\frac{QME}{\hat{\beta}^2 _1}=\frac{3,98\times 10^{-10}}{0,00047^2}=0,00179$$
4.1.10.2 Diagnostic Analysis
After estimating the calibration curve parameters, the adjusted model assumptions need to be validated for the results to be reliable. We call Residual Analysis a set of techniques used to investigate the suitability of a regression model based on residuals. The waste $\varepsilon_i$ is given by the difference between the observed response variable (Area $Y_i$) and the estimated response variable $\hat{Y}_i.$
When establishing the model for calibration curve, we assume that:
i) The mathematical relationship between Y and X is linear (statistical model section for calibration curve);
ii) The values of x are fixed (or controlled), that is, x is not a random variable;
iii) The average error is zero, that is, E(εi)=0. In this way, it follows that
$$\mathbb{E}(Y_i|x_i)=\mathbb{E}(\beta_0+\beta_1 x_i+\varepsilon_i)=\beta_0+\beta_1 x_i+\mathbb{E}(\varepsilon_i)=\beta_0+\beta_1 x_i$$
iv) For a given value of x, the variance of $\epsilon_i$ is always $\sigma^2$, that is,
$$\hbox{Var}(\varepsilon_i)=\mathbb{E}(\varepsilon^2_i)+[\mathbb{E}(\varepsilon_i)]^2=\sigma^2$$
this implies:
$$\hbox{Var}(Y_i)=\mathbb{E}[(Y_i - \mathbb{E} (Y_i~|~x_i) )^2]=\mathbb{E}(\varepsilon^2_i)=\sigma^2$$
So, we can say that the error is homoscedastic (has constant variance);
v) The error of one observation is independent of the error of another observation (uncorrelated errors), i.e.
$$\hbox{Cov}(\varepsilon_i,\varepsilon_j)=0,\quad\hbox{para}~i\neq j$$
vi) We often assume that errors have a Normal distribution.
The assumption of normality is necessary to prepare hypothesis tests and obtain confidence intervals.
In order to meet the requirements of MAPA item 7.1.1.10 subitem ii and the provisions of the linear regression model, we will carry out the diagnostic analysis. Therefore, the first diagnostic analysis is the normality test (for more details, see the normality test content).
From the Action software, we obtain the following results with the data from Example 1.10.1.1:
| Statistics | P-value | |
|---|---|---|
| Anderson-Darling | 0.628952889 | 0.0817437178 |
| Shapiro-Wilk | 0.8967896632 | 0.0850237715 |
| Kolmogorov-Smirnov | 0.2315579312 | 0.0296353187 |
| Ryan-Joiner | 0.952119712 | 0.1165 |
Table 4.1.23: Normality test for Example 1.10.1.1
Figure 4.1.5: Waste analysis graph.
Figure 4.1.6: QQ-plot graph
From the results obtained in Table 4.1.23, we have that for any chosen statistic we have that the residuals are normal. Thus, we met the assumption of normality of residuals.
From the graphs, we note that the concentration level of 1 can affect the normality of the residues, however from the tests (Table 4.1.23), we note that the residues are normal. From the graph waste versus collection order we do not have a trend, so we have evidence that waste is independent. Finally, analyzing the graph of residuals versus adjusted values, we observed a small variation in the residuals, thus we have evidence of homoscedasticity of the residuals.
Next, we will test the independence of the residuals.
| Statistics | P-value |
|---|---|
| 1.373621368 | 0.110129994 |
Table 4.1.24: Residual independence test (Durbin-Watson).
To test the independence of the residuals, we will use the Durbin-Watson statistic (for more details see independence diagnosis). Therefore, for significance level $\alpha=0,05$ we do not reject $H_0$ (p-value$=$0.0547). Therefore, we can state that with a 95% confidence level, the residuals are independent.
Now, let us test assumption (iv), that is, the homoscedasticity test. First, let’s present the test statistics recommended by MAPA.
Brown-Forsythe test
The Brown-Forsythe test is used to test equality of variances, however in certain cases we use it to test the homoscedasticity of residuals in the case of an explanatory variable.
The test $F$ and the Bartlett test are very sensitive to the assumption that the underlying populations are normally distributed. When the underlying distributions are not normally distributed, such tests may extrapolate their nominal significance level.
Levene proposed a statistic for balanced data, which was later generalized to unbalanced data. The statistics are obtained from an ANOVA (1 factor) between groups, in which each observation was replaced by its absolute deviation from its group mean. According to Brown and Forsythe, this statistic was described for very small samples, in which high correlations between deviations in the same group weaken the validity of the test. Therefore, Brown and Forsythe considered the median or 10% of the tri-average (more robust), as alternatives to the mean in calculating absolute deviations.
Now, let’s define the test statistic, so that is $x_{ij}=\mu_i+\varepsilon_{ij}$ for j-th observation ($j=1,\dots,n_i$) in the i-th group ($i=1,\dots,g$), where the average $\mu_i$ are unknown and unequal. We assume that $\varepsilon_{ij}$ are independent and identically distributed with mean zero variance possibly unequal. For each group, we take the median ($\widetilde{x}_i$) and the sampling variance ($s^2_i$). Let the absolute deviations be
$$z_{ij}=|x_{ij}-\widetilde{x}_i|$$
Therefore, we have the following statistics:
$$F_{BF}=\dfrac{\displaystyle\sum^g_{i=1}\frac{n_{i}(\overline{z}_{i.}-\overline{z}_{..})^2}{(g-1)}}{\frac{\displaystyle\sum^g_{i=1}\sum^{n_i}_{j=1}(z_{ij}-\overline{z}_{i.})^2}{\displaystyle\sum^g_{i=1}(n_i-1)}}$$
in which, $\overline{z} _{i.} = \displaystyle\sum^g_{i=1}\frac{z _{ij}}{n_i}$ and $\overline{z} _{..}=\frac{\displaystyle\sum^g_{i=1}\sum^{n_i}_{j=1} z _{ij}}{\displaystyle\sum^g_{i=1}n_i}$
Now let’s calculate the Brown-Forsythe statistic, for this we will make a summary of the necessary data. With this, we calculate $\widetilde{x}_i$ and sample size $n_i$ for each concentration level. Now, let’s calculate the absolute deviations.
| Concentration | Area | $\widetilde{x}_i$ | $z_{ij}$ | $\overline{z}_i$ | $(z_{ij}-\overline{z}_i)^2$ |
|---|---|---|---|---|---|
| 0,05 | 4.05E-06 | 3.00E-06 | 1.04829E-06 | 1.00E-06 | 2.33154E-15 |
| 0,05 | 3.12E-06 | 3.00E-06 | 1.20893E-07 | 1.00E-06 | 7.7283E-13 |
| 0,05 | 2.11E-06 | 3.00E-06 | 8.94803E-07 | 1.00E-06 | 1.10664E-14 |
| 0,1 | 2.86E-05 | 0,000029 | 3.52781E-07 | 2.00E-06 | 2.71333E-12 |
| 0,1 | 2.38E-05 | 0,000029 | 5.19687E-06 | 2.00E-06 | 1.022E-11 |
| 0,1 | 3.08E-05 | 0,000029 | 1.78221E-06 | 2.00E-06 | 4.74331E-14 |
| 0,5 | 0,000191 | 0,000194 | 2.72662E-06 | 3.00E-06 | 7.47356E-14 |
| 0,5 | 0,000194 | 0,000194 | 4.31653E-07 | 3.00E-06 | 6.59641E-12 |
| 0,5 | 0,000201 | 0,000194 | 6.62629E-06 | 3.00E-06 | 1.315E-11 |
| 1 | 0,000488 | 0,000485 | 3.27345E-06 | 0,000004 | 5.27876E-13 |
| 1 | 0,000476 | 0,000485 | 8.86904E-06 | 0,000004 | 2.37075E-11 |
| 1 | 0,000485 | 0,000485 | 1.05052E-07 | 0,000004 | 1.51706E-11 |
| 2 | 0,000907 | 0,000907 | 1.72542E-07 | 0,000008 | 6.12691E-11 |
| 2 | 0,000925 | 0,000907 | 1.75731E-05 | 0,000008 | 9.16435E-11 |
| 2 | 0,000901 | 0,000907 | 6.16094E-06 | 0,000008 | 3.38215E-12 |
| Average | 3.68897E-06 | sum | 2.29289E-10 |
Table 4.1.25: Auxiliary table to calculate the Brown-Forsythe statistic.
Therefore, from the table we obtain the results of
$$z_{ij}=|x_{ij}-\widetilde{x}_i|$$
Finally, we calculate the Brown-Forsythe statistic, for this look at the following table:
| Concentration | $\overline{Z}_i$ | $n_i$ | $n_i-1$ | $Z..$ | $g-1$ | Numerator | $\displaystyle\sum^g_{i=1}(z_{ij}-\overline{z}_i)^2$ | Denominator | F-statistic |
|---|---|---|---|---|---|---|---|---|---|
| 0,05 | 1.00E-06 | 3 | 2 | 3.68897E-06 | 4 | 5.42291E-12 | |||
| 0,1 | 2.00E-06 | 3 | 2 | 3.68897E-06 | 4 | 2.13946E-12 | |||
| 0,5 | 3.00E-06 | 3 | 2 | 3.68897E-06 | 4 | 3.56006E-13 | |||
| 1 | 0,000004 | 3 | 2 | 3.68897E-06 | 4 | 7.25564E-14 | |||
| 2 | 0,000008 | 3 | 2 | 3.68897E-06 | 4 | 1.39388E-11 | |||
| Sum | 10 | 2.19297E-11 | 2.29289E-10 | 2.29289E-11 | 0,937442 |
Table 4.1.26: Brown-Forsythe test.
So, we have to
$$F_{BF}=\dfrac{\displaystyle\sum^g_{i=1}\frac{n_{i}(\overline{z}_{i.}-\overline{z}_{..})^2}{(g-1)}}{\frac{\displaystyle\sum^g_{i=1}\sum^{n_i}_{j=1}(z_{ij}-\overline{z}_{i.})^2}{\displaystyle\sum^g_{i=1}(n_i-1)}}=\dfrac{\hbox{numerador}}{\hbox{denominador}}=0,937442$$
The p-value is given by:
$$\hbox{p-valor}=P[F_{4,10}> F_0]=0,480942$$
For significance level $\alpha=0,05$, we obtain that $F_{0,05;4;10}=3,47.$ Therefore, with 95% confidence, we do not reject $H_0$, that is, the residuals are homoscedastic.
Next, using the Action software, we test homoscedasticity using Breusch-Pagan and Goldfeld-Quandt statistics (for more details see homoscedasticity diagnosis).
| Statistics | Number of Replicas | P-value |
|---|---|---|
| 0.662633998 | 3 | 0.064770204 |
Table 4.1.27: Homoscedasticity Test - Cochran
| Variable | Statistics | G.L.Num. | G.L. Den. | P-value |
|---|---|---|---|---|
| Group | 0.947095236 | 4 | 10 | 0.476288565 |
Table 4.1.28: Homoscedasticity Test (Brown-Forsythe)
| Statistics | GL | P-value |
|---|---|---|
| 1.312140041 | 1 | 0.252007555 |
Table 4.1.29: Homoscedasticity Test - Breusch Pagan
| Variable | Statistics | GL1 | GL2 | P-value |
|---|---|---|---|---|
| Concentration | 13.9374713735602 | 4 | 4 | 0.0256902573810213 |
Table 4.1.30: Homoscedasticity Test - Goldfeld Quandt
| Statistics | P-value |
|---|---|
| 1.373621368 | 0.110129994 |
Table 4.1.31: Homoscedasticity Test - Durbin-Watson
Through the tables we note that for significance level $\alpha=0,05$, we obtain that with 95% confidence, we do not reject $H_0$, that is, the residuals are homoscedastic for the Breusch-Pagan and Brown-Forsythe tests (modified Levene’s test). An important observation is that for the Goldfeld-Quandt test we reject $H_0,$ However, one of the limitations of this test is that we need a relatively large sample, which is not the case with this example. Therefore, we can conclude that the homoscedasticity of the residuals (constant variance).
Diagnosis of outliers and influential points
Next, we will analyze the outliers, which is an extreme observation, that is, it is a point with different behavior from the others. If an outlier is influential, it interferes with the adjusted regression function (whether or not the point is included substantially modifies the adjusted values).
But an observation being considered an outlier does not mean that it is consequently an influential point. Therefore, a point may be an outlier in relation to Y or X, and may or may not be an influential point. The purpose of detecting outliers is to identify outliers in relation to X, outliers in relation to Y and influential observations.
First, let’s analyze the outliers in X, to do this observe the results obtained by the Action software:
Figure 4.1.7: Boxplot of leverage points.
Figure 4.1.8: Graph of leverage points (leverage hii) versus observation number.
From Figure 4.1.7 we notice some indications that observations can boost the model’s adjustment. From Figure 4.1.8 we observe that the points are those with a concentration of 2. We note that it is very far from the concentration of 1. According to the criterion $2(p+1)/n=0,27$ we have that points 13,14 and 15 are an outlier in X (Concentration).
Now, let’s analyze the outliers in Y, to do this observe the results obtained by the Action software:
Figure 4.1.9: Graph of standardized residuals versus adjusted values.
Figure 4.1.10: Graph of studentized residuals versus adjusted values.
From Figures 4.1.9 and 4.1.10 we did not observe any outliers in Y (Area), as no point is outside the zone (-3,3).
Next, we will analyze the influential points, to do this observe the results obtained by the Action software:
| Diagnosis | Formula | Value |
|---|---|---|
| hii (Leverage) | (2*(p+1))/n | 0.27 |
| DFFITS | 2* root ((p+1)/n) | 0.73 |
| DCOOK | 4/n | 0.2667 |
| DFBETA | 2/root(n) | 0.52 |
| Standardized Waste | (-3,3) | 3 |
| Studentized Waste | (-3,3) | 3 |
Table 4.1.32: Criteria for each diagnosis of outliers and influential points
Figure 4.1.11: DFFITS points graph
Figure 4.1.12: D-COOK points graph
It is worth remembering that a point is influential if its exclusion from the regression adjustment causes a substantial change in the adjusted values. DFFITS measure the influence that observation i has on its own fitted value. Using the DFFITS criterion, we did not detect influential points, however, using the Cook distance criterion, we obtained that observation 15 is an influential point.
Figure 4.1.13: DBETAS points graph
DFBETA measures the influence of observation i on the coefficient of X (Concentration). Using the criterion, we observed that point 15 is an influential point for the Concentration coefficient.
Figure 4.1.14: Diagnostic Analysis of outliers and influential points
A general summary of the diagnostic analysis is that points 13, 14 and 15 can influence the normality of the residuals. For the analysis of outliers in Y, we have no point is an outlier in Y (Concentration). Point 15 is an influential point that can cause a substantial change in the model fit.
4.1.10.3 Uncertainty due to the Calibration Curve
After validating the adjusted model assumptions, the next step is to calculate the uncertainty due to the calibration curve. To do this, we propose to calculate the uncertainty (for more details see content 18. Measurement uncertainty) using four methods:
-
MGQ Method (Quality Assurance Manual);
-
Prediction interval projection method;
-
Delta Method;
-
Fieller Method.
Below we will describe the first method, which is the quality assurance manual (QMS) method.
4.1.10.3.1 Uncertainty due to the calibration curve: MGQ Method
When reporting the result of measuring a physical quantity, it is mandatory that some quantitative indication of the quality of the result is given, so that those who use the measurement result can evaluate its reliability. The concept of measurement uncertainty will be used as a quantifiable attribute to determine the quality of a measurement system. In order to meet this concept regarding uncertainty due to the calibration curve for analytical methods and control of contaminating residues in food, the Ministry of Agriculture, Livestock and Supply (MAPA), through the Secretariat of Agricultural Defense and the General Coordination of Laboratory Support (CGAL), decided to write and publish the Analytical Quality Assurance Manual.
Annex IV of the MGQ describes how the uncertainty in predicting the concentration of the analyte from the Calibration Curve is calculated (Calculation of Calibration Uncertainty). The standard uncertainty of the analyte concentration is not the uncertainty of the analyte concentration in the test sample, as in it we do not consider other sources of uncertainty such as the uncertainty of the preparation of the solutions and the concentration levels of the calibration curve, nor the repeatability of the test. This uncertainty is one of the sources of uncertainty in the analytical test.
Initially, we note that in practice the greatest interest is to predict the concentration value (X) given an observation in area (Y), for example, in chromatographic or spectrometric analyzes (ICP). So, given $y_0$ observed, we take it as an estimate (inverting the linear function)
$$\hat{x_0} = \frac{y_0 -\hat{\beta_0} }{\hat{\beta_1}}\quad \tag{1.10.3.1.1}$$
We call the difference in prediction error $(y_0-\widehat{y}_0),$ whose variance is given by
$$Var(y_0-\widehat{y_0})=Var(y_0)+Var(\widehat{y_0})-2\hbox{Cov}(y_0,\widehat{y_0})$$
A point estimator can be obtained from the adjusted model
$$\widehat{y}(x_0)=\widehat{\mu} _{Y \mid x_0}=\widehat{\beta_0}+\widehat{\beta_1} x_0.$$
Let us note that $\widehat{\mu} _{Y \mid x_0}$ is a normally distributed random variable as it is a linear combination of observations $Y_i$. Furthermore, we have to
$$\mathbb{E}(\widehat{y}_0)=\mathbb{E}(\widehat{\mu} \ _{Y \mid x_0})=\beta_0+\beta_1 x_0 =\mu _{Y\mid x_0} \ ,\quad \hbox{e}$$
$$\hbox{Var}(\widehat{y} _0)=\hbox{Var}(\widehat{\mu} _{Y\mid x_0})=\hbox{Var}[\overline{Y}+\widehat{\beta_1}(x_0-\overline{x})]=\hbox{Var}[\overline{Y}]+\hbox{Var}[\widehat{\beta_1}(x_0-\overline{x})]=\hbox{Var}[\overline{Y}]+(x_0-\overline{x})^2\hbox{Var}[\widehat{\beta_1}]=$$
$$=\dfrac{\sigma^2}{n}+(x_0-\overline{x})^2\dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})^2}=\sigma^2\left(\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})^2}\right) = \sigma^2\left(\dfrac{1}{n} + \dfrac{(x_0-\overline{x})^2}{S _{xx}}\right),$$
With this we have to $\widehat{\mu} _{Y \mid x_0}$ is an unbiased estimator for $E\left( Y \mid X=x_0 \right).$ Another important observation is that $\hbox{Var}(\widehat{\beta_1})$ is obtained in the tests and parameter confidence interval section. So, we have to
$$\hbox{Var}(y_0-\widehat{y_0})=\hbox{Var}(y_0)+\hbox{Var}(\widehat{y_0})-2\hbox{Cov}(y_0,\widehat{y_0})=$$
$$=\hat{\sigma}^2+\hat{\sigma}^2\left(\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{S _{xx}}\right)=\hat{\sigma}^2\left(1+\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{S _{xx}}\right).$$
Therefore, returning to (1.10.3.1.1) we obtain
$$\hbox{Var}(\widehat{x}_0)=\dfrac{\hbox{Var}(y_0-\widehat{y_0})}{\widehat{\beta}^2_1}=$$
$$\dfrac{\widehat{\sigma}^2}{\widehat{\beta}^2_1}\left(1+\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{S _{xx}}\right)$$
Therefore, the uncertainty due to the calibration curve using the MGQ method is given by:
$$ u(\widehat{x}_0) = \frac{\sqrt{\hbox{QME}}}{\beta_1} \sqrt{1+\frac{1}{n}+\frac{(x_0-\bar{x})^2}{S _{xx}}} = \dfrac{s _{\hbox{res}}}{\beta_1}\sqrt{1+\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{S _{xx}}}$$
or equivalently
$$u(\widehat{x}_0)=\dfrac{\sqrt{\hbox{QME}}}{\beta_1}\sqrt{1+\dfrac{1}{n}+\dfrac{(y_0-\overline{y})^2}{\beta^2_1 S _{xx}}} =\dfrac{s _{\hbox{res}}}{\beta_1}\sqrt{1+\dfrac{1}{n}+\dfrac{(y_0-\overline{y})^2}{\beta^2_1 S _{xx}}}$$
It is worth remembering that:
$x_{0}$: is the analyte concentration of the solution injected into the analytical measuring instrument obtained by interpolation or extrapolation of the calibration curve.
$y_{0}$: is the average instrumental response of injections into the analytical measuring instrument of the solutions obtained.
$s_{res}$: is the standard deviation of the instrumental response to the sample solution injected into the analytical measuring instrument. More specifically, it is the standard deviation of the residuals of the simple linear regression model.
Example 1.10.3.1.1:
Returning to the example of Motivation 2 in section 4.1.10.1 - Statistical Model for Calibration Curve. We have already calculated:
-
$\overline{x} = 0,73 $
-
$S _{xx} = 7,794$
-
$S_{yy} = 1,73 \times 10^{-6}$
-
$S_{xy} = 0,0036$
-
$\widehat{\beta_1} = 0,00047$
-
$\widehat{\beta_0} = -1,95 \times 10^{-5}$
-
$QME = 3,98 \times 10^{-10}$
We take the point $\widehat{x}_0=1.$ Therefore, the uncertainty due to the calibration curve due to the method of projecting the confidence interval of the mean response is given by
$$u(\widehat{x_0})=\dfrac{\sqrt{\hbox{QME}}}{\widehat{\beta}_1}\sqrt{1+\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{S _{xx}}}= \dfrac{\sqrt{3,98\times 10^{-10}}}{0,00047}\sqrt{1+\dfrac{1}{15}+\dfrac{(1-0,73)^2}{7,794}}=0,042389$$
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 0.0000017266 | 0.0000017266 | 4337.6248414089 | 0 |
| Waste | 13 | 5.2e-9 | 4e-10 |
Table 4.1.33: ANOVA table
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | -0.0000195813 | 0.0000073316 | -2.6708098938 | 0.0192346319 |
| Concentration | 0.0004706666 | 0.0000071464 | 65.8606471378 | 0 |
Table 4.1.34: Coefficients
In the next section, we will describe the mean response confidence interval projection method.
4.1.10.3.2 Uncertainty due to the calibration curve: Projection Method
In this section we will deduce another methodology to calculate the uncertainty due to the calibration curve, which we call the mean response confidence interval projection method. To illustrate this denomination, look at the example of motivation.
Figure 4.1.15: Representation of the method of projecting the confidence interval of the mean response with the data from Motivation 2.
Estimating a confidence interval for $\mathbb{E}\left(Y \mid X=x_0 \right)=\mu _{Y \mid x_0}= \beta_0+\beta_1 x_0$ is of great interest.
A point estimator of $μ_{Y∣x0}$ can be obtained from the fitted model, i.e.
$$\widehat{\mu} _{Y \mid x_0}=\widehat{\beta_0}+\widehat{\beta_1} x_0=\widehat{Y}(x_0)\quad \tag{1.10.3.2.1}$$
Let us note that $\widehat{\mu} _{Y \mid x_0}$ is a normally distributed random variable as it is a linear combination of observations $Y_i$. Furthermore, we saw in the previous section (1.10.3.1) that
$$\mathbb{E}(\hat{\mu} \ _{Y \mid x_0}) = \beta_0 + \beta_1 x_0 = \mu \ _{Y \mid x_0} \qquad \hbox{e} $$
$$\hbox{Var}(\widehat{\mu} _{Y\mid x_0})=\hbox{Var}[\overline{Y}+\widehat{\beta_1}(x_0-\overline{x})]= \dfrac{\sigma^2}{n}+(x_0-\overline{x})^2\dfrac{\sigma^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})^2} = \sigma^2\left[\dfrac{1}{n} + \dfrac{(x_0-\overline{x})^2}{S _{xx}}\right],$$
Therefore, the confidence interval for $\mu _{Y \mid x_0}=E[Y \mid X=x_0]$ is given by
$$IC[\mu _{Y \mid x_0}, 1-\alpha] = \left[\widehat{Y}(x_0)-t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})^2}\right)}\right.~;$$
$$\left.\widehat{Y}(x_0)+t_{\left(1-\frac{\alpha}{2};n-2\right)}\sqrt{QME\left(\dfrac{1}{n}+\dfrac{(x_0-\overline{x})^2}{\displaystyle\sum\limits_{i=1}^n(x_i-\overline{x})^2}\right)}\right],$$
in which $\widehat{Y}(x_0)$ is the estimated average response for the level $x=x_0$. Observe Figure (4.1.16) which illustrates the prediction interval
Figure 4.1.16: Confidence band of the prediction interval.
$$\mathbb{E}[ Y | X=x_{LI} ] = \widehat{y}_{0} - t_{(1-\alpha/2;n-2)} \sqrt{ QME\left( \dfrac{1}{n} + \dfrac{ ( x_{LI} - \overline{x} )^2 }{ S _{xx} } \right) } \tag{1.10.3.2.2}$$
$$\mathbb{E}[ Y | X=x_{LS} ] = \widehat{y}_{0} + t_{(1-\alpha/2;n-2)} \sqrt{ QME\left( \dfrac{1}{n} + \dfrac{ ( x_{LS} - \overline{x} )^2 }{ S _{xx} } \right) } \tag{1.10.3.2.3}$$
First, we draw a line parallel to the axis $X$ at the height of $Y$ estimated at $\widehat{x_0}$, which we will call $Y_0$. We project lines from the confidence bands, then draw a straight line perpendicular to the axis $Y$ to obtain the values of $x_{LI}$ and $x_{LS}$.
Equating equations (1.10.3.2.1) and (1.10.3.2.2), we have:
$$= \hat{\beta} _0 + \hat{\beta} _1 \bar{x} _0 = \hat{y} _0 - t_1 \sqrt{QME \left( \frac{1}{n} + \frac{(x _{LI} - \bar{x})^2}{S _{xx}} \right)}$$ $$\hat{\beta} _0 + \hat{\beta} _1 \bar{x} _0 = \hat{\beta} _0 + \hat{\beta} _1 x_{LI} - t_1 \sqrt{QME \left( \frac{1}{n} + \frac{(x _{LI} - \bar{x})^2}{S _{xx}} \right)}, \quad \hbox{elevando ambos os lados ao quadrado,} $$ $$(\hat{\beta} _1 \bar{x} _0 - \hat{\beta} _1 x_{LI})^2 = t^2 QME \left( \frac{1}{n} + \frac{(x_{LI} - \bar{x})^2}{S _{xx}} \right)$$ $$\hat{\beta}^2 _1 \bar{x} _0^2 - 2 \hat{\beta} _1^2 \bar{x} _0 x _{LI} + \hat{\beta} _1^2 x_{LI}^2 = \frac{t^2 QME}{n} + \frac{t^2 QME (x^2 _{LI} - 2 x_{LI} \bar{x} + \bar{x}^2)}{S _{xx}}$$ $$\hat{\beta}^2 _1 \bar{x} _0^2 - 2 \hat{\beta}^2 _1 \bar{x} _0 x _{LI} + \hat{\beta}^2 _1 x_{LI}^2 = \frac{t^2 QME}{n} + \frac{x _{LI}^2 t^2 QME}{S _{xx}} - \frac{\bar{x}^2 t^2 QME}{S _{xx}} $$
Putting it in evidence $x^2_{LI}$ and $x_{LI}$, we have,
$$ x_{LI}^2 \underbrace{\left(\hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}} \right)}_{a} + x_{LI} \underbrace{\left(\frac{\bar{x} t^2 QME}{S _{xx}} - \hat{\beta}^2 _1 \bar{x} _0 \right)}_{b} + $$ $$ + \underbrace{\hat{\beta}^2 _1 \bar{x}^2 _0 - \frac{t^2 QME}{n} - \frac{\bar{x}^2 - t^2 QME}{S _{xx}}}_{c} = 0 \tag{1.10.3.2.4} $$
It is worth remembering that (1.10.3.2.4) is a second degree equation of the type $a x^2 + b x + c = 0$ (Bhaskara) with:
$$\begin{align*} a &= \hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}} \cr b &= 2 \left( \frac{\bar{x} t^2 QME}{S _{xx}} - \hat{\beta}^2 _1 \bar{x} _0 \right) \cr c &= \hat{\beta}^2 _1 \bar{x} _0^2 - \frac{t^2 QME}{n} - \frac{\bar{x}^2 - t^2 QME}{S _{xx}} \end{align*} $$
Thus, solving equation (1.10.3.2.4) in x we find xLS and xLI. With this, we have to
$$x = \dfrac{-b \pm \sqrt{\Delta}}{2a}$$
Solving $δ$, we have
$$ \begin{align*} \Delta &= b^2 - 4ac \cr \Delta &= \left[ 2 \left( \frac{\bar{x} t^2 QME}{S _{xx}} - \hat{\beta}^2 _1 \bar{x} _0 \right) \right]^2 - 4 \left( \hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}} \right) \left( \hat{\beta}^2 _1 \bar{x} _0^2 - \frac{t^2 QME}{n} - \frac{\bar{x}^2 - t^2 QME}{S _{xx}} \right) \cr \end{align*} $$
$$\begin{align*} \ \ \Delta &= 4 \left[ \left( \dfrac{\bar{x} t^2 QME}{S _{xx}} \right)^2 - \dfrac{2 \bar{x} t^2 QME \hat{\beta}^2 _1 \bar{x} _0}{S _{xx}} + \hat{\beta}^4 _1 \bar{x} _0^2 \right] \cr &\quad - 4 \left[ \hat{\beta}^2 _1 \bar{x} _0^2 - \frac{\hat{\beta}^2 _1 t^2 QME}{n} - \frac{\hat{\beta}^2 _1 \bar{x}^2 QME}{S _{xx}} + \frac{\hat{\beta}^2 _1 x_0^2 t^2 QME}{S _{xx}} + \left( \frac{t^2 QME}{n S _{xx}} \right)^2 + \left( \frac{\bar{x} t^2 QME}{S _{xx}} \right)^2 \right] \cr \Delta &= 4 \left[ \frac{2 \bar{x} t^2 QME \hat{\beta}^2 _1 \bar{x} _0}{S _{xx}} + \frac{\hat{\beta}^2 _1 t^2 QME}{n} + \frac{\hat{\beta}^2 _1 \bar{x}^2 t^2 QME}{S _{xx}} + \frac{\hat{\beta}^2 _1 \bar{x} _0^2 t^2 QME}{S _{xx}} - \left( \frac{t^2 QME}{n S _{xx}} \right)^2 \right] \cr \Delta &= 4 \hat{\beta}^2 _1 t^2 QME \left( - \frac{2 \bar{x} \bar{x} _0}{S _{xx}} + \frac{1}{n} + \frac{\bar{x}^2}{S _{xx}} + \frac{\bar{x} _0^2}{S _{xx}} - \frac{t^2 QME}{\hat{\beta}^2 _1 n S _{xx}} \right) \cr \Delta &= 4 \hat{\beta}^2 _1 t^2 QME \left( \frac{(\bar{x} - \bar{x} _0)^2}{S _{xx}} + \frac{1}{n} - \frac{t^2 QME}{\hat{\beta}^2 _1 n S _{xx}} \right) \end{align*} $$
In this way, we have
$$ \begin{align*} x &= \frac{-b \pm \sqrt{\Delta}}{2a} \cr &= \frac{-2\left( \frac{\bar{x} t^2 QME}{S _{xx}} - \hat{\beta}^2 _1 \bar{x} _0 \right) \pm \sqrt{4 \hat{\beta}^2 _1 t^2 QME \underbrace{\left( \frac{(\bar{x} - \bar{x} _0)^2}{S _{xx}} + \frac{1}{n} - \frac{t^2 QME}{\hat{\beta}^2 _1 n S _{xx}} \right)}_{\delta_*}}} {2\left( \hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}} \right)} \cr x &= \frac{-\left( \frac{\bar{x} t^2 QME}{S _{xx}} - \hat{\beta}^2 _1 \bar{x} _0 \right) \pm \hat{\beta_1} t \sqrt{\delta_*}} {\hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}}} \end{align*} $$
We add and subtract $\widehat{x}_0$, and we get
$$ \begin{align*} x &= \bar{x} _0 - \frac{\bar{x} t^2 QME}{S _{xx}} + \frac{\hat{\beta}^2 _1 \bar{x} _0 \pm \hat{\beta_1} t \sqrt{\delta_*}} {\hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}}} \cr x &= \bar{x} _0 + \frac{-\bar{x} _0 \hat{\beta}^2 _1 + \frac{t^2 QME \bar{x} _0}{S _{xx}} - \frac{\bar{x} t^2 QME}{S _{xx}} + \hat{\beta}^2 _1 \bar{x} _0 \pm \hat{\beta_1} t \sqrt{\delta_*}} {\hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}}} \cr x &= \bar{x} _0 + \frac{\frac{t^2 QME (\bar{x} _0 - \bar{x})}{S _{xx}} \pm \hat{\beta_1} t \sqrt{\delta_*}} {\hat{\beta}^2 _1 - \frac{t^2 QME}{S _{xx}}} \end{align*} $$
We multiply and divide the second term on the right side of the equality by $1 / \widehat{\beta_1}^2$
$$ x = \hat{x}_0 + \frac{ \left( \dfrac{t^2 QME (\hat{x}_0 - \bar{x})}{S _{xx}} \pm \hat{\beta_1} t \sqrt{\delta^*} \right) / \hat{\beta}^2 _1 }{ \left( \dfrac{\hat{\beta}^2 _1 - t^2 QME / S _{xx}}{\hat{\beta}^2 _1} \right) } $$
$$ x = \hat{x}_0 + \frac{ \dfrac{t^2 QME (\hat{x}_0 - \bar{x})}{\hat{\beta}^2 _1 S _{xx}} \pm \dfrac{t}{\hat{\beta_1}}\sqrt{\delta^*} }{ 1 - \dfrac{t^2 QME}{\hat{\beta}^2 _1 S _{xx}} } $$
We replace g with $\dfrac{t^2 QME}{\widehat{\beta_1}^2 S _{xx}}$
$$ x = \hat{x}_0 + \frac{(\hat{x}_0 - \bar{x})g}{1 - g} \pm \frac{t}{\hat{\beta_1} (1-g)} \sqrt{\delta^*}, $$
$$ x = \hat{x}_0 + \frac{(\hat{x}_0 - \bar{x})g}{1 - g} \pm \frac{t}{\hat{\beta_1}} \sqrt{\frac{\delta^*}{(1-g)^2}}, $$
$$ x = \hat{x}_0 + \frac{(\hat{x}_0 - \bar{x})g}{1 - g} \pm \frac{t}{\hat{\beta_1}} \sqrt{QME \left( \frac{(\hat{x}_0 - \bar{x})^2}{S _{xx}(1-g)^2} + \frac{1}{n(1-g)} \right)}. $$
Let’s write $h=\dfrac{(\widehat{x}_0 - \overline{x} )}{1-g}$. With this we have
$$x = \hat{x}_0 + gh \pm \frac{t}{\hat{\beta_1}} \sqrt{QME \left( \frac{h^2}{S _{xx}} + \frac{1}{n(1-g)} \right)} \quad \hbox{para } g \neq 1$$
in which $g = \dfrac{t^2 QME}{\widehat{\beta_1}^2 S _{xx} }$. When g is zero for x, we have the limits for $\widehat{x}_0$. With this we have to
$$x=\widehat{x}_0 \pm \dfrac{t}{ \widehat{\beta_1} }\sqrt{QME \left( \dfrac{ (x_0-\overline{x})^2 }{ S _{xx} } + \dfrac{1}{n} \right) }$$
$x = \hat{x}_0 \pm \frac{t}{\hat{\beta_1}} \sqrt{QME \left( \frac{(x_0 - \bar{x})^2}{S _{xx}} + \frac{1}{n} \right)}$, que são os limites do intervalo de confiança da resposta média dividido pelo parâmetro $\widehat{\beta_1}$.
We can encounter two types of problems when calculating the confidence interval using this method.
-
$QME \left( \dfrac{ h^2 }{ S _{xx} } + \dfrac{1}{n(1-g)} \right)$ can be negative. When this happens, there is no real confidence interval for $\widehat{x} _0$, because the solutions of the equations are not real numbers but complex numbers. In the case where the solutions $x_{LI}$ and $x_{LS}$ are complex, there is no confidence interval for $\widehat{x} _0$.
-
Is it possible to find $x_{LI}$ and $x_{LS}$ both smaller or both larger than $\widehat{x}_0$. When this happens, the uncertainty calculated by this method is not valid.
Therefore, the uncertainty due to the calibration curve due to the mean response confidence interval projection method is given by
$$u(\hat{x}_0) = \frac{1}{\hat{\beta_1}} \sqrt{QME \left( \frac{(\hat{x}_0 - \bar{x})^2}{S _{xx}} + \frac{1}{n} \right)} = \frac{1}{\hat{\beta_1}} \sqrt{\operatorname{Var}(\hat{y}_0)}$$
Example 1.10.3.2.1
Returning to the example of Motivation 2 in section 4.1.10.1 - Statistical Model for Calibration Curve. We have already calculated:
- $\bar{x} = 0,73$
- $S _{xx} = 7,794$
- $S_{yy} = 1,73 \times 10^{-6}$
- $S_{xy} = 0,0036$
- $\hat{\beta_1} = 0,00047$
- $\hat{\beta_0} = -1,95 \times 10^{-5}$
- $QME = 3,98 \times 10^{-10}$
We take the point $\widehat{x}_0$ = 1. Therefore, the uncertainty due to the calibration curve due to the method of projecting the confidence interval of the mean response is given by
$$u(\hat{x}_0) = \frac{1}{\hat{\beta_1}} \sqrt{QME \left( \frac{(\hat{x}_0 - \bar{x})^2}{S _{xx}} + \frac{1}{n} \right)} = $$ $$=\frac{1}{0,00047} \sqrt{3,98 \times 10^{-10} \left( \frac{(1 - 0,73)^2}{7,794} + \frac{1}{15} \right)} = 0,01168$$
Below we present the results obtained by the Action software:
ANOVA table
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 0.0000017266 | 0.0000017266 | 4337.6248414089 | 0 |
| Waste | 13 | 5.2e-9 | 3.98e-10 |
Table 4.1.35: ANOVA table
Coefficients
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | -0.0000195813 | 0.0000073316 | -2.6708098938 | 0.0192346319 |
| Concentration | 0.0004706666 | 0.0000071464 | 65.8606471378 | 0 |
Table 4.1.36: Coefficients
In the next section, we will describe the delta method.
4.1.10.3.3 Uncertainty due to the calibration curve: Delta Method
In this section, we will use the delta method to calculate the uncertainty due to the calibration curve. The delta method is a technique for approximating a random vector, through expansion by the Taylor series. It provides transformations that lead to an asymptotic variance that is independent of the parameter. If we use the 1st order approximation to $g(\widehat{x}_0)$ we get
$$g( \widehat{y_0}, \widehat{\beta_0}, \widehat{\beta_1} ) = \widehat{x_0} = \dfrac{\widehat{y_0} - \widehat{\beta_0} }{ \widehat{\beta_1} }$$
We expand in Taylor series up to first order, with this we obtain,
$\mathbb{E}(g(\widehat{x}_0))=g( \widehat{y_0}, \widehat{\beta_0}, \widehat{\beta_1} ) \approx g( y_0, \beta_0, \beta_1 ) + ( \hat{y_0} - y_0 ) \dfrac{ \partial g( y_0, \beta_0, \beta_1 ) }{ \partial y_0 } +$
$+( \hat{\beta_0} - \beta_0 ) \dfrac{ \partial g( y_0, \beta_0, \beta_1 ) }{ \partial \beta_0 }+ ( \hat{\beta_1} - \beta_1 ) \dfrac{ \partial g( y_0, \beta_0, \beta_1 ) }{ \partial \beta_1 } + 2 (\hat{y_0} - y_0)( \hat{\beta_0} - \beta_0 ) \dfrac{ \partial^2 g( y_0, \beta_0, \beta_1 ) }{\partial y_0 \partial \beta_0}+$
$+ 2 (\hat{y_0} - y_0)( \hat{\beta_1} - \beta_1 ) \dfrac{ \partial^2 g( y_0, \beta_0, \beta_1 ) }{\partial y_0 \partial \beta_1} + 2 (\hat{\beta_0} - \beta_0)( \hat{\beta_1} - \beta_1 ) \dfrac{ \partial^2 g( y_0, \beta_0, \beta_1 ) }{\partial \beta_0 \partial \beta_1}$
So $\hat{\phi} = g( \widehat{y_0}, \widehat{\beta_0}, \widehat{\beta_1} )$ is the estimator of $g( y_0, \beta_0, \beta_1 )$ and we have approximately,
$\hbox{Var}( \hat{\phi} ) = \hbox{Var} ( \widehat{x_0} ) \approx \hbox{Var}( \widehat{y_0} ) \left( \dfrac{\partial \hat{\phi} }{ \partial y_0 } \right)^2 + \hbox{Var}( \widehat{\beta_0} ) \left( \dfrac{\partial \hat{\phi} }{ \partial \beta_0 } \right)^2 + \hbox{Var}( \widehat{\beta_1} ) \left( \dfrac{\partial \hat{\phi} }{ \partial \beta_1 } \right)^2$
$+ 2 \hbox{Cov}( \hat{y_0}, \hat{\beta_0} ) \left( \dfrac{ \partial \hat{\phi} }{ \partial y_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_0 } \right) + 2 \hbox{Cov}( \widehat{y_0}, \widehat{\beta_1} ) \left( \dfrac{ \partial \hat{\phi} }{ \partial y_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_1 } \right) + 2 \hbox{Cov}( \widehat{\beta_0}, \widehat{\beta_1} ) \left( \dfrac{ \partial \hat{\phi} }{ \partial \beta_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_1 } \right)$ (1.10.3.3.1)
From section 4.4.1.3 Properties of Estimators, we have that
-
$\hbox{Var}( y_0 ) = \sigma^2 $
-
$\hbox{Var} ( \widehat{\beta_0} ) = \sigma^2 \left( \dfrac{1}{n} + \dfrac{ \overline{x}^2 }{ S _{xx} } \right)$
-
$\hbox{Var} ( \widehat{\beta_1} ) = \dfrac{ \sigma^2 }{ S _{xx} }$
-
$\hbox{Cov} ( \widehat{\beta_0}, \widehat{\beta_1} ) = - \dfrac{ \overline{x}\sigma^2 }{ S _{xx} }$
Now, we need to calculate the derivatives. So,
$\dfrac{ \partial \hat{\phi} }{ \partial y_0 } = \dfrac{1}{ \beta_1 }$
$\dfrac{ \partial \hat{\phi} }{ \partial \beta_0 } = -\dfrac{1}{ \beta_1 }$
$\dfrac{ \partial \hat{\phi} }{ \partial \beta_1 } = - \dfrac{(y_0 - \beta_0) }{ \beta_1^2 } = - \dfrac{\phi}{\beta_1}$
$\dfrac{ \partial \hat{\phi} }{ \partial y_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_0 } = \dfrac{1}{\beta_1} \left( -\dfrac{1}{\beta_1} \right) = - \dfrac{1}{\beta_1^2}$
$\dfrac{ \partial \hat{\phi} }{ \partial y_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_1 } = \dfrac{1}{\beta_1} \left( - \dfrac{(y_0 - \beta_0) }{ \beta_1^2 } \right) = \left( - \dfrac{ y_0 - \beta_0 }{ \beta_1^3 } \right) = - \dfrac{\phi}{\beta_1^2} $
$\dfrac{ \partial \hat{\phi} }{ \partial \beta_0} \dfrac{ \partial \hat{\phi} }{ \partial \beta_1 } = \left( -\dfrac{1}{\beta_1} \right) \left( -\dfrac{y_0 - \beta_0}{ \beta_1^2 } \right) = \dfrac{y_0 - \beta_0}{ \beta_1^3 } = \dfrac{\phi}{\beta_1^2}$
in which $\phi = \dfrac{y_0 - \beta_0}{\beta_1}$
We substitute the derivatives and data obtained in the previous sections into (1.10.3.3.1).
$$ \hbox{Var}(\widehat{x_0}) \approx \dfrac{2 \hbox{QME}}{n\widehat{\beta}^2_1}+\dfrac{\widehat{x}^2_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} +\dfrac{2\overline{x}^2 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}- 2\dfrac{\widehat{x}_0\overline{x} \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} +$$
$+\dfrac{\widehat{y}^2_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}+\dfrac{\widehat{\beta}^2_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} - 2\dfrac{\widehat{y}_0\widehat{\beta_0} \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}+2\dfrac{\hbox{QME}}{2\widehat{\beta}^2_1}+ 2\dfrac{\overline{x}^2 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}-$
$-2\dfrac{\widehat{x}_0\overline{x}\widehat{\beta_0} \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} -4\dfrac{\widehat{y}^2_0\overline{x}\widehat{\beta_0} \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} - 4\dfrac{\widehat{\beta}^2_0\overline{x}\hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} +8\dfrac{\widehat{y}_0\widehat{\beta_0} \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}+ $
$+ 2\dfrac{\widehat{x}^2_0\widehat{y}^2_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}+2\dfrac{\widehat{x}^2_0\widehat{\beta}^2_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}} -4\dfrac{\widehat{x}^2_0\widehat{y}_0\widehat{y}_0 \hbox{QME}}{\widehat{\beta}^2_1 S _{xx}}$
With some algebraic manipulations we obtain
$ \hbox{Var}(\widehat{x_0}) \approx \dfrac{ \hbox{QME}}{\widehat{\beta}^2_1}\left[\dfrac{4}{n}+\dfrac{(\widehat{x}_0-2\overline{x})^2}{S _{xx}} + +\dfrac{(\widehat{y}_0-\widehat{\beta_0})^2}{S _{xx}}(1-4\overline{x}+2\widehat{x}^2_0)\right]$
Therefore, the uncertainty due to the calibration curve by the delta method is given by
$$u(\widehat{x_0}) \approx \dfrac{ \sqrt{\hbox{QME}}}{\widehat{\beta_1}}\sqrt{\dfrac{4}{n}+\dfrac{(\widehat{x}_0-2\overline{x})^2}{S _{xx}} + \dfrac{(\widehat{y}_0-\widehat{\beta_0})^2}{S _{xx}}(1-4\overline{x}+2\widehat{x}^2_0)}$$
Example 1.10.3.3.1:
We return to the example of Motivation 2. We have already calculated:
-
$\overline{x} = 0,73 $
-
$S _{xx} = 7,794$
-
$\widehat{\beta_1} = 0,00047$
-
$\widehat{\beta_0}=-1,958\times 10^{-5}$
-
$QME = 3,98 \times 10^{-10}$
-
$\widehat{y}_0=0,000451085$
Suppose, $\hat{x}_0 = 1,$ Therefore, the uncertainty due to the calibration curve using the Delta method is given by
$$u(\widehat{x_0}) = \dfrac{ \sqrt{\hbox{QME}}}{\widehat{\beta_1}}\sqrt{\dfrac{4}{n}+\dfrac{(\widehat{x}_0-2\overline{x})^2}{S _{xx}} + \dfrac{(\widehat{y}_0-\widehat{\beta_0})^2}{S _{xx}}(1-4\overline{x}+2\widehat{x}^2_0)}$$
$$=\dfrac{ \sqrt{3,98\times 10^{-10}}}{0,00047}\sqrt{\dfrac{4}{15}+\dfrac{(1-2\times 0,73)^2}{7,794} + \dfrac{(0,000451+1,958\times 10^{-5})^2}{7,794}(1-4\times 0,73+2 \times 1^2)}=$$
$$=0,022977$$
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 0.0000017266 | 0.0000017266 | 4337.6248414089 | 0 |
| Waste | 13 | 5.2e-9 | 3.98e-10 |
Table 4.1.37: ANOVA table
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | -0.0000195813 | 0.0000073316 | -2.6708098938 | 0.0192346319 |
| Concentration | 0.0004706666 | 0.0000071464 | 65.8606471378 | 0 |
Table 4.1.38: Coefficients
In the next section, we will describe Fieller’s method.
4.1.10.3.4 Uncertainty due to the calibration curve: Fieller Method
The uncertainty due to the calibration curve, as stated in the statistical model for calibration curve section, in practice we are interested in predicting the value of concentration X, given an observation in Area (Y). With this we obtain:
$$\widehat{x}_0=\dfrac{\widehat{y}_0-\widehat{\beta_0}}{\widehat{\beta_1}}$$
which is a ratio of two random variables with normal distribution (for more details see Normal distribution), that is, $\widehat{y_0}-\widehat{\beta_0}$ has a normal distribution with a mean $\beta_1 x_0$ and variance $\dfrac{\sigma^2~x^2_0}{S _{xx}}$ and $\widehat{\beta_1}$ has a normal distribution with a mean $\beta_1$ and variance $\dfrac{\sigma^2}{S _{xx}}.$ When we standardize these two random variables, we obtain two standard normal random variables, that is, $W,V\sim N(0,1).$ Therefore, the ratio of these two random variables will have a Cauchy distribution (for more details see the content of the Cauchy distribution), which does not have mean and variance, which would make it impossible to calculate the uncertainty due to the calibration curve. However, we will use a result that will allow us to calculate the uncertainty due to the calibration curve, which is Fieller’s theorem.
Fieller’s theorem is a general result for confidence intervals of the ratio of two normally distributed random variables.
Let the random variable be $\rho=\dfrac{\beta_0}{\beta_1},$ in which $\beta_0$ and $\beta_1$ are estimated by $\widehat{\beta_0}$ and $\widehat{\beta_1}$ and these estimators are normally distributed with means $\beta_0,~\beta_1$ and variances $\hbox{Var}(\beta_0)$ and $\hbox{Var}(\beta_1)$ respectively. We consider $\psi=\widehat{\beta_0}-\rho \widehat{\beta_1}.$
With that, how $\widehat{\beta_0},$ and $~\widehat{\beta_1}$ are unbiased estimators of $\beta_0$ and $\beta_1,$ we have to
$$\mathbb{E}(\psi)=\beta_0-\rho\beta_1\quad \hbox{e}$$
$$\hbox{Var}(\psi)=\hbox{Var}(\widehat{\beta_0})+\hbox{Var}(\rho\widehat{\beta_1})-2\hbox{Cov}(\widehat{\beta_0},\rho\widehat{\beta_1}) \tag{1.10.3.4.1}$$
Let’s suppose that $\psi$ is normally distributed and
$$\dfrac{\widehat{\beta_0}-\rho\widehat{\beta_1}}{\hbox{Var}(\psi)}$$
has a standard normal distribution. Now, let us look at the following inequality,
$$|\widehat{\beta_0}-\rho \widehat{\beta_1}|\leq z_{\alpha/2}\sqrt{\hbox{Var}(\psi)}$$
We square it on both sides and set it equal to zero.
$$\widehat{\beta_0}^2+\rho^2\widehat{\beta_1}^2-2\rho\widehat{\beta_0}\widehat{\beta_1}-z^2_{\alpha/2}\hbox{Var}(\psi)=0$$
We replace $\hbox{Var}(\psi)$ by (1.10.3.4.1), with this we obtain
$$\widehat{\beta_0}^2+\rho^2\widehat{\beta_1}^2-2\rho\widehat{\beta_0}\widehat{\beta_1}-z^2_{\alpha/2}(\hbox{Var}(\widehat{\beta_0})+\hbox{Var}(\widehat{\beta_1})-2\rho\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1}))=0$$
To facilitate notation, we substitute $\hbox{Var}(\widehat{\beta_0})=v_1,$ $\hbox{Var}(\widehat{\beta_1})=v_2,$ $\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})=v_{12}$ and $z_{\alpha/2}=w.$ With this, we have to
$$\widehat{\beta_0}^2+(\widehat{\rho}\widehat{\beta_1})^2-2\widehat{\rho}\widehat{\beta_0}\widehat{\beta_1}-w^2 v_1-\widehat{\rho}^2 w^2 v_2+2\widehat{\rho} w^2 v_{12}=0$$
$$(\widehat{\beta_1}^2-w^2 v_2)\widehat{\rho}^2-(2\widehat{\beta_0}\widehat{\beta_1}-2w^2 v_{12})\widehat{\rho}+(\widehat{\beta_0}^2-w^2 v_1)=0$$
Therefore, this expression is a quadratic equation of the type $ a \rho^2 + b \rho + c = 0 $ (Bhaskara). We then solve this equation as follows:
$$\Delta=4(2\widehat{\beta_0}\widehat{\beta_1}-2w^2 v_{12})^2-4(\widehat{\beta_1}^2-w^2 v_2)(\widehat{\beta_0}^2-w^2 v_1)$$
$$=4 w^2(w^2 v^2_{12}-w^2v_1 v_2+\beta_0^2 v_2+\beta_0^2 v_1-2\beta_0\beta_1v_{12})$$
Therefore, the solution to $\widehat{\rho}$ is given by
$$\widehat{\rho}=\dfrac{\widehat{\beta_0}\widehat{\beta_1}-w^2 v_{12}}{\widehat{\beta_1}^2-w^2 v_2}\pm\dfrac{w}{\widehat{\beta_1}^2-w^2 v_2}\sqrt{w^2 v^2_{12}-w^2v_1 v_2+\beta_0^2 v_2+\beta_1^2 v_1-2\beta_0\beta_1v_{12}}$$
We return to the original notations and arrive at the following expression:
$\widehat{\rho}=\gamma_1\pm\gamma_2\sqrt{\left(z_{\alpha/2}\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})\right)^2 -z^2_{\alpha/2} \hbox{Var}(\widehat{\beta_0}) \hbox{Var}(\widehat{\beta_1})+\beta^2_0 \hbox{Var}(\widehat{\beta_1})+\beta^2_1 \hbox{Var}(\widehat{\beta_0})-2\beta_0\beta_1\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})}$
in which
$$\gamma_1=\dfrac{\widehat{\beta_0}\widehat{\beta_1}-z^2_{\alpha/2} \hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})}{\widehat{\beta_1}^2-z^2_{\alpha/2} \hbox{Var}(\widehat{\beta_1})}\quad\hbox{e}\quad \gamma_2=\dfrac{z_{\alpha/2}}{\widehat{\beta_1}^2-z^2_{\alpha/2} \hbox{Var}(\widehat{\beta_1})}$$
The two roots of the quadratic equation are the confidence limits 100(1-$\alpha$)% for $\rho,$ which is the Fieller method. Now let’s calculate the variance for $\widehat{x}_0=\dfrac{\widehat{y}_0-\widehat{\beta_0}}{\widehat{\beta_1}}.$ To do this, we will adapt the result obtained to $\widehat{\rho}.$ So we just swap $\widehat{\beta_0}$ by $\widehat{y}_0-\widehat{\beta_0}.$ But to do this, let’s do some calculations:
$$\hbox{Var} (\widehat{y} _0 - \widehat{\beta} _0) = \hbox{Var} (\widehat{y} _0) + \hbox{Var} (\widehat{\beta} _0) - 2 \hbox{Cov} (\widehat{y} _0 , \widehat{\beta} _0) \tag{1.10.3.4.2} $$
However, we have
$$\hbox{Cov}(\widehat{y}_0,\widehat{\beta_0})=\mathbb{E}(\widehat{y}_0\widehat{\beta_0})-\mathbb{E}(\widehat{y}_0)\mathbb{E}(\widehat{\beta_0})\quad \tag{1.10.3.4.3}$$
We now calculate
$$\mathbb{E}(\widehat{y}_0\widehat{\beta_0})=\mathbb{E}(\widehat{\beta}^2_0+\widehat{\beta_0}\widehat{\beta_1} x_0)=\mathbb{E}(\widehat{\beta}^2_0)+\mathbb{E}(\widehat{\beta_0}\widehat{\beta_1})x_0=\hbox{Var}(\widehat{\beta_0})+\mathbb{E}^2(\widehat{\beta_0})+\mathbb{E}(\widehat{\beta_0}\widehat{\beta_1})x_0$$
We go back to (1.10.3.4.3) and get
$$\hbox{Cov}(\widehat{y}_0,\widehat{\beta_0})=\hbox{Var}(\widehat{\beta_0})+\mathbb{E}^2(\widehat{\beta_0})+\mathbb{E}(\widehat{\beta_0}\widehat{\beta_1})x_0-\mathbb{E}^2(\widehat{\beta_0})-\mathbb{E}(\widehat{\beta_0})\mathbb{E}(\widehat{\beta_1}) x_0=$$
$$=\hbox{Var}(\widehat{\beta_0})+\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})x_0$$
Now we go back to (1.10.3.4.2) and get
$$\hbox{Var}(\widehat{y}_0-\widehat{\beta_0})=\hbox{Var}(\widehat{y}_0)+\hbox{Var}(\widehat{\beta_0})-2\hbox{Var}(\widehat{\beta_0})-2\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})x_0=$$
$$=\hbox{Var}(\widehat{y}_0)-\hbox{Var}(\widehat{\beta_0})-2\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})x_0$$
It is worth remembering that
$$\hbox{Cov}(\widehat{y}_0-\widehat{\beta_0},\widehat{\beta_1})=\hbox{Cov}(\widehat{y}_0,\widehat{\beta_1})-\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})=\hbox{Cov}(\widehat{\beta_0}+\widehat{\beta_1} x_0,\widehat{\beta_1})-\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})=$$
$$=\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})+\hbox{Cov}(\widehat{\beta_1},\widehat{\beta_1}) x_0-\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})=\hbox{Var}(\widehat{\beta_1}) x_0$$
So, we have to
$$u(\widehat{x} _0)=\gamma_1\pm\gamma_2\left(\left(z_{\alpha/2}\hbox{Var}(\widehat{\beta} _1) x_0\right)^2 -z^2_{\alpha/2}\hbox{Var}(\widehat{y}_0)\hbox{Var}(\widehat{\beta}_1)+z^2_{\alpha/2}\hbox{Var}(\widehat{\beta}_0)\hbox{Var}(\widehat{\beta}_1)+\right.$$
$$+2z^2_{\alpha/2}\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})\hbox{Var}(\widehat{\beta_1})x_0+\widehat{\beta}^2_0\hbox{Var}(\widehat{\beta_1})+\widehat{\beta}^2_1\hbox{Var}(\widehat{y}_0)-\widehat{\beta}^2_1\hbox{Var}(\widehat{\beta_0})$$
$$\left.-2\widehat{\beta}^2_1\hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})x_0-2\widehat{\beta_0}\widehat{\beta_1}\hbox{Var}(\widehat{\beta_1}) x_0\right)^{1/2}$$
We replace the previous equation with the values:
$$\hbox{Var}(\widehat{\beta_1})=\dfrac{\hbox{QME}}{S _{xx}}, \quad\hbox{Var}(\widehat{\beta_0})=\hbox{QME}\left(\dfrac{1}{n}+\dfrac{\overline{x}^2}{S _{xx}}\right)\quad \hbox{e}\quad \hbox{Cov}(\widehat{\beta_0},\widehat{\beta_1})=-\dfrac{\overline{x}\hbox{QME}}{S _{xx}}$$
and with some algebraic manipulations we obtain that
$$V(\widehat{x}_0)=\dfrac{\widehat{\beta}_0 \widehat{\beta}_1+ \overline{x}g}{(\widehat{\beta}^2_1-g)}\pm\dfrac{z_{\alpha/2}}{(\widehat{\beta}^2_1-g)}\sqrt{2g \dfrac{\hbox{QME}}{S _{xx}}\overline{x}\widehat{x}_0+\hbox{QME}\dfrac{\widehat{y}^2_0}{S _{xx}}}$$
in which $g=\dfrac{z^2_{\alpha/2}~\hbox{QME}}{S _{xx}}.$ When g is zero for $V(\widehat{x}_0)$ , we have the limits for $\widehat{\rho}(\widehat{x}_0).$ With this we have to
$$V(\widehat{x} _0)=\widehat{\rho}\pm\dfrac{z_{\alpha/2}}{\widehat{\beta}^2 _1}\sqrt{\hbox{QME}\dfrac{\widehat{y}^2 _0}{S _{xx}}}$$
Now, notice that
$$-\dfrac{z_{\alpha/2}}{\widehat{\beta}^2_1}\sqrt{\hbox{QME}\dfrac{\widehat{y}^2_0}{S _{xx}}}\leq \dfrac{\widehat{\beta_0}}{\widehat{\beta_1}}\leq\dfrac{z_{\alpha/2}}{\widehat{\beta}^2_1}\sqrt{\hbox{QME}\dfrac{\widehat{y}^2_0}{S _{xx}}}$$
We multiply the inequality by -1 and add $\dfrac{\widehat{y}_0}{\widehat{\beta_1}},$ we get that
$$\dfrac{\widehat{y} _0}{\widehat{\beta} _1}- \dfrac{z _{\alpha/2}}{\widehat{\beta}^2 _1}\sqrt{\hbox{QME} \dfrac{\widehat{y}^2 _0}{S _{xx}}}\leq \dfrac{\widehat{y} _0}{\widehat{\beta} _1}- \dfrac{\widehat{\beta} _0}{\widehat{\beta} _1}\leq \dfrac{\widehat{y} _0}{\widehat{\beta} _1}+\dfrac{z _{\alpha/2}}{\widehat{\beta}^2 _1}\sqrt{\hbox{QME} \dfrac{\widehat{y}^2 _0}{S _{xx}}}$$
So, we have to
$$\dfrac{\widehat{y} _0}{\widehat{\beta}_1}-\dfrac{z_{\alpha/2}}{\widehat{\beta}^2_1}\sqrt{\hbox{QME}\dfrac{\widehat{y}^2_0}{S _{xx}}}\leq\widehat{x}_0 \leq\dfrac{\widehat{y}_0}{\widehat{\beta}_1}+\dfrac{z_{\alpha/2}}{\widehat{\beta}^2_1}\sqrt{\hbox{QME}\dfrac{\widehat{y}^2_0}{S _{xx}}}$$
Therefore, the standardized uncertainty due to the calibration curve is given by:
$$u(\widehat{x}_0)=\dfrac{\widehat{y}_0+\widehat{\beta_1}}{\widehat{\beta_1}}\sqrt{\dfrac{\hbox{QME}}{\widehat{\beta}^2_1} \dfrac{\widehat{y}^2_0}{S _{xx}\widehat{\beta}^2_1}}$$
Example 1.10.3.4.1:
We return to the example of Motivation 2. We have already calculated:
- $\overline{x} = 0,73 $
- $S _{xx} = 7,794$
- $\widehat{\beta_1} = 0,00047$
- $\widehat{\beta_0}=-1,958\times 10^{-5}$
- $QME = 3,98 \times 10^{-10}$
- $\widehat{y}_0=0,000451085$
Suppose, $\hat{x}_0 = 1,$ Therefore, the uncertainty due to the calibration curve using the Fieller method is given by
$$u(\widehat{x}_0)=\dfrac{\widehat{y}_0+\widehat{\beta_1}}{\widehat{\beta_1}}\sqrt{\dfrac{\hbox{QME}}{\widehat{\beta}^2_1} \dfrac{\widehat{y}^2_0}{S _{xx}\widehat{\beta}^2_1}} = \dfrac{0,000451085 + 0,00047}{0,00047} \sqrt{\dfrac{3,98\times10^{-5}}{0,00047^2} \dfrac{0,000451085^2}{7,794 \times 0,00047^2}}$$ $$= 9,04328$$
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 0.0000017266 | 0.0000017266 | 4337.6248414089 | 0 |
| Waste | 13 | 5.2e-9 | 3.98e-10 |
Table 4.1.39: ANOVA table
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | -0.0000195813 | 0.0000073316 | -2.6708098938 | 0.0192346319 |
| Concentration | 0.0004706666 | 0.0000071464 | 65.8606471378 | 0 |
Table 4.1.40: Coefficients
4.1.10.3.5 Comparison between methods for uncertainty due to the calibration curve
The inverse linear regression model was applied to evaluate the uncertainty in the determination of chemical compounds based on the construction of a calibration curve for different concentration levels. In the previous sections we used five methods to determine the uncertainty due to the calibration curve $u(\widehat{x}_0)$ and they are:
-
Naive Method;
-
MGQ Method (Quality Assurance Manual);
-
Mean response confidence interval projection method;
-
Delta Method;
-
Fieller Method.
In this section we will make a comparison between the four application methods obtained in section 4.1.10 (ICP - Optical emission spectrometer).
| Concentration | Adjusted Area | u (English) | u (MGQ) | u (Proj) | u (delta) | u (Fieller) |
|---|---|---|---|---|---|---|
| 0,05 | 0,000004 | 0,04239 | 0,04521 | 0,0157 | 0,0318 | 0,00011 |
| 0,1 | 0,000027 | 0,04239 | 0,04508 | 0,0153 | 0,0314 | 0,00083 |
| 0,25 | 0,000098 | 0,04239 | 0,04474 | 0,0143 | 0,0303 | 0,00339 |
| 0,5 | 0,000216 | 0,04239 | 0,04438 | 0,0132 | 0,0286 | 0,00899 |
| 1 | 0,000451 | 0,04239 | 0,04442 | 0,0133 | 0,0263 | 0,0253 |
| 2 | 0,000922 | 0,04239 | 0,04746 | 0,0213 | 0,0266 | 0,078 |
| 3 | 0,001392 | 0,04239 | 0,05379 | 0,0331 | 0,0329 | 0,16 |
| 5 | 0,002334 | 0,04239 | 0,07253 | 0,0589 | 0,0541 | 0,40 |
Table 4.1.41: Summary of uncertainties due to the calibration curve for all methods.
We compared the uncertainties obtained in Table 4.1.41, and noted that the naive (Ing) and quality assurance manual (MGQ) methods are very close at concentrations up to 1 μg/mL, compared to the other methods. It is worth remembering that the naive method (for more details see statistical model for calibration curve) is given by the formula:
$$u(\widehat{x}_0)=\dfrac{\sqrt{\hbox{QME}}}{\widehat{\beta_1}}$$
and this method keeps uncertainty constant for any concentration level.
At concentrations up to 0.5 μg/mL, the Fieller method has lower uncertainty and grows linearly as we increase concentration levels. The delta and MGQ methods have small variations over the concentration levels adopted, while the projection method (Proj) grows linearly as we increase the concentration levels, but with less intensity compared to the Fieller method.
In summary, we note that the Fieller method, for low concentration levels, has low uncertainty, while for high concentration levels the uncertainty is much greater compared to the other methods.
Uncertainty regarding concentration levels (%)
| Concentration | u (English) | u (MGQ) | u (Proj) | u (delta) | u (Fieller) |
|---|---|---|---|---|---|
| 0,05 | 84,78 | 90,42 | 31,44 | 63,66 | 0,23 |
| 0,1 | 42,39 | 45,08 | 15,34 | 31,44 | 0,83 |
| 0,25 | 16,96 | 17,90 | 5,73 | 12,12 | 1,36 |
| 0,5 | 8,48 | 8,88 | 2,63 | 5,73 | 1,80 |
| 1 | 4,24 | 4,44 | 1,33 | 2,63 | 2,53 |
| 2 | 2,12 | 2,37 | 1,07 | 1,33 | 3,90 |
| 3 | 1,41 | 1,79 | 1,10 | 1,10 | 5,25 |
| 5 | 0,85 | 1,45 | 1,18 | 1,08 | 7,95 |
Table 4.1.42: Uncertainties in percentage in relation to concentration levels.
Table 4.1.42 shows us the percentage of uncertainty due to the calibration curve in relation to concentration levels. From this table, we obtain that the uncertainty for low concentration levels is very high. For example, let’s look at the concentration level of 0.05 μg/mL. The highest uncertainty is that obtained by the manual quality assurance (MGQ) method. The mean response confidence interval projection (Proj) method, although with lower uncertainty than the MGQ, delta and naive methods, still has around 32% in relation to the concentration of 0.05 μg/mL. When comparing the uncertainty obtained by the Fieller method with the others, we observed that it is the most suitable for uncertainties with low concentration levels. The other methods decrease as we increase concentration levels (Table 4.1.42), while the Fieller method increases. Another argument favoring Fieller’s method is that $\widehat{x}_0=\dfrac{\widehat{y}_0-\widehat{\beta_0}}{\widehat{\beta_1}}$ is the ratio of two random variables with normal distribution and this method takes this assumption into account. Unlike other methods that do not use this assumption. Therefore, the Fieller method is the most plausible method for calculating the uncertainty due to the calibration curve.
4.1.11 Weighted Linear Regression
In many cases, when analyzing the residuals of the linear regression model, we can conclude that the variance of the experimental errors is not constant over the value adjusted by the model. In this case, one of the assumptions of the regression model is not met. When this happens, we say that the model presents heteroscedasticity in errors, or even that the model is heteroscedastic. Some effects caused by this flaw in the model assumption are:
-
The standard errors of the estimators, obtained by the Ordinary Least Squares Method, are incorrect and therefore the statistical inference is not valid.
-
We can no longer say that Ordinary Least Squares Estimators are the best minimum variance estimators for $\beta$, although they may still be non-addicted.
The curious fact about heteroscedasticity is that ordinary least squares estimators are unbiased. However, the variance of these estimators is incorrect. To prove that the variance is incorrect, we take the simple linear regression model
$$Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i$$
in which $\varepsilon_i$ are uncorrelated random variables with zero mean and variance $\sigma^2_i$ for everyone $i=1, \cdots , n$. We know that least squares estimators are given by
$$\hat{\beta_1} = \frac{Sxy}{Sxx} = \frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x}) y_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2}$$
In this way, we obtain that
$$\mathbb{E} [\hat{\beta_1}] = \mathbb{E} \left[ \frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x}) Y_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} \right] =\beta_0 \mathbb{E} \left[ \frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x})}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} \right] + \beta_1 \mathbb{E} \left[\frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x}) x_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2 } \right] + \mathbb{E} \left[ \frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x}) \varepsilon_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2 } \right]=\beta_1$$
Therefore, we conclude that the least squares estimates are unbiased. On the other hand, we have to
$$Var [\hat{\beta_1}] = Var \left[ \frac{\displaystyle\sum_{i=1}^n (x_i - \bar{x}) y_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} Y_i\right] = \sum_{i=1}^n Var \left[ \frac{ (x_i - \bar{x}) Y_i}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} \right] = \sum_{i=1}^n \left[ \frac{ (x_i - \bar{x})}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} \right]^2 Var[Y_i]=\sum_{i=1}^n \left[ \frac{ (x_i - \bar{x})}{\displaystyle\sum_{i=1}^n (x_i - \bar{x})^2} \right]^2 \sigma^2_i$$
Thus, the variance of the least squares estimate depends on the variance of the experimental errors, which makes it unfeasible to obtain estimates for such variance without some additional hypothesis.
Suppose that the variance of the experimental error is not constant, but can be represented in the form $Var (\varepsilon ) = \sigma^2 V$ in which $V$ is a known diagonal matrix and $\varepsilon=(\varepsilon_1, \cdots , \varepsilon_n)^\top$ the vector of experimental errors. In this case, we have that the observations are uncorrelated but have distinct variances. As we presented above, least squares estimators are not appropriate, as we cannot guarantee that they are of minimum variance among all unbiased. The idea is to transform the observations so that we can apply the ordinary least squares method. Consider the linear model
$$Y=X\beta + \varepsilon$$
in which $Y$ is the vector of observations, $X$ the matrix of independent variables, $\beta = (\beta_0 , \beta_1)^\top$ the parameter vector and $\varepsilon$ the vector of experimental errors. Since $\sigma^2 V$ is the covariance matrix of the experimental error vector, we know that $V$ is a non-singular, positive definite matrix. Then there is a non-singular and symmetric matrix $K_{(n \times n)}$ such that $K^\top K =V$. The matrix $K$ is called the square root of $V$. We define the new variables
$$Z=K^{-1} Y, \quad B=K^{-1} X, \quad \eta = K^{-1} \varepsilon$$
In this way, we obtain that
$$Z=K^{-1} Y = B \beta + \eta $$
The experimental error $\eta$ in the transformed model satisfy
$$Var(\eta) = \mathbb{E} \left[ \left( \eta - \mathbb{E}(\eta) \right) \left( \eta - \mathbb{E}(\eta) \right)^\top\right] = \mathbb{E} \left( \eta ~ \eta^\top\right)$$
$$ = \mathbb{E} \left( K^{-1} \varepsilon ~ \varepsilon^\top \left(K^{-1})^\top\right)=K^{-1} \mathbb{E} \left( \varepsilon ~ \varepsilon^\top \right) (K^\top) \right)^{-1}$$
$$=\sigma^2 K^{-1} V \left(K^\top\right)^{-1} = \sigma^2 K^{-1} KK^\top (\left(K^\top\right))^{-1} = \sigma^2 I.$$
and
$$\mathbb{E}(\eta)=\mathbb{E}(K^{-1}\varepsilon)= K^{-1}\left\lbrace\mathbb{E}(Z)-B\mathbb{E}(\widehat{\beta})\right\rbrace= K\left\lbrace\mathbb{E}(Y)-X\mathbb{E}(\widehat{\beta})\right\rbrace=0$$
Therefore, the elements of $\eta$ have zero mean, are uncorrelated and have constant variance. Thus, the experimental error $\eta$ satisfies the usual hypotheses for applying the ordinary least squares method. This argument guarantees us that we know the form of the heteroscedasticity of the convariance matrix of the experimental error vector $V$, we can transform the linear model so that it meets the usual hypotheses for applying the ordinary least squares method.
Motivation 3
Consider the experiment to determine the calibration curve for a given asset. Below we present the data:
| Area | Concentration |
|---|---|
| 0,078 | 0 |
| 1,329 | 0 |
| 0,483 | 0 |
| 0,698 | 0 |
| 0,634 | 0 |
| 0,652 | 0 |
| 0,071 | 0 |
| 20,718 | 25 |
| 21,805 | 25 |
| 16,554 | 25 |
| 19,948 | 25 |
| 21,676 | 25 |
| 22,207 | 25 |
| 19,671 | 25 |
| 33,833 | 50 |
| 34,726 | 50 |
| 35,463 | 50 |
| 34,04 | 50 |
| 34,194 | 50 |
| 33,664 | 50 |
| 34,517 | 50 |
| 79,224 | 100 |
| 73,292 | 100 |
| 85,514 | 100 |
| 82,072 | 100 |
| 85,044 | 100 |
| 73,876 | 100 |
| 82,568 | 100 |
| 108,065 | 150 |
| 118,268 | 150 |
| 108,89 | 150 |
| 127,183 | 150 |
| 121,447 | 150 |
| 122,414 | 150 |
| 135,555 | 150 |
| 224,932 | 250 |
| 200,113 | 250 |
| 200,368 | 250 |
| 205,17 | 250 |
| 213,059 | 250 |
| 207,931 | 250 |
| 201,766 | 250 |
| 371,534 | 500 |
| 408,86 | 500 |
| 383,509 | 500 |
| 405,143 | 500 |
| 404,132 | 500 |
| 379,243 | 500 |
| 387,419 | 500 |
Table 4.1.43: Motivation 3 sample data
Consider the calibration model given by
$$Y_{ij} = \beta_0 + \beta_1 x_{ij} + \varepsilon_{ij}$$
in which $j=1, \cdots , n_i$ and $i=1, \cdots , k$. As a usual hypothesis of linear models, we admit that $\varepsilon_{ij}$ are iid random variables with constant variance $\sigma^2$. We adjusted the linear regression model, with the computational support of the Action software, for which we obtained the following graph of the residual analysis:
Figure 4.1.17: Analysis of model homoscedasticity.
It is worth remembering that the assumptions for applying the least squares method are that the errors are uncorrelated and with constant variances, that is, the model is homoscedastic. When evaluating the graph of residuals versus adjusted values, we can see signs of heteroscedasticity. Note that the residual graph for the adjusted value has a funnel shape.
When evaluating homoscedasticity, we expect that this graph presents its points arranged randomly around the line drawn at 0. As the graph has a funnel shape, we have evidence that the errors do not have constant variances, in this case we say that the model presents heteroscedasticity in the errors. The evaluation of the hypothesis of homoscedasticity of the variance of experimental errors can be carried out through appropriate hypothesis tests such as Cochran, Brown-Forsyte (Levene), Breusch-Pagan and Goldfeld-Quandt. To do this, we tested the following hypotheses:
$$\begin{cases} H_0:\sigma^2_1=\sigma^2_2 = … =\sigma^2_k \cr H_1:~\hbox{pelo menos um dos} \ \sigma_i^2 \ \hbox{diferente,} \quad i=1,\ldots,k. \end{cases}$$
Next, with the help of the Action software, we will evaluate homoscedasticity through hypothesis tests:
| Statistics | Number of Replicas | P-value |
|---|---|---|
| 0.51051508 | 7 | 0.00099733 |
Table 4.1.44: Homoscedasticity Test - Cochran
| Variable | Statistics | G.L.Num. | G.L. Den. | P-value |
|---|---|---|---|---|
| group | 5.76046332 | 6 | 42 | 0.00019229 |
Table 4.1.45: Homoscedasticity Test (Brown-Forsythe)
| Statistics | GL | P-value |
|---|---|---|
| 12.81922038 | 1 | 0.00034308 |
Table 4.1.46: Homoscedasticity Test - Breusch Pagan
| Variable | Statistics | GL1 | GL2 | P-value |
|---|---|---|---|---|
| Concentration | 37.8362623 | 18 | 17 | 5.765522e-10 |
Table 4.1.47: Homoscedasticity Test - Goldfeld Quandt
From the results, we note that for all statistics used we reject the null hypothesis $H_0$, that is, the model is heteroscedastic at the 5% significance level ($\alpha=0,05$). When we test the homoscedasticity hypothesis and it is rejected, then we have a heteroscedastic model. To overcome the flaw in the assumption of the linear regression model, we describe the estimation by Weighted Least Squares.
Statistical Model
At this point, we consider the simple linear regression model and we will denote by $\sigma_i^2$ the variance related to the ith error $\varepsilon_i,$,The model assumption is that $\varepsilon_i \sim N(0,\sigma_i)$ and are independent. Note that we are considering that the variance $\sigma_i^2$ depends on the ith observation, and may not be constant throughout the observations. The model described is of the form:
$$Y_i=\beta_{w0} + \beta_{w1}X_i + \varepsilon_i \tag{1.11.1}$$
in which,
-
$Y_i$ is the ith observation of the response variable;
-
$X_i$ is the ith observation of the constant and known covariate;
-
$\beta_{w0}$ and $\beta_{w1}$ are the unknown parameters of the regression;
-
$\varepsilon_i$ is the ith error, we consider $\varepsilon_i \sim N(0,\sigma_i^2)$ for $i=1,2,\dots,n$ and $n$ is the number of observations.
With these assumptions, the covariance matrix is defined in the form $\sigma^2 V$, in which the elements of the diagonal of $V$ are given by $\sigma^2_i / \sigma^2$. The main idea is to obtain estimators for the regression parameters so that they are consistent and have minimum variance. In this way, the inference about the model becomes valid. To treat this case, we assume that the matrix $V$ is “known” and thus, we know that the transformed model $Z = B \beta + \eta$ satisfy the assumptions of the simple linear regression model. From this, we know that ordinary least squares estimators are consistent and have minimum variance.
As stated, we will introduce the principles of weighted least squares estimators, in which we must consider that each of the $n$ observations may not generate the same variability in residuals. To determine the weight that each observation will have on the estimators, we use the idea that the weight attributed to an observation is inversely proportional to the variance of the residue related to it, in other words, we consider that observations that cause greater variability in the residues have less reliability in terms of inference for the parameters of the regression function. Similarly, observations with lower variance are more reliable. In practice, we have several ways of considering weights, if we have information that the variance is directly proportional to the independent variable ($X$), we can take as weight $1/x$.
In the example above, we have $7$ replicas of each concentration point. In the case of replicas or “almost replicas” we use the inverse of the variance of each point as weight. When we denote by $s_i^2$ the variance of the point, we define the weight by
$$w_i = \frac{1}{s^2_i} \quad \hbox{e} \quad w_i = k \frac{1/s^2_i}{\sum_{i=1}^k 1 / s^2_i}$$
in which $i=1, \cdots ,k$ and $k$ is the number of points.
4.1.11.1 Weighted linear regression model
Let’s consider a linear regression model in which the error variance is not constant, but the errors are uncorrelated. The error convariance matrix is given by $\sigma^2 V$ in which $V$ is a diagonal and positive definite matrix.
In the previous section, we had a good discussion about the need for weighting, applied to cases in which we detected heteroscedasticity. The model is described in the form:
$$K^{-1}Y_i=K^{-1}\beta_{0} + K^{-1}\beta_{1}X_i + K^{-1}\varepsilon_{i}$$
$$Z_{i}=\beta_{0w} + \beta_{1w}B_{i} + \eta_{i}\tag{1.11.1}$$
in which,
- $Y_i$ is the ith observation of the response variable;
- $X_i$ is the ith observation of the constant and known covariate;
- $\beta_{w0}$ and $\beta_{w1}$ are the unknown parameters of the regression;
- $\eta_{i}$ is the ith error, we consider $\eta_{i} \sim N(0,\sigma^2 V)$ for $i=1,2,\dots,n$ and $n$ is the number of observations.
As presented in the “Weighted Linear Regression” section, when denoting by $K$ the square root of $V$ $(K^\top K =V)$, we know that the model $Z = B \beta + \eta$, in which $Z=K^{-1} Y$, $B = K^{-1} X$ and $\eta = K^{-1} \varepsilon$, satisfy the usual assumptions of the linear regression model. Thus, least squares estimates are consistent and of minimum variance.
4.1.11.2 Estimation of model parameters
To estimate the parameters of the heteroscedastic linear regression model, we take the least squares function by
$$Q_w=\displaystyle\sum^n_{i=1}\eta^2_{i}= \sum_{i=1}^{n} w_i\left( Y_i-\left(\beta_{w0}+\beta_{w1}X_i\right) \right)^2$$
which is the sum of the deviations weighted by $w_i$. In the regression model we admit that the vector of experimental errors has a covariance matrix given by $\sigma^2 V$. So, we have to $V$ is a diagonal matrix with diagonal elements given by $1/w_i$.
The estimators $\widehat{\beta_{w0}}$ and $\widehat{\beta_{w1}}$ that minimize the least squares function are known as weighted least squares estimators. We note that these estimators coincide with the ordinary least squares estimators presented in the previous sections (for more details see Estimation of Model Parameters) when we consider the assumption of homoscedasticity, which implies weights $(w_{i})$ equal.
Observations with higher variance have less influence on the estimators. $\beta_{w0}$ and $\beta_{w1}$, and those with lower variance have more influence. This is due to the fact that observations with lower variance present more pertinent information regarding the $\mathbb{E}[Y|X_i],~~i=1,\dots,n.$
We calculate the weighted least squares estimators by deriving $Q_w$ in relation to the parameters and equaling zero to obtain the minimum point, that is:
$$ \dfrac{\partial Q_w}{\partial \beta_{w0}} = 2\displaystyle \sum_{i=1}^{n} w_i\left(Y_i - \left( \beta_{w0} +\beta_{w1}X_i \right) \right)=2\displaystyle \sum_{i=1}^{n} w_i Y_i -2\beta_{w0}\displaystyle \sum_{i=1}^{n}w_i -2\beta_{w1}\displaystyle \sum_{i=1}^{n}w_iX_i=0$$
$$ \dfrac{\partial Q_w}{\partial \beta_{w1}} = 2\displaystyle \sum_{i=1}^{n} w_i\left(Y_i - \left( \beta_{w0} +\beta_{w1}X_i \right) \right)X_i=2\displaystyle \sum_{i=1}^{n} w_i Y_i X_i -2\beta_{w0}\displaystyle \sum_{i=1}^{n}w_iX_i -2\beta_{w1}\displaystyle \sum_{i=1}^{n}w_i{X_i}^2=0$$
In this way, we obtain the system:
$$\begin{cases}\displaystyle \sum_{i=1}^{n} w_iY_i = \beta_{w0} \displaystyle \sum_{i=1}^{n}w_i + \beta_{w_{w1}} \displaystyle \sum_{i=1}^{n} w_iX_i \cr \displaystyle \sum_{i=1}^{n} w_iY_iX_i = \beta_{w0} \displaystyle \sum_{i=1}^{n}w_iX_i + \beta_{w1} \displaystyle \sum_{i=1}^{n} w_i{X_i}^2 \end{cases}$$
Therefore, the solution of the equations is given by:
$$\beta_{w0}= \dfrac { \displaystyle\displaystyle \sum_{i=1}^{n} w_i Y_i - \beta_{w1} \displaystyle\displaystyle \sum_{i=1}^{n} w_i X_i }{ \displaystyle\displaystyle \sum_{i=1}^{n} w_i}\quad \hbox{e}\quad\beta_{w1} = \dfrac{\displaystyle \displaystyle \sum_{i=1}^{n} w_iY_iX_i - \dfrac{\displaystyle \displaystyle \sum_{i=1}^{n}w_iY_i \displaystyle \displaystyle \sum_{i=1}^{n}w_iX_i }{ \displaystyle \displaystyle \sum_{i=1}^{n} {w_i}}}{ \displaystyle \displaystyle \sum_{i=1}^{n} w_i{X_i}^2 - \dfrac{\left(\displaystyle \displaystyle \sum_{i=1}^{n} w_i X_i \right)^2}{\displaystyle \displaystyle \sum_{i=1}^{n} w_i}}$$
To facilitate notation, we denote $\overline{Y}_w=\dfrac{\displaystyle \sum_{i=1}^{n}w_i Y_i }{\displaystyle \sum_{i=1}^{n} w_i}$ and $\overline{X}_w = \dfrac{\displaystyle \sum_{i=1}^{n} w_i X_i}{\displaystyle \sum_{i=1}^{n} wi}$ the weighted averages of $Y$ and $X$, respectively. In order to facilitate the calculations, we will rewrite the weighted least squares estimator of $\beta_{w1}$ in the following way:
$\widehat{\beta} _{w1}=\dfrac{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X} _w)(Y_i - \overline{Y} _w) }{\displaystyle \sum_{i=1}^{n}w_i (X_i -\overline{X} _w)^2} =$
$$=\dfrac{\displaystyle \sum_{i=1}^n w_i X_i Y_i -\displaystyle \sum_{i=1}^{n} w_i X_i \overline{Y}_w -\displaystyle \sum_{i=1}^n w_i \overline{X}_w Y_i +\displaystyle \sum_{i=1}^n w_i\overline{X}_w \overline{Y}_w}{\displaystyle \sum_{i=1}^{n}w_i (X_i -\overline{X}_w)^2}=$$
$$=\dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i X_i - \displaystyle \sum_{i=1}^{n} w_i X_i \left( \dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i}{ \displaystyle \sum_{i=1}^{n} w_i } \right) - \displaystyle \sum_{i=1}^{n} w_i \overline{X}_w Y_i + \displaystyle \sum_{i=1}^{n} w_i \overline{X}_w \left( \dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i}{\displaystyle \sum_{i=1}^{n} w_i}\right) }{\displaystyle \sum_{i=1}^{n}w_i (X_i -\overline{X}_w)^2}=$$
$$=\dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i X_i - \dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i\displaystyle \sum_{i=1}^{n} w_i X_i}{ \displaystyle \sum_{i=1}^{n} w_i }- \displaystyle \sum_{i=1}^{n} w_i \overline{X}_w Y_i + \dfrac{\displaystyle \sum_{i=1}^{n} w_i \displaystyle \sum_{i=1}^{n}\overline{X}_w w_i Y_i}{\displaystyle \sum_{i=1}^{n} w_i} }{\displaystyle \sum_{i=1}^{n}w_i (X_i -\overline{X}_w)^2}=$$
$$= \dfrac{\displaystyle \sum_{i=1}^{n} w_i Y_i X_i - \displaystyle \sum_{i=1}^{n} w_iY_i \overline{X}_w - \displaystyle \sum_{i=1}^{n} w_i Y_i \overline{X}_w + \displaystyle \sum_{i=1}^{n} w_i Y_i \overline{X}_w}{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}$$
$$=\dfrac{\displaystyle \sum_{i=1}^{n} w_iY_iX_i -\displaystyle \sum_{i=1}^{n} w_i Y_i \overline{X}_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2 } = \dfrac{ \displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)Y_i }{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2} \tag{1.11.1.5}$$
Therefore, the weighted least squares estimators are given by:
$$\widehat{\beta_{w0}} = \overline{Y}_w - \widehat{\beta_{w1}}\overline{X}_w\quad \hbox{e}\quad \widehat{\beta_{w1}} = \dfrac{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w) Y_i }{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2 } $$
The values of $\widehat{\beta_{w0}}$ and $\widehat{\beta_{w0}}$ obtained are called Weighted Least Squares Estimators (EMQP).
The adjusted weighted simple linear regression model is given by
$$\widehat{Y_i}=\widehat{\beta_{w0}}+\widehat{\beta_{w1}}X_i\quad i=1,\dots,n$$
in which $\widehat{Y}$ is a point estimator of the mean of variable Y for a value of $x$, that is,
$$\widehat{\mathbb{E}(Y|X_i)}=\widehat{\beta_{w0}}+\widehat{\beta_{w1}}X_i,\quad i=1,\dots,n$$
Example 1.11.1.1
We return to the motivation, consider the calibration curve for the test of a certain chemical compound carried out by equipment called a Chromatograde. Next, we will calculate the parameter estimates $\beta_{w0}$ and $\beta_{w1}$ using the weighted least squares method. It is worth remembering that we are developing the theory, as if the variances were known, but to solve this example we will assume that the variances are unknown. With this, we will use the sample variance $s^2_i$ instead of $\sigma^2_i.$ Using the Action software, we obtain the weight values $1/s^2_i:$
From the results obtained from Action, we calculated $w_i=1/s^2_i=$ 1/Variance. With this, we obtain Table 4.1.48:
| n | Area $(Y_i)$ | Concentration $(X_i)$ | $w_i$ | $w_i X_i$ | $w_i Y_i$ | $V=(X_i-\overline{X}_w)$ | $w_i * V * Y_i$ | $w_i*V^2$ |
|---|---|---|---|---|---|---|---|---|
| 1 | 0.08 | 0 | 5.446476181 | 0.000 | 0.425 | -17.811 | -7.566 | 1727.748 |
| 2 | 1.33 | 0 | 5.446476181 | 0.000 | 7.238 | -17.811 | -128.921 | 1727.748 |
| 3 | 0.48 | 0 | 5.446476181 | 0.000 | 2.631 | -17.811 | -46.854 | 1727.748 |
| 4 | 0.70 | 0 | 5.446476181 | 0.000 | 3.802 | -17.811 | -67.710 | 1727.748 |
| 5 | 0.63 | 0 | 5.446476181 | 0.000 | 3.453 | -17.811 | -61.502 | 1727.748 |
| 6 | 0.65 | 0 | 5.446476181 | 0.000 | 3.551 | -17.811 | -63.248 | 1727.748 |
| 7 | 0.07 | 0 | 5.446476181 | 0.000 | 0.387 | -17.811 | -6.887 | 1727.748 |
| 8 | 20.72 | 25 | 0.266796416 | 6.670 | 5.527 | 7.189 | 39.738 | 13.789 |
| 9 | 21.81 | 25 | 0.266796416 | 6.670 | 5.817 | 7.189 | 41.823 | 13.789 |
| 10 | 16.55 | 25 | 0.266796416 | 6.670 | 4.417 | 7.189 | 31.752 | 13.789 |
| 11 | 19.95 | 25 | 0.266796416 | 6.670 | 5.322 | 7.189 | 38.262 | 13.789 |
| 12 | 21.68 | 25 | 0.266796416 | 6.670 | 5.783 | 7.189 | 41.576 | 13.789 |
| 13 | 22.21 | 25 | 0.266796416 | 6.670 | 5.925 | 7.189 | 42.594 | 13.789 |
| 14 | 19.67 | 25 | 0.266796416 | 6.670 | 5.248 | 7.189 | 37.730 | 13.789 |
| 15 | 33.83 | 50 | 2.647451047 | 132.373 | 89.571 | 32.189 | 2883.229 | 2743.149 |
| 16 | 34.73 | 50 | 2.647451047 | 132.373 | 91.935 | 32.189 | 2959.330 | 2743.149 |
| 17 | 35.46 | 50 | 2.647451047 | 132.373 | 93.887 | 32.189 | 3022.137 | 2743.149 |
| 18 | 34.04 | 50 | 2.647451047 | 132.373 | 90.119 | 32.189 | 2900.870 | 2743.149 |
| 19 | 34.19 | 50 | 2.647451047 | 132.373 | 90.527 | 32.189 | 2913.994 | 2743.149 |
| 20 | 33.66 | 50 | 2.647451047 | 132.373 | 89.124 | 32.189 | 2868.827 | 2743.149 |
| 21 | 34.52 | 50 | 2.647451047 | 132.373 | 91.382 | 32.189 | 2941.520 | 2743.149 |
| 22 | 79.22 | 100 | 0.040140331 | 4.014 | 3.180 | 82.189 | 261.368 | 271.151 |
| 23 | 73.29 | 100 | 0.040140331 | 4.014 | 2.942 | 82.189 | 241.798 | 271.151 |
| 24 | 85.51 | 100 | 0.040140331 | 4.014 | 3.433 | 82.189 | 282.120 | 271.151 |
| 25 | 82.07 | 100 | 0.040140331 | 4.014 | 3.294 | 82.189 | 270.764 | 271.151 |
| 26 | 85.04 | 100 | 0.040140331 | 4.014 | 3.414 | 82.189 | 280.569 | 271.151 |
| 27 | 73.88 | 100 | 0.040140331 | 4.014 | 2.965 | 82.189 | 243.725 | 271.151 |
| 28 | 82.57 | 100 | 0.040140331 | 4.014 | 3.314 | 82.189 | 272.400 | 271.151 |
| 29 | 108.07 | 150 | 0.010528595 | 1.579 | 1.138 | 132.189 | 150.401 | 183.977 |
| 30 | 118.27 | 150 | 0.010528595 | 1.579 | 1.245 | 132.189 | 164.601 | 183.977 |
| 31 | 108.89 | 150 | 0.010528595 | 1.579 | 1.146 | 132.189 | 151.550 | 183.977 |
| 32 | 127.18 | 150 | 0.010528595 | 1.579 | 1.339 | 132.189 | 177.009 | 183.977 |
| 33 | 121.45 | 150 | 0.010528595 | 1.579 | 1.279 | 132.189 | 169.026 | 183.977 |
| 34 | 122.41 | 150 | 0.010528595 | 1.579 | 1.289 | 132.189 | 170.372 | 183.977 |
| 35 | 135.56 | 150 | 0.010528595 | 1.579 | 1.427 | 132.189 | 188.661 | 183.977 |
| 36 | 224.93 | 250 | 0.012536482 | 3.134 | 2.820 | 232.189 | 654.740 | 675.865 |
| 37 | 200.11 | 250 | 0.012536482 | 3.134 | 2.509 | 232.189 | 582.496 | 675.865 |
| 38 | 200.37 | 250 | 0.012536482 | 3.134 | 2.512 | 232.189 | 583.238 | 675.865 |
| 39 | 205.17 | 250 | 0.012536482 | 3.134 | 2.572 | 232.189 | 597.216 | 675.865 |
| 40 | 213.06 | 250 | 0.012536482 | 3.134 | 2.671 | 232.189 | 620.180 | 675.865 |
| 41 | 207.93 | 250 | 0.012536482 | 3.134 | 2.607 | 232.189 | 605.253 | 675.865 |
| 42 | 201.77 | 250 | 0.012536482 | 3.134 | 2.529 | 232.189 | 587.308 | 675.865 |
| 43 | 371.53 | 500 | 0.00470075 | 2.350 | 1.746 | 482.189 | 842.138 | 1092.955 |
| 44 | 408.86 | 500 | 0.00470075 | 2.350 | 1.922 | 482.189 | 926.743 | 1092.955 |
| 45 | 383.51 | 500 | 0.00470075 | 2.350 | 1.803 | 482.189 | 869.281 | 1092.955 |
| 46 | 405.14 | 500 | 0.00470075 | 2.350 | 1.904 | 482.189 | 918.318 | 1092.955 |
| 47 | 404.13 | 500 | 0.00470075 | 2.350 | 1.900 | 482.189 | 916.026 | 1092.955 |
| 48 | 379.24 | 500 | 0.00470075 | 2.350 | 1.783 | 482.189 | 859.612 | 1092.955 |
| 49 | 387.42 | 500 | 0.00470075 | 2.350 | 1.821 | 482.189 | 878.144 | 1092.955 |
| Sum | 33845,74 | 46960,42 | ||||||
| Weighted average | 12,86 | 17,81 | $\widehat{\beta}_{w1}$ | 0,720729081 | ||||
| $\widehat{\beta}_{w0}$ | 0,020396847 |
Table 4.1.48: Calculation of regression coefficients.
Now, let’s calculate the weighted averages.
$\overline{Y} _w =\dfrac{\displaystyle \sum_{i=1}^{n}w_i Y_i }{\displaystyle \sum_{i=1}^{n}w_i}=\dfrac{758,58}{59}=12,86~~$ and $~\overline{X}_w = \dfrac{\displaystyle \sum_{i=1}^{n} w_i X_i}{\displaystyle \sum_{i=1}^{n}wi}=\dfrac{1050,84}{59}=17,81$
To illustrate the calculations, let’s take observation 8, with this we obtain:
$$w_8(X_8-\overline{X}_w)Y_8=0,27(25\sqrt{0,27}-17,81)20,718=39,74$$
and
$$w_8(X_8-\overline{X}_w)^2=0,27~(25\sqrt{27}-17,81)^2=13,79 $$
We repeat the calculations for all observations and obtain:
$$\widehat{\beta_{w1}} = \dfrac{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w) Y_i }{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2 }=\dfrac{33845,74}{46960,42}=0,7207 $$
$$\widehat{\beta_{w0}} = \overline{Y_w} - \widehat{\beta_{w1}}\overline{X_w}=12,86-0,7207\times 17,81=0,02039.$$
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 24393.617047064 | 24393.617047064 | 4688.040436639 | 0 |
| Waste | 47 | 244.558471009 | 5.203371724 |
Table 4.1.49: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -3.893404242 | 0.187295875 | 1.465691028 | 1.108825534 | 2.336105311 | 5.008184259 |
Table 4.1.50: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | 0.020396895 | 0.351200081 | 0.058077706 | 0.953932958 |
| Concentration | 0.720729068 | 0.010526315 | 68.469266366 | 0 |
Table 4.1.51: Coefficients
Figure 4.1.18: Scatterplot
We note that the higher concentration ranges present greater variability than the initial concentration ranges.
Example 1.11.1.2
In this example we apply the weighted regression model for weight $w_i = k\times \frac{1/s_i^2}{\displaystyle\sum_{i=1}^k 1/s_i^2}$ in which $s_i$ is the estimate of the standard deviation at the level $i$, $i=1,…,k$ and $k=8.$ Here we use the point column, as real concentrations were used, which are often used in practice. In the following table, we have the Concentration and Absorbance values of the analyte and some calculations that will be used to estimate the parameters.
| Point | Concentration | Area |
|---|---|---|
| A | 0,020253 | 0,00154 |
| A | 0,020713 | 0,00152 |
| A | 0,020289 | 0,00152 |
| B | 0,11507 | 0,00617 |
| B | 0,11644 | 0,00608 |
| B | 0,1093 | 0,00608 |
| C | 0,23444 | 0,01234 |
| C | 0,22935 | 0,01215 |
| C | 0,22946 | 0,01215 |
| D | 0,35652 | 0,0185 |
| D | 0,35304 | 0,01823 |
| D | 0,34955 | 0,01823 |
| And | 0,47907 | 0,02467 |
| And | 0,48037 | 0,02431 |
| And | 0,47239 | 0,02431 |
| F | 0,60912 | 0,03084 |
| F | 0,59584 | 0,03038 |
| F | 0,58696 | 0,03038 |
| G | 0,73821 | 0,03701 |
| G | 0,69549 | 0,03646 |
| G | 0,71271 | 0,03646 |
| H | 0,80135 | 0,04009 |
| H | 0,76376 | 0,0395 |
| H | 0,77783 | 0,0395 |
Table 4.1.52: Weighted regression validation.
Below we describe the validation steps
- Parameter Estimates
To calculate the parameter estimates of the weighted regression model, we consider the following calculations:
$\overline{Y_w}=\dfrac{\displaystyle\sum_{i=1}^{n}w_i Y_i }{\displaystyle\sum_{i=1}^{n}w_i}=\dfrac{0,051262319}{24,018679112}= 0,002134269$
$\overline{X_w} = \dfrac{\displaystyle\sum_{i=1}^{n} w_i X_i}{\displaystyle\sum_{i=1}^{n}wi}=\dfrac{0,782306555}{24,018679112}=0,032570757$
$\widehat{\beta_{w1}} = \dfrac{\displaystyle\sum_{i=1}^{n} w_i (X_i - \overline{X_w}) Y_i }{\displaystyle\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2 }=\dfrac{0,005730354}{0,111810742}=0,051250474 $
$\widehat{\beta_{w0}} = \overline{Y_w} - \widehat{\beta_{w1}}\overline{X_w}=0,002134269-0,051250474\times 0,032570757 =0,000465002.$
Therefore, the adjusted weighted model is
$$\hbox{Absorbância} = 0,000465002 + 0,051250474*\hbox{Concentração}$$
We prove these calculations using the following table:
| Point | Concentration | Area | $\frac{k\frac{1}{s^2_i}}{\displaystyle\sum^k_{i=1}\frac{1}{s^2_i}}$ | $w_i X_i$ | $w_i Y_i$ | $w^{1/2}_i X_i$ | $w^{1/2}_i Y_i$ | $X_i-\overline{X}_w$ | $w^{1/2}_i(X_i-\overline{X}_w)$ | $w_i(X_i-\overline{X}_w)Y_i$ | $w_i(X_i-\overline{X}_w)^2$ |
|---|---|---|---|---|---|---|---|---|---|---|---|
| A | 0.02025 | 0.00154 | 7.452965696 | 0.150944914 | 0.011477567 | 0.055290934 | 0.004204219 | -0.012317757 | -0.033627624 | -0.000141378 | 0.001130817 |
| A | 0.02071 | 0.00152 | 7.452965696 | 0.154373278 | 0.011328508 | 0.056546739 | 0.004149618 | 0.020713000 | 0.056546739 | 0.000234647 | 0.003197534 |
| A | 0.02029 | 0.00152 | 7.471644808 | 0.151592202 | 0.011356900 | 0.055458581 | 0.004154815 | 0.020289000 | 0.055458581 | 0.000230420 | 0.003075654 |
| B | 0.11507 | 0.00617 | 0.368047689 | 0.042351248 | 0.002270854 | 0.069809441 | 0.003743150 | 0.115070000 | 0.069809441 | 0.000261307 | 0.004873358 |
| B | 0.11644 | 0.00608 | 0.368047689 | 0.042855473 | 0.002237730 | 0.070640578 | 0.003688550 | 0.116440000 | 0.070640578 | 0.000260561 | 0.004990091 |
| B | 0.10930 | 0.00608 | 0.368047689 | 0.040227612 | 0.002237730 | 0.066308959 | 0.003688550 | 0.109300000 | 0.066308959 | 0.000244584 | 0.004396878 |
| C | 0.23444 | 0.01234 | 0.082581337 | 0.019360369 | 0.001019054 | 0.067370950 | 0.003546142 | 0.234440000 | 0.067370950 | 0.000238907 | 0.004538845 |
| C | 0.22935 | 0.01215 | 0.082581337 | 0.018940030 | 0.001003363 | 0.065908238 | 0.003491542 | 0.229350000 | 0.065908238 | 0.000230121 | 0.004343896 |
| C | 0.22946 | 0.01215 | 0.082581337 | 0.018949114 | 0.001003363 | 0.065939849 | 0.003491542 | 0.229460000 | 0.065939849 | 0.000230232 | 0.004348064 |
| D | 0.35652 | 0.01850 | 0.040894188 | 0.014579596 | 0.000756542 | 0.072096584 | 0.003741128 | 0.356520000 | 0.072096584 | 0.000269723 | 0.005197917 |
| D | 0.35304 | 0.01823 | 0.040894188 | 0.014437284 | 0.000745501 | 0.071392848 | 0.003686527 | 0.353040000 | 0.071392848 | 0.000263192 | 0.005096939 |
| D | 0.34955 | 0.01823 | 0.040894188 | 0.014294563 | 0.000745501 | 0.070687089 | 0.003686527 | 0.349550000 | 0.070687089 | 0.000260590 | 0.004996665 |
| And | 0.47907 | 0.02467 | 0.023002981 | 0.011020038 | 0.000567484 | 0.072659270 | 0.003741633 | 0.479070000 | 0.072659270 | 0.000271864 | 0.005279370 |
| And | 0.48037 | 0.02431 | 0.023002981 | 0.011049942 | 0.000559202 | 0.072856438 | 0.003687033 | 0.480370000 | 0.072856438 | 0.000268624 | 0.005308061 |
| And | 0.47239 | 0.02431 | 0.023002981 | 0.010866378 | 0.000559202 | 0.071646132 | 0.003687033 | 0.472390000 | 0.071646132 | 0.000264162 | 0.005133168 |
| F | 0.60912 | 0.03084 | 0.014088782 | 0.008581759 | 0.000434498 | 0.072300214 | 0.003660590 | 0.609120000 | 0.072300214 | 0.000264661 | 0.005227321 |
| F | 0.59584 | 0.03038 | 0.014088782 | 0.008394660 | 0.000428017 | 0.070723929 | 0.003605990 | 0.595840000 | 0.070723929 | 0.000255030 | 0.005001874 |
| F | 0.58696 | 0.03038 | 0.014088782 | 0.008269552 | 0.000428017 | 0.069669907 | 0.003605990 | 0.586960000 | 0.069669907 | 0.000251229 | 0.004853896 |
| G | 0.73821 | 0.03701 | 0.009855161 | 0.007275179 | 0.000364740 | 0.073284443 | 0.003674100 | 0.738210000 | 0.073284443 | 0.000269254 | 0.005370610 |
| G | 0.69549 | 0.03646 | 0.009855161 | 0.006854166 | 0.000359319 | 0.069043493 | 0.003619500 | 0.695490000 | 0.069043493 | 0.000249903 | 0.004767004 |
| G | 0.71271 | 0.03646 | 0.009855161 | 0.007023872 | 0.000359319 | 0.070752977 | 0.003619500 | 0.712710000 | 0.070752977 | 0.000256090 | 0.005005984 |
| H | 0.80135 | 0.04009 | 0.008564166 | 0.006862895 | 0.000343337 | 0.074159157 | 0.003710040 | 0.801350000 | 0.074159157 | 0.000275133 | 0.005499581 |
| H | 0.76376 | 0.03950 | 0.008564166 | 0.006540968 | 0.000338285 | 0.070680474 | 0.003655440 | 0.763760000 | 0.070680474 | 0.000258368 | 0.004995729 |
| H | 0.77783 | 0.03950 | 0.008564166 | 0.006661465 | 0.000338285 | 0.071982551 | 0.003655440 | 0.777830000 | 0.071982551 | 0.000263128 | 0.005181488 |
| Sum | 24.018679112 | 0.782306555 | 0.051262319 | 1.647209777 | 0.089194596 | 0.005730354 | 0.111810742 | ||||
| Average | 0.411146875 | 0.021184167 | 0.032570757 | 0.002134269 | |||||||
| $\widehat{\beta}_{1w}$ | 0.051250474 | ||||||||||
| $\widehat{\beta}_{0w}$ | 0.000465002 |
Table 4.1.53: Validation of regression coefficient calculations for example 1.11.1.2.
Below we present the results obtained by Action Stat.
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 0.018183 | 0.018183 | 84350,03285 | 0 |
| Waste | 22 | 0.000005 | 0 |
Table 4.1.54: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -0.000818 | -0.000289 | 0.00008 | -0.000002 | 0.000238 | 0.001157 |
Table 4.1.55: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value | |
|---|---|---|---|---|
| Intercept | 0.000492 | 0.000037 | 13.223138 | 0 |
| Temperature | 0.050328 | 0.000173 | 290.430771 | 0 |
Table 4.1.56: Coefficients
| Standard Deviation of Residues | Degrees of Freedom | $R^2$ | $R^2$ Adjusted |
|---|---|---|---|
| 0.000464 | 22 | 0.999739 | 0.999727 |
Table 4.1.57: Descriptive Measure of Quality of Fit
4.1.11.2.1 Waste
The difference between the observed value $Y_{i}$ and the corresponding adjusted value $\widehat{Y}_{i}$, is called a residue and is denoted by
$$e_{i}=Y_{i}-\widehat{Y}_{i}=Y_{i}-(\widehat\beta_{w0}+\widehat\beta_{w1}x_{i})$$
This measurement is important as we use it to check the fit of the model.
Some properties of the least squares fit
- The sum of the weighted residuals is always zero.
$$\sum^n_{i=1}\eta_i=\sum\limits_{i=1}^{n}(w_i)^{1/2}e_{i}=\sum\limits_{i=1}^{n}(w_i)(Y_{i}-\widehat{Y}_{i})=0;$$
In fact,
$$\sum^n_{i=1}\eta_i=\sum^n_{i=1}w_i(Y_i-\widehat{Y}_i)=\sum^n_{i=1}w_i \left\lbrace Y_i-\widehat{\beta_{w0}}-\widehat{\beta_{w1}}x_i \right\rbrace=$$
$$=\sum^n_{i=1}w_i \left \lbrace Y_i-\overline{Y}_{w}+\widehat{\beta_{w1}}\overline{X}_{w}-\widehat{\beta_{w1}}x_i \right \rbrace=$$
$$=\sum^n_{i=1}w_i \left \lbrace Y_i-\frac{\displaystyle\sum^n_{i=1}w_i Y_i}{\displaystyle\sum^n_{i=1}w_i}-\widehat{\beta_{w1}}\left(x_i-\frac{\displaystyle\sum^n_{i=1}w_i x_i}{\displaystyle\sum^n_{i=1}w_i}\right) \right \rbrace=$$
$$=\sum^n_{i=1}w_iY_i-\sum^n_{i=1}w_i\frac{\displaystyle\sum^n_{i=1}w_i Y_i}{\displaystyle\sum^n_{i=1}w_i}-\widehat{\beta_{w1}}\left(\sum^n_{i=1}w_ix_i-\sum^n_{i=1}w_i\frac{\displaystyle\sum^n_{i=1}w_i x_i}{\displaystyle\sum^n_{i=1}w_i}\right)=$$
$$=\sum^n_{i=1}w_iY_i-\sum^n_{i=1}w_iY_i-\widehat{\beta_{w1}}\left(\sum^n_{i=1}w_ix_i-\sum^n_{i=1}w_ix_i\right)=0$$
- The least squares regression line passes through the point $(\overline{X},\overline{Y})$. In fact,
$$Y_i=\beta_{w0}+\beta_{w1}X_i+\varepsilon_i=\beta_{w0}+\beta_{w1}(X_i-\overline{X})+\beta_{w1}\overline{X}+\varepsilon_i=$$
$$=(\beta_{w0}+\beta_{w1}\overline{X})+\beta_{w1}(X_i-\overline{X})+\varepsilon_i=\beta_{w0}^{*}+\beta_{w1}(X_i-\overline{X})+\varepsilon_i,$$
with $\beta_{w0}^{*}=\beta_{w0}+\beta_{w1}\overline{X}$. Thus, the adjusted regression line is given by
$$\widehat{Y}=\widehat{\beta_{w0}}^{*}+\widehat{\beta_{w1}}(X_i-\overline{X})=\widehat{\beta_{w0}}+\widehat{\beta_{w1}}\overline{X}+\widehat{\beta_{w1}}(X_i-\overline{X})=$$
$$=(\overline{Y}-\widehat{\beta_{w1}}\overline{X})+\widehat{\beta_{w1}}\overline{X}+\widehat{\beta_{w1}}(X_i-\overline{X})=\overline{Y}+\widehat{\beta_{w1}}(X_i-\overline{X}).$$
Then, $$\widehat{Y}=\overline{Y}+\widehat{\beta_{w1}}(\overline{X}-\overline{X})=\overline{Y}$$
and therefore, we have that the fitted line passes through $(\overline{X},\overline{Y})$.
- The sum of the residuals weighted by the corresponding value of the regressor variable is always zero.
$$\sum\limits_{i=1}^{n}(w_i)^{1/2} x_{i}e_{i}=0;$$
- The sum of the residuals weighted by the corresponding adjusted value is always zero.
$$\sum\limits_{i=1}^{n}(w_i) \widehat{Y}_{i}e_{i}=0.$$
| Area | Concentration | $w_i$ | $w_i\times X_i$ | $w_i\times Y_i$ | $\widehat{Y}_i$ | $e_i$ | $w_i\times e_i$ | $w_i\times \widehat{Y}_i\times e_i$ |
|---|---|---|---|---|---|---|---|---|
| 0,078 | 0 | 5,446474769 | 0 | 0,424825 | 0,020397 | 0,057603 | 0,313734574 | 0,00639917 |
| 1,329 | 0 | 5,446474769 | 0 | 7,238365 | 0,020397 | 1,308603 | 7,12727451 | 0,145373333 |
| 0,483 | 0 | 5,446474769 | 0 | 2,630647 | 0,020397 | 0,462603 | 2,519556855 | 0,051390806 |
| 0,698 | 0 | 5,446474769 | 0 | 3,801639 | 0,020397 | 0,677603 | 3,690548931 | 0,075275254 |
| 0,634 | 0 | 5,446474769 | 0 | 3,453065 | 0,020397 | 0,613603 | 3,341974545 | 0,068165465 |
| 0,652 | 0 | 5,446474769 | 0 | 3,551102 | 0,020397 | 0,631603 | 3,440011091 | 0,070165093 |
| 0,071 | 0 | 5,446474769 | 0 | 0,3867 | 0,020397 | 0,050603 | 0,27560925 | 0,005621537 |
| 20,718 | 25 | 0,266796415 | 6,66991 | 5,527488 | 18,03862 | 2,679376 | 0,714848045 | 12,89487474 |
| 21,805 | 25 | 0,266796415 | 6,66991 | 5,817496 | 18,03862 | 3,766376 | 1,004855748 | 18,12621451 |
| 16,554 | 25 | 0,266796415 | 6,66991 | 4,416548 | 18,03862 | -1,48462 | -0,39609223 | -7,14495857 |
| 19,948 | 25 | 0,266796415 | 6,66991 | 5,322055 | 18,03862 | 1,909376 | 0,509414805 | 9,189141874 |
| 21,676 | 25 | 0,266796415 | 6,66991 | 5,783079 | 18,03862 | 3,637376 | 0,97043901 | 17,50538394 |
| 22,207 | 25 | 0,266796415 | 6,66991 | 5,924748 | 18,03862 | 4,168376 | 1,112107907 | 20,06089582 |
| 19,671 | 25 | 0,266796415 | 6,66991 | 5,248152 | 18,03862 | 1,632376 | 0,435512198 | 7,856040571 |
| 33,833 | 50 | 2,647451113 | 132,3726 | 89,57121 | 36,05685 | -2,22385 | -5,88753479 | -212,28596 |
| 34,726 | 50 | 2,647451113 | 132,3726 | 91,93539 | 36,05685 | -1,33085 | -3,52336095 | -127,041298 |
| 35,463 | 50 | 2,647451113 | 132,3726 | 93,88656 | 36,05685 | -0,59385 | -1,57218947 | -56,6882004 |
| 34,04 | 50 | 2,647451113 | 132,3726 | 90,11924 | 36,05685 | -2,01685 | -5,33951241 | -192,525999 |
| 34,194 | 50 | 2,647451113 | 132,3726 | 90,52694 | 36,05685 | -1,86285 | -4,93180494 | -177,825352 |
| 33,664 | 50 | 2,647451113 | 132,3726 | 89,12379 | 36,05685 | -2,39285 | -6,33495403 | -228,418489 |
| 34,517 | 50 | 2,647451113 | 132,3726 | 91,38207 | 36,05685 | -1,53985 | -4,07667823 | -146,992176 |
| 79,224 | 100 | 0,040140331 | 4,014033 | 3,180078 | 72,0933 | 7,130696 | 0,286228509 | 20,6351588 |
| 73,292 | 100 | 0,040140331 | 4,014033 | 2,941965 | 72,0933 | 1,198696 | 0,048116066 | 3,468846133 |
| 85,514 | 100 | 0,040140331 | 4,014033 | 3,43256 | 72,0933 | 13,4207 | 0,53871119 | 38,83746944 |
| 82,072 | 100 | 0,040140331 | 4,014033 | 3,294397 | 72,0933 | 9,978696 | 0,400548171 | 28,87684095 |
| 85,044 | 100 | 0,040140331 | 4,014033 | 3,413694 | 72,0933 | 12,9507 | 0,519845235 | 37,47736038 |
| 73,876 | 100 | 0,040140331 | 4,014033 | 2,965407 | 72,0933 | 1,782696 | 0,071558019 | 5,158853989 |
| 82,568 | 100 | 0,040140331 | 4,014033 | 3,314307 | 72,0933 | 10,4747 | 0,420457775 | 30,31219009 |
| 108,065 | 150 | 0,010528595 | 1,579289 | 1,137773 | 108,1298 | -0,06476 | -0,0006818 | -0,0737231 |
| 118,268 | 150 | 0,010528595 | 1,579289 | 1,245196 | 108,1298 | 10,13824 | 0,106741449 | 11,54192695 |
| 108,89 | 150 | 0,010528595 | 1,579289 | 1,146459 | 108,1298 | 0,760243 | 0,008004288 | 0,865501761 |
| 127,183 | 150 | 0,010528595 | 1,579289 | 1,339058 | 108,1298 | 19,05324 | 0,20060387 | 21,69124775 |
| 121,447 | 150 | 0,010528595 | 1,579289 | 1,278666 | 108,1298 | 13,31724 | 0,140211851 | 15,16107342 |
| 122,414 | 150 | 0,010528595 | 1,579289 | 1,288847 | 108,1298 | 14,28424 | 0,150393002 | 16,26195881 |
| 135,555 | 150 | 0,010528595 | 1,579289 | 1,427204 | 108,1298 | 27,42524 | 0,288749264 | 31,22238783 |
| 224,932 | 250 | 0,012536482 | 3,134121 | 2,819856 | 180,2027 | 44,72934 | 0,560748529 | 101,0483789 |
| 200,113 | 250 | 0,012536482 | 3,134121 | 2,508713 | 180,2027 | 19,91034 | 0,249605574 | 44,9795894 |
| 200,368 | 250 | 0,012536482 | 3,134121 | 2,51191 | 180,2027 | 20,16534 | 0,252802377 | 45,55566182 |
| 205,17 | 250 | 0,012536482 | 3,134121 | 2,57211 | 180,2027 | 24,96734 | 0,313002565 | 56,40389611 |
| 213,059 | 250 | 0,012536482 | 3,134121 | 2,67101 | 180,2027 | 32,85634 | 0,411902874 | 74,22599531 |
| 207,931 | 250 | 0,012536482 | 3,134121 | 2,606723 | 180,2027 | 27,72834 | 0,347615793 | 62,64129197 |
| 201,766 | 250 | 0,012536482 | 3,134121 | 2,529436 | 180,2027 | 21,56334 | 0,270328379 | 48,71389413 |
| 371,534 | 500 | 0,00470075 | 2,350375 | 1,746488 | 360,3849 | 11,14907 | 0,052408983 | 18,88740762 |
| 408,86 | 500 | 0,00470075 | 2,350375 | 1,921949 | 360,3849 | 48,47507 | 0,227869174 | 82,1206165 |
| 383,509 | 500 | 0,00470075 | 2,350375 | 1,80278 | 360,3849 | 23,12407 | 0,108700463 | 39,17400882 |
| 405,143 | 500 | 0,00470075 | 2,350375 | 1,904476 | 360,3849 | 44,75807 | 0,210396486 | 75,82372325 |
| 404,132 | 500 | 0,00470075 | 2,350375 | 1,899723 | 360,3849 | 43,74707 | 0,205644028 | 74,11100895 |
| 379,243 | 500 | 0,00470075 | 2,350375 | 1,782726 | 360,3849 | 18,85807 | 0,088647064 | 31,94706596 |
| 387,419 | 500 | 0,00470075 | 2,350375 | 1,82116 | 360,3849 | 27,03407 | 0,127080395 | 45,7978594 |
| Sum | 59,00039919 | 1050,842 | 758,5758 | 5.84061E-13 | 2.90896E-11 | |||
| Average | 17,81076 | 12,85713 | 1.19196E-14 |
Table 4.1.58: Example of calculation of weighted residuals.
Example 1.11.1.3
Returning to example 1.11.2, we apply the same set of data to calculate the weighted residuals. In this way, we calculate the weighted residuals for the first observation obtained from Table 4.1.1, the others are calculated in a similar way.
$$e_{1}=Y_1-\widehat{Y_1}= Y_1-\widehat{\beta_{0w}}-\widehat{\beta_{1w}}x_1=0,00154-0,000497721-0,050245873\times 0,020253=2,46498\times 10^{-5}$$
$$e_{1w}=w^{1/2}_1\times e_1= \sqrt{7,453}\times 2,46498\times 10^{-5}=6,72942\times 10^{-5}$$
| Point | Concentration | Area | $\widehat{Y}_i$ | $e_i$ | $w_i^{1/2}e_i$ |
|---|---|---|---|---|---|
| A | 0,020253 | 0,00154 | 0,001515 | 2.46E-05 | 6.72942E-05 |
| A | 0,020713 | 0,00152 | 0,001538 | -1.8E-05 | -5.04051E-05 |
| A | 0,020289 | 0,00152 | 0,001517 | 2.84E-06 | 7.75575E-06 |
| B | 0,11507 | 0,00617 | 0,00628 | -0,00011 | -6.64383E-05 |
| B | 0,11644 | 0,00608 | 0,006348 | -0,00027 | -0,0001628 |
| B | 0,1093 | 0,00608 | 0,00599 | 9.04E-05 | 5.48462E-05 |
| C | 0,23444 | 0,01234 | 0,012277 | 6.26E-05 | 1.8E-05 |
| C | 0,22935 | 0,01215 | 0,012022 | 0,000128 | 3.68949E-05 |
| C | 0,22946 | 0,01215 | 0,012027 | 0,000123 | 3.53066E-05 |
| D | 0,35652 | 0,0185 | 0,018411 | 8.86E-05 | 1.79212E-05 |
| D | 0,35304 | 0,01823 | 0,018237 | -6.5E-06 | -1.31923E-06 |
| D | 0,34955 | 0,01823 | 0,018061 | 0,000169 | 3.41422E-05 |
| And | 0,47907 | 0,02467 | 0,024569 | 0,000101 | 1.53167E-05 |
| And | 0,48037 | 0,02431 | 0,024634 | -0,00032 | -4.91904E-05 |
| And | 0,47239 | 0,02431 | 0,024233 | 7.66E-05 | 1.16225E-05 |
| F | 0,60912 | 0,03084 | 0,031103 | -0,00026 | -3.12749E-05 |
| F | 0,59584 | 0,03038 | 0,030436 | -5.6E-05 | -6.6733E-06 |
| F | 0,58696 | 0,03038 | 0,02999 | 0,00039 | 4.6287E-05 |
| G | 0,73821 | 0,03701 | 0,03759 | -0,00058 | -5.75513E-05 |
| G | 0,69549 | 0,03646 | 0,035443 | 0,001017 | 0,000100939 |
| G | 0,71271 | 0,03646 | 0,036308 | 0,000152 | 1.50442E-05 |
| H | 0,80135 | 0,04009 | 0,040762 | -0,00067 | -6.2212E-05 |
| H | 0,76376 | 0,0395 | 0,038874 | 0,000626 | 5.79772E-05 |
| H | 0,77783 | 0,0395 | 0,03958 | -8E-05 | -7.44675E-06 |
| $\widehat{\beta}_{1w}$ | 0,050246 | ||||
| $\widehat{\beta}_{0w}$ | 0,000498 |
Table 4.1.59: Validation of the calculation of weighted residuals for example 1.11.1.2.
Below we present the results obtained by Action Stat.
| N.Note | Area | Concentration | (weights) | Weighted Waste | Studentized Waste | Standardized Waste |
|---|---|---|---|---|---|---|
| 1 | 0.00154 | 0.020253 | 49.375401 | 0.000203 | 0.509495 | 0.518292 |
| 2 | 0.00152 | 0.020713 | 48.278859 | -0.000099 | -0.246403 | -0.251838 |
| 3 | 0.00152 | 0.020289 | 49.287791 | 0.00005 | 0.123911 | 0.126781 |
| 4 | 0.00617 | 0.11507 | 8.690362 | -0.000333 | -0.725197 | -0.73314 |
| 5 | 0.00608 | 0.11644 | 8.588114 | -0.000797 | -1.846104 | -1.752672 |
| 6 | 0.00608 | 0.1093 | 9.149131 | 0.000264 | 0.572321 | 0.581274 |
| 7 | 0.01234 | 0.23444 | 4.265484 | 0.000102 | 0.217234 | 0.222096 |
| 8 | 0.01215 | 0.22935 | 4.360148 | 0.000241 | 0.517671 | 0.526504 |
| 9 | 0.01215 | 0.22946 | 4.358058 | 0.000229 | 0.492418 | 0.501121 |
| 10 | 0.0185 | 0.35652 | 2.804892 | 0.000109 | 0.234089 | 0.239286 |
Table 4.1.60: 10 first observations with summary of Residue Analysis
4.1.11.2.2 Residual variance estimator
Just like the parameters $\beta_{w0}$ and $\beta_{w1}$, the variance $\sigma^2_i$ of the terms of the error $\varepsilon_i$ needs to be estimated. This is necessary since inferences about the regression function and the prediction of Y require an estimate of $\sigma^2_i$. Let us consider the waste $\varepsilon_{i}$. In this way, we define the Sum of Squares of the Residuals (Errors),
$$SQE = \sum\limits_{i=1}^n w_i e_i^{2} =\sum\limits_{i=1}^n w_i(Y_i - \widehat{Y}_i)^{2}=\sum\limits_{i=1}^n w_i(Y_i - (\widehat{\beta_{w0}}+\widehat{\beta_{w1}}X_i))^{2}.$$
We do not use the sum of the residuals since in (i),
$$\sum\limits_{i=1}^{n} w_i\widehat{\varepsilon}_{i}=0.$$
In the “Estimator Properties” section we demonstrate that SQE is an unbiased estimator of $\sigma^2$, that is,
$$\mathbb{E}(SQE)= \sigma^2_w(n-2).$$
In this way, an unbiased estimator for $\sigma^2_w$ is given by
$$\widehat{\sigma}^2_w=QME_w=\dfrac{SQE}{n-2},$$
where QME is the Mean Square of Errors (Residuals).
| Area | Concentration | 1/s² | $w_i\times e^2_i$ |
|---|---|---|---|
| 0,078 | 0 | 5,446475 | 0,018072 |
| 1,329 | 0 | 5,446475 | 9,326774 |
| 0,483 | 0 | 5,446475 | 1,165555 |
| 0,698 | 0 | 5,446475 | 2,500728 |
| 0,634 | 0 | 5,446475 | 2,050646 |
| 0,652 | 0 | 5,446475 | 2,172722 |
| 0,071 | 0 | 5,446475 | 0,013947 |
| 20,718 | 25 | 0,266796 | 1,915347 |
| 21,805 | 25 | 0,266796 | 3,784665 |
| 16,554 | 25 | 0,266796 | 0,588048 |
| 19,948 | 25 | 0,266796 | 0,972665 |
| 21,676 | 25 | 0,266796 | 3,529852 |
| 22,207 | 25 | 0,266796 | 4,635684 |
| 19,671 | 25 | 0,266796 | 0,71092 |
| 33,833 | 50 | 2,647451 | 13,093 |
| 34,726 | 50 | 2,647451 | 4,689066 |
| 35,463 | 50 | 2,647451 | 0,933645 |
| 34,04 | 50 | 2,647451 | 10,769 |
| 34,194 | 50 | 2,647451 | 9,187214 |
| 33,664 | 50 | 2,647451 | 15,1586 |
| 34,517 | 50 | 2,647451 | 6,277474 |
| 79,224 | 100 | 0,04014 | 2,041009 |
| 73,292 | 100 | 0,04014 | 0,057677 |
| 85,514 | 100 | 0,04014 | 7,229879 |
| 82,072 | 100 | 0,04014 | 3,996949 |
| 85,044 | 100 | 0,04014 | 6,732358 |
| 73,876 | 100 | 0,04014 | 0,127566 |
| 82,568 | 100 | 0,04014 | 4,404167 |
| 108,065 | 150 | 0,010529 | 4.42E-05 |
| 118,268 | 150 | 0,010529 | 1,082171 |
| 108,89 | 150 | 0,010529 | 0,006085 |
| 127,183 | 150 | 0,010529 | 3,822154 |
| 121,447 | 150 | 0,010529 | 1,867235 |
| 122,414 | 150 | 0,010529 | 2,14825 |
| 135,555 | 150 | 0,010529 | 7,919019 |
| 224,932 | 250 | 0,012536 | 25,08191 |
| 200,113 | 250 | 0,012536 | 4,969731 |
| 200,368 | 250 | 0,012536 | 5,097845 |
| 205,17 | 250 | 0,012536 | 7,81484 |
| 213,059 | 250 | 0,012536 | 13,53362 |
| 207,931 | 250 | 0,012536 | 9,638807 |
| 201,766 | 250 | 0,012536 | 5,829182 |
| 371,534 | 500 | 0,004701 | 0,584311 |
| 408,86 | 500 | 0,004701 | 11,04597 |
| 383,509 | 500 | 0,004701 | 2,513597 |
| 405,143 | 500 | 0,004701 | 9,41694 |
| 404,132 | 500 | 0,004701 | 8,996323 |
| 379,243 | 500 | 0,004701 | 1,671712 |
| 387,419 | 500 | 0,004701 | 3,4355 |
| Sum | 59,0004 | 244,5585 | |
| $\sqrt{\hbox{QME}_w}$ | 2,28109 |
Table 4.1.65: Calculation of $\sqrt{\hbox{QME}_w}$
So, $\hbox{QME}_w = (2,28109)^2 = 5,20337159$
Below we present the results obtained by Action Stat.
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 24393.61704706 | 24393.61704706 | 4688.04043664 | 0 |
| Waste | 47 | 244.55847101 | 5.20337172 |
Table 4.1.66: Weighted regression result $\hbox{Peso} = 1 / s_i^2$
Example 1.11.1.4
Returning to example 1.11.1.2, we apply the same set of data to calculate the standard deviation of the residuals.
Using the weighted residuals from table 1.11.2.5, we calculated the sum of squares of the residuals.
$$QME = \frac{1}{n-2}\sum\limits_{i=1}^n w_i \varepsilon_i^{2} =\frac{1}{n-2}\sum\limits_{i=1}^n w_i(Y_i - \widehat{Y}_i)^{2}=3,29293\times 10^{-9} $$
The standard deviation of the residuals are calculated as follows:
$$\widehat{\sigma}=\sqrt{QME} =\sqrt{3,29293\times 10^{-9}}=5,73840\times 10^{-5} $$
| $SQE_w$ | 7.24444E-08 |
|---|---|
| $n-p$ | 22 |
| $QME_w$ | 3.29293E-09 |
| $\widehat{\sigma}=\sqrt{\hbox{QME}_w}$ | 5.7384E-05 |
Table 4.1.67: Calculation of $\sqrt{\hbox{QME}_w}$
Below we present the results obtained by Action Stat.
(image missing)
Table 4.1.68:
4.1.11.3 Properties of estimators
In order to make inferences about weighted least squares estimators, we need to know some properties of the estimators. The expectation (mean) and variance are of greater importance, as this way we will know your sampling distributions, whether exact or asymptotic.
Expectation of slope
Now, let’s calculate $\mathbb{E} \left[ \widehat{\beta}_{w1} \right]$ using the estimator expression found in (1.11.1.5) of the model parameter estimators section. With this, we obtain:
$$\mathbb{E} \left[ \widehat{\beta_{w1}} \right] = \mathbb{E} \left[ \dfrac{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w) Y_i}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2 } \right] = \mathbb{E} \left[ \dfrac{ \displaystyle \sum_{i=1}^{n} w_iX_iY_i - \displaystyle \sum_{i=1}^{n} w_i\overline{X}_w Y_i}{\displaystyle \sum w_i (X_i - \overline{X}_w)^2} \right]=$$
$$= \mathbb{E} \left[ \underbrace{\dfrac{\displaystyle \sum_{i=1}^{n}w_iX_i(\beta_{w0} + \beta_{w1}X_i + \varepsilon_i)}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}_{z_1}- \underbrace{\dfrac{\displaystyle \sum_{i=1}^{n} w_i\overline{X}_w (\beta_{w0} + \beta_{w1}X_i + \varepsilon_i) }{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}_{z_2}\right] \tag{1.11.1.6}$$
We apply a little algebra to $z_1-z_2,$ remembering that $\mathbb{E}(\varepsilon_i)=0,$ so we won’t take it into account. So, we have to
$$z_1-z_2= \dfrac{\displaystyle \sum_{i=1}^{n} w_iX_i ( \beta_{w0} + \beta_{w1}X_i)}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2} - \dfrac{\displaystyle \sum_{i=1}^{n} w_i \overline{X}_w (\beta_{w0} + \beta_{w1}X_i)}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2}=$$
$$= \dfrac{\beta_{w0} \left( \displaystyle \sum_{i=1}^{n} w_i X_i = \displaystyle \sum_{i=1}^{n} w_i \overline{X}_w \right)+ \beta_{w1} \left( \displaystyle \sum_{i=1}^{n} w_i x^2_i-\displaystyle \sum_{i=1}^{n} w_i \overline{X}_wX_i \right)}{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}=$$
$$= \dfrac{\beta_{w0} \left(\displaystyle \sum_{i=1}^{n} w_i X_i - \dfrac{\displaystyle \sum_{i=1}^{n}w_i \displaystyle \sum_{i=1}^{n}w_iX_i}{\displaystyle \sum_{i=1}^{n} w_i}\right) + \beta_{w_1} \left( \displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)X_i \right)}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}=$$
$$= \dfrac{\beta_{w0} \left( \displaystyle \sum_{i=1}^{n} w_i X_i - \displaystyle \sum_{i=1}^{n} w_i X_i \right)}{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2} + \dfrac{\beta_{w1}\left( \displaystyle \sum_{i=1}^{n} w_i(X_i-\overline{X}_w )^2\right)}{\displaystyle \sum_{i=1}^{n} w_i (X_i-\overline{X}_w)^2}$$
We return to equation (1.11.1.6) and obtain
$$= \mathbb{E}\left[\underbrace{\dfrac{\beta_{w0} \left( \displaystyle \sum_{i=1}^{n} w_i X_i - \displaystyle \sum_{i=1}^{n} w_i X_i \right)}{ \displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}_{=0}\right] + \mathbb{E}\left[\beta_{w1}\underbrace{\dfrac{\left( \displaystyle \sum_{i=1}^{n} w_i(X_i-\overline{X}_w )^2\right)}{\displaystyle \sum_{i=1}^{n} w_i (X_i-\overline{X}_w)^2}}_{=1}\right]=\beta_{w1}$$
Therefore, we have to $\mathbb{E}(\widehat{\beta_{w1}}) = \beta_{w1}$, that is, unbiased estimator.
Expected value of the intercept
In this topic, we will calculate the expected value of the intercept $\widehat{\beta}_{w0},$ in fact:
$$\mathbb{E} \left[ \widehat{\beta_{w0}} \right]= \mathbb{E} \left[ \overline{Y}_w - \widehat{\beta}_{w1}\overline{X}_w \right] = \mathbb{E} \left[ \dfrac{\displaystyle \sum_{i=1}^{n} w_iY_i}{\displaystyle \sum_{i=1}^{n} w_i} \right] - \mathbb{E} \left[ \dfrac{\displaystyle \sum_{i=1}^{n}w_i(X_i - \overline{X}_w)Y_i}{\displaystyle \sum_{i=1}^{n}w_i(X_i - \overline{X}_w)^2}\right]\overline{X}_w=$$
$$=\mathbb{E} \left[ \underbrace{\dfrac{\displaystyle \sum_{i=1}^{n} w_i (\beta_{w0}+\beta_{w1}+\varepsilon_i)}{\displaystyle \sum_{i=1}^{n}w_i} -\overline{X}_w\displaystyle \sum_{i=1}^{n} \dfrac{w_i(X_i - \overline{X}_w)(\beta_{w0}+\beta_{w1}X_i + \varepsilon_i)}{\displaystyle \sum_{i=1}^{n} w_i(X_i-\overline{X})^2}}_{(*)}\right]\quad \tag{1.11.1.7}$$
We apply a little algebra to (*)
$$(*)=\dfrac{\displaystyle \sum_{i=1}^{n}w_i(\beta_{w0}+\beta_{w1}X_i)}{\displaystyle \sum_{i=1}^{n}w_i} - \overline{X}_w \dfrac{\displaystyle \sum_{i=1}^{n}w_i(X_i-\overline{X}_w)(\beta_{w0}+\beta_{w1}X_i)}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X})^2}=$$
$$=\dfrac{\beta_{w0}\displaystyle \sum_{i=1}^{n}w_i}{\displaystyle \sum_{i=1}^{n}w_i}+\dfrac{\beta_{w1} \displaystyle \sum_{i=1}^{n}X_iw_i}{\displaystyle \sum_{i=1}^{n} w_i} - \dfrac{\beta_{w0}\overline{X}_w \displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)}{\displaystyle \sum_{i=1}^{n}w_i(X_i - \overline{X}_w)^2} - \dfrac{\beta_{w1}\overline{X}_w\displaystyle \sum_{i=1}^{n}w_i(X_i-\overline{X}_w)X_i}{\displaystyle \sum_{i=1}^{n}w_i(X_i - \overline{X}_w)^2}=$$
$$=\beta_{w0} + \beta_{w1}\overline{X}_w - \dfrac{\beta_{w0}\overline{X}_w}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2} \left( \displaystyle \sum_{i=1}^{n}w_iX_i - \dfrac{\displaystyle \sum_{i=1}^{n}w_i\displaystyle \sum_{i=1}^{n}w_iX_i}{\displaystyle \sum_{i=1}^{n}w_i} \right) - \beta_{w1}\overline{X}_w\underbrace{\dfrac{\displaystyle \sum_{i=1}^{n}w_i(X_i-\overline{X}_w)^2}{\displaystyle \sum_{i=1}^{n}w_i(X_i - \overline{X}_w)^2}}_{=1}$$
We return to equation (1.11.1.7) and obtain
$$=\mathbb{E}[\beta_{w0}]+\mathbb{E}\left[\beta_{w1}\overline{X}_w - \dfrac{\beta_{w0}\overline{X}_w}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2}\left( \displaystyle \sum_{i=1}^{n}w_iX_i - \displaystyle \sum_{i=1}^{n}w_iX_i\right) - \beta_{w1}\overline{X}_w \right]= \beta_{w0}$$
Therefore, we have to $\mathbb{E}(\widehat{\beta_{w0}}) = \beta_{w0}$, that is, unbiased estimator.
Slope variance
To calculate the variance of $\widehat{\beta}_{w1},$ we have to:
$$\hbox{Var}(\widehat{\beta_{w1}}) = \hbox{Var} \left(\displaystyle \dfrac{\displaystyle\sum_{i=1}^{n}w_i (x_i-\overline{X}_w) Y_i }{\displaystyle\sum^n_{i=1}w_i(x_i-\overline{X}_w)^2}\right) \overset{Y_i~ \hbox{ind.}}{=}\dfrac{1 }{\displaystyle[\sum^n_{i=1}w_i(x_i-\overline{X}_w)^2]^2}\sum_{i=1}^{n}w_i (x_i-\overline{X}_w)^2\hbox{Var}(w^{1/2}_iY_i) =\dfrac{\sigma^2 }{\displaystyle \sum^n_{i=1}w_i(x_i-\overline{X}_w)^2}$$
Intercept variance
From the model parameter estimation topic, we obtain that
$$\widehat{\beta_{w0}} = \overline{Y}_w - \widehat{\beta_{w1}} \overline{X}_w$$
With this, we have to
$$\hbox{Var}(\widehat{\beta_{w0}}) = \hbox{Var}(\overline{Y}_w - \widehat{\beta_{w1}}\overline{X}_w) = \hbox{Var}(\overline{Y}_w) + \hbox{Var}(\widehat{\beta_{w1}}) - 2\hbox{Cov}(\overline{Y}_w,\widehat{\beta_{w1}}\overline{X}_w)$$
We notice that
$$\hbox{Var}(\overline{Y_w})=\frac{1}{\left(\displaystyle\sum^n_{i=1}w_i\right)^2}\sum^n_{i=1}w_i\hbox{Var}(w^{1/2}_i Y_i)=\frac{\sigma^2}{\displaystyle\sum^n_{i=1}w_i}$$
and
$$\overline{X}^2_w\hbox{Var}(\widehat{\beta_{w1}})=\dfrac{\overline{X}^2_w\sigma^2 }{\displaystyle \sum^n_{i=1}w_i(x_i-\overline{X}_w)^2}$$
By substituting we get:
$$\hbox{Var}(\widehat{\beta_{w0}}) = \frac{\sigma^2}{\displaystyle\sum^n_{i=1}w_i}+ \dfrac{\overline{X}^2_w\sigma^2 }{\displaystyle \sum^n_{i=1}w_i(x_i-\overline{X}_w)^2}- 2\hbox{Cov}(\overline{Y}_w,\widehat{\beta_{w1}}\overline{X}_w) \tag{1.1.1.8}$$
Now let’s calculate $\hbox{Cov}(\overline{Y_w} , \widehat{\beta_{w1}} \overline{X_w})$
$$\hbox{Cov}(\overline{Y} _w , \widehat{\beta} _{w1} \overline{X} _w)= \mathbb{E}\left[ \overline{Y} _w \widehat{\beta} _{w2} \overline{X} _w \right]-\mathbb{E}\left[\overline{Y} _w \right] \mathbb{E}\left[ \widehat{\beta} _{w1} \overline{X} _w \right] = \overline{X} _w \mathbb{E} \left[ \overline{Y} _w \widehat{\beta} _{w1} \right] - \mathbb{E} \left[\overline{Y} _w \right] \widehat{\beta} _{w1} \overline{X} _w =$$
$= \overline{X} _w \mathbb{E} \left[ \dfrac{ \widehat{\beta} _{w1} \displaystyle \sum_{i=1}^{n} \left( \beta_{w0} + \beta_{w1}X_i + \varepsilon_i \right)}{ \displaystyle \sum_{i=1}^{n} w_i} \right] - \mathbb{E} \left[ \dfrac{ \displaystyle \sum_{i=1}^{n} \left( \beta_{w0} + \beta_{w1}X_i + \varepsilon_i \right)}{ \displaystyle \sum_{i=1}^{n} w_i} \right]\beta_{w1} \overline{X} _w =$
$= \dfrac{\overline{X} _w \displaystyle \sum_{i=1}^{n} w_i \left( \mathbb{E}\left[ \widehat{\beta_{w1}}\beta_{w0} \right] + \mathbb{E}\left[ \widehat{\beta_{w1}}\beta_{w1}X_i \right] + \mathbb{E}\left[ \widehat{\beta_{w1}}\varepsilon_i \right] - \beta_{w1} \mathbb{E}\left[ \beta_{w0} \right] - \beta_{w1}\mathbb{E}\left[ \beta_{w1}X_i \right] - \beta_{w1} \mathbb{E}\left[\varepsilon_i \right]\right)}{\displaystyle \sum_{i=1}^{n} w_i} $
but $\mathbb{E}\left[\varepsilon_i \right]=0$, then:
$$\hbox{Cov}(\overline{Y} _w , \widehat{\beta} _{w1} \overline{X} _w)= \dfrac{\overline{X} _w \displaystyle \sum_{i=1}^{n} w_i \left( \beta_{w1}\mathbb{E}\left[ \beta_{w0} \right] + \beta_{w1}\mathbb{E}\left[ \beta_{w1}X_i \right] + \mathbb{E} \left[ \widehat{\beta} _{x1}\varepsilon_i \right] - \beta_{w1} \mathbb{E}\left[ \beta_{w0} \right] - \beta_{w1}\mathbb{E}\left[ \beta_{w1} X_i \right]\right)}{\displaystyle \sum_{i=1}^{n} w_i}$$
Then,
$$\hbox{Cov}(\overline{Y} _w , \widehat{\beta} _{w1} \overline{X}_w)=\dfrac{\overline{X}_w \displaystyle \sum_{i=1}^{n} w_i \mathbb{E}\left[ \widehat{\beta} _{w1} \varepsilon_i \right]}{\displaystyle \sum_{i=1}^{n} w_i} \tag{1.11.1.9}$$
But, we observed that
$$\mathbb{E}\left[ \widehat{\beta_{w1}}\varepsilon_i \right] = \mathbb{E}\left[ \dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})Y_j}{\displaystyle \sum_{j=1}^{n}w_j (x_j - \overline{X_w})^2} \varepsilon_i \right] = \dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})\mathbb{E}\left[ Y_j\varepsilon_i \right]}{\displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2}= \dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})\mathbb{E}\left[ \left( \beta_{w0} + \beta_{w1}x_j + \varepsilon_j \right)\varepsilon_i \right]}{\displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2} =$$
$=\dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})\left( \beta_{w0}\mathbb{E}\left[\varepsilon_i \right] + \beta_{w1}x_j\mathbb{E}\left[\varepsilon_i \right] + \mathbb{E}\left[\varepsilon_j \varepsilon_i \right] \right)}{\displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2}= \dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})\left( \mathbb{E}\left[\varepsilon_j \varepsilon_i \right] \right)}{\displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2} $
Thus, we have two cases:
$$\mathbb{E}\left[\varepsilon_j \varepsilon_i \right] = \begin{cases} \dfrac{\sigma^2}{w_i} \hbox{ se $i = j$}; \cr 0 ~\hbox{ se $i \neq j$}.\end{cases}$$
We consider $i=j$, then we get
$$\hbox{Cov}(\overline{Y_w} , \widehat{\beta_{w1}} \overline{X_w})=\dfrac{\overline{X_w} \displaystyle \sum_{i=1}^{n} w_i \mathbb{E}\left[ \widehat{\beta_{w1}}\varepsilon_i \right]}{\displaystyle \sum_{i=1}^{n} w_i}=\dfrac{\displaystyle \sum_{j=1}^{n} w_j (x_j - \overline{X_w})\left( \mathbb{E}\left[\varepsilon_j \varepsilon_i \right] \right)}{\displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2} $$
How to $i \neq j$ the expectation of the product of errors is equal to zero, consequently $\hbox{Cov}(\overline{Y_w} , \widehat{\beta_{w1}} \overline{X_w})$ it is too. Therefore, for $i=j$ the crossed sum cancels out, so the expression above is summarized:
$$\hbox{Cov}(\overline{Y_w} , \widehat{\beta_{w1}} \overline{X_w})= \dfrac{ \overline{X_w} \displaystyle \sum_{i=1}^{n}w^2_i\left(X_i - \overline{X_w}\right)\mathbb{E}\left[ \varepsilon_i^2\right] }{ \displaystyle \sum_{i=1}^{n} w_i \displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2} =\dfrac{ \overline{X_w} \displaystyle \sum_{i=1}^{n}w^2_i\left(X_i - \overline{X_w}\right)\dfrac{\sigma^2}{w_i}}{ \displaystyle \sum_{i=1}^{n} w_i \displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2}=$$
$=\sigma^2\dfrac{ \overline{X_w} \displaystyle \sum_{i=1}^{n}w_i\left(X_i - \overline{X_w}\right) }{ \displaystyle \sum_{i=1}^{n} w_i \displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2}=\sigma^2\dfrac{ \overline{X_w} \displaystyle \sum_{i=1}^{n}w_iX_i -\displaystyle \sum_{i=1}^{n}w_i\overline{X_w} }{ \displaystyle \sum_{i=1}^{n} w_i \displaystyle \sum_{j=1}^{n} w_j(x_j - \overline{X_w})^2}=0$
Finally, we return to equation (1.11.1.8) and obtain that
$$\hbox{Var}(\widehat{\beta_{w0}}) =\sigma^2\left( \frac{1}{\displaystyle\sum^n_{i=1}w_i}+ \dfrac{\overline{X}^2_w }{\displaystyle \sum^n_{i=1}w_i(x_i-\overline{X_w})^2}\right)$$
In matrix form we have
$$\hbox{Var}(\widehat{\mathbf{\beta}}_{w}) = (\mathbf{B}^{\top}\mathbf{B})^{-1}\sigma^2 = (\mathbf{X}^{\top} V^{-1}\mathbf{X})^{-1}\sigma^2$$
Expected value of QME
In this topic, we will calculate the mean square expected value of the QME error.
$$\hbox{SQE}=(\mathbf{Z}-\widehat{\mathbf{Z}})^{\top}(\mathbf{Z}-\widehat{\mathbf{Z}})= (\mathbf{Z}-\widehat{\mathbf{\mathbf{B}}\beta})^{\top}(\mathbf{Z}-\widehat{\mathbf{\mathbf{\mathbf{B}}\beta}})= \mathbf{Y}^{\top}(V-\mathbf{X}(\mathbf{X}^{\top}V^{-1}\mathbf{X})^{-1}\mathbf{X}^{\top})\mathbf{Y}$$
$$\mathbb{E}(\hbox{SQE})= (V-\mathbf{X}(\mathbf{X}^{\top}V^{-1}\mathbf{X})^{-1}\mathbf{X}^{\top})\sigma^2$$
Now we apply the theorem to distributions of quadratic forms and we obtain:
$$\hbox{rank}(V-\mathbf{X}(\mathbf{X}^{\top}V^{-1}\mathbf{X})^{-1}\mathbf{X}^{\top})=n-(p+1)$$
Therefore, an unbiased estimator for $\sigma^2$ is given by
$$\widehat{\sigma}^2=\hbox{QME}=\frac{\hbox{SQE}}{n-(p+1)}$$
Example 1.11.2.1
We return to Motivation 3, consider the calibration curve for the test of a certain chemical compound carried out by equipment called a Chromatograde. Next, we will calculate the variances of the parameters $\beta_{w0}$ and $\beta_{w1}.$
| Area | Concentration | Weight $(w_i)$ | Adjusted value $(\widehat{Y}_i)$ | Waste $(Y_i-\widehat{Y}_i)$ | $w_i(Y_i-\widehat{Y}_i)^2$ |
|---|---|---|---|---|---|
| 0,078 | 0 | 5,446 | 0,0204 | 0,0576 | 0,018 |
| 1,329 | 0 | 5,446 | 0,0204 | 1,31 | 9,33 |
| 0,483 | 0 | 5,446 | 0,0204 | 0,46 | 1,17 |
| 0,698 | 0 | 5,446 | 0,0204 | 0,68 | 2,50 |
| 0,634 | 0 | 5,446 | 0,0204 | 0,61 | 2,05 |
| 0,652 | 0 | 5,446 | 0,0204 | 0,63 | 2,17 |
| 0,071 | 0 | 5,446 | 0,0204 | 0,05 | 0,01 |
| 20,718 | 25 | 0,267 | 18,039 | 2,68 | 1,92 |
| 21,805 | 25 | 0,267 | 18,039 | 3,77 | 3,78 |
| 16,554 | 25 | 0,267 | 18,039 | -1,48 | 0,59 |
| 19,948 | 25 | 0,267 | 18,039 | 1,91 | 0,97 |
| 21,676 | 25 | 0,267 | 18,039 | 3,64 | 3,53 |
| 22,207 | 25 | 0,267 | 18,039 | 4,17 | 4,64 |
| 19,671 | 25 | 0,267 | 18,039 | 1,63 | 0,71 |
| 33,833 | 50 | 2,647 | 36,057 | -2,22 | 13,09 |
| 34,726 | 50 | 2,647 | 36,057 | -1,33 | 4,69 |
| 35,463 | 50 | 2,647 | 36,057 | -0,59 | 0,93 |
| 34,04 | 50 | 2,647 | 36,057 | -2,02 | 10,77 |
| 34,194 | 50 | 2,647 | 36,057 | -1,86 | 9,19 |
| 33,664 | 50 | 2,647 | 36,057 | -2,39 | 15,16 |
| 34,517 | 50 | 2,647 | 36,057 | -1,54 | 6,28 |
| 79,224 | 100 | 0,04014 | 72,093 | 7,13 | 2,04 |
| 73,292 | 100 | 0,04014 | 72,093 | 1,20 | 0,06 |
| 85,514 | 100 | 0,04014 | 72,093 | 13,42 | 7,23 |
| 82,072 | 100 | 0,04014 | 72,093 | 9,98 | 4,00 |
| 85,044 | 100 | 0,04014 | 72,093 | 12,95 | 6,73 |
| 73,876 | 100 | 0,04014 | 72,093 | 1,78 | 0,13 |
| 82,568 | 100 | 0,04014 | 72,093 | 10,47 | 4,40 |
| 108,065 | 150 | 0,01053 | 108,130 | -0,06 | 0,00 |
| 118,268 | 150 | 0,01053 | 108,130 | 10,14 | 1,08 |
| 108,89 | 150 | 0,01053 | 108,130 | 0,76 | 0,01 |
| 127,183 | 150 | 0,01053 | 108,130 | 19,05 | 3,82 |
| 121,447 | 150 | 0,01053 | 108,130 | 13,32 | 1,87 |
| 122,414 | 150 | 0,01053 | 108,130 | 14,28 | 2,15 |
| 135,555 | 150 | 0,01053 | 108,130 | 27,43 | 7,92 |
| 224,932 | 250 | 0,01254 | 180,203 | 44,73 | 25,08 |
| 200,113 | 250 | 0,01254 | 180,203 | 19,91 | 4,97 |
| 200,368 | 250 | 0,01254 | 180,203 | 20,17 | 5,10 |
| 205,17 | 250 | 0,01254 | 180,203 | 24,97 | 7,81 |
| 213,059 | 250 | 0,01254 | 180,203 | 32,86 | 13,53 |
| 207,931 | 250 | 0,01254 | 180,203 | 27,73 | 9,64 |
| 201,766 | 250 | 0,01254 | 180,203 | 21,56 | 5,83 |
| 371,534 | 500 | 0,00470 | 360,385 | 11,15 | 0,58 |
| 408,86 | 500 | 0,00470 | 360,385 | 48,48 | 11,05 |
| 383,509 | 500 | 0,00470 | 360,385 | 23,12 | 2,51 |
| 405,143 | 500 | 0,00470 | 360,385 | 44,76 | 9,42 |
| 404,132 | 500 | 0,00470 | 360,385 | 43,75 | 9,00 |
| 379,243 | 500 | 0,00470 | 360,385 | 18,86 | 1,67 |
| 387,419 | 500 | 0,00470 | 360,385 | 27,03 | 3,44 |
| 5983,552 | 7525 | 59,00039 | 5424,486 | 244,56 | |
| $QME_w$ | $\displaystyle\sum^n_{i=1}\dfrac{w_i(Y_i-\widehat{Y}_i)}{n-2}$ | 5,203371015 | |||
| Standard deviation of residuals $(\sqrt{QME_w})$ | 2,281089874 |
Table 4.1.69: Table for calculating the $QME_w$.
From the results obtained from table (4.1.69) we calculated the $QME_w$ as follows
$$QME_w=\displaystyle\sum^n_{i=1}\dfrac{w_i(Y_i-\widehat{Y}_i)}{n-2}=\dfrac{244,56}{49-2}=5,203371015$$
Therefore, the standard deviation of the residuals is obtained as follows
$$\widehat{\hbox{DP}}(QME_w)=\sqrt{\displaystyle\sum^n_{i=1}\dfrac{w_i(Y_i-\widehat{Y}_i)}{n-2}}=2,281089874$$
Now, let’s calculate the variances of $\widehat{\beta_{w1}}$ and $\widehat{\beta_{w0}},$ To do this, observe the following table:
| n | Area (Y) | Concentration (X) | Weight $(w_i)$ | $w_i X_i$ | $w_i Y_i$ | $X_i-\overline{X}_w$ | $w_i X^2_i$ | $w_i(X_i-\overline{X}_w)^2$ |
|---|---|---|---|---|---|---|---|---|
| 1 | 0,078 | 0 | 5,45 | 0 | 0,42 | -17,81 | 0,00 | 1727,75 |
| 2 | 1,329 | 0 | 5,45 | 0 | 7,24 | -17,81 | 0,00 | 1727,75 |
| 3 | 0,483 | 0 | 5,45 | 0 | 2,63 | -17,81 | 0,00 | 1727,75 |
| 4 | 0,698 | 0 | 5,45 | 0 | 3,80 | -17,81 | 0,00 | 1727,75 |
| 5 | 0,634 | 0 | 5,45 | 0 | 3,45 | -17,81 | 0,00 | 1727,75 |
| 6 | 0,652 | 0 | 5,45 | 0 | 3,55 | -17,81 | 0,00 | 1727,75 |
| 7 | 0,071 | 0 | 5,45 | 0 | 0,39 | -17,81 | 0,00 | 1727,75 |
| 8 | 20,718 | 25 | 0,27 | 6,67 | 5,53 | 7,19 | 166,75 | 13,79 |
| 9 | 21,805 | 25 | 0,27 | 6,67 | 5,82 | 7,19 | 166,75 | 13,79 |
| 10 | 16,554 | 25 | 0,27 | 6,67 | 4,42 | 7,19 | 166,75 | 13,79 |
| 11 | 19,948 | 25 | 0,27 | 6,67 | 5,32 | 7,19 | 166,75 | 13,79 |
| 12 | 21,676 | 25 | 0,27 | 6,67 | 5,78 | 7,19 | 166,75 | 13,79 |
| 13 | 22,207 | 25 | 0,27 | 6,67 | 5,92 | 7,19 | 166,75 | 13,79 |
| 14 | 19,671 | 25 | 0,27 | 6,67 | 5,25 | 7,19 | 166,75 | 13,79 |
| 15 | 33,833 | 50 | 2,65 | 132,37 | 89,57 | 32,19 | 6618,62 | 2743,15 |
| 16 | 34,726 | 50 | 2,65 | 132,37 | 91,94 | 32,19 | 6618,62 | 2743,15 |
| 17 | 35,463 | 50 | 2,65 | 132,37 | 93,89 | 32,19 | 6618,62 | 2743,15 |
| 18 | 34,04 | 50 | 2,65 | 132,37 | 90,12 | 32,19 | 6618,62 | 2743,15 |
| 19 | 34,194 | 50 | 2,65 | 132,37 | 90,53 | 32,19 | 6618,62 | 2743,15 |
| 20 | 33,664 | 50 | 2,65 | 132,37 | 89,12 | 32,19 | 6618,62 | 2743,15 |
| 21 | 34,517 | 50 | 2,65 | 132,37 | 91,38 | 32,19 | 6618,62 | 2743,15 |
| 22 | 79,224 | 100 | 0,040 | 4,01 | 3,18 | 82,19 | 401,40 | 271,15 |
| 23 | 73,292 | 100 | 0,040 | 4,01 | 2,94 | 82,19 | 401,40 | 271,15 |
| 24 | 85,514 | 100 | 0,040 | 4,01 | 3,43 | 82,19 | 401,40 | 271,15 |
| 25 | 82,072 | 100 | 0,040 | 4,01 | 3,29 | 82,19 | 401,40 | 271,15 |
| 26 | 85,044 | 100 | 0,040 | 4,01 | 3,41 | 82,19 | 401,40 | 271,15 |
| 27 | 73,876 | 100 | 0,040 | 4,01 | 2,97 | 82,19 | 401,40 | 271,15 |
| 28 | 82,568 | 100 | 0,040 | 4,01 | 3,31 | 82,19 | 401,40 | 271,15 |
| 29 | 108,065 | 150 | 0,011 | 1,58 | 1,14 | 132,19 | 236,89 | 183,98 |
| 30 | 118,268 | 150 | 0,011 | 1,58 | 1,25 | 132,19 | 236,89 | 183,98 |
| 31 | 108,89 | 150 | 0,011 | 1,58 | 1,15 | 132,19 | 236,89 | 183,98 |
| 32 | 127,183 | 150 | 0,011 | 1,58 | 1,34 | 132,19 | 236,89 | 183,98 |
| 33 | 121,447 | 150 | 0,011 | 1,58 | 1,28 | 132,19 | 236,89 | 183,98 |
| 34 | 122,414 | 150 | 0,011 | 1,58 | 1,29 | 132,19 | 236,89 | 183,98 |
| 35 | 135,555 | 150 | 0,011 | 1,58 | 1,43 | 132,19 | 236,89 | 183,98 |
| 36 | 224,932 | 250 | 0,013 | 3,13 | 2,82 | 232,19 | 783,53 | 675,86 |
| 37 | 200,113 | 250 | 0,013 | 3,13 | 2,51 | 232,19 | 783,53 | 675,86 |
| 38 | 200,368 | 250 | 0,013 | 3,13 | 2,51 | 232,19 | 783,53 | 675,86 |
| 39 | 205,17 | 250 | 0,013 | 3,13 | 2,57 | 232,19 | 783,53 | 675,86 |
| 40 | 213,059 | 250 | 0,013 | 3,13 | 2,67 | 232,19 | 783,53 | 675,86 |
| 41 | 207,931 | 250 | 0,013 | 3,13 | 2,61 | 232,19 | 783,53 | 675,86 |
| 42 | 201,766 | 250 | 0,013 | 3,13 | 2,53 | 232,19 | 783,53 | 675,86 |
| 43 | 371,534 | 500 | 0,0047 | 2,35 | 1,75 | 482,19 | 1175,19 | 1092,95 |
| 44 | 408,86 | 500 | 0,0047 | 2,35 | 1,92 | 482,19 | 1175,19 | 1092,95 |
| 45 | 383,509 | 500 | 0,0047 | 2,35 | 1,80 | 482,19 | 1175,19 | 1092,95 |
| 46 | 405,143 | 500 | 0,0047 | 2,35 | 1,90 | 482,19 | 1175,19 | 1092,95 |
| 47 | 404,132 | 500 | 0,0047 | 2,35 | 1,90 | 482,19 | 1175,19 | 1092,95 |
| 48 | 379,243 | 500 | 0,0047 | 2,35 | 1,78 | 482,19 | 1175,19 | 1092,95 |
| 49 | 387,419 | 500 | 0,0047 | 2,35 | 1,82 | 482,19 | 1175,19 | 1092,95 |
| Sum | 59,00 | 65676,70 | 46960,42 | |||||
| Weighted average | 12,86 | 17,81 | $\hbox{Var}(\widehat{\beta}_{w1})$ | 0,000110803 | ||||
| $QME_w$ | 5,203371 | $DP (\widehat{\beta}_{w1})$ | 0,010526316 | |||||
| $\hbox{Var}(\widehat{\beta}_{w0})$ | 0,12334151 | |||||||
| $DP (\widehat{\beta}_{w0})$ | 0,3512001 |
Table 4.1.70: Table to calculate coefficient variances.
We obtain the following results from the Action Stat of the weighted regression model with the data from Motivation 3 with $\hbox{Peso} = 1 / s_i^2$:
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 24393.61704706 | 24393.61704706 | 4688.04043664 | 0 |
| Waste | 47 | 244.55847101 | 5.20337172 |
Table 4.1.71: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -3.89340424 | 0.18729587 | 1.46569103 | 1.10882553 | 2.33610531 | 5.00818426 |
Table 4.1.72: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value |
|---|---|---|---|
| Intercept | 0.02039689 | 0.35120008 | 0.05807771 |
| Concentration | 0.72072907 | 0.01052632 | 68.46926637 |
Table 4.1.73: Coefficients
| Standard Deviation of Residues | Degrees of Freedom | R^2 | Adjusted R^2 |
|---|---|---|---|
| 2.28109003 | 47 | 0.990074 | 0.98986281 |
Table 4.1.74: Descriptive Measure of Quality of Fit
From the data in table (4.1.70) we obtain the data to calculate the variances of the coefficients:
$$\hbox{Var}(\widehat{\beta_{w0}})=\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}=\dfrac{5,203371\times 65676,7}{59\times 46960,42}=0,12334151$$
$$\hbox{Var}(\widehat{\beta_{w1}})=\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}=\dfrac{5,203371}{46960,42}=0,000110803$$
Therefore, the standard deviations of the coefficients are
$$\widehat{\hbox{DP}}(\widehat{\beta_{w0}})=\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}=0,3512001$$
$$\widehat{\hbox{DP}}(\widehat{\beta_{w1}})=\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}=0,010526316$$
4.1.11.4 Tests and confidence intervals for parameters
In weighted linear regression, it is important to assess whether there is a good “correlation” between the response and the explanatory variable, as stated in the Simple Linear Regression section. To answer this question, we used hypothesis tests and confidence intervals for the parameters.
Sampling distribution of estimators:
In this topic, we will discuss the sampling distribution of estimators, for this, we observe that $\widehat{\beta_{w0}}$ and $\widehat{\beta_{w1}}$ are linear combinations of $Y$, which is a random variable with normal distribution. Therefore, the distributions of the estimators are exact normal, with means and variances equal to the expectations and variances of the estimators, so we have that:
$$\widehat{\beta_{wo}} \sim N\left(\beta_{w0}, \dfrac{\sigma^2_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}\right)\quad \hbox{e}\quad \widehat{\beta}_{w1} \sim N \left(\beta_{w1}, \dfrac{\sigma^2_w}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2} \right)$$
Furthermore,
$$Z=\dfrac{\widehat{\beta_{w0}} - \beta_{w0}}{\sqrt{\dfrac{\sigma^2_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}}}\sim N(0,1)\quad \hbox{e}\quad Z=\dfrac{\widehat{\beta}_{w1} - \beta_{w1}}{\sqrt{\dfrac{\sigma^2_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}}\sim N(0,1)$$
From this result we can construct confidence intervals and test hypotheses regarding the estimators.
Inference for the intercept
It is unusual for us to make inferences about $\beta_{w0},$ this only occurs when the variable x can assume the value x=0. This practice is not recommended, including for MAPA, which in one of its normative instructions (item 7.1.1.6) states that “calibration curves should not be forced to pass through the origin”.
Suppose we wish to test the hypothesis that the intercept is equal to a certain value, denoted by $\beta_{w0*}$. In this way, the hypotheses
$$\begin{cases} H_{0}:\beta_{w0}=\beta_{w0*} \cr H_{1}:\beta_{w0} \neq \beta_{w0*} \end{cases} $$
As seen previously,
$$\widehat{\beta_{w0}} \sim N\left(\beta_{w0}, \dfrac{\sigma^2_w \displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}\right)\quad \hbox{e}\quad Z=\dfrac{\widehat{\beta}_{w0} - \beta_{w0}}{\sqrt{\dfrac{\sigma^2_w \displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}}}\sim N(0,1)$$
From this result we can construct confidence intervals and test hypotheses regarding the estimators. It is worth remembering that1
$$\chi =\dfrac{(n-2)QME_w}{\sigma^2_w}~~\sim \chi_{(n-2)}^2.$$
How do random variables $Z$ and $\chi$ are independent, it follows that
$$T= \dfrac{Z}{\sqrt{\dfrac{\chi}{n-2}}} = \dfrac{\dfrac{\widehat{\beta_{w0}} - \beta_{w0*}}{\sqrt{\dfrac{\sigma^2_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}}}{\sqrt{\dfrac{\dfrac{(n-2)QME_w}{\sigma^2_w}}{(n-2)}}}= \dfrac{\widehat{\beta_{w0}} - \beta_{w0*}}{\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}}} \quad \sim t_{(n-2)}$$
that is, T has Student’s t-distribution with n-2 degrees of freedom. Therefore, confidence intervals and tests regarding $\beta_{w0}$ can be performed using the t distribution.
In the weighted model, we want to test the hypotheses
$$\begin{cases} H_{0}:\beta_{w0}=0. \cr H_{1}:\beta_{w0} \neq 0.\end{cases} $$
Thus, the test statistic is given by
$$T_0=\dfrac{\widehat{\beta_{w0}}}{\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}} \quad\sim t_{(n-2)}.$$
Therefore, we reject $H_0$ with a confidence level of (1-$\alpha$)100% if $\mid T_0\mid> t_{(1-\alpha/2,n-2)}$. The p-value associated with the test is given by
$$\hbox{P-valor}=2\times\mathbb{P}\left( t_{(n-2)}> \mid T_0 \mid \right)$$
We reject $H_0$ if the p-value is less than the significance level $\alpha$ considered. We generally adopt $\alpha=$0,05.
When we don’t reject $H_0$, we can use the “Weighted Regression Model without Intercept”.
The confidence interval for $\beta_{w0}$ with $(1-\alpha)100\char37$ is given by
$$\left[\widehat{\beta_{w0}} - t_{\left(1-\alpha/2;n-2\right)} \sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X}_w )^2}} ~;~ \widehat{\beta}_{w0} +t_{\left(1-\alpha/2;n-2\right)}\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}\right]$$
Inference for slope
Inference about $\beta_{w1}$ is more frequent since through this parameter we have an indication of the existence or not of a linear association between the variables involved.
Similarly to the parameter $\beta_{w0}$, let us consider the hypotheses
$$\begin{cases} H_{0}:\beta_{w1}=\beta_{w1*} \cr H_{1}:\beta_{w1} \neq \beta_{w1*} \end{cases}$$
From the beginning of this section we obtain that
$$\widehat{\beta_{w1}} \sim N \left(\beta_{w1}, \dfrac{\sigma^2_w}{\displaystyle \sum_{i=1}^{n} w_i(X_i - \overline{X}_w)^2} \right).\quad \hbox{e}\quad Z=\dfrac{\widehat{\beta_{w1}} - \beta_{w1}}{\sqrt{\dfrac{\sigma^2_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}}\sim N(0,1)$$
Again, we consider that
$$\chi =\dfrac{(n-2)QME_w}{\sigma^2_w} ~~\sim \chi_{(n-2)}^2$$
and that $N_1$ and $\chi$ are independent, we get
$$T=\dfrac{Z}{\sqrt{\dfrac{\chi}{n-2}}}= \dfrac{\dfrac{\widehat{\beta_{w1}} - \beta_{w1}}{\sqrt{\dfrac{\sigma^2_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}}}}{\sqrt{\dfrac{\dfrac{(n-2)QME_w}{\sigma^2_w}}{(n-2)}}}= \dfrac{\widehat{\beta}_{w1} - \beta_{w1}}{\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}}}\quad \sim t_{(n-2)},$$
that is, T has Student’s t-distribution with n-2 degrees of freedom. Therefore, confidence intervals and tests regarding $\beta_{w1}$ can be performed using the t distribution.
In the model in question, we want to test the following hypotheses
$$\begin{cases} H_{0}:\beta_{w1}=0 \cr H_{1}:\beta_{w1} \neq 0 \end{cases}$$
In this case, the test statistic is
$$T_0=\dfrac{\widehat{\beta_{w1}}}{\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}}}\quad\sim t_{(n-2)}.$$
Therefore, we reject $H_0$ with a confidence level (1-$\alpha$)100% if $\mid T_0\mid> t_{(1-\alpha/2,n-2)}$. The p-value associated with the test is given by
$$\hbox{P-valor}=2\times\mathbb{P}\left( t_{(n-2)}> \mid T_0 \mid \right).$$
We reject $H_0$ if the P-value is less than $\alpha.$
The confidence interval for $\beta_{w1}$ with (1-$\alpha$)100% is given by
$$IC[\beta_{w1}; 1-\alpha] = \left[\widehat{\beta_{w1}} - t_{\left(1-\alpha/2 ;n-2\right)}\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X}_w)^2}} ~;~\widehat{\beta_{w1}} +t_{\left(1-\alpha/2;n-2\right)}\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}} \right]$$
Example 1.11.3.1
In this example. we will apply hypothesis tests and construct confidence intervals for the parameters $(\beta_{w0},\beta_{w1}),$ For this we will use the data from example 1.11.1.1. As seen in Example 1.11.1.1, the parameter estimates are $\widehat{\beta_{w0}}=0,02039$ and $\widehat{\beta_{w1}}=0,720729$
From example 1.11.2.1 we obtain that
$$QME_w=5,203371\quad\hbox{e} \quad \widehat{\hbox{Var}}(\widehat{\beta}_{w0})=0,1233$$
Now, let’s test the hypotheses
$$\begin{cases} H_{0}:\beta_{w0}=0. \cr H_{1}:\beta_{w0} \neq 0. \end{cases}$$
Thus, the test statistic is given by
$$T_0=\dfrac{\widehat{\beta_{w0}}}{\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}}=\dfrac{0,02039}{\sqrt{0,1233}}=0,05807757$$
For $\alpha =$ 0.05 we have $t_{(1-0,05/2;47)}=2,101$.
How $T_0=26,46> 2,011741 = t_{(1-0,05/2;18)}$, and
$\hbox{P-valor} =2\times\mathbb{P}\left( t_{(n-2)}> \mid T_0 \mid\right)= 0,9539,$ we do not reject $H_0.$
The confidence interval, CI (95%), for $\beta_{w0}$ is given by
$$\left[\widehat{\beta_{w0}} - t_{\left(1-\alpha/2;n-2\right)} \sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}} ~;~ \widehat{\beta_{w0}} +t_{\left(1-\alpha/2;n-2\right)}\sqrt{\dfrac{QME_w\displaystyle\sum_{i=1}^{n} w_i x^2_i }{\displaystyle \sum_{i=1}^{n} w_i\sum_{i=1}^{n} w_i (X_i - \overline{X_w} )^2}}\right]$$
$$\left[0,02039-2,011741\times0,35120010 ~;~ 0,02039+2,011741\times0,35120010\right]$$
$$\left[ -0,6861266 ~;~ 0,7269203\right]$$
Similarly, we will test the hypotheses
$$\begin{cases} H_{0}:\beta_{w1}=0 \cr H_{1}:\beta_{w1} \neq 0 \end{cases}$$
It is worth remembering that from example 1.11.2.1 we obtain that $\widehat{\hbox{Var}}(\widehat{\beta_{w1}})=0,0001108.$ In this case, the test statistic is
$$T_0=\dfrac{\widehat{\beta_{w1}}}{\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}}}= \dfrac{0,7207}{0,02117622}= 68,46926310$$
For $\alpha =$ 0.05 we have $t_{(1-0,05/2;47)}=2,0117$.
How $T_0=68,47>2,0117=t_{(1-0,05/2;47)}$ and
$2\times \mathbb{P}\left( t_{(n-2)}> \mid T_0\mid \right)=9,3769053\times 10^{-49},$ we reject $H_0.$
The confidence interval, CI (95%), for $\beta_{w1}$ is given by
$$\left[\widehat{\beta_{w1}} - t_{\left(1-\alpha/2 ;n-2\right)}\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}} ~;~\widehat{\beta_{w1}} +t_{\left(1-\alpha/2;n-2\right)}\sqrt{\dfrac{QME_w}{\displaystyle \sum_{i=1}^{n} w_i (X_i - \overline{X_w})^2}} \right]$$
$$\left[ 0,72072908-2,0117\times 0,01052632~;~ 0,72072908+2,0117\times 0,01052632 \right]$$
$$\left[0,6995529~;~ 0,7419053\right]$$
Finally, look at the results obtained by the Action software again:
| G.L. | Sum of Squares | Medium Square | Stat. F | P-value | |
|---|---|---|---|---|---|
| Concentration | 1 | 24393.61704706 | 24393.61704706 | 4688.04043664 | 0 |
| Waste | 47 | 244.55847101 | 5.20337172 |
Table 4.1.75: ANOVA table
| Minimum | 1Q | Median | Average | 3Q | Maximum |
|---|---|---|---|---|---|
| -3.89340424 | 0.18729587 | 1.46569103 | 1.10882553 | 2.33610531 | 5.00818426 |
Table 4.1.76: Exploratory Analysis (residues)
| Estimate | Standard Deviation | Stat.t | P-value |
|---|---|---|---|
| Intercept | 0.02039689 | 0.35120008 | 0.05807771 |
| Concentration | 0.72072907 | 0.01052632 | 68.46926637 |
Table 4.1.77: Coefficients
| Standard Deviation of Residues | Degrees of Freedom | R^2 | Adjusted R^2 |
|---|---|---|---|
| 2.28109003 | 47 | 0.990074 | 0.98986281 |
Table 4.1.78: Descriptive Measure of Quality of Fit
4.1.11.5 Weighted least squares through transformations
The Action Stat software, as well as several available statistical software, allow the user to specify weights, not just the one used in the previous sections, that is, the weight $1/s^2_i.$ When this option is not available, weighted least squares estimators can be obtained by applying unweighted least squares to specially transformed observations.
The weighted least squares method is equivalent to the ordinary least squares method for specially transformed data. To illustrate this, we consider the case in which the error variance is proportional to the squared explanatory variable, that is, $\sigma^2_i=k X^2_i$ in which $w_i=1/X^2_i.$
$$Q_w= \sum^n_{i=1}w_i(Y_i-\beta_0-\beta_1 X_i)^2=\sum^n_{i=1}\dfrac{1}{X^2_i}(Y_i-\beta_0-\beta_1 X_i)^2$$
$$=\sum^n_{i=1}(\dfrac{Y_i}{X^2_i}-\dfrac{\beta_0}{X^2_i}-\beta_1)^2 \tag{1.11.4.1}$$
We denote by
$$ Y^{\char42}_i=\dfrac{Y_i}{X_i}; \quad \beta^*_0=\beta_1;\quad X^{\char42}_i= \dfrac{1}{X_i}\quad \hbox{e} \quad \beta^{\char42}_1 = \beta_0$$
And we substitute in (1.11.4.1) and we get
$$Q_w= \sum^n_{i=1}w_i(Y^*_i-\beta^*_0-\beta^*_1 X^*_i)^2$$
which is the unweighted least squares criterion for observations $X^*_i$ and $Y^*_i$ transformed.
The variance of the residuals (error) for the model with the transformed variables is now constant. This can be seen by dividing the terms in the original model:
$$Y_i=\beta_0+\beta_i X_i+\varepsilon_i,\quad i=1,\dots,n.$$
by $\sqrt{w_i}=1/X_i.$
$$\dfrac{Y_i}{X_i}=\dfrac{\beta_0}{X_i}+\beta_i +\dfrac{\varepsilon_i}{X_i}$$
Using the same notation we obtain
$$Y^{\char42}_i = \beta^{\char42}_0 + \beta^{\char42}_i X^{\char42}_i+ \varepsilon^{\char42}_i \tag{1.11.4.2}$$
With this, we obtain that $\varepsilon^*_i=\varepsilon_i/X_i$
Therefore, (1.11.4.2) is the simple linear regression model using variable transformation. The variance of the residuals is now constant, because:
$$\hbox{Var}(\varepsilon^*_i)=\hbox{Var}\left(\dfrac{\varepsilon_i}{X_i}\right)=\dfrac{1}{X^2_i}\hbox{Var}\left(\varepsilon_i\right)= \dfrac{1}{X^2_i}(k X^2_i)=k$$
The Action software provides several weights for weighted simple linear regression, the main weights are:
$$w_i= \begin{cases}\dfrac{1}{X_i},\quad X_i\neq 0~\hbox{para todo}~ i \cr \cr \dfrac{1}{X^2_i},\quad X^2_i\neq 0~\hbox{para todo}~ i \cr \cr \dfrac{1}{Y_i},\quad Y_i\neq 0~\hbox{para todo}~ i \cr \cr \dfrac{1}{Y^2_i},\quad Y^2_i\neq 0~\hbox{para todo}~ i \cr \cr \dfrac{1}{s^2_i},\quad s^2_i\neq 0~\hbox{para todo}~ i \cr \cr \dfrac{1/s^2_i}{n\displaystyle\sum^n_{j=1}\frac{1}{s^2_i}}\quad s^2_i\neq 0 ~\hbox{para todo}~i \cr \cr \end{cases} $$
There are strategies for choosing these weights, for example, in the article by Almeida et al. (2002), cites a method for calibration curves. In this article, the best weight is chosen according to the calculation of the percentage of relative error (%RE), in which it compares the concentration found through the adjustment of the weighted regression model ($C_{adj}$) versus the nominal concentration ($C_{nom}$). The relative error percentage is calculated as follows:
$$\char37RE= \dfrac{C_{adj}-C_{nom}}{C_{nom}}\times 100\char37$$
It is worth remembering that in statistics this is the study of bias or vice of the adjusted concentration versus the empirical concentration of the model.
The evaluation of the best model is done through the graph of the percentage of relative error versus concentration, in which %RE must be randomly distributed around zero and by calculating the sum of the percentage of relative error (%RE). This sum is defined as the sum of the absolute values of the relative error percentage and the evaluation of this measure is made using the lowest among all the models tested.
Below we present a summary of the strategy adopted to deal with the failure of the homoscedasticity assumption of the simple linear regression model.
Figure 4.1.19: Flowchart for heteroscedastic model.
We conclude that there are several strategies for considering the simple linear regression model to deal with the heteroscedasticity of the model and the Action software allows the choice of these and even leaves the user free to choose the weight that best suits the intended application.