Categories &

Functions List

Function Reference: adtest

statistics: h = adtest (x)
statistics: h = adtest (x, Name, Value)
statistics: [h, pval] = adtest (…)
statistics: [h, pval, adstat, cv] = adtest (…)

Anderson-Darling goodness-of-fit hypothesis test.

h = adtest (x) returns a test decision for the null hypothesis that the data in vector x is from a population with a normal distribution, using the Anderson-Darling test. The alternative hypothesis is that x is not from a population with a normal distribution. The result h is 1 if the test rejects the null hypothesis at the 5% significance level, or 0 otherwise.

h = adtest (x, Name, Value) returns a test decision for the Anderson-Darling test with additional options specified by one or more Name-Value pair arguments. For example, you can specify a null distribution other than normal, or select an alternative method for calculating the p-value, such as a Monte Carlo simulation.

The following parameters can be parsed as Name-Value pair arguments.

NameDescription
"Distribution"The distribution being tested for. It tests whether x could have come from the specified distribution. There are two choise available for parsing distribution parameters:
  • One of the following char strings: "norm", "exp", "ev", "logn", "weibull", for defining either the ’normal’, ’exponential’, ’extreme value’, lognormal, or ’Weibull’ distribution family, accordingly. In this case, x is tested against a composite hypothesis for the specified distribution family and the required distribution parameters are estimated from the data in x. The default is "norm".
  • A cell array defining a distribution in which the first cell contains a char string with the distribution name, as mentioned above, and the consecutive cells containing all specified parameters of the null distribution. In this case, x is tested against a simple hypothesis.
"Alpha"Significance level alpha for the test. Any scalar numeric value between 0 and 1. The default is 0.05 corresponding to the 5% significance level.
"MCTol"Monte-Carlo standard error for the p-value, pval, value. which must be a positive scalar value. In this case, an approximation for the p-value is computed directly, using Monte-Carlo simulations.
"Asymptotic"Method for calculating the p-value of the Anderson-Darling test, which can be either true or false logical value. If you specify ’true’, adtest estimates the p-value using the limiting distribution of the Anderson-Darling test statistic. If you specify ’false’, adtest calculates the p-value based on an analytical formula. For sample sizes greater than 120, the limiting distribution estimate is likely to be more accurate than the small sample size approximation method.
  • If you specify a distribution family with unknown parameters for the distribution Name-Value pair (i.e. composite distribution hypothesis test), the "Asymptotic" option must be false.
  • If you use MCTol to calculate the p-value using a Monte Carlo simulation, the "Asymptotic" option must be false.

[h, pval] = adtest (…) also returns the p-value, pval, of the Anderson-Darling test, using any of the input arguments from the previous syntaxes.

[h, pval, adstat, cv] = adtest (…) also returns the test statistic, adstat, and the critical value, cv, for the Anderson-Darling test.

The Anderson-Darling test statistic belongs to the family of Quadratic Empirical Distribution Function statistics, which are based on the weighted sum of the difference [Fn(×)-F(×)]^2 over the ordered sample values X1 < X2 < ... < Xn, where F is the hypothesized continuous distribution and Fn is the empirical CDF based on the data sample with n sample points.

See also: kstest

Source Code: adtest