Learn R Programming

acepack (version 1.6.1)

acetest: ACE permutation test of independence

Description

Performs a permutation test of independence or association. The alternative hypothesis is that x and y are dependent.

Code authored by Bernhard Klar, Shawn Garbett.

Usage

acetest(x, y = NULL, nperm = 999, ...)

# S3 method for acetest summary(object, ..., digits)

# S3 method for acetest print(x, ...)

# S3 method for acetest plot( x, acol = "blue", xlim = c(min(x$tp), max(c(x$tp, ceiling(x$ace * 10)/10))), col = "black", breaks = 100, main = "ACE Correlation Permutations", xlab = bquote(rho(.(x$xname), .(x$yname))), lwd = 2, ... )

Value

a list containing the following:

  • ace The value of the test statistic.

  • pval The *p*-value of the test.

Arguments

x

a numeric vector, or a matrix or data frame with two columns. The first column is the 'y' and the second column is the 'x' when calling ace.

y

a vector with same length as x. Default is NULL.

nperm

number of permutations. Default is 999.

...

additional arguments to pass to cor.

object

S3 object of test results to dispatch.

digits

Number of significant digits to round for summary.

acol

for plot; color of the point estimate of correlation

xlim

for plot;xlimit of histogram

col

for plot;color of histogram bars

breaks

for plot;number of breaks. Default to 100.

main

for plot; main title of plot

xlab

for plot; x-axis label

lwd

for plot; line width of point estimate

References

Holzmann, H., Klar, B. 2025. "Lancaster correlation - a new dependence measure linked to maximum correlation". Scandinavian Journal of Statistics. 52(1):145-169 <doi:10.1111/sjos.12733>

See Also

Examples

Run this code

n <- 200
z <- matrix(rnorm(2*n), n) / sqrt(rchisq(n, 2)/2)
x <- z[,2]; y <- z[,1]
cor.test(x, y, method="spearman")
acetest(x, y)

plot(acetest(z))

Run the code above in your browser using DataLab