I'm testing the hypothesis that there's a monotonic relationship between two variables. I think I should use a Spearman rank correlation test, since my data don't necessarily meet normality assumptions & have many outliers. However, there are many ties in the independent variable. How can I tell whether the ties are causing me a problem?
The data look something like this (R code):
set.seed(0)
x <- rep(1:10, 10)
y <- x + rnorm(length(x), sd=rep(x, 10))
One approach I can think of is to add a small random number to each x value many time, and look at the mean/median p-value, like so:
nReps <- 100
pVec <- rep(NA, 100)
for(i in 1:nReps) {
xDodge <- x + rnorm(n=nReps, mean=0, sd=0.0001)
pVec[i] <- cor.test(xDodge, y, method="spearman")$p.value
}
mean(pVec)
sd(pVec)
Does that method seem reasonable? Is there a previously-described method to assess the effect of ties on Spearman's rho, or a similar correlation method that does better with large numbers of ties?