On this page
6.6 Normality Tests
Normality tests are used to check whether the probability distribution associated with a set of data can be approximated by the normal distribution. The main techniques discussed are:
6.6.1 Graphic technique
Probability Paper and QQ-plot
Graphical method is a technique used to verify the adequacy of a given statistical model to the data. The technique we will describe is simple to use and can be applied to numerous types of statistical models. Let’s consider the Normal model with average $\mu$ and variance $\sigma^2$. For more information about normal distribution, see chapter 6.2 - Normal distribution. Se $X\sim N(\mu,\sigma^2)$, the transformation $$Z=\frac{X-\mu}{\sigma}$$
has a standard normal distribution (mean zero and variance 1). Let us denote the cumulative distribution of $Z$ by $\Phi$. Se $F$ is the cumulative distribution function of the normal distribution with mean $\mu$ and variance $\sigma^2$, we have to $$F(x)=\mathbb{P}[X \leq x ]=\mathbb{P}\left[Z\leq \frac{x-\mu}{\sigma}\right]=\Phi\left(\frac{x-\mu}{\sigma}\right).$$
Applying the function $\Phi^{-1}$ on both sides we have $$\Phi^{-1}(F(x))=\frac{x-\mu}{\sigma}$$
where do we get that $$x=\sigma\Phi^{-1}(F(x))+\mu$$
where $\Phi^{-1}(F(x))$ is the quantile of the standard Normal distribution, calculated at the point $F(x)$. As the expression above has the format of a linear expression, when we graph between $x$ and $\Phi^{-1}(F(x))$ we should expect a linear behavior of the points, if the Normal distribution is really adequate. With this, we can build the Probability Paper or QQ-Plot from the following steps:
-
Consider a sample $x_1,\ldots,x_n$;
-
Order the sample elements, i.e. $x_{(1)}\leq x_{(2)}\leq\ldots\leq x_{(n)}$;
-
Calculate $n$ values $d_i = \dfrac{i-a}{n+1-2\cdot a}$, with $i = 1,\ldots,n. \quad a= \dfrac{3}{8}$, if $n \leq 10; a= \dfrac{1}{2}$, otherwise. Correction is necessary so that we do not have $d_i=1$, because in this case, we would have to $\phi^{-1} (1) = \infty$. These constants are not standard, depending on the author (or statistics software) they may change.
-
Calculate the quantiles of the standard Normal distribution for each of the values $d_i$, that is, $$\Phi^{-1}(d_{i}), \quad \quad i=1, \ldots, n;$$
5.1) (Probability Paper Case) Make a graph with the points $(x_{(i)}, \Phi^{-1}(d_{i})), \quad i=1, \ldots, n;$ or
5.2) (QQ-plot case) Make a graph with the points $(\Phi^{-1}(d_{i}), x_{(i)}), \quad i=1, \ldots, n;$ and
assess the normality of the data. To do this, we must check the linear behavior of the points. The “more linear” the graph, the better the normality of the data.
Example 6.1.1
Evaluate the normality of data referring to the measurement of 10 pieces.
| Sample |
|---|
| 1,90642 |
| 2,10288 |
| 1,52229 |
| 2,61826 |
| 1,42738 |
| 2,22488 |
| 1,69742 |
| 3,15435 |
| 1,98492 |
| 1,99568 |
Table 6.6.1: Part measurement sample (1)
Ordering the sample elements, we have
| $x_{(1)}$ | 1,42738 |
| $x_{(2)}$ | 1,52229 |
| $x_{(3)}$ | 1,69742 |
| $x_{(4)}$ | 1,90642 |
| $x_{(5)}$ | 1,98492 |
| $x_{(6)}$ | 1,99568 |
| $x_{(7)}$ | 2,10288 |
| $x_{(8)}$ | 2,22488 |
| $x_{(9)}$ | 2,61826 |
| $x_{(10)}$ | 3,15435 |
Table 6.6.2: Ordered sample
Let’s now calculate the values $d_i$’s, to $i = 1,\ldots,10$. We have to, $n=10, a=\frac{3}{8}=0,375$. The results are as follows:
$$d_{1}=\frac{1-0,375}{10+1-2\cdot0,375}=0,060976$$
$$d_{2}=\frac{2-0,375}{10+1-2\cdot0,375}=0,158537$$
$$d_{3}=\frac{3-0,375}{10+1-2\cdot0,375}=0,256098$$
$$d_{4}=\frac{4-0,375}{10+1-2\cdot0,375}=0,353659$$
$$d_{5}=\frac{5-0,375}{10+1-2\cdot0,375}=0,451220$$
$$d_{6}=\frac{6-0,375}{10+1-2\cdot0,375}=0,548780$$
$$d_{7}=\frac{7-0,375}{10+1-2\cdot0,375}=0,646341$$
$$d_{8}=\frac{8-0,375}{10+1-2\cdot0,375}=0,743902$$
$$d_{9}=\frac{9-0,375}{10+1-2\cdot0,375}=0,841463$$
$$d_{10}=\frac{10-0,375}{10+1-2\cdot0,375}=0,939024$$
In this way, calculating the quantiles $\Phi^{-1}(d_i)$ we have to
| $x_{(i)}$ | $d_i$ | $\Phi^{-1}(d_i)$ |
|---|---|---|
| 1,42738 | 0,060976 | -1,54664 |
| 1,52229 | 0,158537 | -1,00049 |
| 1,69742 | 0,256098 | -0,65542 |
| 1,90642 | 0,353659 | -0,37546 |
| 1,98492 | 0,45122 | -0,12258 |
| 1,99568 | 0,54878 | 0,122581 |
| 2,10288 | 0,646341 | 0,375462 |
| 2,22488 | 0,743902 | 0,655424 |
| 2,61826 | 0,841463 | 1,000491 |
| 3,15435 | 0,939024 | 1,546635 |
Table 6.6.3: Calculated sample statistics
Plotting the points of the shape $(x_{(i)},\Phi^{-1}(d_i))$ we have the probability role given by
Figure 6.6.1: Probability Paper Chart
Also, if plotting the points of the form $(\Phi^{-1}(d_i), x_{(i)},)$ we have the QQ-plot given by
Figure 6.6.2: QQ-plot graph
As demonstrated above, the normality of the data is related to the linearity of the graph, the “more linear” the graph, the better the normality of the data. In the example above, the points are close to the straight line, which is a good indication of the normality of the data.
Histogram
We can compare the histogram of the data distribution with the theoretical density function, in this case, the normal distribution with corresponding mean and standard deviation.
Figure 6.6.3: Histogram of data distribution with the theoretical density function
Empirical
We compare the empirical distribution function with the theoretical accumulated distribution function.
Figure 6.6.4: Empirical distribution function and theoretical FDA
6.6.2 Kolmogorov-Smirnov test
Most of the problems we encounter in statistics are treated with the assumption that the data are taken from a population with a specific probability distribution. The format of this distribution may be one of the objectives of the analysis. For example, suppose that a small number of observations were drawn from a population with an unknown distribution and that we are interested in testing hypotheses about the mean of this population. The traditional parametric test, based on the student’s t-distribution, is obtained under the assumption that the population has a normal distribution. In this sense, there is a need to certify whether this assumption can be assumed. In some cases, assuming data normality is the first step we take to simplify our analyses. To support this assumption, we consider, among others, the Kolmogorov - Smirnov test.
The Kolmogorov - Smirnov test can be used to evaluate the hypotheses:
$$\begin{cases} H_0: \hbox{Os dados seguem uma distribuição normal} \cr H_1: \hbox{Os dados não seguem uma distribuição normal.}\end{cases}$$
This test observes the maximum absolute difference between the accumulated distribution function assumed for the data, in this case Normal, and the empirical distribution function of the data. As a criterion, we compare this difference with a critical value, for a given level of significance.
Consider a simple random sample $X_1, X_2 , \cdots , X_n$ of a population with continuous cumulative distribution function $F_X$ unknown. The statistics used for the test are: $$D_n=\sup_x|F(x)-F_n(x)|$$
This function corresponds to the maximum vertical distance between the graphs of $F(x)$ and $F_n(x)$ about the range of possible values of $x$. In $D_n$ we have to
-
$F(x)$ represents the accumulated distribution function assumed for the data;
-
$F_n(x)$ represents the empirical accumulated distribution function of the data.
In this case, we want to test the hypothesis $H_0 : F_X = F$ against the alternative hypothesis $H_1 : F_X \neq F$. For this, we take $X_{(1)}, X_{(2)}, \cdots , X_{(n)}$ random observations ordered in increasing order of the population with continuous distribution function $F_X$. In the case of analyzing data normality, we assume $F$ the normal distribution function.
The cumulative distribution function assumed for the data is defined by $F(x_{(i)}) = \mathbb{P}(X\leq x_{(i)})$ and the empirical accumulated distribution function is defined by a ladder function, given by the formula: $$F_n(x)=\frac{1}{n}\sum_{i=1}^n \mathbb{I}_{\lbrace(-\infty,x]\rbrace}(x_{(i)})$$
where $\mathbb{I}_A$ is the indicator function. The indicator function is defined as follows:
$$\mathbb{I}_{A}=\begin{cases} 1; \ \hbox{se} \ x\in A \cr 0; \ \hbox{caso contrário}\end{cases}$$
Note that the empirical distribution function $F_n(x)$ corresponds to the proportion of values less than or equal to $x$. Such a function can also be written as follows
$$F_{n}(x)=\begin{cases}0, \hbox{se} \quad x< x_{(1)}\cr\frac{k}{n}, \hbox{se} \quad x_{(k)}\leq x< x_{(k + 1)}\cr1,\hbox{se} \quad x>x_{(n)} \end{cases}$$
Under $H_0$, the asymptotic distribution of the Kolmogorov-Smirnov statistic is given by $$\lim_{n \rightarrow \infty}P\left[\sqrt{n} D_n \leq x\right] = 1-2 \sum_{j=1}^{\infty} (-1)^{j-1} \exp^{-2j^2x^2}.$$
This asymptotic distribution is valid when we have complete knowledge about the distribution of $H_0$, however, in practice, $H_0$ specifies a family of probability distributions. In this case, the asymptotic distribution of the Kolmogorov-Smirnov statistic is not known and was determined via simulation.
How does the empirical distribution function $F_n$ is discontinuous and the hypothesized distribution function is continuous, let’s consider two other statistics: $$D^+=\sup_{x_{(i)}}|F(x_{(i)})-F_n(x_{(i)})|$$
$$D^-=\sup_{x_{(i)}}|F(x_{(i)})-F_n(x_{(i-1)})|$$
to calculate the Kolmogorov-Smirnov statistic. These statistics measure the distances (vertical) between the graphs of the two functions, theoretical and empirical, at the points $x_{(i-1)}$ and $x_{(i)}$. With this, we can use as a test statistic $$D_n=\max(D^+,D^-)$$
Se $D_n$ is greater than the critical value, we reject the hypothesis of data normality with $(1-\alpha)100\char37$ trustworthy. Otherwise, we do not reject the normality hypothesis.
Summary of test statistics.
| x(ordered) | $F_{n}(x) $ | $F(x)=\mathbb{P}\left(z_{(i)}\leq\frac{\displaystyle x_{(i)}- \overline{x}}{\displaystyle s} \right)$ | $\mid F(x_{i})-F_{n}(x_{(i)})\mid$ | $\mid F(x_{(i)})-F_{n}(x_{(i-1)})\mid$ |
|---|---|---|---|---|
| $$x_{(1)}$$ $$x_{(2)}$$ $$\vdots$$ | $$\frac{1}{n}$$ $$\frac{2}{n}$$ $$\vdots$$ | $$F(x)=\mathbb{P}\left(z_{(1)} \leq\frac{\displaystyle x_{(1)}-\overline{x}}{\displaystyle s}\right)$$ $$F(x)=\mathbb{P}\left(z_{(2)} \leq\frac{\displaystyle x_{(2)}-\overline{x}}{\displaystyle s}\right)$$ $$\vdots$$ | $$\mid F(x_{(1)})-F_{n}(x_{(1)})\mid$$ $$\mid F(x_{(2)})-F_{n}(x_{(2)})\mid$$ $$\vdots$$ | $$\mid F(x_{(1)})-0 \mid$$ $$\mid F(x_{(2)})-F_{n}(x_{(1)})\mid$$ $$\vdots$$ |
| $$\vdots$$ $$x_{(n-1)}$$ $$x_{(n)}$$ | $$\frac{n-1}{n}$$ $$1$$ | $$F(x)=\mathbb{P} \left(z_{(n-1)} \leq \frac{\displaystyle x_{(n-1)}-\overline{x}}{\displaystyle s}\right) $$ $$F(x)=\mathbb{P} \left(z_{(n)}\leq\frac{\displaystyle x_{(n)}-\overline{x}}{\displaystyle s}\right)$$ | $$\mid F(x_{(n-1)})-F_{n}x_{(n-1)}\mid$$ $$ \mid F(x_{(n)})-F_{n}(x_{(n)})\mid$$ | $$\mid F(x_{(n-1)})-F_{n}(x_{(n-2)})\mid $$ $$\mid F(x_{(n)})-F_{n}(x_{(n-1)})\mid$$ |
Table 6.6.4: Test statistics.
NOTE: The value of $\mathbb{P}\left(Z_{(i)}\leq\frac{x_{(i)}-\bar{x}}{s}\right)$ is found in the standard normal distribution table.
The table of critical values for the Komolgorov-Smirnov test statistic $(D_n)$ is given below.
Significance levels
| n | 0,2 | 0,1 | 0,05 | 0,01 |
|---|---|---|---|---|
| 5 | 0,45 | 0,51 | 0,56 | 0,67 |
| 10 | 0,32 | 0,37 | 0,41 | 0,49 |
| 15 | 0,27 | 0,30 | 0,34 | 0,40 |
| 20 | 0,23 | 0,26 | 0,29 | 0,36 |
| 25 | 0,21 | 0,24 | 0,27 | 0,32 |
| 30 | 0,19 | 0,22 | 0,24 | 0,29 |
| 35 | 0,18 | 0,20 | 0,23 | 0,27 |
| 40 | 0,17 | 0,19 | 0,21 | 0,25 |
| 45 | 0,16 | 0,18 | 0,20 | 0,24 |
| 50 | 0,15 | 0,17 | 0,19 | 0,23 |
| Higher values | $ \frac{1,07}{\sqrt{n}} $ | $ \frac{1,22}{\sqrt{n}} $ | $ \frac{1,36}{\sqrt{n}} $ | $ \frac{1,63}{\sqrt{n}} $ |
Table 6.6.5: The table of critical values for the Komolgorov-Smirnov test statistic $(D_n)$ of different levels of significance
Example 6.2.1
Evaluate the normality of the data regarding the measurement of 10 pieces.
| 1,90642 |
| 2,10288 |
| 1,52229 |
| 2,61826 |
| 1,42738 |
| 2,22488 |
| 1,69742 |
| 3,15435 |
| 1,98492 |
| 1,99568 |
Table 6.6.6: Part measurement sample (1)
Solution
After sorting the data, we obtain the value of $F_n(x_{(i)})$ making the ratio between the position $i$ and the total data value, $n$. The value of $F(x_{(i)})$ is found in the standard normal distribution table, after transforming the data by the relation $$Z_{(i)}=\frac{x_{(i)}-\overline{x}}{s}$$
where $\overline{x}$ is the arithmetic mean and $s$ is the standard deviation of the data.
| Data | $ F_n(x) $ empirical | $ F(x) $ theoretical | $ |F(x_{(i)})-F_n(x_{(i)})| $ | $ |F(x_{(i)})-F_n(x_{(i-1)})| $ |
|---|---|---|---|---|
| 1,42738 | 0,1 | 0,1086547 | 0,0086547 | 0,1086547 |
| 1,52229 | 0,2 | 0,1469448 | 0,0530552 | 0,0469448 |
| 1,69742 | 0,3 | 0,2388688 | 0,0611312 | 0,0388688 |
| 1,90642 | 0,4 | 0,3803466 | 0,0196534 | 0,0803466 |
| 1,98492 | 0,5 | 0,4394702 | 0,0605298 | 0,0394702 |
| 1,99568 | 0,6 | 0,4477126 | 0,1522874 | 0,0522874 |
| 2,10288 | 0,7 | 0,5304822 | 0,1695178 | 0,0695178 |
| 2,22488 | 0,8 | 0,6229025 | 0,1770975 | 0,0770975 |
| 2,61826 | 0,9 | 0,8590611 | 0,0409389 | 0,0590611 |
| 3,15435 | 1,0 | 0,9828237 | 0,0171763 | 0,0828237 |
| Maximum | 0,1770975 | 0,1086547 |
Table 6.6.7: Calculated test statistics
With this, $$D_n=\max(0,1770975;0,1086547)=0,1770975.$$
Considering $\alpha = 0,05$ and $n = 10$, we find from the table of critical values the value $0,41$. How $D_n = 0,1770975 \ < \ 0,41$, we have no evidence to reject the hypothesis of data normality.
See below the results obtained by the software Action.
| Statistics | P-values | |
|---|---|---|
| Kolmogorov - Smirnov | 0.1771 | 0.5012 |
Table 6.6.8: Results of the Kolmogorov - Smirnov normality test
Figure 6.6.5: Probability Paper Chart
6.6.3 Anderson-Darling test
The Anderson-Darling test can be used to evaluate the following hypotheses:
$$\begin{cases}H_0: \ \hbox{A amostra segue uma distribuição normal.} \cr H_1: \hbox{A amostra não segue uma distribuição normal.} \end{cases}$$
For Normal distribution with probability density function $$f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \ (-\infty < x < \infty).$$
The following table provides some quantile values and the modified Anderson Darling statistic, given by $$A^2_m=\left(1+\frac{0,75}{n}+\frac{2,25}{n^2}\right)A^2.$$
Case 0: The parameter $\theta (\mu,\sigma^2)$ is fully known.
Case 1: $\mu$ is known and $\sigma^2$ is estimated by $s^2$.
Case 2: $\sigma^2$ is known and $\mu$ is estimated by $\overline{X}$.
Case 3: None of the components of $\theta = (\mu,\sigma^2)$ is known and are estimated by ($\overline{X},s^2$)
| Case | Modification | 15,0 | 10,0 | 5,0 | 2,5 | 1,0 |
|---|---|---|---|---|---|---|
| Case 0 | - | 1,610 | 1,933 | 2,492 | 3,070 | 3,857 |
| Case 1 | - | 0,784 | 0,897 | 1,088 | 1,281 | 1,541 |
| Case 2 | - | 1,443 | 1,761 | 2,315 | 2,890 | 3,682 |
| Case 3 | $A²(1+(0,75/n)+(2,25/n²))$ | 0,560 | 0,632 | 0,751 | 0,870 | 1,029 |
Table 6.6.8: Some quantile values and the modified Anderson Darling statistic
Regarding the calculation of the p-value, it depends on the value of the modified Anderson-Darling statistic $A^{2}_{m}$. From this value, an interpolation is used that approximates an exponential function. We present the calculation of the p-value in the following table.
| $ A^{2}_{m} $ | P-value |
|---|---|
| $ A^{2}_{m} < 0,200 $ | p-value = 1 - exp(-13.436 + 101.14 * $A²_{m}$ - 223,73 * ($A^{2}_{m})^{2}$) |
| $ 0,200 < A^{2}_{m} < 0,340 $ | p-value = 1 - exp(-8.318 + 42.796 * $A²_{m}$ - 59,938 * ($A^{2}_{m})^{2}$) |
| $ 0,340 < A^{2}_{m} < 0,600 $ | p-value = exp(0.9177 - 4.279 * $A²_{m}$ - 1,38 * ($A^{2}_{m})^{2}$) |
| $ A^{2}_{m} > 0,600 $ | p-value = exp(1.2937 - 5.709 * $A²_{m}$ + 0,0186 * ($A^{2}_{m})^{2}$) |
Table 6.6.9: Calculation of the p-value depending on the value of the modified Anderson Darling statistic
Example 6.3.1:
Consider again Example 6.1.1 about measuring 10 pieces.
| 1,90642 | 2,22488 |
| 2,10288 | 1,69742 |
| 1,52229 | 3,15435 |
| 2,61826 | 1,98492 |
| 1,42738 | 1,99568 |
Table 6.6.10: Part measurement sample (1)
Let’s test
$$\begin{cases}H_0: \ \hbox{os dados seguem uma distribuição normal} \ N(\mu,\sigma^2) \cr H_1: \ \hbox{os dados não seguem uma distribuição normal} \end{cases}$$
The average of the data is $\bar{X} = 2,0634$ and the standard deviation is $s = 0,5156$.
| Data | Ordered data | $ F(x_i) $ | $ \ln(F(x_i)) $ | $ \ln(1-F(x_i)) $ |
|---|---|---|---|---|
| 1,90642 | 1,42738 | 0,10865 | -2,21958 | -0,11502 |
| 2,10288 | 1,52229 | 0,14694 | -1,91770 | -0,15893 |
| 1,52229 | 1,69742 | 0,23887 | -1,43184 | -0,27295 |
| 2,61826 | 1,90642 | 0,38035 | -0,96667 | -0,47860 |
| 1,42738 | 1,98492 | 0,43947 | -0,82219 | -0,57887 |
| 2,22488 | 1,99568 | 0,44771 | -0,80360 | -0,59369 |
| 1,69742 | 2,10288 | 0,53048 | -0,63397 | -0,75605 |
| 3,15435 | 2,22488 | 0,62290 | -0,47337 | -0,97523 |
| 1,98492 | 2,61826 | 0,85906 | -0,15192 | -1,95942 |
| 1,99568 | 3,15435 | 0,98282 | -0,01733 | -4,06422 |
Table 6.6.11: Calculated test statistics
Using the formula $(\star)$, we have to $$D = -103,4169.$$
$$A^2=-n-\frac{D}{n}=-10+\frac{103,4169}{10}=0,3416856.$$
The modified Anderson Darling statistic for this case (Case 3 with unknown μ and σ) is given by: $$A_m^2=A^2\left(1+\frac{0,75}{n}+\frac{2,25}{n^2}\right)=0,375.$$
How the modified statistic resulted in $A^{2}_{m} = 0,375$, we have that the calculation of the p-value is given by:
$$\hbox{p-valor} = \exp(0,9177 - 4,279 \times A²_{m} + 1,38 \times (A^{2}_{m})^{2})=$$ $$\exp(0,9177 - 4,279 \times 0,375 + 1,38 \times (0,375)^{2})=0,414374$$
Therefore, there is strong evidence that the data comes from a Normal distribution.
See below the results obtained from the Action software.
| Statistics | P-values | |
|---|---|---|
| Anderson - Darling | 0.3417 | 0.4144 |
Table 6.6.12: Anderson Darling normality test results
Figure 6.6.6: Probability Paper Chart
Example 6.3.2
Consider the following men’s weight measurements (in pounds): 148, 154, 158, 160, 161, 162, 166, 170, 182, 195, 236. Let’s test:
$$\begin{cases}H_0: \ \hbox{os dados seguem uma distribuição normal} \ N(\mu,\sigma^2) \cr H_1: \ \hbox{os dados não seguem uma distribuição normal} \end{cases}$$
The average of the data is $\bar{x} = 172$ and the standard deviation is $s = 24,9520$.
Calculating the value of A²
| Data | Ordered data | $ F(x_i) $ | $ \ln(F(x_i)) $ | $ \ln(1-F(x_i)) $ |
|---|---|---|---|---|
| 154 | 148 | 0,168063 | -1,78341 | -0,184 |
| 148 | 154 | 0,235336 | -1,44674 | -0,26832 |
| 170 | 158 | 0,287372 | -1,24698 | -0,3388 |
| 161 | 160 | 0,315285 | -1,15428 | -0,37875 |
| 160 | 161 | 0,329662 | -1,10969 | -0,39997 |
| 166 | 162 | 0,344295 | -1,06626 | -0,42204 |
| 162 | 166 | 0,404986 | -0,9039 | -0,51917 |
| 158 | 170 | 0,468057 | -0,75916 | -0,63122 |
| 182 | 182 | 0,655705 | -0,42204 | -1,06626 |
| 195 | 195 | 0,821676 | -0,19641 | -1,72415 |
| 236 | 236 | 0,99484 | -0,00517 | -5,26684 |
Table 6.6.13: Calculated test statistics
Using the formula $(\star)$, we have: $$D= -131,4145.$$
$$A^2=-\frac{D}{n}-n=\frac{131,4145}{11}-11=0,9467719.$$
The modified Anderson Darling statistic for this case (Case 3 with $\mu$ and $\sigma$ unknown) is given by: $$A_m^2=A^2\left(1+\frac{0,75}{n}+\frac{2,25}{n^2}\right)=0,9467719\times(1+0,06818182+0,01859504)=1,02893.$$
We have that the p-value is given by:
$$\hbox{p-valor} = \exp(1,2937 - 5,709 \times A²_{m} + 0,0186 \times (A^{2}_{m})^{2})=$$ $$\exp(1,2937 - 5,709 \times 1,02893 + 0,0186 \times (1,02893)^{2}) = 0,01044824 \simeq 1 \char37$$
Therefore, the p-value is approximately 1%. So, there is strong evidence that the data does not come from a Normal distribution.
See below the results obtained by the software Action.
| Statistics | P-values | |
|---|---|---|
| Anderson - Darling | 0.9468 | 0.0105 |
Table 6.6.14: Anderson Darling normality test results
Figure 6.6.7: Probability Paper Chart
6.6.4 Shapiro-Wilk test
The Shapiro-Wilk test, proposed in 1965, is based on the W statistic given by: $$W=\frac{b^2}{\displaystyle\sum_{i=1}^n (x_{(i)}-\bar{x})^2}$$
in which $x_{i}$ are the ordered sample values ($x_{(1)}$ is the smallest). The constant b is determined as follows
$$b=\begin{cases}\displaystyle\sum_{i=1}^{n/2}a_{n-i+1}\times (x_{(n-i+1)}-x_{(i)}) \ \hbox{se n é par} \cr \cr \displaystyle\sum_{i=1}^{(n+1)/2}a_{n-i+1}\times (x_{(n-i+1)}-x_{(i)}) \ \hbox{se n é ímpar}\end{cases}$$
in which $a_{n-i+1}$ are constants generated by the means, variances and covariances of the order statistics of a sample of size n from a Normal distribution. Their values, tabulated, are given below.
| i\n | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0,7071 | 0,7071 | 0,6872 | 0,6646 | 0,6431 | 0,6233 | 0,6062 | 0,5888 | 0,5739 | 0,5601 | 0,5475 | 0,5359 | |
| 2 | 0,1677 | 0,2413 | 0,2806 | 0,3031 | 0,3164 | 0,3244 | 0,3291 | 0,3315 | 0,3325 | 0,3325 | |||
| 3 | 0,0875 | 0,1401 | 0,1743 | 0,1976 | 0,2141 | 0,2260 | 0,2347 | 0,2412 | |||||
| 4 | 0,0561 | 0,0947 | 0,1224 | 0,1429 | 0,1586 | 0,1707 | |||||||
| 5 | 0,0399 | 0,0695 | 0,0922 | 0,1099 | |||||||||
| 6 | 0,0303 | 0,0539 | |||||||||||
| i\n | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | |
| 1 | 0,5251 | 0,5150 | 0,5056 | 0,4968 | 0,4886 | 0,4808 | 0,4734 | 0,4643 | 0,4590 | 0,4542 | 0,4493 | 0,4450 | |
| 2 | 0,3318 | 0,3306 | 0,3290 | 0,3273 | 0,3253 | 0,3232 | 0,3211 | 0,3185 | 0,3156 | 0,3126 | 0,3098 | 0,3069 | |
| 3 | 0,2460 | 0,2495 | 0,2521 | 0,2540 | 0,2553 | 0,2561 | 0,2565 | 0,2578 | 0,2571 | 0,2563 | 0,2554 | 0,2543 | |
| 4 | 0,1802 | 0,1878 | 0,1939 | 0,1988 | 0,2027 | 0,2059 | 0,2085 | 0,2119 | 0,2131 | 0,2139 | 0,2145 | 0,2148 | |
| 5 | 0,1240 | 0,1353 | 0,1447 | 0,1524 | 0,1587 | 0,1641 | 0,1686 | 0,1736 | 0,1764 | 0,1787 | 0,1807 | 0,1822 | |
| 6 | 0,0727 | 0,0880 | 0,1005 | 0,1109 | 0,1197 | 0,1271 | 0,1334 | 0,1399 | 0,1443 | 0,1480 | 0,1512 | 0,1539 | |
| 7 | 0,0240 | 0,0433 | 0,0593 | 0,0725 | 0,0837 | 0,0932 | 0,1013 | 0,1092 | 0,115 | 0,1201 | 0,1245 | 0,1283 | |
| 8 | 0,0196 | 0,0359 | 0,0496 | 0,0612 | 0,0711 | 0,0804 | 0,0878 | 0,0941 | 0,0997 | 0,1046 | |||
| 9 | 0,0163 | 0,0303 | 0,0422 | 0,0530 | 0,0618 | 0,0696 | 0,0764 | 0,0823 | |||||
| 10 | 0,0140 | 0,0263 | 0,0368 | 0,0459 | 0,0539 | 0,061 | |||||||
| 11 | 0,0122 | 0,0228 | 0,0321 | 0,0403 | |||||||||
| 12 | 0,0107 | 0,0200 | |||||||||||
| 13 | 0,0000 | ||||||||||||
| i\n | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | |
| 1 | 0,4407 | 0,4366 | 0,4328 | 0,4291 | 0,4254 | 0,4220 | 0,4188 | 0,4156 | 0,4127 | 0,4096 | 0,4068 | 0,4040 | |
| 2 | 0,3043 | 0,3018 | 0,2992 | 0,2968 | 0,2944 | 0,2921 | 0,2898 | 0,2876 | 0,2854 | 0,2834 | 0,2813 | 0,2794 | |
| 3 | 0,2533 | 0,2522 | 0,2510 | 0,2499 | 0,2487 | 0,2475 | 0,2463 | 0,2451 | 0,2439 | 0,2427 | 0,2415 | 0,2403 | |
| 4 | 0,2151 | 0,2152 | 0,2151 | 0,2150 | 0,2148 | 0,2145 | 0,2141 | 0,2137 | 0,2132 | 0,1227 | 0,2121 | 0,2116 | |
| 5 | 0,1836 | 0,1848 | 0,1857 | 0,1864 | 0,1870 | 0,1874 | 0,1878 | 0,1880 | 0,1882 | 0,1883 | 0,1883 | 0,1883 | |
| 6 | 0,1563 | 0,1584 | 0,1601 | 0,1616 | 0,1630 | 0,1641 | 0,1651 | 0,1660 | 0,1667 | 0,1673 | 0,1678 | 0,1683 | |
| 7 | 0,1316 | 0,1346 | 0,1372 | 0,1395 | 0,1415 | 0,1433 | 0,1449 | 0,1463 | 0,1475 | 0,1487 | 0,1496 | 0,1505 | |
| 8 | 0,1089 | 0,1128 | 0,1162 | 0,1192 | 0,1219 | 0,1243 | 0,1265 | 0,1284 | 0,1301 | 0,1317 | 0,1331 | 0,1344 | |
| 9 | 0,0876 | 0,0923 | 0,0965 | 0,1002 | 0,1036 | 0,1066 | 0,1093 | 0,1118 | 0,1140 | 0,1160 | 0,1179 | 0,1196 | |
| 10 | 0,0672 | 0,0728 | 0,0778 | 0,0822 | 0,0862 | 0,0899 | 0,0931 | 0,0961 | 0,0988 | 0,1013 | 0,1036 | 0,1056 | |
| 11 | 0,0476 | 0,0540 | 0,0598 | 0,065 | 0,0697 | 0,0739 | 0,0777 | 0,0812 | 0,0844 | 0,0873 | 0,0900 | 0,0924 | |
| 12 | 0,0284 | 0,0358 | 0,0424 | 0,0483 | 0,0537 | 0,0585 | 0,0629 | 0,0669 | 0,0706 | 0,0739 | 0,0770 | 0,0798 | |
| 13 | 0,0094 | 0,0178 | 0,0253 | 0,032 | 0,0381 | 0,0435 | 0,0485 | 0,0530 | 0,0572 | 0,0610 | 0,0645 | 0,0677 | |
| 14 | 0,0000 | 0,0084 | 0,0159 | 0,0227 | 0,0289 | 0,0344 | 0,0395 | 0,0441 | 0,0484 | 0,0523 | 0,0559 | ||
| 15 | 0 | 0,0076 | 0,0144 | 0,0206 | 0,0262 | 0,0314 | 0,0361 | 0,0404 | 0,0444 | ||||
| 16 | 0,0000 | 0,0068 | 0,0131 | 0,0187 | 0,0239 | 0,0287 | 0,0331 | ||||||
| 17 | 0,0000 | 0,0062 | 0,0119 | 0,0172 | 0,0220 | ||||||||
| 18 | 0,0000 | 0,0057 | 0,0110 | ||||||||||
| 19 | 0,0000 | ||||||||||||
| i\n | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
| 1 | 0,4015 | 0,3989 | 0,3964 | 0,3940 | 0,3917 | 0,3894 | 0,3872 | 0,3850 | 0,3830 | 0,3808 | 0,3789 | 0,3770 | 0,3751 |
| 2 | 0,2774 | 0,2755 | 0,2737 | 0,2719 | 0,2701 | 0,2684 | 0,2667 | 0,2651 | 0,2635 | 0,2620 | 0,2604 | 0,2589 | 0,2574 |
| 3 | 0,2391 | 0,2380 | 0,2368 | 0,2357 | 0,2345 | 0,2334 | 0,2323 | 0,2313 | 0,2302 | 0,2291 | 0,2281 | 0,2271 | 0,2260 |
| 4 | 0,2110 | 0,2104 | 0,2098 | 0,2091 | 0,2085 | 0,2078 | 0,2072 | 0,2065 | 0,2058 | 0,2052 | 0,2045 | 0,2038 | 0,2032 |
| 5 | 0,1881 | 0,1880 | 0,1878 | 0,1876 | 0,1874 | 0,1871 | 0,1868 | 0,1865 | 0,1862 | 0,1859 | 0,1855 | 0,1851 | 0,1847 |
| 6 | 0,1686 | 0,1689 | 0,1691 | 0,1693 | 0,1694 | 0,1695 | 0,1695 | 0,1695 | 0,1695 | 0,1695 | 0,1693 | 0,1692 | 0,1691 |
| 7 | 0,1513 | 0,1520 | 0,1526 | 0,1531 | 0,1535 | 0,1539 | 0,1542 | 0,1545 | 0,1548 | 0,1550 | 0,1551 | 0,1553 | 0,1554 |
| 8 | 0,1356 | 0,1366 | 0,1376 | 0,1384 | 0,1392 | 0,1398 | 0,1405 | 0,1410 | 0,1415 | 0,1420 | 0,1423 | 0,1427 | 0,1430 |
| 9 | 0,1211 | 0,1225 | 0,1237 | 0,1249 | 0,1259 | 0,1269 | 0,1278 | 0,1286 | 0,1293 | 0,1300 | 0,1306 | 0,1312 | 0,1317 |
| 10 | 0,1075 | 0,1092 | 0,1108 | 0,1123 | 0,1136 | 0,1149 | 0,1160 | 0,1170 | 0,1180 | 0,1189 | 0,1197 | 0,1205 | 0,1212 |
| 11 | 0,0947 | 0,0967 | 0,0986 | 0,1004 | 0,1020 | 0,1035 | 0,1049 | 0,1062 | 0,1073 | 0,1085 | 0,1095 | 0,1105 | 0,1113 |
| 12 | 0,0824 | 0,0848 | 0,0870 | 0,0891 | 0,0909 | 0,0927 | 0,0943 | 0,0959 | 0,0972 | 0,0986 | 0,0998 | 0,1010 | 0,1020 |
| 13 | 0,0706 | 0,0733 | 0,0759 | 0,0782 | 0,0804 | 0,0824 | 0,0842 | 0,0860 | 0,0876 | 0,0892 | 0,0906 | 0,0919 | 0,0932 |
| 14 | 0,0592 | 0,0622 | 0,0651 | 0,0677 | 0,0701 | 0,0724 | 0,0745 | 0,0765 | 0,0783 | 0,0801 | 0,0817 | 0,0832 | 0,0846 |
| 15 | 0,0481 | 0,0515 | 0,0546 | 0,0575 | 0,0602 | 0,0628 | 0,0651 | 0,0673 | 0,0694 | 0,0713 | 0,0731 | 0,0748 | 0,0764 |
| 16 | 0,0372 | 0,0409 | 0,0444 | 0,0476 | 0,0506 | 0,0534 | 0,0560 | 0,0584 | 0,0607 | 0,0628 | 0,0648 | 0,0667 | 0,0685 |
| 17 | 0,0264 | 0,0305 | 0,0343 | 0,0379 | 0,0411 | 0,0442 | 0,0471 | 0,0497 | 0,0522 | 0,0546 | 0,0568 | 0,0588 | 0,0608 |
| 18 | 0,0158 | 0,0203 | 0,0244 | 0,0283 | 0,0318 | 0,0352 | 0,0383 | 0,0412 | 0,0439 | 0,0465 | 0,0489 | 0,0511 | 0,0532 |
| 19 | 0,0053 | 0,0101 | 0,0146 | 0,0188 | 0,0227 | 0,0263 | 0,0296 | 0,0328 | 0,0357 | 0,0385 | 0,0411 | 0,0436 | 0,0459 |
| 20 | 0,0000 | 0,0049 | 0,0094 | 0,0136 | 0,0175 | 0,0211 | 0,0245 | 0,0277 | 0,0307 | 0,0335 | 0,0361 | 0,0386 | |
| 21 | 0,0000 | 0,0045 | 0,0087 | 0,0126 | 0,0163 | 0,0197 | 0,0229 | 0,0259 | 0,0288 | 0,0314 | |||
| 22 | 0,0000 | 0,0042 | 0,0081 | 0,0118 | 0,0153 | 0,0185 | 0,0215 | 0,0244 | |||||
| 23 | 0,0000 | 0,0039 | 0,0076 | 0,0111 | 0,0143 | 0,0174 | |||||||
| 24 | 0,0000 | 0,0037 | 0,0071 | 0,0104 | |||||||||
| 25 | 0,0000 | 0,0350 |
Table 6.6.15: Constant statistic values $a$ by Shapiro-Wilk
To perform the Shapiro-Wilk test, we must:
1. Formulation of the Hypothesis:
$$\displaystyle \begin{cases}H_0: \hbox{A amostra provém de uma população Normal} \cr H_1: \hbox{A amostra não provém de uma população Normal}\end{cases}$$
2. Establish the test significance level (α), normally 0.05;
3. Calculate the test statistic:
-
Order the n sample observations: $x_{(1)}$, $x_{(2)}$, $x_{(3)}$, …, $x_{(n)}$;
-
Calculate $\displaystyle\sum_{i=1}^n(x_i-\bar{x})^2$;
-
Calculate b;
-
Calculate W.
4. Make the decision: Reject $H_{0}$ at the significance level α if $W_{\hbox{calculado }}$< $W_α$ (os valores críticos da estatística W de Shapiro-Wilk são dados na Tabela 6.6.16 abaixo).
Níveis de significância:
| N | 0,01 | 0,02 | 0,05 | 0,1 | 0,5 | 0,9 | 0,95 | 0,98 | 0,99 |
|---|---|---|---|---|---|---|---|---|---|
| 3 | 0,753 | 0,756 | 0,767 | 0,789 | 0,959 | 0,998 | 0,999 | 1,000 | 1,000 |
| 4 | 0,687 | 0,707 | 0,748 | 0,792 | 0,935 | 0,987 | 0,992 | 0,996 | 0,997 |
| 5 | 0,686 | 0,715 | 0,762 | 0,806 | 0,927 | 0,979 | 0,986 | 0,991 | 0,993 |
| 6 | 0,713 | 0,743 | 0,788 | 0,826 | 0,927 | 0,974 | 0,981 | 0,986 | 0,989 |
| 7 | 0,730 | 0,760 | 0,803 | 0,838 | 0,928 | 0,972 | 0,979 | 0,985 | 0,988 |
| 8 | 0,749 | 0,778 | 0,818 | 0,851 | 0,932 | 0,972 | 0,978 | 0,984 | 0,987 |
| 9 | 0,764 | 0,791 | 0,829 | 0,859 | 0,935 | 0,972 | 0,978 | 0,984 | 0,986 |
| 10 | 0,781 | 0,806 | 0,842 | 0,869 | 0,938 | 0,972 | 0,978 | 0,983 | 0,986 |
| 11 | 0,792 | 0,817 | 0,850 | 0,876 | 0,940 | 0,973 | 0,979 | 0,984 | 0,986 |
| 12 | 0,805 | 0,828 | 0,859 | 0,883 | 0,943 | 0,973 | 0,979 | 0,984 | 0,986 |
| 13 | 0,814 | 0,837 | 0,866 | 0,889 | 0,945 | 0,974 | 0,979 | 0,984 | 0,986 |
| 14 | 0,825 | 0,846 | 0,874 | 0,895 | 0,947 | 0,975 | 0,980 | 0,984 | 0,986 |
| 15 | 0,835 | 0,855 | 0,881 | 0,901 | 0,950 | 0,975 | 0,980 | 0,984 | 0,987 |
| 16 | 0,844 | 0,863 | 0,887 | 0,906 | 0,952 | 0,976 | 0,981 | 0,985 | 0,987 |
| 17 | 0,851 | 0,869 | 0,892 | 0,910 | 0,954 | 0,977 | 0,981 | 0,985 | 0,987 |
| 18 | 0,858 | 0,874 | 0,897 | 0,914 | 0,956 | 0,978 | 0,982 | 0,986 | 0,988 |
| 19 | 0,863 | 0,879 | 0,901 | 0,917 | 0,957 | 0,978 | 0,982 | 0,986 | 0,988 |
| 20 | 0,868 | 0,884 | 0,905 | 0,920 | 0,959 | 0,979 | 0,983 | 0,986 | 0,988 |
| 21 | 0,873 | 0,888 | 0,908 | 0,923 | 0,960 | 0,980 | 0,983 | 0,987 | 0,989 |
| 22 | 0,878 | 0,892 | 0,911 | 0,926 | 0,961 | 0,980 | 0,984 | 0,987 | 0,989 |
| 23 | 0,881 | 0,895 | 0,914 | 0,928 | 0,962 | 0,981 | 0,984 | 0,987 | 0,989 |
| 24 | 0,884 | 0,898 | 0,916 | 0,930 | 0,963 | 0,981 | 0,984 | 0,987 | 0,989 |
| 25 | 0,888 | 0,901 | 0,918 | 0,931 | 0,964 | 0,981 | 0,985 | 0,988 | 0,989 |
| 26 | 0,891 | 0,904 | 0,920 | 0,933 | 0,965 | 0,982 | 0,985 | 0,988 | 0,989 |
| 27 | 0,894 | 0,906 | 0,923 | 0,935 | 0,965 | 0,982 | 0,985 | 0,988 | 0,990 |
| 28 | 0,896 | 0,908 | 0,924 | 0,936 | 0,966 | 0,982 | 0,985 | 0,988 | 0,990 |
| 29 | 0,898 | 0,910 | 0,926 | 0,937 | 0,966 | 0,982 | 0,985 | 0,988 | 0,990 |
| 30 | 0,900 | 0,912 | 0,927 | 0,939 | 0,967 | 0,983 | 0,985 | 0,988 | 0,990 |
| 31 | 0,902 | 0,914 | 0,929 | 0,940 | 0,967 | 0,983 | 0,986 | 0,988 | 0,990 |
| 32 | 0,904 | 0,915 | 0,930 | 0,941 | 0,968 | 0,983 | 0,986 | 0,988 | 0,990 |
| 33 | 0,906 | 0,917 | 0,931 | 0,942 | 0,968 | 0,983 | 0,986 | 0,989 | 0,990 |
| 34 | 0,908 | 0,919 | 0,933 | 0,943 | 0,969 | 0,983 | 0,986 | 0,989 | 0,990 |
| 35 | 0,910 | 0,920 | 0,934 | 0,944 | 0,969 | 0,984 | 0,986 | 0,989 | 0,990 |
| 36 | 0,912 | 0,922 | 0,935 | 0,945 | 0,970 | 0,984 | 0,986 | 0,989 | 0,990 |
| 37 | 0,914 | 0,924 | 0,936 | 0,946 | 0,970 | 0,984 | 0,987 | 0,989 | 0,990 |
| 38 | 0,916 | 0,925 | 0,938 | 0,947 | 0,971 | 0,984 | 0,987 | 0,989 | 0,990 |
| 39 | 0,917 | 0,927 | 0,939 | 0,948 | 0,971 | 0,984 | 0,987 | 0,989 | 0,991 |
| 40 | 0,919 | 0,928 | 0,940 | 0,949 | 0,972 | 0,985 | 0,987 | 0,989 | 0,991 |
| 41 | 0,920 | 0,929 | 0,941 | 0,950 | 0,972 | 0,985 | 0,987 | 0,989 | 0,991 |
| 42 | 0,922 | 0,930 | 0,942 | 0,951 | 0,972 | 0,985 | 0,987 | 0,989 | 0,991 |
| 43 | 0,923 | 0,932 | 0,943 | 0,951 | 0,973 | 0,985 | 0,987 | 0,990 | 0,991 |
| 44 | 0,924 | 0,933 | 0,944 | 0,952 | 0,973 | 0,985 | 0,987 | 0,990 | 0,991 |
| 45 | 0,926 | 0,934 | 0,945 | 0,953 | 0,973 | 0,985 | 0,988 | 0,990 | 0,991 |
| 46 | 0,927 | 0,935 | 0,945 | 0,953 | 0,974 | 0,985 | 0,988 | 0,990 | 0,991 |
| 47 | 0,928 | 0,936 | 0,946 | 0,954 | 0,974 | 0,985 | 0,988 | 0,990 | 0,991 |
| 48 | 0,929 | 0,937 | 0,947 | 0,954 | 0,974 | 0,985 | 0,988 | 0,990 | 0,991 |
| 49 | 0,929 | 0,938 | 0,947 | 0,955 | 0,974 | 0,985 | 0,988 | 0,990 | 0,991 |
| 50 | 0,930 | 0,939 | 0,947 | 0,955 | 0,974 | 0,985 | 0,988 | 0,990 | 0,991 |
Table 6.6.16: The table of critical values for the Shapiro Wilk test statistic $W_{\alpha}$ of different levels of significance
Example 6.4.1
Consider again Example 6.1.1 about measuring 10 pieces.
| 1,90642 | 2,22488 |
| 2,10288 | 1,69742 |
| 1,52229 | 3,15435 |
| 2,61826 | 1,98492 |
| 1,42738 | 1,99568 |
Table 6.6.17: Part measurement sample (1)
Let’s test
$$\begin{cases}H_0: \ \hbox{os dados seguem uma distribuição normal} \ N(\mu,\sigma^2) \cr H_1: \ \hbox{os dados não seguem uma distribuição normal} \end{cases}$$
First, we sort the sample data
| $x_{(1)}$ | 1,42738 |
| $x_{(2)}$ | 1,52229 |
| $x_{(3)}$ | 1,69742 |
| $x_{(4)}$ | 1,90642 |
| $x_{(5)}$ | 1,98492 |
| $x_{(6)}$ | 1,99568 |
| $x_{(7)}$ | 2,10288 |
| $x_{(8)}$ | 2,22488 |
| $x_{(9)}$ | 2,61826 |
| $x_{(10)}$ | 3,15435 |
Table 6.6.18: Ordered sample
We have to $\displaystyle\sum_{i=1}^n(x_i-\bar{x})^2=2,392327$ and
| $i$ | $n-i+1$ | $a_{n-i+1}$ | $x_{(n-i+1)}$ | $x_{(i)}$ | $a_{n-i+1(x(n-i+1)-x(i))}$ |
|---|---|---|---|---|---|
| 1 | 10 | 0,5739 | 3,15435 | 1,42738 | 0,991108 |
| 2 | 9 | 0,3291 | 2,61826 | 1,52229 | 0,360684 |
| 3 | 8 | 0,2141 | 2,22488 | 1,69742 | 0,112929 |
| 4 | 7 | 0,1224 | 2,10288 | 1,90642 | 0,024047 |
| 5 | 6 | 0,0399 | 1,99568 | 1,98492 | 0,000429 |
Table 6.6.19: Calculated test statistics
Thus, it follows that b = 1.484197 and, finally, $W$ is given by $$W=\frac{b^2}{\displaystyle\sum_{i=1}^n(x_i-\bar{x})^2}=\frac{2,217708}{2,392327}=0,927.$$
By the test decision rule, $W_{\hbox{calculado}} = 0,927 > W_{(0,05;10)} = 0,842$, with the p-value calculated by $\mathbb{P}[W > W_{\hbox{calculado}}] = 0,4162 > α = 0,05$. Thus, we can state with a significance level of 5% that the sample comes from a normal population.
See below the results obtained by the software Action.
| Statistics | P-values | |
|---|---|---|
| Shapiro - Wilk | 0.9267 | 0.4162 |
Table 6.6.20: Anderson Darling normality test results
Figure 6.6.8: Probability Paper Chart
Example 6.4.2
Evaluate the normality of the data regarding the measurement of 10 pieces.
8; 9; 10; 10; 10; 12; 12; 16; 19; 24
Then we calculate $\displaystyle\sum_{i=1}^n (x_i-\bar{x})^2=236$ and the constant b:
| $i$ | $n-i+1$ | $a_{n-i+1}$ | $x_{(n-i+1)}$ | $x_{(i)}$ | $a_{n-i+1(x(n-i+1)-x(i))}$ |
|---|---|---|---|---|---|
| 1 | 10 | 0,5739 | 24 | 8 | 9,1824 |
| 2 | 9 | 0,3291 | 19 | 9 | 3,2910 |
| 3 | 8 | 0,2141 | 16 | 10 | 1,2846 |
| 4 | 7 | 0,1224 | 12 | 10 | 0,2448 |
| 5 | 6 | 0,0399 | 12 | 10 | 0,0798 |
| b=14.0826 |
Table 6.6.21: Shapiro-Wilk normality test statistics
and finally, $W$: $$W=\frac{b^2}{\displaystyle\sum_{i=1}^n(x_i-\bar{x})^2}=\frac{14,0826^2}{236}=0,840.$$
By the test decision rule, $W{\hbox{calculado}}$ = 0,840 < $W_{(0,05;10)}$ = 0,842, com o p-valor calculado por P[W > $W{\hbox{calculado}}$] = 0,0443 < α = 0,05. Assim, podemos afirmar com nível de significância de 5% que a amostra não provém de uma população normal. Esse fato é confirmado pela aleatoriedade dos pontos em torno da reta.
Veja a seguir os resultados obtidos pelo software Action.
| Estatísticas | P-valores | |
|---|---|---|
| Shapiro - Wilk | 0.8401 | 0.0443 |
Table 6.6.22: Shapiro Wilk normality test results
Figure 6.6.9: Probability Paper Chart
6.6.5 Ryan-Joiner Test
The Ryan-Joiner test is used to test whether data comes from a population with a normal distribution. It is similar to the Shapiro-Wilk test, as it is also based on the linear relationship between the order statistic of the normal distribution of a sample size $n$ and the sample of the population under study after being ordered.
Suppose $\mathbf{X}=X_1, X_2, \dots,X_n$ represent the vector containing a sample of size $n$ of the population of interest. Denoting by $\mathbf{Y}=Y_1,Y_2, \dots,Y_n$ the ascendingly ordered vector of the elements of $\mathbf{X}$, that is, $Y_1=\min(\mathbf{X})$ and $Y_n=\max(\mathbf{X})$ and similarly for the intermediate terms, finally, whether $\mathbf{Z}=Z_1,Z_2, \dots,Z_n$ a vector containing the theoretical quantile values of a distribution $N(0,1)$, given by
$$Z_i=\Phi ^{-1} \left(\frac{i-3/8}{n+1/4}\right) \qquad i=1,2,\dots,n$$
in which $\left(\dfrac{i-3/8}{n+1/4}\right)$ is known as plot position.
The Ryan-Joiner test boils down to studying the normal probability graph between $\mathbf{Z}$ and $\mathbf{Y}$ using the linear regression method (see probability paper in more detail), if the sample $\mathbf{X}$ comes from a normal population, we hope that $\mathbf{Z}$ and $\mathbf{Y}$ actually have a linear relationship. The central idea of the test is to study how significant this relationship is, for this Ryan-Joiner proposed the test statistic based on Pearson’s sample correlation coefficient, given by $$r=\frac{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right) \left( Z_i - \bar{Z} \right)}{\displaystyle\sqrt{\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)^2 } \sqrt{\displaystyle\sum_{i=1}^{n} \left( Z_i - \bar{Z} \right)^2}}$$
The Ryan-Joiner test rejects the hypothesis of data normality if $ r \ \leq c_{\alpha}$ where $c_{\alpha}$ is the critical value of the test. However, under $H_0$, the distribution of $r$ depends on $n$, that is, for different sample sizes we have different distributions and consequently different critical values.
In turn, the $\hbox{p-valor}$ is calculated as the probability of $r$ be less than $r_{\hbox{obs}}$ considering that $H_0$ is true, that is, $\hbox{p-valor}=\mathbf{P} [ r \ < \ r_{\hbox{obs}} | H_0 ]$, however, as mentioned the distribution of $r$, under $H_0$, depends on the sample size, therefore we need computational support to calculate the p-value and $c_{\alpha}$.
In practical terms, the Ryan-Joiner test is performed by the following steps:
-
Fix the hypotheses
-
$$\begin{cases} H_0: \hbox{A amostra provém de população com distribuição normal}; \cr H_1: \hbox{A amostra não provém de população com distribuição normal}.\end{cases}$$
-
Set the sample size $n$;
-
Order the sample $x_1,x_2, \dots ,x_n$ in $y_1,y_2, \dots, y_n$;
-
Calculate quantiles $z_1,z_2, \dots ,z_n$;
-
Calculate
-
$r=\frac{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right) \left( Z_i - \bar{Z} \right)}{\sqrt{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)^2 } \sqrt{\displaystyle\sum_{i=1}^{n} \left( Z_i - \bar{Z} \right)^2}}$;
-
Set the significance level $\alpha$;
-
Calculate $c_\alpha$;
-
Se $r\ \leq \ c_\alpha$, at a level of significance $\alpha$, reject $H_0$, otherwise do not reject $H_0$.
Example 6.5.1
Consider the example again $(6.1.1)$ of measurements of 10 pieces:
Data:
| 1,90642 | 2,10288 | 1,52229 | 2,61826 | 1,42738 | 2,22488 | 1,69742 | 3,15435 | 1,98492 | 1,99568 |
Table 6.6.23: Part measurement sample (1)
For the example in question, we have $n=10$. The ordered data and theoretical quantiles for $i=1,2, \dots,10$ are given by Table 6.6.24 below:
| y1 | 1,42738 | z1 | -1,5466353 |
| y2 | 1,52229 | z2 | -1,0004905 |
| y3 | 1,69742 | z3 | -0,6554235 |
| y4 | 1,90642 | z4 | -0,3754618 |
| y5 | 1,98492 | z5 | -0,1225808 |
| y6 | 1,99568 | z6 | 0,1225808 |
| y7 | 2,10288 | z7 | 0,3754618 |
| y8 | 2,22488 | z8 | 0,6554235 |
| y9 | 2,61826 | z9 | 1,0004905 |
| y10 | 3,15435 | z10 | 1,5466353 |
Table 6.6.24: Ordered sample and its theoretical quantiles
Pearson’s correlation coefficient is given by: $$r=\frac{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)\left( Z_i - \bar{Z} \right)}{\sqrt{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)^2 } \sqrt{\displaystyle\sum_{i=1}^{n} \left( Z_i - \bar{Z} \right)^2}}=\frac{4,188292}{\sqrt{2,39237} \sqrt{7,957279}} =\frac{4,188292}{1,546715 \times 2,820865}=0,959408$$
Using the confidence level $\alpha=0,05$, with $n=10$, we have to $c_{0,05}=0,9173243$. How $r=0,9599408 \ > \ c_{0,05}=0,9173243$ we do not reject $H_0$ at a significance level of 5%, that is, we do not reject that the sample comes from a normal population. Furthermore, $\hbox{p-valor}=\mathbf{P}[r \ < \ r_{obs}]=\mathbf{P}[r \ < \ 0,9599408]=0,3244$, which is greater than the significance level $\alpha=0,05$ reinforcing the conclusion.
| Statistics | P-values | |
|---|---|---|
| Ryan - Joiner | 0.9599 | 0.3094 |
Table 6.6.25: Ryan-Joiner normality test results
Figure 6.6.10: Probability Paper Chart
Example 6.5.2
Consider again the measurement data for 10 pieces from example 6.4.2:
Measurements:
| 8 | 9 | 10 | 10 | 10 | 12 | 12 | 16 | 19 | 24 |
Table 6.6.26: Part measurement sample (2)
For the example in question, again we have $n=10$. The ordered data and theoretical quantiles for $i=1,2, \dots,10$ are given by the following tables:
| y1 | 8 | z1 | -1,5466353 |
| y2 | 9 | z2 | -1,0004905 |
| y3 | 10 | z3 | -0,6554235 |
| y4 | 10 | z4 | -0,3754618 |
| y5 | 10 | z5 | -0,1225808 |
| y6 | 12 | z6 | 0,1225808 |
| y7 | 12 | z7 | 0,3754618 |
| y8 | 16 | z8 | 0,6554235 |
| y9 | 19 | z9 | 1,0004905 |
| y10 | 24 | z10 | 1,5466353 |
Table 6.6.27: Ordered sample and its theoretical quantiles
Pearson’s correlation coefficient is given by: $$r=\frac{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)\left( Z_i - \bar{Z} \right)}{\sqrt{\displaystyle\sum_{i=1}^{n} \left(Y_i-\bar{Y}\right)^2 } \sqrt{\displaystyle\sum_{i=1}^{n} \left( Z_i - \bar{Z} \right)^2}}=\frac{39,6797}{\sqrt{236}\sqrt{7,957279}} =\frac{39,6797}{15,36229\times2820865}=0,915611$$
Using the confidence level $\alpha=0,05$, with $n=10$, we have to $c_{0,05}=0,9173243$.
How $r=0,915611\ < \ c_{0,05}=0,9173243$ we reject $H_0$ at a significance level of 5%, that is, we reject that the sample comes from a normal population. Furthermore, $\hbox{p-valor}=\mathbf{P}[r \ < \ r_{obs}]=\mathbf{P}[r \ < \ 0,9599408]= 0,0485$, which is lower than the significance level $\alpha=0,05$ reinforcing the conclusion.
| Statistics | P-values | |
|---|---|---|
| Ryan - Joiner | 0.9157 | 0.0467 |
Table 6.6.28: Ryan-Joiner normality test results
Figure 6.6.11: Probability Paper Chart