Learn R Programming

exptest (version 1.2)

shapiro.exp.test: Shapiro-Wilk test for exponentiality

Description

Performs Shapiro-Wilk test for the composite hypothesis of exponentiality, see e.g. Shapiro and Wilk (1972).

Usage

shapiro.exp.test(x, nrepl=2000)

Arguments

x
a numeric vector of data values.
nrepl
the number of replications in Monte Carlo simulation.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the Shapiro-Wilk statistic.
  • p.valuethe p-value for the test.
  • methodthe character string "Shapiro-Wilk test for exponentiality".
  • data.namea character string giving the name(s) of the data.

Details

The Shapiro-Wilk test for exponentiality is based on the following statistic: $$W = \frac{n(\overline{X} - X_{(1)})^2}{(n - 1)\sum_{i=1}^n{(X_i - \overline{X})^2}}.$$ The p-value is computed by Monte Carlo simulation.

References

Shapiro, S.S. and Wilk, M.B. (1972): An analysis of variance test for the exponential distribution (complete samples). --- Technometrics, vol. 14, pp. 355-370.

Examples

Run this code
shapiro.exp.test(rexp(100))
shapiro.exp.test(rchisq(100,1))

Run the code above in your browser using DataLab