Learn R Programming

sscor (version 0.2)

sscor.test: Correlation test based on spatial signs

Description

Robust one-sample test and confidence interval for the correlation coefficient.

Usage

sscor.test(x, y, rho0=0, alternative=c("two.sided","less","greater"), conf.level=0.95, ...)

Arguments

x,y
(required) numeric vectors of observations, must have the same length.
rho0
(optional) correlation coefficient under the null hypothesis. The default is 0.
alternative
(optional) character string indicating the type of alternative to be tested. Must be one of "two.sided", "less", "greater". The default is "two-sided".
conf.level
(optional) confidence level. The default is 0.95.
...
optional arguments passed to sscor (such as location and scale estimates to be used).

Value

A list with class "htest" containing the following values (similar to the output of cor.test):
statistic
the value of the test statistic. Under the null, the test statistic is (asymptotically) standard normal.
p.value
the p-value of the test.
estimate
the estimated spatial sign correlation.
null.value
the true correlation under the null hypothesis.
alternative
a character string describing the alternative hypothesis.
method
a characters string indicating the choosen correlation estimator. Currently only the spatial sign correlation is implemented.
data.name
a character giving the names of the data.
conf.int
confidence interval for the correlation coefficient.

Details

The test is based on the spatial sign correlation (Dürre et al. 2015), which is a highly robust correlation estimator, consistent for the generalized correlation coefficient under ellipticity. The confidence interval and the p-value are based on the asymptotic distribution after a variance-stabilizing transformation similar to Fisher's z-transform. They provide accurate approximations also for very small samples (Dürre and Vogel, 2015). The test is furthermore distribution-free within the elliptical model. It has, e.g., the same power at the elliptical Cauchy distribution as at the multivariate Gaussian distribution.

References

Dürre, A., Vogel, D., Fried, R. (2015): Spatial sign correlation, Journal of Multivariate Analyis, vol. 135, 89--105. arvix 1403.7635

Dürre, A., Vogel, D. (2015): Asymptotics of the two-stage spatial sign correlation, preprint. arxiv 1506.02578

See Also

Classical correlation testing: cor.test.

For more information on the spatial sign correlation: sscor.

Examples

Run this code

set.seed(5)
require(mvtnorm)

# create bivariate shape matrix with correlation 0.5
sigma <- matrix(c(1,0.5,0.5,1),ncol=2)

# under normality, both tests behave similarly
data <- rmvnorm(100,c(0,0),sigma)
x <- data[,1]
y <- data[,2]

sscor.test(x,y)
cor.test(x,y)

# sscor.test also works at a Cauchy distribution
data <- rmvt(100,diag(1,2), df=1)
x <- data[,1]
y <- data[,2]

sscor.test(x,y)
cor.test(x,y)

Run the code above in your browser using DataLab