Learn R Programming

lawstat (version 3.0)

symmetry.test: Test of Symmetry

Description

This function performs test for symmetry about an unknown median. Users can choose between the Cabilio-Masaro test (Cabilio and Masaro, 1996), the Mira test (Mira, 1999), or the MGG test (Miao, Gel and Gastwirth, 2006); and using asymptotic distribution of respective statistics or a distribution from $m$-out-of-$n$ bootstrap. Additionally to the general distribution asymmetry, the function allows to test for negative or positive skeweness (see the argument side). NAs from the data are omitted.

Usage

symmetry.test(x, option=c("MGG", "CM", "M"), side=c("both", "left", "right"), boot=TRUE, B=1000, q=8/9)

Arguments

x
data to be tested for symmetry.
option
test statistic to be applied. Options include statistic by Miao, Gel and Gastwirth (2006) (default), Cabilio and Masaro (1996), and by Mira (1999).
side
choice from the three possible alternative hypotheses: general distribution asymmetry (side="both", default), left skewness (side="left"), or right skewness (side="right").
boot
logical value indicates whether $m$-out-of-$n$ bootstrap will be used to obtain critical values (default), or asymptotic distribution of the chosen statistic.
B
number of bootstrap replications to perform (default is 1000).
q
scalar from 0 to 1 to define a set of possible $m$ for the $m$-out-of-$n$ bootstrap. Default q=8/9. Possible $m$ are then set as the values unique(round(n*(q^j)) greater than 4, where n=length(x), j = seq(from=0, to=20, by=1).

Value

A list with class htest containing the following components:
method
name of the method.
data.name
name of the data.
statistic
value of the test statistic.
p.value
$p$-value of the test.
alternative
alternative hypothesis.
estimate
bootstrap optimal m (given in the output only if bootstrap was used, i.e., boot=TRUE).

Details

If the bootstrap option is used (boot=TRUE), a bootstrap distribution is obtained for each candidate subsample size $m$. Then, a heuristic method (Bickel et al., 1997; Bickel and Sakov, 2008) is used for the choice of optimal $m$. Particularly, we use Wasserstein metric (Ruschendorf, 2001) to calculate distances between different bootstrap distributions and select $m$, which corresponds to the minimal distance.

References

Bickel, P. J., Gotze, F., and van Zwet, W. R. (1997) Resampling fewer than n observations: gains, losses, and remedies for losses. Statistica Sinica, 7, 1-31.

Bickel, P. J. and Sakov, A. (2008) On the choice of m in the m out of n bootstrap and its application to confdence bounds for extreme percentiles. Statistica Sinica, 18, 967-985.

Cabilio, P. and Masaro, J. (1996) A simple test of symmetry about an unknown median. The Canadian Journal of Statistics, 24, 349-361.

Miao, W., Gel, Y. R., and Gastwirth, J. L. (2006) A New Test of Symmetry about an Unknown Median. Random Walk, Sequential Analysis and Related Topics - A Festschrift in Honor of Yuan-Shih Chow. Eds.: Agnes Hsiung, Cun-Hui Zhang, and Zhiliang Ying, World Scientific Publisher, Singapore.

Mira, A. (1999) Distribution-free test for symmetry based on Bonferroni's measure. Journal of Applied Statistics, 26, 959-972.

Ruschendorf, L. (2001) Wasserstein metric. In Encyclopedia of Mathematics (ed. M. Hazewinkel). Berlin: Springer.

Examples

Run this code
data(zuni)
symmetry.test(zuni[,"Revenue"], boot=FALSE)

##	Symmetry test by Miao, Gel, and Gastwirth (2006)
##
## data:  zuni[, "Revenue"]
## Test statistic = 5.0321, p-value = 4.851e-07
## alternative hypothesis: the distribution is asymmetric.

Run the code above in your browser using DataLab