Learn R Programming

normtest (version 1.1)

spiegelhalter.norm.test: Spiegelhalter test for normality

Description

Performs Spiegelhalter test for the composite hypothesis of normality, see Spiegelhalter (1977).

Usage

spiegelhalter.norm.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 Geary statistic.
  • p.valuethe p-value for the test.
  • methodthe character string "Spiegelhalter test for normality".
  • data.namea character string giving the name(s) of the data.

Details

The Spiegelhalter test for normality is based on the following statistic: $$T = \left( (c_nu)^{-(n-1)}+g^{-(n-1)} \right)^{1/(n-1)},$$ where $$u=\frac{X_{(n)}-X_{(1)}}{s}, \quad g=\frac{\sum_{i=1}^n|X_i-\overline{X}|}{s\sqrt{n(n-1)}}, \quad c_n=\frac{(n!)^{1/(n-1)}}{2n}, \quad s^2=\frac{1}{n-1}\sum_{i=1}^n(X_i-\overline{X})^2.$$ The p-value is computed by Monte Carlo simulation.

References

Spiegelhalter, D. J. (1977): A test for normality against symmetric alternatives. --- Biometrika, vol. 64, pp. 415--418.

Examples

Run this code
spiegelhalter.norm.test(rnorm(100))
spiegelhalter.norm.test(rexp(100))

Run the code above in your browser using DataLab