0
$\begingroup$

After running the shapiro.exp.test in testing for exponentiality I am getting powers of the test as equal to zero. I suppose the issue might be on my rejection criteria (i.e $p.value<0.05). This works for all other tests e.g ks.exp.test and cvm.exp.test

Can anyone assist?

powerSW = mean(replicate(1000,(shapiro.exp.test(rt(50, 7))$p.value<0.05)))
$\endgroup$
6
  • $\begingroup$ A better test for exponentiality might be to use Lilliefors test. $\endgroup$ Commented May 28, 2018 at 0:31
  • $\begingroup$ Why would you expect it to be better? (it may well be, but it has fairly low power so it seems an odd one to suggest) $\endgroup$
    – Glen_b
    Commented May 28, 2018 at 2:22
  • 1
    $\begingroup$ @Show you should identify the package you're running the function from; it's perfectly possible (and indeed regularly happens) that several packages may use the same name for somewhat different functions (even if they perform the same task their inputs and outputs may differ). Do you mean the function in package exptest ? $\endgroup$
    – Glen_b
    Commented May 28, 2018 at 2:25
  • $\begingroup$ Lillefors test is especially designed for the exponential distribution. I am not sure what version of Shapiro's test the OP is referring to. If it is the Shapiro-Wilk test that one is intended for determining normlity. $\endgroup$ Commented May 28, 2018 at 3:31
  • 1
    $\begingroup$ @Michael The test for exponentiality is in Shapiro & Wilk (1972) "An Analysis of Variance Test for the Exponential Distribution (Complete Samples)". It's one of a number of tests for exponentiality (among which I'd expect the Lilliefors test to be relatively low powered against many of the alternatives likely to be of interest). $\endgroup$
    – Glen_b
    Commented May 28, 2018 at 4:52

1 Answer 1

3
$\begingroup$

Proceeding on the assumption that this is the function in package exptest:

The test stat here is $$W = \frac{n(\overline{X} - X_{(1)})^2}{(n - 1)\sum_{i=1}^n{(X_i - \overline{X})^2}}$$

With that test statistic the test would actually be for testing a shifted exponential against a range of alternatives. (Edit: the original paper confirms this)

After shifting the sample by the minimum (and discarding that value), this statistic is a function of the coefficient of variation which makes sense -- with the ordinary exponential the CV should be close to 1.

Because of the particular form of the statistic I'd have expected it to have good power against the normal (except in a particular subset of cases) -- but trying it on samples from the standard normal it doesn't seem to; this might instead suggest some implementation issue.

Looking at the code, it looks like the implementation of the test might indeed be wrong.

To quote the original paper, $^{[1]}$

As an omnibus procedure, W is to be used as a two tailed statistic

As far as I can see, the code only looks at one tail. There may be other issues with it, I haven't checked closely, but that could easily explain very low power against some alternatives where the CV differs from 1.

[1] Shapiro, S. S. & Wilk, M. B. (1972)
"An Analysis of Variance Test for the Exponential Distribution (Complete Samples)"
Technometrics, 01 May 1972, Vol.14(2), p.355-370

$\endgroup$

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