naginterfaces.library.nonpar.gofstat_​anddar

naginterfaces.library.nonpar.gofstat_anddar(issort, y)[source]

gofstat_anddar calculates the Anderson–Darling goodness-of-fit test statistic.

For full information please refer to the NAG Library document for g08ch

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g08/g08chf.html

Parameters
issortbool

Set if the observations are sorted in ascending order; otherwise the function will sort the observations.

yfloat, array-like, shape

, for , the observations.

Returns
gofsfloat

The Anderson–Darling goodness-of-fit test statistic.

yfloat, ndarray, shape

If , the data sorted in ascending order; otherwise the array is unchanged.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

and the data in is not sorted in ascending order.

(errno )

The data in must lie in the interval .

Notes

Denote by the Anderson–Darling test statistic for observations of a variable assumed to be standard uniform and sorted in ascending order, then:

where:

When observations of a random variable are non-uniformly distributed, the probability integral transformation (PIT):

where is the cumulative distribution function of the distribution of interest, yields a uniformly distributed random variable . The PIT is true only if all parameters of a distribution are known as opposed to estimated; otherwise it is an approximation.

References

Anderson, T W and Darling, D A, 1952, Asymptotic theory of certain ‘goodness-of-fit’ criteria based on stochastic processes, Annals of Mathematical Statistics (23), 193–212