Learn R Programming

lawstat (version 3.2)

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) and j = c(0:20).

Value

A list of 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 the 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 confidence bounds for extrema. 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(3): 349--361. DOI: 10.2307/3315744

Lyubchich, V., Wang, X., Heyes, A., and Gel, Y. R. (2016). A distribution-free m-out-of-n bootstrap approach to testing symmetry about an unknown median. Computational Statistics and Data Analysis 104: 1--9. DOI: 10.1016/j.csda.2016.05.004

Miao, W., Gel, Y. R., and Gastwirth, J. L. (2006). A new test of symmetry about an unknown median. In: A. Hsiung, C.-H. Zhang, and Z. Ying (Eds.) Random Walk, Sequential Analysis and Related Topics --- A Festschrift in Honor of Yuan-Shih Chow. World Scientific Publisher, Singapore, pp. 199--214. DOI: 10.1142/9789812772558_0013

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

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

Examples

Run this code
# NOT RUN {
data(zuni) #run ?zuni to see the data description
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