testes normalidade

7
skewness e kurtosis Duas medidas importantes para caracterizar uma distribuição não-normal são os coeficientesde skewness e de kurtosis. - No caso do skewness, coeficiente próximo de zero significa simetria, caso contrário, uma tendência à esquerda para números negativos e, à direita para números positivos. -A kurtosis mede a concentração próxima a média (ou pico),a Kurtosis (Curtose) é uma medida de dispersão que caracteriza o "achatamento" da curva da função de distribuição. Se o valor da Kurtosis for = 0, então tem o mesmo achatamento que a distribuição normal. Se o valor é > 0 então a distribuição em questão é mais alta (afunilada) e concentrada que a distribuição normal. Se o valor é < 0 então a função de distribuição é mais "achatada" que a distribuição normal The Shapiro-Wilk Test For Normality The Shapiro-Wilk test, proposed in 1965 , calculates a W statistic that tests whether a random sample, x 1 , x 2 , ..., x n comes from (specifically) a normal distribution . Small values of W are evidence of departure from normality and percentage points for the W statistic, obtained via Monte Carlo simulations, were reproduced by Pearson and Hartley (1972, Table 16) . This test has done very well in comparison studies with other goodness of fit tests. The W statistic is calculated as follows: where the x (i) are the ordered sample values (x (1) is the smallest) and the a i are constants generated from the means, variances and covariances of the order statistics of a sample of size n from a normal distribution (see Pearson and Hartley (1972, Table 15) . For more information about the Shapiro-Wilk test the reader is referred to the original Shapiro and Wilk (1965) paper and the tables in Pearson and Hartley (1972) ,

Upload: manuel-canela

Post on 24-Nov-2014

111 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Testes Normalidade

skewness e kurtosis

Duas medidas importantes para caracterizar uma distribuição não-normal são os coeficientesde skewness e de kurtosis.

- No caso do skewness, coeficiente próximo de zero significa simetria, caso contrário, uma tendência à esquerda para números negativos e, à direita para números positivos.

-A kurtosis mede a concentração próxima a média (ou pico),a Kurtosis (Curtose) é uma medida de dispersão que caracteriza o "achatamento" da curva da função de distribuição.Se o valor da Kurtosis for = 0, então tem o mesmo achatamento que a distribuição normal.Se o valor é > 0 então a distribuição em questão é mais alta (afunilada) e concentrada que a distribuição normal.Se o valor é < 0 então a função de distribuição é mais "achatada" que a distribuição normal

The Shapiro-Wilk Test For Normality

The Shapiro-Wilk test, proposed in 1965, calculates a W statistic that tests whether a random sample, x1, x2, ..., xn comes from (specifically) a normal distribution . Small values of W are evidence of departure from normality and percentage points for the W statistic, obtained via Monte Carlo simulations, were reproduced by Pearson and Hartley (1972, Table 16). This test has done very well in comparison studies with other goodness of fit tests.

The W statistic is calculated as follows:

where the x(i) are the ordered sample values (x(1) is the smallest) and the ai are constants generated from the means, variances and covariances of the order statistics of a sample of size n from a normal distribution (see Pearson and Hartley (1972, Table 15).

For more information about the Shapiro-Wilk test the reader is referred to the original Shapiro and Wilk (1965) paper and the tables in Pearson and Hartley (1972),

Page 2: Testes Normalidade

Chi-Square Goodness-of-Fit Test

Purpose:Test for distributional adequacy

The chi-square test (Snedecor and Cochran, 1989) is used to test if a sample of data came from a population with a specific distribution.

An attractive feature of the chi-square goodness-of-fit test is that it can be applied to any univariate distribution for which you can calculate the cumulative distribution function. The chi-square goodness-of-fit test is applied to binned data (i.e., data put into classes). This is actually not a restriction since for non-binned data you can simply calculate a histogram or frequency table before generating the chi-square test. However, the value of the chi-square test statistic are dependent on how the data is binned. Another disadvantage of the chi-square test is that it requires a sufficient sample size in order for the chi-square approximation to be valid.

The chi-square test is an alternative to the Anderson-Darling and Kolmogorov-Smirnov goodness-of-fit tests. The chi-square goodness-of-fit test can be applied to discrete distributions such as the binomial and the Poisson. The Kolmogorov-Smirnov and Anderson-Darling tests are restricted to continuous distributions.

Additional discussion of the chi-square goodness-of-fit test is contained in the product and process comparisons chapter (chapter 7).

Definition The chi-square test is defined for the hypothesis: H0: The data follow a specified distribution. Ha: The data do not follow the specified distribution. Test Statistic: For the chi-square goodness-of-fit computation, the data are divided into k bins and

the test statistic is defined as

where is the observed frequency for bin i and is the expected frequency for bin i. The expected frequency is calculated by

where F is the cumulative Distribution function for the distribution being tested, Yu is the upper limit for class i, Yl is the lower limit for class i, and N is the sample size.

This test is sensitive to the choice of bins. There is no optimal choice for the bin width (since the optimal bin width depends on the distribution). Most reasonable choices should produce similar, but not identical, results. Dataplot uses 0.3*s, where s is the sample standard deviation, for the class width. The lower and upper bins are at the sample mean plus and minus 6.0*s, respectively. For the chi-square approximation to be valid, the expected frequency should be at least 5. This test is not valid for small samples, and if some of the counts are less than five, you may need to combine some bins in the tails.

Significance Level:

.

Critical Region:

The test statistic follows, approximately, a chi-square distribution with (k - c) degrees of freedom where k is the number of non-empty cells and c = the number of estimated parameters (including location and scale parameters and shape parameters) for the distribution + 1. For example, for a 3-parameter Weibull distribution, c = 4.

Therefore, the hypothesis that the data are from a population with the specified distribution is rejected if

where is the chi-square percent point function with k - c degrees of freedom and a significance level of .

In the above formulas for the critical regions, the Handbook follows the convention

that is the upper critical value from the chi-square distribution and is the lower critical value from the chi-square distribution. Note that this is the opposite of what is used in some texts and software programs. In particular, Dataplot uses the opposite convention.

Page 3: Testes Normalidade

Purpose:Test for

Distributional Adequacy The Kolmogorov-Smirnov test (Chakravart, Laha, and Roy, 1967) is used to decide if a sample comes from a population with a specific distribution.

Jarque–Bera test In statistics, the Jarque–Bera test is a goodness-of-fit measure of departure from normality, based on the sample kurtosis and skewness. The test is named after Carlos Jarque and Anil K. Bera. The test statistic JB is defined as

where n is the number of observations (or degrees of freedom in general); S is the sample skewness, and K is the sample kurtosis:

where and are the estimates of third and fourth central moments, respectively, is

the sample mean, and is the estimate of the second central moment, the variance.

The statistic JB has an asymptotic chi-square distribution with two degrees of freedom and can be used to test the null hypothesis that the data are from a normal distribution. The null hypothesis is a joint hypothesis of the skewness being zero and the excess kurtosis being 0, since samples from a normal distribution have an expected skewness of 0 and an expected excess kurtosis of 0 (which is the same as a kurtosis of 3). As the definition of JB shows, any deviation from this increases the JB statistic.

The chi-square approximation, however, is overly sensitive (lacking specificity) for small samples, rejecting the null hypothesis often when it is in fact true. Furthermore, the distribution of p-values departs from a uniform distribution and becomes a right-skewed uni-modal distribution, especially for small p-values. This leads to a large Type I error rate. The table below shows some p-values approximated by a chi-square distribution that differ from their true alpha levels for very small samples.

Calculated p-value equivalents to true alpha levels at given sample sizesTrue α level 20 30 50 70 100

.1 .307 .252 .201 .183 .1560.05 .1461 .109 .079 .067 .062

.025 .051 .0303 .020 .016 .0168.01 .0064 .0033 .0015 .0012 .002

(These values have been approximated by using Monte Carlo simulation on Matlab)

As seen in MATLAB, the chi-square approximation for the JB statistic's distribution is only used for large sample sizes (> 2000). For smaller sample sizes, it uses a table derived from Monte Carlo simulations in order to interpolate p-values for smaller samples.[1]

Kolmogorov-Smirnov Goodness-of-Fit Test

Page 4: Testes Normalidade

The Kolmogorov-Smirnov (K-S) test is based on the empirical distribution function (ECDF). Given N ordered data points Y1, Y2, ..., YN, the ECDF is defined as

where n(i) is the number of points less than Yi and the Yi are ordered from smallest to largest value. This is a step function that increases by 1/N at the value of each ordered data point.

The graph below is a plot of the empirical distribution function with a normal cumulative distribution function for 100 normal random numbers. The K-S test is based on the maximum distance between these two curves.

Characteristics and Limitations of the K-S Test An attractive feature of this test is that the distribution of the K-S test statistic itself does not depend on the underlying cumulative distribution function being tested. Another advantage is that it is an exact test (the chi-square goodness-of-fit test depends on an adequate sample size for the approximations to be valid). Despite these advantages, the K-S test has several important limitations:

1. It only applies to continuous distributions. 2. It tends to be more sensitive near the center of the distribution than at the tails. 3. Perhaps the most serious limitation is that the distribution must be fully specified. That is, if location, scale,

and shape parameters are estimated from the data, the critical region of the K-S test is no longer valid. It typically must be determined by simulation.

Due to limitations 2 and 3 above, many analysts prefer to use the Anderson-Darling goodness-of-fit test. However, the Anderson-Darling test is only available for a few specific distributions. Definition The Kolmogorov-Smirnov test is defined by: H0: The data follow a specified distribution Ha: The data do not follow the specified distribution Test Statistic:

The Kolmogorov-Smirnov test statistic is defined as

where F is the theoretical cumulative distribution of the distribution being tested which must be a continuous distribution (i.e., no discrete distributions such as the binomial or Poisson), and it must be fully specified (i.e., the location, scale, and shape parameters cannot be estimated from the data).

Significance Level:

.

Critical Values:

The hypothesis regarding the distributional form is rejected if the test statistic, D, is greater than the critical value obtained from a table. There are several variations of these tables in the literature that use somewhat different scalings for the K-S test statistic and critical regions. These alternative formulations should be equivalent, but it is

Page 5: Testes Normalidade

necessary to ensure that the test statistic is calculated in a way that is consistent with how the critical values were tabulated.

We do not provide the K-S tables in the Handbook since software programs that perform a K-S test will provide the relevant critical values.

Technical Note Previous editions of e-Handbook gave the following formula for the computation of the Kolmogorov-Smirnov goodness of fit statistic:

This formula is in fact not correct. Note that this formula can be rewritten as:

This form makes it clear that an upper bound on the difference between these two formulas is i/N. For actual data, the difference is likely to be less than the upper bound.

For example, for N = 20, the upper bound on the difference between these two formulas is 0.05 (for comparison, the 5% critical value is 0.294). For N = 100, the upper bound is 0.001. In practice, if you have moderate to large sample sizes (say N ≥ 50), these formulas are essentially equivalent.

Anderson-Darling Test

Purpose:Test for Distributional Adequacy

The Anderson-Darling test (Stephens, 1974) is used to test if a sample of data came from a population with a specific distribution. It is a modification of the Kolmogorov-Smirnov (K-S) test and gives more weight to the tails than does the K-S test. The K-S test is distribution free in the sense that the critical values do not depend on the specific distribution being tested. The Anderson-Darling test makes use of the specific distribution in calculating critical values. This has the advantage of allowing a more sensitive test and the disadvantage that critical values must be calculated for each distribution. Currently, tables of critical values are available for the normal, lognormal, exponential, Weibull, extreme value type I, and logistic distributions. We do not provide the tables of critical values in this Handbook (see Stephens 1974, 1976, 1977, and 1979) since this test is usually applied with a statistical software program that will print the relevant critical values.

The Anderson-Darling test is an alternative to the chi-square and Kolmogorov-Smirnov goodness-of-fit tests.

Definition The Anderson-Darling test is defined as: H0: The data follow a specified distribution. Ha: The data do not follow the specified distribution Test Statistic:

The Anderson-Darling test statistic is defined as

where

F is the cumulative distribution function of the specified distribution. Note that the Yi are the ordered data.

Significance Level: Critical Region:

The critical values for the Anderson-Darling test are dependent on the specific distribution that is being tested. Tabulated values and formulas have been published

Page 6: Testes Normalidade

(Stephens, 1974, 1976, 1977, 1979) for a few specific distributions (normal, lognormal, exponential, Weibull, logistic, extreme value type 1). The test is a one-sided test and the hypothesis that the distribution is of a specific form is rejected if the test statistic, A, is greater than the critical value.

Note that for a given distribution, the Anderson-Darling statistic may be multiplied by a constant (which usually depends on the sample size, n). These constants are given in the various papers by Stephens. In the sample output below, this is the "adjusted Anderson-Darling" statistic. This is what should be compared against the critical values. Also, be aware that different constants (and therefore critical values) have been published. You just need to be aware of what constant was used for a given set of critical values (the needed constant is typically given with the critical values).

Lilliefors

The test proceeds as follows:1. First estimate the population mean and population variance based on the data.2. Then find the maximum discrepancy between the empirical distribution function and the cumulative distribution function (CDF) of the normal distribution with the estimated mean and estimated variance. Just as in the Kolmogorov–Smirnov test, this will be the test statistic.3. Finally, we confront the question of whether the maximum discrepancy is large enough to be statistically significant, thus requiring rejection of the null hypothesis. This is where this test becomes more complicated than the Kolmogorov–Smirnov test. Since the hypothesized CDF has been moved closer to the data by estimation based on those data, the maximum discrepancy has been made smaller than it would have been if the null hypothesis had singled out just one normal distribution. Thus the "null distribution" of the test statistic, i.e. its probability distribution assuming the null hypothesis is true, is stochastically smaller than the Kolmogorov–Smirnov distribution. This is the Lilliefors distribution.