I need a goodness of fit test for the exponential distribution. I understand that Kolmogorov-Smirnov is not generally regarded as very powerful and that Anderson-Darling is regarded as superior. However I have two problems.

  • None of the literature I can find specifically talks about goodness of fit for exponential distributions. Anderson-Darling is almost always discussed wrt the normal distribution.
  • Is there an R (or python) package to do an Anderson-Darling goodness of fit for the exponential distribution? I can find them for other distributions.
  • Is there a better test (which exists in R or python)?
  • $\begingroup$ Is this a completeley specified distribution or are we estimating parameters? $\endgroup$ – Glen_b Aug 15 '14 at 8:08
  • $\begingroup$ @Glen_b In some case I will have to estimate the parameters which I know causes another problem. A method which had a correction factor for that case would be even better of course! $\endgroup$ – felix Aug 15 '14 at 8:28
  • $\begingroup$ When you say A-D's more powerful than K-S, what kind of departures from exponentiality are you thinking of? $\endgroup$ – Scortchi - Reinstate Monica Aug 15 '14 at 9:58
  • $\begingroup$ @Scortchi I am thinking for example if the tail is too long. A test just for that case would be great. $\endgroup$ – felix Aug 15 '14 at 18:17
  • 1
    $\begingroup$ I'd guess the LRT for Weibull shape parameter less than one would have good power against long tailed alternatives. $\endgroup$ – Scortchi - Reinstate Monica Aug 18 '14 at 9:54

The same considerations apply as to the distribution of the Kolmogorov–Smirnov test statistic discussed here. The Anderson–Darling test statistic (for a given sample size) has a distribution that (1) doesn't depend on the null-hypothesis distribution when all parameters are known, & (2) depends only on the functional form of the null-hypothesis distribution when location & scale parameters are estimated. I don't know of an R implementation of the A–D test specifically for the exponential distribution with estimated rate parameter, but you could quickly make a function to calculate the test statistic by adapting the ad.test function from the nortest package: change the distribution function from the best-fit normal, pnorm((x - mean(x))/sd(x)), to the best-fit exponential,pexp(x/mean(x)). Then get critical values for any desired significance level & sample size by simulation.

As to the "best" test, note that different tests are more powerful against different kinds of departure from the null-hypothesis distribution. If you have a quite specific alternative in mind, e.g. a Weibull distribution with shape parameter greater than one, a likelihood ratio test will be more powerful than a general-purpose goodness-of-fit test. For more vaguely specified alternatives it might be helpful to compare the power of various tests against a rogues gallery, following the approach of Stephens (1974), "EDF statistics for goodness of fit and some comparisons", JASA, 69, 347.

| cite | improve this answer | |
  • $\begingroup$ Thank you very much. I couldn't even find an implementation of the A-D test for the exponential distribution with known rate parameter. I am sorry if this is obvious but are you saying nortest can be used in that case somehow? $\endgroup$ – felix Aug 15 '14 at 18:16
  • $\begingroup$ I'm saying that rather than write a function to calculate the A-D statistic from scratch, you can modify the code used in ad.test. (Type ad.test to see it.) $\endgroup$ – Scortchi - Reinstate Monica Aug 18 '14 at 9:52
  • $\begingroup$ @Scortchi, how did you know to change pnorm((x - mean(x))/sd(x)) for a normal distribution to pexp(x/mean(x)) for an exponential distribution? I am looking to test weibull and lognormal distributions thorough the AD statistic $\endgroup$ – lukeg Oct 11 '15 at 17:36
  • $\begingroup$ @lukeg: I just substituted a standardized exponential variate for a standardized normal variate, & the exponential for the normal distribution function. NB (1) If you're estimating the shape of a Weibull distribution as well as the scale, you need to simulate the distribution of the test statistic under your estimated parameters, & results are approximate; (2) the logarithm of a log-normal random variate has a normal distribution. $\endgroup$ – Scortchi - Reinstate Monica Oct 12 '15 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.