| Title: | Symmetry Tests for Univariate Data |
|---|---|
| Description: | Implements statistical tests for detecting departures from symmetry in univariate data, including procedures based on moments, spacings, order statistics, and triples. The functions provide straightforward tools for assessing symmetry in empirical distributions. |
| Authors: | Isabel Parra-Frutos [aut, cre], Lourdes Molera [aut] |
| Maintainer: | Isabel Parra-Frutos <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-10 14:13:00 UTC |
| Source: | https://github.com/cran/symtests |
Performs the ES symmetry test by Ekström & Jammalamadaka (2007).
es_symtest(x)es_symtest(x)
x |
A numeric vector. |
Let denote the ordered sample, and let
be the successive spacings.
The test uses
together with a variance estimate based on spacings of order 2m-1,
where m = 3 if n < 200 and m = 4 otherwise.
The resulting test statistic is
where is an estimator of the asymptotic variance of
. The -value is computed using a Student’s approximation.
An object of class "htest" with the following components:
The value of the test statistic.
The -value of the test.
Ekström, M., & Jammalamadaka, R. S. (2007). An asymptotically distribution-free test of symmetry. Journal of Statistical Planning and Inference, 137(3), 799–810. doi:10.1016/j.jspi.2006.06.009
triples_symtest(), tail_symtest(), gupta_symtest(),
lawstat::symmetry.test(), symmetry::symmetry_test()
set.seed(123) es_symtest(rnorm(100)) set.seed(123) es_symtest(rexp(100))set.seed(123) es_symtest(rnorm(100)) set.seed(123) es_symtest(rexp(100))
Performs the test of symmetry by Gupta (1967) based on the standardized third central moment and its asymptotic variance.
gupta_symtest(x)gupta_symtest(x)
x |
A numeric vector. |
The test is based on the sample skewness measure
where .
The test statistic is
where
For distributions with zero skewness and finite moments up to order six, the test statistic converges in distribution to a standard normal distribution, N(0,1).
An object of class "htest" with the following components:
The value of the test statistic.
The two-sided -value.
Gupta, M. K. (1967). An asymptotically nonparametric test of symmetry. The Annals of Mathematical Statistics, 38(3), 849–866.
triples_symtest(), tail_symtest(), es_symtest(),
lawstat::symmetry.test(), symmetry::symmetry_test()
x <- c(-3, -2, -1, 0, 1, 2, 3) gupta_symtest(x) y <- c(1, 2, 2, 3, 4, 10, 25) gupta_symtest(y)x <- c(-3, -2, -1, 0, 1, 2, 3) gupta_symtest(x) y <- c(1, 2, 2, 3, 4, 10, 25) gupta_symtest(y)
Performs a tail-based symmetry test by comparing spacings in the lower and upper tails of the ordered sample.
tail_symtest(x, alpha = NULL)tail_symtest(x, alpha = NULL)
x |
A numeric vector. |
alpha |
Optional significance level used to select the tuning value |
Let denote the ordered sample, and define the spacings
, . For a tuning value , let
denote the number of spacings averaged in each tail, where
is the ceiling function. The test statistic is defined as a standardized
difference between the average lower- and upper-tail spacings,
where is the sample standard deviation of spacings.
The two-sided -value is computed using the standard normal approximation.
For a nominal significance level of alpha=0.05, the value = 0.26 provides the best calibration,
whereas for alpha=0.10, = 0.28 is preferred. The default choice = 0.27 provides reasonably
good performance across significance levels between 0.05 and 0.10, avoiding the need
to recalibrate the tuning value for each significance level. Because the test is based on
tail spacings, it may have low power against alternatives where departures from symmetry
are confined to the center of the distribution.
An object of class htest containing:
the test statistic
the two-sided -value
the number of observations in the sample
the tuning value used in the test
the number of spacings averaged in each tail, computed as
Molera, L., and Parra-Frutos, I. (2026). A Symmetry Test based on Tail Spacings. Manuscript submitted for publication.
triples_symtest(), es_symtest(), gupta_symtest(),
lawstat::symmetry.test(), symmetry::symmetry_test()
set.seed(123) x <- rnorm(100) tail_symtest(x) tail_symtest(x, alpha = 0.10) tail_symtest(rexp(60, 1))set.seed(123) x <- rnorm(100) tail_symtest(x) tail_symtest(x, alpha = 0.10) tail_symtest(rexp(60, 1))
Performs the test of symmetry by Randles et al. (1980).
triples_symtest(x)triples_symtest(x)
x |
A numeric vector of observations. |
The test is based on a standardized U-statistic that compares the numbers of
sample triples skewed to the right and to the left. The -value is computed
using a Student’s approximation with n degrees of freedom, where n is the
sample size. Since all possible triples are considered, computation may be
slow for large samples.
An object of class "htest" with the following components:
The value of the test statistic.
The degrees of freedom used in the approximation.
The two-sided -value for the null hypothesis of symmetry.
Randles, R. H., Fligner, M. A., Policello, G. E., and Wolfe, D. A. (1980). "An asymptotically distribution-free test for symmetry versus asymmetry." Journal of the American Statistical Association, 75, 168–172.
tail_symtest(), es_symtest(), gupta_symtest(),
lawstat::symmetry.test(), symmetry::symmetry_test()
set.seed(123) x <- rnorm(20) triples_symtest(x) y <- rexp(20) - 1 triples_symtest(y)set.seed(123) x <- rnorm(20) triples_symtest(x) y <- rexp(20) - 1 triples_symtest(y)